@i14ks/ccv 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +30 -2
  2. package/bundle/ccv.mjs +1305 -214
  3. package/package.json +4 -2
  4. package/web/apple-touch-icon.png +0 -0
  5. package/web/assets/{codemirror-BtJ9Kw6s.js → codemirror-Jn-nlEEo.js} +1 -1
  6. package/web/assets/{index-B9YW7yGO.js → index-BP4uDvBo.js} +1 -1
  7. package/web/assets/{index-BwiSzzXj.js → index-Bt0SR_BE.js} +1 -1
  8. package/web/assets/{index-Dm_hwn8g.js → index-C6yiLJP6.js} +1 -1
  9. package/web/assets/{index-CNOLHL_4.js → index-CB9Ecmwu.js} +1 -1
  10. package/web/assets/{index-DHwxEPqa.js → index-CaVGDL0G.js} +1 -1
  11. package/web/assets/{index-CWKatwuc.js → index-CckLujnN.js} +1 -1
  12. package/web/assets/{index-DvfkEh9E.js → index-CfBtWXkv.js} +1 -1
  13. package/web/assets/index-Cjq5qPxL.css +1 -0
  14. package/web/assets/{index-Ccp0JT8x.js → index-DIt15fZq.js} +1 -1
  15. package/web/assets/{index-C8QQfurN.js → index-DP1WFH_k.js} +1 -1
  16. package/web/assets/{index-BlUJ9mDA.js → index-DdG4EILc.js} +1 -1
  17. package/web/assets/{index-BAlM5PeU.js → index-DdTtoxsO.js} +1 -1
  18. package/web/assets/{index-DWr0O8ZE.js → index-DkcdGFc4.js} +1 -1
  19. package/web/assets/{index-Dc4p-U2p.js → index-OpaL2d_i.js} +1 -1
  20. package/web/assets/{index-BpAEaXJC.js → index-P-Bcy60v.js} +1 -1
  21. package/web/assets/{index-BDq5JNDx.js → index-SnbL_sGM.js} +1 -1
  22. package/web/assets/{index-McXNmpFb.js → index-aEpkBsNa.js} +1 -1
  23. package/web/assets/{index-Ba1mAYRn.js → index-aFwgvegU.js} +1 -1
  24. package/web/assets/{index-yIku6ofv.js → index-hFxJfMy0.js} +1 -1
  25. package/web/assets/{index-C3Ai8_SG.js → index-n7R3xkAJ.js} +1 -1
  26. package/web/assets/index-rXb9w15o.js +143 -0
  27. package/web/favicon.ico +0 -0
  28. package/web/favicon.png +0 -0
  29. package/web/favicon.svg +4 -2
  30. package/web/index.html +8 -5
  31. package/web/assets/index-C6Y6TadO.css +0 -1
  32. package/web/assets/index-DYqdo2vo.js +0 -134
@@ -0,0 +1,143 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-aEpkBsNa.js","./index-hFxJfMy0.js","./index-aFwgvegU.js","./index-BHot-lnj.js","./index-891wE-Rj.js","./index-DdG4EILc.js","./index-n7R3xkAJ.js","./index-SnbL_sGM.js","./index-P-Bcy60v.js","./index-CfBtWXkv.js","./index-DkcdGFc4.js","./index-OpaL2d_i.js","./index-CaVGDL0G.js","./index-Bt0SR_BE.js","./index-DdTtoxsO.js","./index-C6yiLJP6.js","./index-CckLujnN.js","./index-DIt15fZq.js","./index-BP4uDvBo.js","./index-DP1WFH_k.js","./index-CB9Ecmwu.js","./codemirror-Jn-nlEEo.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
+ var U0=Object.defineProperty;var Lx=n=>{throw TypeError(n)};var H0=(n,l,r)=>l in n?U0(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r;var Qt=(n,l,r)=>H0(n,typeof l!="symbol"?l+"":l,r),qh=(n,l,r)=>l.has(n)||Lx("Cannot "+r);var st=(n,l,r)=>(qh(n,l,"read from private field"),r?r.call(n):l.get(n)),jn=(n,l,r)=>l.has(n)?Lx("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,r),zt=(n,l,r,c)=>(qh(n,l,"write to private field"),c?c.call(n,r):l.set(n,r),r),Bn=(n,l,r)=>(qh(n,l,"access private method"),r);(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 u of o)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function c(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();var Gh={exports:{}},Xo={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var zx;function B0(){if(zx)return Xo;zx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(c,o,u){var h=null;if(u!==void 0&&(h=""+u),o.key!==void 0&&(h=""+o.key),"key"in o){u={};for(var p in o)p!=="key"&&(u[p]=o[p])}else u=o;return o=u.ref,{$$typeof:n,type:c,key:h,ref:o!==void 0?o:null,props:u}}return Xo.Fragment=l,Xo.jsx=r,Xo.jsxs=r,Xo}var Ix;function q0(){return Ix||(Ix=1,Gh.exports=B0()),Gh.exports}var a=q0(),$h={exports:{}},rt={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Ux;function G0(){if(Ux)return rt;Ux=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),y=Symbol.iterator;function T(S){return S===null||typeof S!="object"?null:(S=y&&S[y]||S["@@iterator"],typeof S=="function"?S:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,A={};function D(S,Z,de){this.props=S,this.context=Z,this.refs=A,this.updater=de||N}D.prototype.isReactComponent={},D.prototype.setState=function(S,Z){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,Z,"setState")},D.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function q(){}q.prototype=D.prototype;function Q(S,Z,de){this.props=S,this.context=Z,this.refs=A,this.updater=de||N}var z=Q.prototype=new q;z.constructor=Q,E(z,D.prototype),z.isPureReactComponent=!0;var U=Array.isArray;function O(){}var I={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function R(S,Z,de){var be=de.ref;return{$$typeof:n,type:S,key:Z,ref:be!==void 0?be:null,props:de}}function L(S,Z){return R(S.type,Z,S.props)}function G(S){return typeof S=="object"&&S!==null&&S.$$typeof===n}function se(S){var Z={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(de){return Z[de]})}var ve=/\/+/g;function je(S,Z){return typeof S=="object"&&S!==null&&S.key!=null?se(""+S.key):Z.toString(36)}function we(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(O,O):(S.status="pending",S.then(function(Z){S.status==="pending"&&(S.status="fulfilled",S.value=Z)},function(Z){S.status==="pending"&&(S.status="rejected",S.reason=Z)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function F(S,Z,de,be,Me){var Ie=typeof S;(Ie==="undefined"||Ie==="boolean")&&(S=null);var Ke=!1;if(S===null)Ke=!0;else switch(Ie){case"bigint":case"string":case"number":Ke=!0;break;case"object":switch(S.$$typeof){case n:case l:Ke=!0;break;case v:return Ke=S._init,F(Ke(S._payload),Z,de,be,Me)}}if(Ke)return Me=Me(S),Ke=be===""?"."+je(S,0):be,U(Me)?(de="",Ke!=null&&(de=Ke.replace(ve,"$&/")+"/"),F(Me,Z,de,"",function(ge){return ge})):Me!=null&&(G(Me)&&(Me=L(Me,de+(Me.key==null||S&&S.key===Me.key?"":(""+Me.key).replace(ve,"$&/")+"/")+Ke)),Z.push(Me)),1;Ke=0;var ce=be===""?".":be+":";if(U(S))for(var Ue=0;Ue<S.length;Ue++)be=S[Ue],Ie=ce+je(be,Ue),Ke+=F(be,Z,de,Ie,Me);else if(Ue=T(S),typeof Ue=="function")for(S=Ue.call(S),Ue=0;!(be=S.next()).done;)be=be.value,Ie=ce+je(be,Ue++),Ke+=F(be,Z,de,Ie,Me);else if(Ie==="object"){if(typeof S.then=="function")return F(we(S),Z,de,be,Me);throw Z=String(S),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Ke}function $(S,Z,de){if(S==null)return S;var be=[],Me=0;return F(S,be,"","",function(Ie){return Z.call(de,Ie,Me++)}),be}function ne(S){if(S._status===-1){var Z=S._result;Z=Z(),Z.then(function(de){(S._status===0||S._status===-1)&&(S._status=1,S._result=de)},function(de){(S._status===0||S._status===-1)&&(S._status=2,S._result=de)}),S._status===-1&&(S._status=0,S._result=Z)}if(S._status===1)return S._result.default;throw S._result}var pe=typeof reportError=="function"?reportError:function(S){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof S=="object"&&S!==null&&typeof S.message=="string"?String(S.message):String(S),error:S});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",S);return}console.error(S)},Ne={map:$,forEach:function(S,Z,de){$(S,function(){Z.apply(this,arguments)},de)},count:function(S){var Z=0;return $(S,function(){Z++}),Z},toArray:function(S){return $(S,function(Z){return Z})||[]},only:function(S){if(!G(S))throw Error("React.Children.only expected to receive a single React element child.");return S}};return rt.Activity=j,rt.Children=Ne,rt.Component=D,rt.Fragment=r,rt.Profiler=o,rt.PureComponent=Q,rt.StrictMode=c,rt.Suspense=g,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,rt.__COMPILER_RUNTIME={__proto__:null,c:function(S){return I.H.useMemoCache(S)}},rt.cache=function(S){return function(){return S.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(S,Z,de){if(S==null)throw Error("The argument must be a React element, but you passed "+S+".");var be=E({},S.props),Me=S.key;if(Z!=null)for(Ie in Z.key!==void 0&&(Me=""+Z.key),Z)!V.call(Z,Ie)||Ie==="key"||Ie==="__self"||Ie==="__source"||Ie==="ref"&&Z.ref===void 0||(be[Ie]=Z[Ie]);var Ie=arguments.length-2;if(Ie===1)be.children=de;else if(1<Ie){for(var Ke=Array(Ie),ce=0;ce<Ie;ce++)Ke[ce]=arguments[ce+2];be.children=Ke}return R(S.type,Me,be)},rt.createContext=function(S){return S={$$typeof:h,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null},S.Provider=S,S.Consumer={$$typeof:u,_context:S},S},rt.createElement=function(S,Z,de){var be,Me={},Ie=null;if(Z!=null)for(be in Z.key!==void 0&&(Ie=""+Z.key),Z)V.call(Z,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(Me[be]=Z[be]);var Ke=arguments.length-2;if(Ke===1)Me.children=de;else if(1<Ke){for(var ce=Array(Ke),Ue=0;Ue<Ke;Ue++)ce[Ue]=arguments[Ue+2];Me.children=ce}if(S&&S.defaultProps)for(be in Ke=S.defaultProps,Ke)Me[be]===void 0&&(Me[be]=Ke[be]);return R(S,Ie,Me)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(S){return{$$typeof:p,render:S}},rt.isValidElement=G,rt.lazy=function(S){return{$$typeof:v,_payload:{_status:-1,_result:S},_init:ne}},rt.memo=function(S,Z){return{$$typeof:x,type:S,compare:Z===void 0?null:Z}},rt.startTransition=function(S){var Z=I.T,de={};I.T=de;try{var be=S(),Me=I.S;Me!==null&&Me(de,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(O,pe)}catch(Ie){pe(Ie)}finally{Z!==null&&de.types!==null&&(Z.types=de.types),I.T=Z}},rt.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},rt.use=function(S){return I.H.use(S)},rt.useActionState=function(S,Z,de){return I.H.useActionState(S,Z,de)},rt.useCallback=function(S,Z){return I.H.useCallback(S,Z)},rt.useContext=function(S){return I.H.useContext(S)},rt.useDebugValue=function(){},rt.useDeferredValue=function(S,Z){return I.H.useDeferredValue(S,Z)},rt.useEffect=function(S,Z){return I.H.useEffect(S,Z)},rt.useEffectEvent=function(S){return I.H.useEffectEvent(S)},rt.useId=function(){return I.H.useId()},rt.useImperativeHandle=function(S,Z,de){return I.H.useImperativeHandle(S,Z,de)},rt.useInsertionEffect=function(S,Z){return I.H.useInsertionEffect(S,Z)},rt.useLayoutEffect=function(S,Z){return I.H.useLayoutEffect(S,Z)},rt.useMemo=function(S,Z){return I.H.useMemo(S,Z)},rt.useOptimistic=function(S,Z){return I.H.useOptimistic(S,Z)},rt.useReducer=function(S,Z,de){return I.H.useReducer(S,Z,de)},rt.useRef=function(S){return I.H.useRef(S)},rt.useState=function(S){return I.H.useState(S)},rt.useSyncExternalStore=function(S,Z,de){return I.H.useSyncExternalStore(S,Z,de)},rt.useTransition=function(){return I.H.useTransition()},rt.version="19.2.8",rt}var Hx;function Cp(){return Hx||(Hx=1,$h.exports=G0()),$h.exports}var b=Cp(),Yh={exports:{}},Qo={},Vh={exports:{}},Xh={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Bx;function $0(){return Bx||(Bx=1,(function(n){function l(F,$){var ne=F.length;F.push($);e:for(;0<ne;){var pe=ne-1>>>1,Ne=F[pe];if(0<o(Ne,$))F[pe]=$,F[ne]=Ne,ne=pe;else break e}}function r(F){return F.length===0?null:F[0]}function c(F){if(F.length===0)return null;var $=F[0],ne=F.pop();if(ne!==$){F[0]=ne;e:for(var pe=0,Ne=F.length,S=Ne>>>1;pe<S;){var Z=2*(pe+1)-1,de=F[Z],be=Z+1,Me=F[be];if(0>o(de,ne))be<Ne&&0>o(Me,de)?(F[pe]=Me,F[be]=ne,pe=be):(F[pe]=de,F[Z]=ne,pe=Z);else if(be<Ne&&0>o(Me,ne))F[pe]=Me,F[be]=ne,pe=be;else break e}}return $}function o(F,$){var ne=F.sortIndex-$.sortIndex;return ne!==0?ne:F.id-$.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var h=Date,p=h.now();n.unstable_now=function(){return h.now()-p}}var g=[],x=[],v=1,j=null,y=3,T=!1,N=!1,E=!1,A=!1,D=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function z(F){for(var $=r(x);$!==null;){if($.callback===null)c(x);else if($.startTime<=F)c(x),$.sortIndex=$.expirationTime,l(g,$);else break;$=r(x)}}function U(F){if(E=!1,z(F),!N)if(r(g)!==null)N=!0,O||(O=!0,se());else{var $=r(x);$!==null&&we(U,$.startTime-F)}}var O=!1,I=-1,V=5,R=-1;function L(){return A?!0:!(n.unstable_now()-R<V)}function G(){if(A=!1,O){var F=n.unstable_now();R=F;var $=!0;try{e:{N=!1,E&&(E=!1,q(I),I=-1),T=!0;var ne=y;try{t:{for(z(F),j=r(g);j!==null&&!(j.expirationTime>F&&L());){var pe=j.callback;if(typeof pe=="function"){j.callback=null,y=j.priorityLevel;var Ne=pe(j.expirationTime<=F);if(F=n.unstable_now(),typeof Ne=="function"){j.callback=Ne,z(F),$=!0;break t}j===r(g)&&c(g),z(F)}else c(g);j=r(g)}if(j!==null)$=!0;else{var S=r(x);S!==null&&we(U,S.startTime-F),$=!1}}break e}finally{j=null,y=ne,T=!1}$=void 0}}finally{$?se():O=!1}}}var se;if(typeof Q=="function")se=function(){Q(G)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,je=ve.port2;ve.port1.onmessage=G,se=function(){je.postMessage(null)}}else se=function(){D(G,0)};function we(F,$){I=D(function(){F(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(F){F.callback=null},n.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<F?Math.floor(1e3/F):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_next=function(F){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var ne=y;y=$;try{return F()}finally{y=ne}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(F,$){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var ne=y;y=F;try{return $()}finally{y=ne}},n.unstable_scheduleCallback=function(F,$,ne){var pe=n.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?pe+ne:pe):ne=pe,F){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=ne+Ne,F={id:v++,callback:$,priorityLevel:F,startTime:ne,expirationTime:Ne,sortIndex:-1},ne>pe?(F.sortIndex=ne,l(x,F),r(g)===null&&F===r(x)&&(E?(q(I),I=-1):E=!0,we(U,ne-pe))):(F.sortIndex=Ne,l(g,F),N||T||(N=!0,O||(O=!0,se()))),F},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(F){var $=y;return function(){var ne=y;y=$;try{return F.apply(this,arguments)}finally{y=ne}}}})(Xh)),Xh}var qx;function Y0(){return qx||(qx=1,Vh.exports=$0()),Vh.exports}var Qh={exports:{}},bs={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Gx;function V0(){if(Gx)return bs;Gx=1;var n=Cp();function l(g){var x="https://react.dev/errors/"+g;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)x+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+g+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var c={d:{f:r,r:function(){throw Error(l(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(g,x,v){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:j==null?null:""+j,children:g,containerInfo:x,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,x){if(g==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return bs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,bs.createPortal=function(g,x){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(l(299));return u(g,x,null,v)},bs.flushSync=function(g){var x=h.T,v=c.p;try{if(h.T=null,c.p=2,g)return g()}finally{h.T=x,c.p=v,c.d.f()}},bs.preconnect=function(g,x){typeof g=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,c.d.C(g,x))},bs.prefetchDNS=function(g){typeof g=="string"&&c.d.D(g)},bs.preinit=function(g,x){if(typeof g=="string"&&x&&typeof x.as=="string"){var v=x.as,j=p(v,x.crossOrigin),y=typeof x.integrity=="string"?x.integrity:void 0,T=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;v==="style"?c.d.S(g,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:j,integrity:y,fetchPriority:T}):v==="script"&&c.d.X(g,{crossOrigin:j,integrity:y,fetchPriority:T,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},bs.preinitModule=function(g,x){if(typeof g=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var v=p(x.as,x.crossOrigin);c.d.M(g,{crossOrigin:v,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0})}}else x==null&&c.d.M(g)},bs.preload=function(g,x){if(typeof g=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var v=x.as,j=p(v,x.crossOrigin);c.d.L(g,v,{crossOrigin:j,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},bs.preloadModule=function(g,x){if(typeof g=="string")if(x){var v=p(x.as,x.crossOrigin);c.d.m(g,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:v,integrity:typeof x.integrity=="string"?x.integrity:void 0})}else c.d.m(g)},bs.requestFormReset=function(g){c.d.r(g)},bs.unstable_batchedUpdates=function(g,x){return g(x)},bs.useFormState=function(g,x,v){return h.H.useFormState(g,x,v)},bs.useFormStatus=function(){return h.H.useHostTransitionStatus()},bs.version="19.2.8",bs}var $x;function X0(){if($x)return Qh.exports;$x=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),Qh.exports=V0(),Qh.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var Yx;function Q0(){if(Yx)return Qo;Yx=1;var n=Y0(),l=Cp(),r=X0();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(u(e)!==e)throw Error(c(188))}function x(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(c(188));return t!==e?null:e}for(var s=e,i=t;;){var d=s.return;if(d===null)break;var f=d.alternate;if(f===null){if(i=d.return,i!==null){s=i;continue}break}if(d.child===f.child){for(f=d.child;f;){if(f===s)return g(d),e;if(f===i)return g(d),t;f=f.sibling}throw Error(c(188))}if(s.return!==i.return)s=d,i=f;else{for(var _=!1,w=d.child;w;){if(w===s){_=!0,s=d,i=f;break}if(w===i){_=!0,i=d,s=f;break}w=w.sibling}if(!_){for(w=f.child;w;){if(w===s){_=!0,s=f,i=d;break}if(w===i){_=!0,i=f,s=d;break}w=w.sibling}if(!_)throw Error(c(189))}}if(s.alternate!==i)throw Error(c(190))}if(s.tag!==3)throw Error(c(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var j=Object.assign,y=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var ve=Symbol.for("react.client.reference");function je(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case D:return"Profiler";case A:return"StrictMode";case U:return"Suspense";case O:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case Q:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return t=e.displayName||null,t!==null?t:je(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return je(e(t))}catch{}}return null}var we=Array.isArray,F=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},pe=[],Ne=-1;function S(e){return{current:e}}function Z(e){0>Ne||(e.current=pe[Ne],pe[Ne]=null,Ne--)}function de(e,t){Ne++,pe[Ne]=e.current,e.current=t}var be=S(null),Me=S(null),Ie=S(null),Ke=S(null);function ce(e,t){switch(de(Ie,t),de(Me,e),de(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lx(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lx(t),e=ax(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Z(be),de(be,e)}function Ue(){Z(be),Z(Me),Z(Ie)}function ge(e){e.memoizedState!==null&&de(Ke,e);var t=be.current,s=ax(t,e.type);t!==s&&(de(Me,e),de(be,s))}function Ze(e){Me.current===e&&(Z(be),Z(Me)),Ke.current===e&&(Z(Ke),Go._currentValue=ne)}var dt,lt;function gt(e){if(dt===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);dt=t&&t[1]||"",lt=-1<s.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+dt+e+lt}var et=!1;function Tt(e,t){if(!e||et)return"";et=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(le){var te=le}Reflect.construct(e,[],me)}else{try{me.call()}catch(le){te=le}e.call(me.prototype)}}else{try{throw Error()}catch(le){te=le}(me=e())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(le){if(le&&te&&typeof le.stack=="string")return[le.stack,te.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),_=f[0],w=f[1];if(_&&w){var M=_.split(`
45
+ `),W=w.split(`
46
+ `);for(d=i=0;i<M.length&&!M[i].includes("DetermineComponentFrameRoot");)i++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(i===M.length||d===W.length)for(i=M.length-1,d=W.length-1;1<=i&&0<=d&&M[i]!==W[d];)d--;for(;1<=i&&0<=d;i--,d--)if(M[i]!==W[d]){if(i!==1||d!==1)do if(i--,d--,0>d||M[i]!==W[d]){var oe=`
47
+ `+M[i].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=i&&0<=d);break}}}finally{et=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?gt(s):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return gt(e.type);case 16:return gt("Lazy");case 13:return e.child!==t&&t!==null?gt("Suspense Fallback"):gt("Suspense");case 19:return gt("SuspenseList");case 0:case 15:return Tt(e.type,!1);case 11:return Tt(e.type.render,!1);case 1:return Tt(e.type,!0);case 31:return gt("Activity");default:return""}}function tt(e){try{var t="",s=null;do t+=ee(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
48
+ Error generating stack: `+i.message+`
49
+ `+i.stack}}var Fe=Object.prototype.hasOwnProperty,$e=n.unstable_scheduleCallback,Je=n.unstable_cancelCallback,Qe=n.unstable_shouldYield,ft=n.unstable_requestPaint,De=n.unstable_now,wt=n.unstable_getCurrentPriorityLevel,Nt=n.unstable_ImmediatePriority,Ht=n.unstable_UserBlockingPriority,Kt=n.unstable_NormalPriority,kt=n.unstable_LowPriority,ot=n.unstable_IdlePriority,wn=n.log,Dn=n.unstable_setDisableYieldValue,ln=null,$t=null;function hn(e){if(typeof wn=="function"&&Dn(e),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(ln,e)}catch{}}var yt=Math.clz32?Math.clz32:_e,Wn=Math.log,ae=Math.LN2;function _e(e){return e>>>=0,e===0?32:31-(Wn(e)/ae|0)|0}var qe=256,it=262144,Pe=4194304;function Zt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function K(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var d=0,f=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var w=i&134217727;return w!==0?(i=w&~f,i!==0?d=Zt(i):(_&=w,_!==0?d=Zt(_):s||(s=w&~e,s!==0&&(d=Zt(s))))):(w=i&~f,w!==0?d=Zt(w):_!==0?d=Zt(_):s||(s=i&~e,s!==0&&(d=Zt(s)))),d===0?0:t!==0&&t!==d&&(t&f)===0&&(f=d&-d,s=t&-t,f>=s||f===32&&(s&4194048)!==0)?t:d}function fe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ve(){var e=Pe;return Pe<<=1,(Pe&62914560)===0&&(Pe=4194304),e}function Mt(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Cn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function il(e,t,s,i,d,f){var _=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var w=e.entanglements,M=e.expirationTimes,W=e.hiddenUpdates;for(s=_&~s;0<s;){var oe=31-yt(s),me=1<<oe;w[oe]=0,M[oe]=-1;var te=W[oe];if(te!==null)for(W[oe]=null,oe=0;oe<te.length;oe++){var le=te[oe];le!==null&&(le.lane&=-536870913)}s&=~me}i!==0&&Vs(e,i,0),f!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=f&~(_&~t))}function Vs(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-yt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function vs(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-yt(s),d=1<<i;d&t|e[i]&t&&(e[i]|=t),s&=~d}}function js(e,t){var s=t&-t;return s=(s&42)!==0?1:Xs(s),(s&(e.suspendedLanes|t))!==0?0:s}function Xs(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Wa(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Tx(e.type))}function us(e,t){var s=$.p;try{return $.p=e,t()}finally{$.p=s}}var ds=Math.random().toString(36).slice(2),Ft="__reactFiber$"+ds,at="__reactProps$"+ds,Nn="__reactContainer$"+ds,Ks="__reactEvents$"+ds,Zs="__reactListeners$"+ds,ws="__reactHandles$"+ds,Ns="__reactResources$"+ds,Dt="__reactMarker$"+ds;function rl(e){delete e[Ft],delete e[at],delete e[Ks],delete e[Zs],delete e[ws]}function rn(e){var t=e[Ft];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Nn]||s[Ft]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=fx(e);e!==null;){if(s=e[Ft])return s;e=fx(e)}return t}e=s,s=e.parentNode}return null}function Jt(e){if(e=e[Ft]||e[Nn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function pn(e){var t=e[Ns];return t||(t=e[Ns]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[Dt]=!0}var Kn=new Set,es={};function ts(e,t){Pt(e,t),Pt(e+"Capture",t)}function Pt(e,t){for(es[e]=t,e=0;e<t.length;e++)Kn.add(t[e])}var cl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Wt={},An={};function On(e){return Fe.call(An,e)?!0:Fe.call(Wt,e)?!1:cl.test(e)?An[e]=!0:(Wt[e]=!0,!1)}function fs(e,t,s){if(On(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function hs(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Gn(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+i)}}function en(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ks(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(_){s=""+_,f.call(this,_)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(_){s=""+_},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ns(e){if(!e._valueTracker){var t=vl(e)?"checked":"value";e._valueTracker=ks(e,t,""+e[t])}}function xn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=vl(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function jl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var $l=/[\n"\\]/g;function kn(e){return e.replace($l,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wl(e,t,s,i,d,f,_,w){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),t!=null?_==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+en(t)):e.value!==""+en(t)&&(e.value=""+en(t)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),t!=null?Ls(e,_,en(t)):s!=null?Ls(e,_,en(s)):i!=null&&e.removeAttribute("value"),d==null&&f!=null&&(e.defaultChecked=!!f),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+en(w):e.removeAttribute("name")}function ol(e,t,s,i,d,f,_,w){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||s!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){ns(e);return}s=s!=null?""+en(s):"",t=t!=null?""+en(t):s,w||t===e.value||(e.value=t),e.defaultValue=t}i=i??d,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=w?e.checked:!!i,e.defaultChecked=!!i,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),ns(e)}function Ls(e,t,s){t==="number"&&jl(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function tn(e,t,s,i){if(e=e.options,t){t={};for(var d=0;d<s.length;d++)t["$"+s[d]]=!0;for(s=0;s<e.length;s++)d=t.hasOwnProperty("$"+e[s].value),e[s].selected!==d&&(e[s].selected=d),d&&i&&(e[s].defaultSelected=!0)}else{for(s=""+en(s),t=null,d=0;d<e.length;d++){if(e[d].value===s){e[d].selected=!0,i&&(e[d].defaultSelected=!0);return}t!==null||e[d].disabled||(t=e[d])}t!==null&&(t.selected=!0)}}function ye(e,t,s){if(t!=null&&(t=""+en(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+en(s):""}function C(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(c(92));if(we(i)){if(1<i.length)throw Error(c(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=en(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),ns(e)}function J(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var xe=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Oe(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||xe.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Ye(e,t,s){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var d in t)i=t[d],t.hasOwnProperty(d)&&s[d]!==i&&Oe(e,d,i)}else for(var f in t)t.hasOwnProperty(f)&&Oe(e,f,t[f])}function Le(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Yt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),vt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bn(e){return vt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bt(){}var Sn=null;function mn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zs=null,_n=null;function Fs(e){var t=Jt(e);if(t&&(e=t.stateNode)){var s=e[at]||null;e:switch(e=t.stateNode,t.type){case"input":if(wl(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+kn(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var d=i[at]||null;if(!d)throw Error(c(90));wl(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&xn(i)}break e;case"textarea":ye(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&tn(e,!!s.multiple,t,!1)}}}var ss=!1;function Nl(e,t,s){if(ss)return e(t,s);ss=!0;try{var i=e(t);return i}finally{if(ss=!1,(zs!==null||_n!==null)&&(ad(),zs&&(t=zs,e=_n,_n=zs=null,Fs(t),e)))for(t=0;t<e.length;t++)Fs(e[t])}}function k(e,t){var s=e.stateNode;if(s===null)return null;var i=s[at]||null;if(i===null)return null;s=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(c(231,t,typeof s));return s}var ie=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Re=!1;if(ie)try{var nt={};Object.defineProperty(nt,"passive",{get:function(){Re=!0}}),window.addEventListener("test",nt,nt),window.removeEventListener("test",nt,nt)}catch{Re=!1}var yn=null,kl=null,Lr=null;function Sl(){if(Lr)return Lr;var e,t=kl,s=t.length,i,d="value"in yn?yn.value:yn.textContent,f=d.length;for(e=0;e<s&&t[e]===d[e];e++);var _=s-e;for(i=1;i<=_&&t[s-i]===d[f-i];i++);return Lr=d.slice(e,1<i?1-i:void 0)}function Yl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _a(){return!0}function ei(){return!1}function $n(e){function t(s,i,d,f,_){this._reactName=s,this._targetInst=d,this.type=i,this.nativeEvent=f,this.target=_,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(s=e[w],this[w]=s?s(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?_a:ei,this.isPropagationStopped=ei,this}return j(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=_a)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=_a)},persist:function(){},isPersistent:_a}),t}var ya={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ti=$n(ya),Vl=j({},ya,{view:0,detail:0}),pu=$n(Vl),ni,zr,Js,Ps=j({},Vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Js&&(Js&&e.type==="mousemove"?(ni=e.screenX-Js.screenX,zr=e.screenY-Js.screenY):zr=ni=0,Js=e),ni)},movementY:function(e){return"movementY"in e?e.movementY:zr}}),mu=$n(Ps),Jc=j({},Ps,{dataTransfer:0}),Ir=$n(Jc),Pc=j({},Vl,{relatedTarget:0}),Ur=$n(Pc),Hr=j({},ya,{animationName:0,elapsedTime:0,pseudoElement:0}),si=$n(Hr),Wc=j({},ya,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Br=$n(Wc),$i=j({},ya,{data:0}),gu=$n($i),qr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pf={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $r(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gr[e])?!!t[e]:!1}function Yi(){return $r}var Vi=j({},Vl,{key:function(e){if(e.key){var t=qr[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?pf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yi,charCode:function(e){return e.type==="keypress"?Yl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),va=$n(Vi),Yr=j({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vr=$n(Yr),mf=j({},Vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yi}),ja=$n(mf),Xi=j({},ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),xu=$n(Xi),Xr=j({},Ps,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),bu=$n(Xr),Qr=j({},ya,{newState:0,oldState:0}),El=$n(Qr),Kr=[9,13,27,32],wa=ie&&"CompositionEvent"in window,Ws=null;ie&&"documentMode"in document&&(Ws=document.documentMode);var Qi=ie&&"TextEvent"in window&&!Ws,cn=ie&&(!wa||Ws&&8<Ws&&11>=Ws),Zr=" ",_u=!1;function yu(e,t){switch(e){case"keyup":return Kr.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fr(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tl=!1;function Ln(e,t){switch(e){case"compositionend":return Fr(t);case"keypress":return t.which!==32?null:(_u=!0,Zr);case"textInput":return e=t.data,e===Zr&&_u?null:e;default:return null}}function Ki(e,t){if(Tl)return e==="compositionend"||!wa&&yu(e,t)?(e=Sl(),Lr=kl=yn=null,Tl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return cn&&t.locale!=="ko"?null:t.data;default:return null}}var Jr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function eo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Jr[e.type]:t==="textarea"}function Rn(e,t,s,i){zs?_n?_n.push(i):_n=[i]:zs=i,t=fd(t,"onChange"),0<t.length&&(s=new ti("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var li=null,ai=null;function Cl(e){Pg(e,0)}function Zi(e){var t=Ct(e);if(xn(t))return e}function Fi(e,t){if(e==="change")return t}var Ji=!1;if(ie){var Na;if(ie){var Al="oninput"in document;if(!Al){var to=document.createElement("div");to.setAttribute("oninput","return;"),Al=typeof to.oninput=="function"}Na=Al}else Na=!1;Ji=Na&&(!document.documentMode||9<document.documentMode)}function ii(){li&&(li.detachEvent("onpropertychange",Pi),ai=li=null)}function Pi(e){if(e.propertyName==="value"&&Zi(ai)){var t=[];Rn(t,ai,e,mn(e)),Nl(Cl,t)}}function Wi(e,t,s){e==="focusin"?(ii(),li=t,ai=s,li.attachEvent("onpropertychange",Pi)):e==="focusout"&&ii()}function er(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zi(ai)}function vu(e,t){if(e==="click")return Zi(t)}function tr(e,t){if(e==="input"||e==="change")return Zi(t)}function gf(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zn=typeof Object.is=="function"?Object.is:gf;function ka(e,t){if(zn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var d=s[i];if(!Fe.call(t,d)||!zn(e[d],t[d]))return!1}return!0}function ju(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function no(e,t){var s=ju(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=ju(s)}}function Y(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Y(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ri(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jl(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=jl(e.document)}return t}function Sa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var wu=ie&&"documentMode"in document&&11>=document.documentMode,Ea=null,so=null,Ss=null,lo=!1;function Nu(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;lo||Ea==null||Ea!==jl(i)||(i=Ea,"selectionStart"in i&&Sa(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ss&&ka(Ss,i)||(Ss=i,i=fd(so,"onSelect"),0<i.length&&(t=new ti("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=Ea)))}function Ta(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var ci={animationend:Ta("Animation","AnimationEnd"),animationiteration:Ta("Animation","AnimationIteration"),animationstart:Ta("Animation","AnimationStart"),transitionrun:Ta("Transition","TransitionRun"),transitionstart:Ta("Transition","TransitionStart"),transitioncancel:Ta("Transition","TransitionCancel"),transitionend:Ta("Transition","TransitionEnd")},ao={},Ca={};ie&&(Ca=document.createElement("div").style,"AnimationEvent"in window||(delete ci.animationend.animation,delete ci.animationiteration.animation,delete ci.animationstart.animation),"TransitionEvent"in window||delete ci.transitionend.transition);function Aa(e){if(ao[e])return ao[e];if(!ci[e])return e;var t=ci[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Ca)return ao[e]=t[s];return e}var ku=Aa("animationend"),Su=Aa("animationiteration"),Eu=Aa("animationstart"),xf=Aa("transitionrun"),bf=Aa("transitionstart"),_f=Aa("transitioncancel"),Tu=Aa("transitionend"),io=new Map,ro="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ro.push("scrollEnd");function el(e,t){io.set(e,t),ts(t,[e])}var Pr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Yn=[],oi=0,co=0;function ui(){for(var e=oi,t=co=oi=0;t<e;){var s=Yn[t];Yn[t++]=null;var i=Yn[t];Yn[t++]=null;var d=Yn[t];Yn[t++]=null;var f=Yn[t];if(Yn[t++]=null,i!==null&&d!==null){var _=i.pending;_===null?d.next=d:(d.next=_.next,_.next=d),i.pending=d}f!==0&&Cu(s,d,f)}}function Wr(e,t,s,i){Yn[oi++]=e,Yn[oi++]=t,Yn[oi++]=s,Yn[oi++]=i,co|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function nr(e,t,s,i){return Wr(e,t,s,i),sr(e)}function ul(e,t){return Wr(e,null,null,t),sr(e)}function Cu(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var d=!1,f=e.return;f!==null;)f.childLanes|=s,i=f.alternate,i!==null&&(i.childLanes|=s),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(d=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,d&&t!==null&&(d=31-yt(s),e=f.hiddenUpdates,i=e[d],i===null?e[d]=[t]:i.push(t),t.lane=s|536870912),f):null}function sr(e){if(50<Lo)throw Lo=0,dh=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Xl={};function Au(e,t,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ps(e,t,s,i){return new Au(e,t,s,i)}function ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dl(e,t){var s=e.alternate;return s===null?(s=ps(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Ru(e,t){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function lr(e,t,s,i,d,f){var _=0;if(i=e,typeof e=="function")ec(e)&&(_=1);else if(typeof e=="string")_=S0(e,s,be.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=ps(31,s,t,d),e.elementType=R,e.lanes=f,e;case E:return Ql(s.children,d,f,t);case A:_=8,d|=24;break;case D:return e=ps(12,s,t,d|2),e.elementType=D,e.lanes=f,e;case U:return e=ps(13,s,t,d),e.elementType=U,e.lanes=f,e;case O:return e=ps(19,s,t,d),e.elementType=O,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Q:_=10;break e;case q:_=9;break e;case z:_=11;break e;case I:_=14;break e;case V:_=16,i=null;break e}_=29,s=Error(c(130,e===null?"null":typeof e,"")),i=null}return t=ps(_,s,t,d),t.elementType=e,t.type=i,t.lanes=f,t}function Ql(e,t,s,i){return e=ps(7,e,i,t),e.lanes=s,e}function oo(e,t,s){return e=ps(6,e,null,t),e.lanes=s,e}function uo(e){var t=ps(18,null,null,0);return t.stateNode=e,t}function ar(e,t,s){return t=ps(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var tc=new WeakMap;function Is(e,t){if(typeof e=="object"&&e!==null){var s=tc.get(e);return s!==void 0?s:(t={value:e,source:t,stack:tt(t)},tc.set(e,t),t)}return{value:e,source:t,stack:tt(t)}}var di=[],fi=0,Kl=null,hi=0,Us=[],Es=0,Zl=null,fl=1,hl="";function Rl(e,t){di[fi++]=hi,di[fi++]=Kl,Kl=e,hi=t}function Mu(e,t,s){Us[Es++]=fl,Us[Es++]=hl,Us[Es++]=Zl,Zl=e;var i=fl;e=hl;var d=32-yt(i)-1;i&=~(1<<d),s+=1;var f=32-yt(t)+d;if(30<f){var _=d-d%5;f=(i&(1<<_)-1).toString(32),i>>=_,d-=_,fl=1<<32-yt(t)+d|s<<d|i,hl=f+e}else fl=1<<f|s<<d|i,hl=e}function fo(e){e.return!==null&&(Rl(e,1),Mu(e,1,0))}function ho(e){for(;e===Kl;)Kl=di[--fi],di[fi]=null,hi=di[--fi],di[fi]=null;for(;e===Zl;)Zl=Us[--Es],Us[Es]=null,hl=Us[--Es],Us[Es]=null,fl=Us[--Es],Us[Es]=null}function Du(e,t){Us[Es++]=fl,Us[Es++]=hl,Us[Es++]=Zl,fl=t.id,hl=t.overflow,Zl=e}var Vn=null,nn=null,ht=!1,Fl=null,Ts=!1,po=Error(c(519));function Jl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ir(Is(t,e)),po}function Ou(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[Ft]=e,t[at]=i,s){case"dialog":mt("cancel",t),mt("close",t);break;case"iframe":case"object":case"embed":mt("load",t);break;case"video":case"audio":for(s=0;s<Io.length;s++)mt(Io[s],t);break;case"source":mt("error",t);break;case"img":case"image":case"link":mt("error",t),mt("load",t);break;case"details":mt("toggle",t);break;case"input":mt("invalid",t),ol(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":mt("invalid",t);break;case"textarea":mt("invalid",t),C(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||nx(t.textContent,s)?(i.popover!=null&&(mt("beforetoggle",t),mt("toggle",t)),i.onScroll!=null&&mt("scroll",t),i.onScrollEnd!=null&&mt("scrollend",t),i.onClick!=null&&(t.onclick=Bt),t=!0):t=!1,t||Jl(e,!0)}function Lu(e){for(Vn=e.return;Vn;)switch(Vn.tag){case 5:case 31:case 13:Ts=!1;return;case 27:case 3:Ts=!0;return;default:Vn=Vn.return}}function Pl(e){if(e!==Vn)return!1;if(!ht)return Lu(e),ht=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Sh(e.type,e.memoizedProps)),s=!s),s&&nn&&Jl(e),Lu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));nn=dx(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));nn=dx(e)}else t===27?(t=nn,ki(e.type)?(e=Rh,Rh=null,nn=e):nn=t):nn=Vn?ml(e.stateNode.nextSibling):null;return!0}function Ml(){nn=Vn=null,ht=!1}function pi(){var e=Fl;return e!==null&&(Gs===null?Gs=e:Gs.push.apply(Gs,e),Fl=null),e}function ir(e){Fl===null?Fl=[e]:Fl.push(e)}var mo=S(null),Ra=null,Dl=null;function Wl(e,t,s){de(mo,t._currentValue),t._currentValue=s}function Ol(e){e._currentValue=mo.current,Z(mo)}function go(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function xo(e,t,s,i){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var f=d.dependencies;if(f!==null){var _=d.child;f=f.firstContext;e:for(;f!==null;){var w=f;f=d;for(var M=0;M<t.length;M++)if(w.context===t[M]){f.lanes|=s,w=f.alternate,w!==null&&(w.lanes|=s),go(f.return,s,e),i||(_=null);break e}f=w.next}}else if(d.tag===18){if(_=d.return,_===null)throw Error(c(341));_.lanes|=s,f=_.alternate,f!==null&&(f.lanes|=s),go(_,s,e),_=null}else _=d.child;if(_!==null)_.return=d;else for(_=d;_!==null;){if(_===e){_=null;break}if(d=_.sibling,d!==null){d.return=_.return,_=d;break}_=_.return}d=_}}function mi(e,t,s,i){e=null;for(var d=t,f=!1;d!==null;){if(!f){if((d.flags&524288)!==0)f=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var _=d.alternate;if(_===null)throw Error(c(387));if(_=_.memoizedProps,_!==null){var w=d.type;zn(d.pendingProps.value,_.value)||(e!==null?e.push(w):e=[w])}}else if(d===Ke.current){if(_=d.alternate,_===null)throw Error(c(387));_.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Go):e=[Go])}d=d.return}e!==null&&xo(t,e,s,i),t.flags|=262144}function nc(e){for(e=e.firstContext;e!==null;){if(!zn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ma(e){Ra=e,Dl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xn(e){return zu(Ra,e)}function sc(e,t){return Ra===null&&Ma(e),zu(e,t)}function zu(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Dl===null){if(e===null)throw Error(c(308));Dl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Dl=Dl.next=t;return s}var yf=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},vf=n.unstable_scheduleCallback,jf=n.unstable_NormalPriority,vn={$$typeof:Q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lc(){return{controller:new yf,data:new Map,refCount:0}}function ea(e){e.refCount--,e.refCount===0&&vf(jf,function(){e.controller.abort()})}var ls=null,ms=0,Ot=0,ta=null;function wf(e,t){if(ls===null){var s=ls=[];ms=0,Ot=xh(),ta={status:"pending",value:void 0,then:function(i){s.push(i)}}}return ms++,t.then(Iu,Iu),t}function Iu(){if(--ms===0&&ls!==null){ta!==null&&(ta.status="fulfilled");var e=ls;ls=null,Ot=0,ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ac(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(d){s.push(d)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var d=0;d<s.length;d++)(0,s[d])(t)},function(d){for(i.status="rejected",i.reason=d,d=0;d<s.length;d++)(0,s[d])(void 0)}),i}var bo=F.S;F.S=function(e,t){Sg=De(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&wf(e,t),bo!==null&&bo(e,t)};var pl=S(null);function rr(){var e=pl.current;return e!==null?e:sn.pooledCache}function cr(e,t){t===null?de(pl,pl.current):de(pl,t.pool)}function or(){var e=rr();return e===null?null:{parent:vn._currentValue,pool:e}}var Da=Error(c(460)),_o=Error(c(474)),na=Error(c(542)),ur={then:function(){}};function Uu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dr(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Bt,Bt),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Hu(e),e;default:if(typeof t.status=="string")t.then(Bt,Bt);else{if(e=sn,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var d=t;d.status="fulfilled",d.value=i}},function(i){if(t.status==="pending"){var d=t;d.status="rejected",d.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Hu(e),e}throw tl=t,Da}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(tl=s,Da):s}}var tl=null;function La(){if(tl===null)throw Error(c(459));var e=tl;return tl=null,e}function Hu(e){if(e===Da||e===na)throw Error(c(483))}var za=null,gi=0;function ic(e){var t=gi;return gi+=1,za===null&&(za=[]),dr(za,e,t)}function fr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function hr(e,t){throw t.$$typeof===y?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yo(e){function t(X,B){if(e){var P=X.deletions;P===null?(X.deletions=[B],X.flags|=16):P.push(B)}}function s(X,B){if(!e)return null;for(;B!==null;)t(X,B),B=B.sibling;return null}function i(X){for(var B=new Map;X!==null;)X.key!==null?B.set(X.key,X):B.set(X.index,X),X=X.sibling;return B}function d(X,B){return X=dl(X,B),X.index=0,X.sibling=null,X}function f(X,B,P){return X.index=P,e?(P=X.alternate,P!==null?(P=P.index,P<B?(X.flags|=67108866,B):P):(X.flags|=67108866,B)):(X.flags|=1048576,B)}function _(X){return e&&X.alternate===null&&(X.flags|=67108866),X}function w(X,B,P,he){return B===null||B.tag!==6?(B=oo(P,X.mode,he),B.return=X,B):(B=d(B,P),B.return=X,B)}function M(X,B,P,he){var Xe=P.type;return Xe===E?oe(X,B,P.props.children,he,P.key):B!==null&&(B.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===V&&Oa(Xe)===B.type)?(B=d(B,P.props),fr(B,P),B.return=X,B):(B=lr(P.type,P.key,P.props,null,X.mode,he),fr(B,P),B.return=X,B)}function W(X,B,P,he){return B===null||B.tag!==4||B.stateNode.containerInfo!==P.containerInfo||B.stateNode.implementation!==P.implementation?(B=ar(P,X.mode,he),B.return=X,B):(B=d(B,P.children||[]),B.return=X,B)}function oe(X,B,P,he,Xe){return B===null||B.tag!==7?(B=Ql(P,X.mode,he,Xe),B.return=X,B):(B=d(B,P),B.return=X,B)}function me(X,B,P){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=oo(""+B,X.mode,P),B.return=X,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case T:return P=lr(B.type,B.key,B.props,null,X.mode,P),fr(P,B),P.return=X,P;case N:return B=ar(B,X.mode,P),B.return=X,B;case V:return B=Oa(B),me(X,B,P)}if(we(B)||se(B))return B=Ql(B,X.mode,P,null),B.return=X,B;if(typeof B.then=="function")return me(X,ic(B),P);if(B.$$typeof===Q)return me(X,sc(X,B),P);hr(X,B)}return null}function te(X,B,P,he){var Xe=B!==null?B.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Xe!==null?null:w(X,B,""+P,he);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case T:return P.key===Xe?M(X,B,P,he):null;case N:return P.key===Xe?W(X,B,P,he):null;case V:return P=Oa(P),te(X,B,P,he)}if(we(P)||se(P))return Xe!==null?null:oe(X,B,P,he,null);if(typeof P.then=="function")return te(X,B,ic(P),he);if(P.$$typeof===Q)return te(X,B,sc(X,P),he);hr(X,P)}return null}function le(X,B,P,he,Xe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return X=X.get(P)||null,w(B,X,""+he,Xe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case T:return X=X.get(he.key===null?P:he.key)||null,M(B,X,he,Xe);case N:return X=X.get(he.key===null?P:he.key)||null,W(B,X,he,Xe);case V:return he=Oa(he),le(X,B,P,he,Xe)}if(we(he)||se(he))return X=X.get(P)||null,oe(B,X,he,Xe,null);if(typeof he.then=="function")return le(X,B,P,ic(he),Xe);if(he.$$typeof===Q)return le(X,B,P,sc(B,he),Xe);hr(B,he)}return null}function ze(X,B,P,he){for(var Xe=null,At=null,He=B,ut=B=0,_t=null;He!==null&&ut<P.length;ut++){He.index>ut?(_t=He,He=null):_t=He.sibling;var Rt=te(X,He,P[ut],he);if(Rt===null){He===null&&(He=_t);break}e&&He&&Rt.alternate===null&&t(X,He),B=f(Rt,B,ut),At===null?Xe=Rt:At.sibling=Rt,At=Rt,He=_t}if(ut===P.length)return s(X,He),ht&&Rl(X,ut),Xe;if(He===null){for(;ut<P.length;ut++)He=me(X,P[ut],he),He!==null&&(B=f(He,B,ut),At===null?Xe=He:At.sibling=He,At=He);return ht&&Rl(X,ut),Xe}for(He=i(He);ut<P.length;ut++)_t=le(He,X,ut,P[ut],he),_t!==null&&(e&&_t.alternate!==null&&He.delete(_t.key===null?ut:_t.key),B=f(_t,B,ut),At===null?Xe=_t:At.sibling=_t,At=_t);return e&&He.forEach(function(Ai){return t(X,Ai)}),ht&&Rl(X,ut),Xe}function We(X,B,P,he){if(P==null)throw Error(c(151));for(var Xe=null,At=null,He=B,ut=B=0,_t=null,Rt=P.next();He!==null&&!Rt.done;ut++,Rt=P.next()){He.index>ut?(_t=He,He=null):_t=He.sibling;var Ai=te(X,He,Rt.value,he);if(Ai===null){He===null&&(He=_t);break}e&&He&&Ai.alternate===null&&t(X,He),B=f(Ai,B,ut),At===null?Xe=Ai:At.sibling=Ai,At=Ai,He=_t}if(Rt.done)return s(X,He),ht&&Rl(X,ut),Xe;if(He===null){for(;!Rt.done;ut++,Rt=P.next())Rt=me(X,Rt.value,he),Rt!==null&&(B=f(Rt,B,ut),At===null?Xe=Rt:At.sibling=Rt,At=Rt);return ht&&Rl(X,ut),Xe}for(He=i(He);!Rt.done;ut++,Rt=P.next())Rt=le(He,X,ut,Rt.value,he),Rt!==null&&(e&&Rt.alternate!==null&&He.delete(Rt.key===null?ut:Rt.key),B=f(Rt,B,ut),At===null?Xe=Rt:At.sibling=Rt,At=Rt);return e&&He.forEach(function(I0){return t(X,I0)}),ht&&Rl(X,ut),Xe}function Xt(X,B,P,he){if(typeof P=="object"&&P!==null&&P.type===E&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case T:e:{for(var Xe=P.key;B!==null;){if(B.key===Xe){if(Xe=P.type,Xe===E){if(B.tag===7){s(X,B.sibling),he=d(B,P.props.children),he.return=X,X=he;break e}}else if(B.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===V&&Oa(Xe)===B.type){s(X,B.sibling),he=d(B,P.props),fr(he,P),he.return=X,X=he;break e}s(X,B);break}else t(X,B);B=B.sibling}P.type===E?(he=Ql(P.props.children,X.mode,he,P.key),he.return=X,X=he):(he=lr(P.type,P.key,P.props,null,X.mode,he),fr(he,P),he.return=X,X=he)}return _(X);case N:e:{for(Xe=P.key;B!==null;){if(B.key===Xe)if(B.tag===4&&B.stateNode.containerInfo===P.containerInfo&&B.stateNode.implementation===P.implementation){s(X,B.sibling),he=d(B,P.children||[]),he.return=X,X=he;break e}else{s(X,B);break}else t(X,B);B=B.sibling}he=ar(P,X.mode,he),he.return=X,X=he}return _(X);case V:return P=Oa(P),Xt(X,B,P,he)}if(we(P))return ze(X,B,P,he);if(se(P)){if(Xe=se(P),typeof Xe!="function")throw Error(c(150));return P=Xe.call(P),We(X,B,P,he)}if(typeof P.then=="function")return Xt(X,B,ic(P),he);if(P.$$typeof===Q)return Xt(X,B,sc(X,P),he);hr(X,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,B!==null&&B.tag===6?(s(X,B.sibling),he=d(B,P),he.return=X,X=he):(s(X,B),he=oo(P,X.mode,he),he.return=X,X=he),_(X)):s(X,B)}return function(X,B,P,he){try{gi=0;var Xe=Xt(X,B,P,he);return za=null,Xe}catch(He){if(He===Da||He===na)throw He;var At=ps(29,He,null,X.mode);return At.lanes=he,At.return=X,At}finally{}}}var Ia=yo(!0),Bu=yo(!1),sa=!1;function pr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function la(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Cs(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Lt&2)!==0){var d=i.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),i.pending=t,t=sr(e),Cu(e,null,s),t}return Wr(e,i,t,s),sr(e)}function Ua(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,vs(e,s)}}function vo(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var d=null,f=null;if(s=s.firstBaseUpdate,s!==null){do{var _={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};f===null?d=f=_:f=f.next=_,s=s.next}while(s!==null);f===null?d=f=t:f=f.next=t}else d=f=t;s={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var cc=!1;function xi(){if(cc){var e=ta;if(e!==null)throw e}}function m(e,t,s,i){cc=!1;var d=e.updateQueue;sa=!1;var f=d.firstBaseUpdate,_=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var M=w,W=M.next;M.next=null,_===null?f=W:_.next=W,_=M;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,w=oe.lastBaseUpdate,w!==_&&(w===null?oe.firstBaseUpdate=W:w.next=W,oe.lastBaseUpdate=M))}if(f!==null){var me=d.baseState;_=0,oe=W=M=null,w=f;do{var te=w.lane&-536870913,le=te!==w.lane;if(le?(bt&te)===te:(i&te)===te){te!==0&&te===Ot&&(cc=!0),oe!==null&&(oe=oe.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ze=e,We=w;te=t;var Xt=s;switch(We.tag){case 1:if(ze=We.payload,typeof ze=="function"){me=ze.call(Xt,me,te);break e}me=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=We.payload,te=typeof ze=="function"?ze.call(Xt,me,te):ze,te==null)break e;me=j({},me,te);break e;case 2:sa=!0}}te=w.callback,te!==null&&(e.flags|=64,le&&(e.flags|=8192),le=d.callbacks,le===null?d.callbacks=[te]:le.push(te))}else le={lane:te,tag:w.tag,payload:w.payload,callback:w.callback,next:null},oe===null?(W=oe=le,M=me):oe=oe.next=le,_|=te;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;le=w,w=le.next,le.next=null,d.lastBaseUpdate=le,d.shared.pending=null}}while(!0);oe===null&&(M=me),d.baseState=M,d.firstBaseUpdate=W,d.lastBaseUpdate=oe,f===null&&(d.shared.lanes=0),yi|=_,e.lanes=_,e.memoizedState=me}}function H(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function re(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)H(s[e],t)}var Ce=S(null),jt=S(0);function In(e,t){e=Qa,de(jt,e),de(Ce,t),Qa=e|t.baseLanes}function As(){de(jt,Qa),de(Ce,Ce.current)}function Ha(){Qa=jt.current,Z(Ce),Z(jt)}var gs=S(null),Rs=null;function Ll(e){var t=e.alternate;de(ue,ue.current&1),de(gs,e),Rs===null&&(t===null||Ce.current!==null||t.memoizedState!==null)&&(Rs=e)}function oc(e){de(ue,ue.current),de(gs,e),Rs===null&&(Rs=e)}function jo(e){e.tag===22?(de(ue,ue.current),de(gs,e),Rs===null&&(Rs=e)):zl()}function zl(){de(ue,ue.current),de(gs,gs.current)}function xs(e){Z(gs),Rs===e&&(Rs=null),Z(ue)}var ue=S(0);function Se(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Ch(s)||Ah(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ge=0,Te=null,Be=null,It=null,uc=!1,dc=!1,mr=!1,qu=0,wo=0,fc=null,Ey=0;function En(){throw Error(c(321))}function Nf(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!zn(e[s],t[s]))return!1;return!0}function kf(e,t,s,i,d,f){return Ge=f,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Im:Bf,mr=!1,f=s(i,d),mr=!1,dc&&(f=nm(t,s,i,d)),tm(e),f}function tm(e){F.H=So;var t=Be!==null&&Be.next!==null;if(Ge=0,It=Be=Te=null,uc=!1,wo=0,fc=null,t)throw Error(c(300));e===null||Un||(e=e.dependencies,e!==null&&nc(e)&&(Un=!0))}function nm(e,t,s,i){Te=e;var d=0;do{if(dc&&(fc=null),wo=0,dc=!1,25<=d)throw Error(c(301));if(d+=1,It=Be=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}F.H=Um,f=t(s,i)}while(dc);return f}function Ty(){var e=F.H,t=e.useState()[0];return t=typeof t.then=="function"?No(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(Te.flags|=1024),t}function Sf(){var e=qu!==0;return qu=0,e}function Ef(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Tf(e){if(uc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uc=!1}Ge=0,It=Be=Te=null,dc=!1,wo=qu=0,fc=null}function Ms(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Te.memoizedState=It=e:It=It.next=e,It}function Mn(){if(Be===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=It===null?Te.memoizedState:It.next;if(t!==null)It=t,Be=e;else{if(e===null)throw Te.alternate===null?Error(c(467)):Error(c(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},It===null?Te.memoizedState=It=e:It=It.next=e}return It}function Gu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=wo;return wo+=1,fc===null&&(fc=[]),e=dr(fc,e,t),t=Te,(It===null?t.memoizedState:It.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Im:Bf),e}function $u(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return No(e);if(e.$$typeof===Q)return Xn(e)}throw Error(c(438,String(e)))}function Cf(e){var t=null,s=Te.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=Te.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(d){return d.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Gu(),Te.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=L;return t.index++,s}function Ba(e,t){return typeof t=="function"?t(e):t}function Yu(e){var t=Mn();return Af(t,Be,e)}function Af(e,t,s){var i=e.queue;if(i===null)throw Error(c(311));i.lastRenderedReducer=s;var d=e.baseQueue,f=i.pending;if(f!==null){if(d!==null){var _=d.next;d.next=f.next,f.next=_}t.baseQueue=d=f,i.pending=null}if(f=e.baseState,d===null)e.memoizedState=f;else{t=d.next;var w=_=null,M=null,W=t,oe=!1;do{var me=W.lane&-536870913;if(me!==W.lane?(bt&me)===me:(Ge&me)===me){var te=W.revertLane;if(te===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),me===Ot&&(oe=!0);else if((Ge&te)===te){W=W.next,te===Ot&&(oe=!0);continue}else me={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(w=M=me,_=f):M=M.next=me,Te.lanes|=te,yi|=te;me=W.action,mr&&s(f,me),f=W.hasEagerState?W.eagerState:s(f,me)}else te={lane:me,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(w=M=te,_=f):M=M.next=te,Te.lanes|=me,yi|=me;W=W.next}while(W!==null&&W!==t);if(M===null?_=f:M.next=w,!zn(f,e.memoizedState)&&(Un=!0,oe&&(s=ta,s!==null)))throw s;e.memoizedState=f,e.baseState=_,e.baseQueue=M,i.lastRenderedState=f}return d===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Rf(e){var t=Mn(),s=t.queue;if(s===null)throw Error(c(311));s.lastRenderedReducer=e;var i=s.dispatch,d=s.pending,f=t.memoizedState;if(d!==null){s.pending=null;var _=d=d.next;do f=e(f,_.action),_=_.next;while(_!==d);zn(f,t.memoizedState)||(Un=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function sm(e,t,s){var i=Te,d=Mn(),f=ht;if(f){if(s===void 0)throw Error(c(407));s=s()}else s=t();var _=!zn((Be||d).memoizedState,s);if(_&&(d.memoizedState=s,Un=!0),d=d.queue,Of(im.bind(null,i,d,e),[e]),d.getSnapshot!==t||_||It!==null&&It.memoizedState.tag&1){if(i.flags|=2048,hc(9,{destroy:void 0},am.bind(null,i,d,s,t),null),sn===null)throw Error(c(349));f||(Ge&127)!==0||lm(i,t,s)}return s}function lm(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Te.updateQueue,t===null?(t=Gu(),Te.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function am(e,t,s,i){t.value=s,t.getSnapshot=i,rm(t)&&cm(e)}function im(e,t,s){return s(function(){rm(t)&&cm(e)})}function rm(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!zn(e,s)}catch{return!0}}function cm(e){var t=ul(e,2);t!==null&&$s(t,e,2)}function Mf(e){var t=Ms();if(typeof e=="function"){var s=e;if(e=s(),mr){hn(!0);try{s()}finally{hn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:e},t}function om(e,t,s,i){return e.baseState=s,Af(e,Be,typeof i=="function"?i:Ba)}function Cy(e,t,s,i,d){if(Qu(e))throw Error(c(485));if(e=t.action,e!==null){var f={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){f.listeners.push(_)}};F.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,um(t,f)):(f.next=s.next,t.pending=s.next=f)}}function um(e,t){var s=t.action,i=t.payload,d=e.state;if(t.isTransition){var f=F.T,_={};F.T=_;try{var w=s(d,i),M=F.S;M!==null&&M(_,w),dm(e,t,w)}catch(W){Df(e,t,W)}finally{f!==null&&_.types!==null&&(f.types=_.types),F.T=f}}else try{f=s(d,i),dm(e,t,f)}catch(W){Df(e,t,W)}}function dm(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){fm(e,t,i)},function(i){return Df(e,t,i)}):fm(e,t,s)}function fm(e,t,s){t.status="fulfilled",t.value=s,hm(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,um(e,s)))}function Df(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,hm(t),t=t.next;while(t!==i)}e.action=null}function hm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function pm(e,t){return t}function mm(e,t){if(ht){var s=sn.formState;if(s!==null){e:{var i=Te;if(ht){if(nn){t:{for(var d=nn,f=Ts;d.nodeType!==8;){if(!f){d=null;break t}if(d=ml(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){nn=ml(d.nextSibling),i=d.data==="F!";break e}}Jl(i)}i=!1}i&&(t=s[0])}}return s=Ms(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pm,lastRenderedState:t},s.queue=i,s=Om.bind(null,Te,i),i.dispatch=s,i=Mf(!1),f=Hf.bind(null,Te,!1,i.queue),i=Ms(),d={state:t,dispatch:null,action:e,pending:null},i.queue=d,s=Cy.bind(null,Te,d,f,s),d.dispatch=s,i.memoizedState=e,[t,s,!1]}function gm(e){var t=Mn();return xm(t,Be,e)}function xm(e,t,s){if(t=Af(e,t,pm)[0],e=Yu(Ba)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=No(t)}catch(_){throw _===Da?na:_}else i=t;t=Mn();var d=t.queue,f=d.dispatch;return s!==t.memoizedState&&(Te.flags|=2048,hc(9,{destroy:void 0},Ay.bind(null,d,s),null)),[i,f,e]}function Ay(e,t){e.action=t}function bm(e){var t=Mn(),s=Be;if(s!==null)return xm(t,s,e);Mn(),t=t.memoizedState,s=Mn();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function hc(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=Te.updateQueue,t===null&&(t=Gu(),Te.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function _m(){return Mn().memoizedState}function Vu(e,t,s,i){var d=Ms();Te.flags|=e,d.memoizedState=hc(1|t,{destroy:void 0},s,i===void 0?null:i)}function Xu(e,t,s,i){var d=Mn();i=i===void 0?null:i;var f=d.memoizedState.inst;Be!==null&&i!==null&&Nf(i,Be.memoizedState.deps)?d.memoizedState=hc(t,f,s,i):(Te.flags|=e,d.memoizedState=hc(1|t,f,s,i))}function ym(e,t){Vu(8390656,8,e,t)}function Of(e,t){Xu(2048,8,e,t)}function Ry(e){Te.flags|=4;var t=Te.updateQueue;if(t===null)t=Gu(),Te.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function vm(e){var t=Mn().memoizedState;return Ry({ref:t,nextImpl:e}),function(){if((Lt&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function jm(e,t){return Xu(4,2,e,t)}function wm(e,t){return Xu(4,4,e,t)}function Nm(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function km(e,t,s){s=s!=null?s.concat([e]):null,Xu(4,4,Nm.bind(null,t,e),s)}function Lf(){}function Sm(e,t){var s=Mn();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Nf(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Em(e,t){var s=Mn();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Nf(t,i[1]))return i[0];if(i=e(),mr){hn(!0);try{e()}finally{hn(!1)}}return s.memoizedState=[i,t],i}function zf(e,t,s){return s===void 0||(Ge&1073741824)!==0&&(bt&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Tg(),Te.lanes|=e,yi|=e,s)}function Tm(e,t,s,i){return zn(s,t)?s:Ce.current!==null?(e=zf(e,s,i),zn(e,t)||(Un=!0),e):(Ge&42)===0||(Ge&1073741824)!==0&&(bt&261930)===0?(Un=!0,e.memoizedState=s):(e=Tg(),Te.lanes|=e,yi|=e,t)}function Cm(e,t,s,i,d){var f=$.p;$.p=f!==0&&8>f?f:8;var _=F.T,w={};F.T=w,Hf(e,!1,t,s);try{var M=d(),W=F.S;if(W!==null&&W(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var oe=ac(M,i);ko(e,t,oe,ll(e))}else ko(e,t,i,ll(e))}catch(me){ko(e,t,{then:function(){},status:"rejected",reason:me},ll())}finally{$.p=f,_!==null&&w.types!==null&&(_.types=w.types),F.T=_}}function My(){}function If(e,t,s,i){if(e.tag!==5)throw Error(c(476));var d=Am(e).queue;Cm(e,d,t,ne,s===null?My:function(){return Rm(e),s(i)})}function Am(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:ne},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Rm(e){var t=Am(e);t.next===null&&(t=e.alternate.memoizedState),ko(e,t.next.queue,{},ll())}function Uf(){return Xn(Go)}function Mm(){return Mn().memoizedState}function Dm(){return Mn().memoizedState}function Dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=ll();e=la(s);var i=Cs(t,e,s);i!==null&&($s(i,t,s),Ua(i,t,s)),t={cache:lc()},e.payload=t;return}t=t.return}}function Oy(e,t,s){var i=ll();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Qu(e)?Lm(t,s):(s=nr(e,t,s,i),s!==null&&($s(s,e,i),zm(s,t,i)))}function Om(e,t,s){var i=ll();ko(e,t,s,i)}function ko(e,t,s,i){var d={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Qu(e))Lm(t,d);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var _=t.lastRenderedState,w=f(_,s);if(d.hasEagerState=!0,d.eagerState=w,zn(w,_))return Wr(e,t,d,0),sn===null&&ui(),!1}catch{}finally{}if(s=nr(e,t,d,i),s!==null)return $s(s,e,i),zm(s,t,i),!0}return!1}function Hf(e,t,s,i){if(i={lane:2,revertLane:xh(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Qu(e)){if(t)throw Error(c(479))}else t=nr(e,s,i,2),t!==null&&$s(t,e,2)}function Qu(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Lm(e,t){dc=uc=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function zm(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,vs(e,s)}}var So={readContext:Xn,use:$u,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useLayoutEffect:En,useInsertionEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useSyncExternalStore:En,useId:En,useHostTransitionStatus:En,useFormState:En,useActionState:En,useOptimistic:En,useMemoCache:En,useCacheRefresh:En};So.useEffectEvent=En;var Im={readContext:Xn,use:$u,useCallback:function(e,t){return Ms().memoizedState=[e,t===void 0?null:t],e},useContext:Xn,useEffect:ym,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Vu(4194308,4,Nm.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Vu(4194308,4,e,t)},useInsertionEffect:function(e,t){Vu(4,2,e,t)},useMemo:function(e,t){var s=Ms();t=t===void 0?null:t;var i=e();if(mr){hn(!0);try{e()}finally{hn(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Ms();if(s!==void 0){var d=s(t);if(mr){hn(!0);try{s(t)}finally{hn(!1)}}}else d=t;return i.memoizedState=i.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},i.queue=e,e=e.dispatch=Oy.bind(null,Te,e),[i.memoizedState,e]},useRef:function(e){var t=Ms();return e={current:e},t.memoizedState=e},useState:function(e){e=Mf(e);var t=e.queue,s=Om.bind(null,Te,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Lf,useDeferredValue:function(e,t){var s=Ms();return zf(s,e,t)},useTransition:function(){var e=Mf(!1);return e=Cm.bind(null,Te,e.queue,!0,!1),Ms().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=Te,d=Ms();if(ht){if(s===void 0)throw Error(c(407));s=s()}else{if(s=t(),sn===null)throw Error(c(349));(bt&127)!==0||lm(i,t,s)}d.memoizedState=s;var f={value:s,getSnapshot:t};return d.queue=f,ym(im.bind(null,i,f,e),[e]),i.flags|=2048,hc(9,{destroy:void 0},am.bind(null,i,f,s,t),null),s},useId:function(){var e=Ms(),t=sn.identifierPrefix;if(ht){var s=hl,i=fl;s=(i&~(1<<32-yt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=qu++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Ey++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Uf,useFormState:mm,useActionState:mm,useOptimistic:function(e){var t=Ms();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=Hf.bind(null,Te,!0,s),s.dispatch=t,[e,t]},useMemoCache:Cf,useCacheRefresh:function(){return Ms().memoizedState=Dy.bind(null,Te)},useEffectEvent:function(e){var t=Ms(),s={impl:e};return t.memoizedState=s,function(){if((Lt&2)!==0)throw Error(c(440));return s.impl.apply(void 0,arguments)}}},Bf={readContext:Xn,use:$u,useCallback:Sm,useContext:Xn,useEffect:Of,useImperativeHandle:km,useInsertionEffect:jm,useLayoutEffect:wm,useMemo:Em,useReducer:Yu,useRef:_m,useState:function(){return Yu(Ba)},useDebugValue:Lf,useDeferredValue:function(e,t){var s=Mn();return Tm(s,Be.memoizedState,e,t)},useTransition:function(){var e=Yu(Ba)[0],t=Mn().memoizedState;return[typeof e=="boolean"?e:No(e),t]},useSyncExternalStore:sm,useId:Mm,useHostTransitionStatus:Uf,useFormState:gm,useActionState:gm,useOptimistic:function(e,t){var s=Mn();return om(s,Be,e,t)},useMemoCache:Cf,useCacheRefresh:Dm};Bf.useEffectEvent=vm;var Um={readContext:Xn,use:$u,useCallback:Sm,useContext:Xn,useEffect:Of,useImperativeHandle:km,useInsertionEffect:jm,useLayoutEffect:wm,useMemo:Em,useReducer:Rf,useRef:_m,useState:function(){return Rf(Ba)},useDebugValue:Lf,useDeferredValue:function(e,t){var s=Mn();return Be===null?zf(s,e,t):Tm(s,Be.memoizedState,e,t)},useTransition:function(){var e=Rf(Ba)[0],t=Mn().memoizedState;return[typeof e=="boolean"?e:No(e),t]},useSyncExternalStore:sm,useId:Mm,useHostTransitionStatus:Uf,useFormState:bm,useActionState:bm,useOptimistic:function(e,t){var s=Mn();return Be!==null?om(s,Be,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Cf,useCacheRefresh:Dm};Um.useEffectEvent=vm;function qf(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:j({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Gf={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=ll(),d=la(i);d.payload=t,s!=null&&(d.callback=s),t=Cs(e,d,i),t!==null&&($s(t,e,i),Ua(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=ll(),d=la(i);d.tag=1,d.payload=t,s!=null&&(d.callback=s),t=Cs(e,d,i),t!==null&&($s(t,e,i),Ua(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=ll(),i=la(s);i.tag=2,t!=null&&(i.callback=t),t=Cs(e,i,s),t!==null&&($s(t,e,s),Ua(t,e,s))}};function Hm(e,t,s,i,d,f,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,_):t.prototype&&t.prototype.isPureReactComponent?!ka(s,i)||!ka(d,f):!0}function Bm(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&Gf.enqueueReplaceState(t,t.state,null)}function gr(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=j({},s));for(var d in e)s[d]===void 0&&(s[d]=e[d])}return s}function qm(e){Pr(e)}function Gm(e){console.error(e)}function $m(e){Pr(e)}function Ku(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Ym(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function $f(e,t,s){return s=la(s),s.tag=3,s.payload={element:null},s.callback=function(){Ku(e,t)},s}function Vm(e){return e=la(e),e.tag=3,e}function Xm(e,t,s,i){var d=s.type.getDerivedStateFromError;if(typeof d=="function"){var f=i.value;e.payload=function(){return d(f)},e.callback=function(){Ym(t,s,i)}}var _=s.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){Ym(t,s,i),typeof d!="function"&&(vi===null?vi=new Set([this]):vi.add(this));var w=i.stack;this.componentDidCatch(i.value,{componentStack:w!==null?w:""})})}function Ly(e,t,s,i,d){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&mi(t,s,d,!0),s=gs.current,s!==null){switch(s.tag){case 31:case 13:return Rs===null?id():s.alternate===null&&Tn===0&&(Tn=3),s.flags&=-257,s.flags|=65536,s.lanes=d,i===ur?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),ph(e,i,d)),!1;case 22:return s.flags|=65536,i===ur?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),ph(e,i,d)),!1}throw Error(c(435,s.tag))}return ph(e,i,d),id(),!1}if(ht)return t=gs.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=d,i!==po&&(e=Error(c(422),{cause:i}),ir(Is(e,s)))):(i!==po&&(t=Error(c(423),{cause:i}),ir(Is(t,s))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,i=Is(i,s),d=$f(e.stateNode,i,d),vo(e,d),Tn!==4&&(Tn=2)),!1;var f=Error(c(520),{cause:i});if(f=Is(f,s),Oo===null?Oo=[f]:Oo.push(f),Tn!==4&&(Tn=2),t===null)return!0;i=Is(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=d&-d,s.lanes|=e,e=$f(s.stateNode,i,e),vo(s,e),!1;case 1:if(t=s.type,f=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(vi===null||!vi.has(f))))return s.flags|=65536,d&=-d,s.lanes|=d,d=Vm(d),Xm(d,e,s,i),vo(s,d),!1}s=s.return}while(s!==null);return!1}var Yf=Error(c(461)),Un=!1;function as(e,t,s,i){t.child=e===null?Bu(t,null,s,i):Ia(t,e.child,s,i)}function Qm(e,t,s,i,d){s=s.render;var f=t.ref;if("ref"in i){var _={};for(var w in i)w!=="ref"&&(_[w]=i[w])}else _=i;return Ma(t),i=kf(e,t,s,_,f,d),w=Sf(),e!==null&&!Un?(Ef(e,t,d),qa(e,t,d)):(ht&&w&&fo(t),t.flags|=1,as(e,t,i,d),t.child)}function Km(e,t,s,i,d){if(e===null){var f=s.type;return typeof f=="function"&&!ec(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,Zm(e,t,f,i,d)):(e=lr(s.type,null,i,t,t.mode,d),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Pf(e,d)){var _=f.memoizedProps;if(s=s.compare,s=s!==null?s:ka,s(_,i)&&e.ref===t.ref)return qa(e,t,d)}return t.flags|=1,e=dl(f,i),e.ref=t.ref,e.return=t,t.child=e}function Zm(e,t,s,i,d){if(e!==null){var f=e.memoizedProps;if(ka(f,i)&&e.ref===t.ref)if(Un=!1,t.pendingProps=i=f,Pf(e,d))(e.flags&131072)!==0&&(Un=!0);else return t.lanes=e.lanes,qa(e,t,d)}return Vf(e,t,s,i,d)}function Fm(e,t,s,i){var d=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|s:s,e!==null){for(i=t.child=e.child,d=0;i!==null;)d=d|i.lanes|i.childLanes,i=i.sibling;i=d&~f}else i=0,t.child=null;return Jm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&cr(t,f!==null?f.cachePool:null),f!==null?In(t,f):As(),jo(t);else return i=t.lanes=536870912,Jm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(cr(t,f.cachePool),In(t,f),zl(),t.memoizedState=null):(e!==null&&cr(t,null),As(),zl());return as(e,t,d,s),t.child}function Eo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Jm(e,t,s,i,d){var f=rr();return f=f===null?null:{parent:vn._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&cr(t,null),As(),jo(t),e!==null&&mi(e,t,i,!0),t.childLanes=d,null}function Zu(e,t){return t=Ju({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Pm(e,t,s){return Ia(t,e.child,null,s),e=Zu(t,t.pendingProps),e.flags|=2,xs(t),t.memoizedState=null,e}function zy(e,t,s){var i=t.pendingProps,d=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ht){if(i.mode==="hidden")return e=Zu(t,i),t.lanes=536870912,Eo(null,e);if(oc(t),(e=nn)?(e=ux(e,Ts),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:fl,overflow:hl}:null,retryLane:536870912,hydrationErrors:null},s=uo(e),s.return=t,t.child=s,Vn=t,nn=null)):e=null,e===null)throw Jl(t);return t.lanes=536870912,null}return Zu(t,i)}var f=e.memoizedState;if(f!==null){var _=f.dehydrated;if(oc(t),d)if(t.flags&256)t.flags&=-257,t=Pm(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Un||mi(e,t,s,!1),d=(s&e.childLanes)!==0,Un||d){if(i=sn,i!==null&&(_=js(i,s),_!==0&&_!==f.retryLane))throw f.retryLane=_,ul(e,_),$s(i,e,_),Yf;id(),t=Pm(e,t,s)}else e=f.treeContext,nn=ml(_.nextSibling),Vn=t,ht=!0,Fl=null,Ts=!1,e!==null&&Du(t,e),t=Zu(t,i),t.flags|=4096;return t}return e=dl(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fu(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(c(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function Vf(e,t,s,i,d){return Ma(t),s=kf(e,t,s,i,void 0,d),i=Sf(),e!==null&&!Un?(Ef(e,t,d),qa(e,t,d)):(ht&&i&&fo(t),t.flags|=1,as(e,t,s,d),t.child)}function Wm(e,t,s,i,d,f){return Ma(t),t.updateQueue=null,s=nm(t,i,s,d),tm(e),i=Sf(),e!==null&&!Un?(Ef(e,t,f),qa(e,t,f)):(ht&&i&&fo(t),t.flags|=1,as(e,t,s,f),t.child)}function eg(e,t,s,i,d){if(Ma(t),t.stateNode===null){var f=Xl,_=s.contextType;typeof _=="object"&&_!==null&&(f=Xn(_)),f=new s(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Gf,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},pr(t),_=s.contextType,f.context=typeof _=="object"&&_!==null?Xn(_):Xl,f.state=t.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(qf(t,s,_,i),f.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(_=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),_!==f.state&&Gf.enqueueReplaceState(f,f.state,null),m(t,i,f,d),xi(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var w=t.memoizedProps,M=gr(s,w);f.props=M;var W=f.context,oe=s.contextType;_=Xl,typeof oe=="object"&&oe!==null&&(_=Xn(oe));var me=s.getDerivedStateFromProps;oe=typeof me=="function"||typeof f.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,oe||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w||W!==_)&&Bm(t,f,i,_),sa=!1;var te=t.memoizedState;f.state=te,m(t,i,f,d),xi(),W=t.memoizedState,w||te!==W||sa?(typeof me=="function"&&(qf(t,s,me,i),W=t.memoizedState),(M=sa||Hm(t,s,M,i,te,W,_))?(oe||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=W),f.props=i,f.state=W,f.context=_,i=M):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,rc(e,t),_=t.memoizedProps,oe=gr(s,_),f.props=oe,me=t.pendingProps,te=f.context,W=s.contextType,M=Xl,typeof W=="object"&&W!==null&&(M=Xn(W)),w=s.getDerivedStateFromProps,(W=typeof w=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(_!==me||te!==M)&&Bm(t,f,i,M),sa=!1,te=t.memoizedState,f.state=te,m(t,i,f,d),xi();var le=t.memoizedState;_!==me||te!==le||sa||e!==null&&e.dependencies!==null&&nc(e.dependencies)?(typeof w=="function"&&(qf(t,s,w,i),le=t.memoizedState),(oe=sa||Hm(t,s,oe,i,te,le,M)||e!==null&&e.dependencies!==null&&nc(e.dependencies))?(W||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,le,M),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,le,M)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||_===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=le),f.props=i,f.state=le,f.context=M,i=oe):(typeof f.componentDidUpdate!="function"||_===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Fu(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Ia(t,e.child,null,d),t.child=Ia(t,null,s,d)):as(e,t,s,d),t.memoizedState=f.state,e=t.child):e=qa(e,t,d),e}function tg(e,t,s,i){return Ml(),t.flags|=256,as(e,t,s,i),t.child}var Xf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qf(e){return{baseLanes:e,cachePool:or()}}function Kf(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=sl),e}function ng(e,t,s){var i=t.pendingProps,d=!1,f=(t.flags&128)!==0,_;if((_=f)||(_=e!==null&&e.memoizedState===null?!1:(ue.current&2)!==0),_&&(d=!0,t.flags&=-129),_=(t.flags&32)!==0,t.flags&=-33,e===null){if(ht){if(d?Ll(t):zl(),(e=nn)?(e=ux(e,Ts),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:fl,overflow:hl}:null,retryLane:536870912,hydrationErrors:null},s=uo(e),s.return=t,t.child=s,Vn=t,nn=null)):e=null,e===null)throw Jl(t);return Ah(e)?t.lanes=32:t.lanes=536870912,null}var w=i.children;return i=i.fallback,d?(zl(),d=t.mode,w=Ju({mode:"hidden",children:w},d),i=Ql(i,d,s,null),w.return=t,i.return=t,w.sibling=i,t.child=w,i=t.child,i.memoizedState=Qf(s),i.childLanes=Kf(e,_,s),t.memoizedState=Xf,Eo(null,i)):(Ll(t),Zf(t,w))}var M=e.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(f)t.flags&256?(Ll(t),t.flags&=-257,t=Ff(e,t,s)):t.memoizedState!==null?(zl(),t.child=e.child,t.flags|=128,t=null):(zl(),w=i.fallback,d=t.mode,i=Ju({mode:"visible",children:i.children},d),w=Ql(w,d,s,null),w.flags|=2,i.return=t,w.return=t,i.sibling=w,t.child=i,Ia(t,e.child,null,s),i=t.child,i.memoizedState=Qf(s),i.childLanes=Kf(e,_,s),t.memoizedState=Xf,t=Eo(null,i));else if(Ll(t),Ah(w)){if(_=w.nextSibling&&w.nextSibling.dataset,_)var W=_.dgst;_=W,i=Error(c(419)),i.stack="",i.digest=_,ir({value:i,source:null,stack:null}),t=Ff(e,t,s)}else if(Un||mi(e,t,s,!1),_=(s&e.childLanes)!==0,Un||_){if(_=sn,_!==null&&(i=js(_,s),i!==0&&i!==M.retryLane))throw M.retryLane=i,ul(e,i),$s(_,e,i),Yf;Ch(w)||id(),t=Ff(e,t,s)}else Ch(w)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,nn=ml(w.nextSibling),Vn=t,ht=!0,Fl=null,Ts=!1,e!==null&&Du(t,e),t=Zf(t,i.children),t.flags|=4096);return t}return d?(zl(),w=i.fallback,d=t.mode,M=e.child,W=M.sibling,i=dl(M,{mode:"hidden",children:i.children}),i.subtreeFlags=M.subtreeFlags&65011712,W!==null?w=dl(W,w):(w=Ql(w,d,s,null),w.flags|=2),w.return=t,i.return=t,i.sibling=w,t.child=i,Eo(null,i),i=t.child,w=e.child.memoizedState,w===null?w=Qf(s):(d=w.cachePool,d!==null?(M=vn._currentValue,d=d.parent!==M?{parent:M,pool:M}:d):d=or(),w={baseLanes:w.baseLanes|s,cachePool:d}),i.memoizedState=w,i.childLanes=Kf(e,_,s),t.memoizedState=Xf,Eo(e.child,i)):(Ll(t),s=e.child,e=s.sibling,s=dl(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(_=t.deletions,_===null?(t.deletions=[e],t.flags|=16):_.push(e)),t.child=s,t.memoizedState=null,s)}function Zf(e,t){return t=Ju({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ju(e,t){return e=ps(22,e,null,t),e.lanes=0,e}function Ff(e,t,s){return Ia(t,e.child,null,s),e=Zf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sg(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),go(e.return,t,s)}function Jf(e,t,s,i,d,f){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:d,treeForkCount:f}:(_.isBackwards=t,_.rendering=null,_.renderingStartTime=0,_.last=i,_.tail=s,_.tailMode=d,_.treeForkCount=f)}function lg(e,t,s){var i=t.pendingProps,d=i.revealOrder,f=i.tail;i=i.children;var _=ue.current,w=(_&2)!==0;if(w?(_=_&1|2,t.flags|=128):_&=1,de(ue,_),as(e,t,i,s),i=ht?hi:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sg(e,s,t);else if(e.tag===19)sg(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(s=t.child,d=null;s!==null;)e=s.alternate,e!==null&&Se(e)===null&&(d=s),s=s.sibling;s=d,s===null?(d=t.child,t.child=null):(d=s.sibling,s.sibling=null),Jf(t,!1,d,s,f,i);break;case"backwards":case"unstable_legacy-backwards":for(s=null,d=t.child,t.child=null;d!==null;){if(e=d.alternate,e!==null&&Se(e)===null){t.child=d;break}e=d.sibling,d.sibling=s,s=d,d=e}Jf(t,!0,s,null,f,i);break;case"together":Jf(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function qa(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),yi|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(mi(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,s=dl(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=dl(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Pf(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&nc(e)))}function Iy(e,t,s){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Wl(t,vn,e.memoizedState.cache),Ml();break;case 27:case 5:ge(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Wl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ll(t),t.flags|=128,null):(s&t.child.childLanes)!==0?ng(e,t,s):(Ll(t),e=qa(e,t,s),e!==null?e.sibling:null);Ll(t);break;case 19:var d=(e.flags&128)!==0;if(i=(s&t.childLanes)!==0,i||(mi(e,t,s,!1),i=(s&t.childLanes)!==0),d){if(i)return lg(e,t,s);t.flags|=128}if(d=t.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),de(ue,ue.current),i)break;return null;case 22:return t.lanes=0,Fm(e,t,s,t.pendingProps);case 24:Wl(t,vn,e.memoizedState.cache)}return qa(e,t,s)}function ag(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)Un=!0;else{if(!Pf(e,s)&&(t.flags&128)===0)return Un=!1,Iy(e,t,s);Un=(e.flags&131072)!==0}else Un=!1,ht&&(t.flags&1048576)!==0&&Mu(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e=="function")ec(e)?(i=gr(e,i),t.tag=1,t=eg(null,t,e,i,s)):(t.tag=0,t=Vf(null,t,e,i,s));else{if(e!=null){var d=e.$$typeof;if(d===z){t.tag=11,t=Qm(null,t,e,i,s);break e}else if(d===I){t.tag=14,t=Km(null,t,e,i,s);break e}}throw t=je(e)||e,Error(c(306,t,""))}}return t;case 0:return Vf(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,d=gr(i,t.pendingProps),eg(e,t,i,d,s);case 3:e:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(c(387));i=t.pendingProps;var f=t.memoizedState;d=f.element,rc(e,t),m(t,i,null,s);var _=t.memoizedState;if(i=_.cache,Wl(t,vn,i),i!==f.cache&&xo(t,[vn],s,!0),xi(),i=_.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:_.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=tg(e,t,i,s);break e}else if(i!==d){d=Is(Error(c(424)),t),ir(d),t=tg(e,t,i,s);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(nn=ml(e.firstChild),Vn=t,ht=!0,Fl=null,Ts=!0,s=Bu(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Ml(),i===d){t=qa(e,t,s);break e}as(e,t,i,s)}t=t.child}return t;case 26:return Fu(e,t),e===null?(s=gx(t.type,null,t.pendingProps,null))?t.memoizedState=s:ht||(s=t.type,e=t.pendingProps,i=hd(Ie.current).createElement(s),i[Ft]=t,i[at]=e,is(i,s,e),xt(i),t.stateNode=i):t.memoizedState=gx(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ge(t),e===null&&ht&&(i=t.stateNode=hx(t.type,t.pendingProps,Ie.current),Vn=t,Ts=!0,d=nn,ki(t.type)?(Rh=d,nn=ml(i.firstChild)):nn=d),as(e,t,t.pendingProps.children,s),Fu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ht&&((d=i=nn)&&(i=h0(i,t.type,t.pendingProps,Ts),i!==null?(t.stateNode=i,Vn=t,nn=ml(i.firstChild),Ts=!1,d=!0):d=!1),d||Jl(t)),ge(t),d=t.type,f=t.pendingProps,_=e!==null?e.memoizedProps:null,i=f.children,Sh(d,f)?i=null:_!==null&&Sh(d,_)&&(t.flags|=32),t.memoizedState!==null&&(d=kf(e,t,Ty,null,null,s),Go._currentValue=d),Fu(e,t),as(e,t,i,s),t.child;case 6:return e===null&&ht&&((e=s=nn)&&(s=p0(s,t.pendingProps,Ts),s!==null?(t.stateNode=s,Vn=t,nn=null,e=!0):e=!1),e||Jl(t)),null;case 13:return ng(e,t,s);case 4:return ce(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ia(t,null,i,s):as(e,t,i,s),t.child;case 11:return Qm(e,t,t.type,t.pendingProps,s);case 7:return as(e,t,t.pendingProps,s),t.child;case 8:return as(e,t,t.pendingProps.children,s),t.child;case 12:return as(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,Wl(t,t.type,i.value),as(e,t,i.children,s),t.child;case 9:return d=t.type._context,i=t.pendingProps.children,Ma(t),d=Xn(d),i=i(d),t.flags|=1,as(e,t,i,s),t.child;case 14:return Km(e,t,t.type,t.pendingProps,s);case 15:return Zm(e,t,t.type,t.pendingProps,s);case 19:return lg(e,t,s);case 31:return zy(e,t,s);case 22:return Fm(e,t,s,t.pendingProps);case 24:return Ma(t),i=Xn(vn),e===null?(d=rr(),d===null&&(d=sn,f=lc(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=s),d=f),t.memoizedState={parent:i,cache:d},pr(t),Wl(t,vn,d)):((e.lanes&s)!==0&&(rc(e,t),m(t,null,null,s),xi()),d=e.memoizedState,f=t.memoizedState,d.parent!==i?(d={parent:i,cache:i},t.memoizedState=d,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=d),Wl(t,vn,i)):(i=f.cache,Wl(t,vn,i),i!==d.cache&&xo(t,[vn],s,!0))),as(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function Ga(e){e.flags|=4}function Wf(e,t,s,i,d){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Mg())e.flags|=8192;else throw tl=ur,_o}else e.flags&=-16777217}function ig(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!vx(t))if(Mg())e.flags|=8192;else throw tl=ur,_o}function Pu(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ve():536870912,e.lanes|=t,xc|=t)}function To(e,t){if(!ht)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function on(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var d=e.child;d!==null;)s|=d.lanes|d.childLanes,i|=d.subtreeFlags&65011712,i|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)s|=d.lanes|d.childLanes,i|=d.subtreeFlags,i|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function Uy(e,t,s){var i=t.pendingProps;switch(ho(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(t),null;case 1:return on(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Ol(vn),Ue(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Pl(t)?Ga(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,pi())),on(t),null;case 26:var d=t.type,f=t.memoizedState;return e===null?(Ga(t),f!==null?(on(t),ig(t,f)):(on(t),Wf(t,d,null,i,s))):f?f!==e.memoizedState?(Ga(t),on(t),ig(t,f)):(on(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ga(t),on(t),Wf(t,d,e,i,s)),null;case 27:if(Ze(t),s=Ie.current,d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return on(t),null}e=be.current,Pl(t)?Ou(t):(e=hx(d,i,s),t.stateNode=e,Ga(t))}return on(t),null;case 5:if(Ze(t),d=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return on(t),null}if(f=be.current,Pl(t))Ou(t);else{var _=hd(Ie.current);switch(f){case 1:f=_.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=_.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=_.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=_.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=_.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?_.createElement("select",{is:i.is}):_.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?_.createElement(d,{is:i.is}):_.createElement(d)}}f[Ft]=t,f[at]=i;e:for(_=t.child;_!==null;){if(_.tag===5||_.tag===6)f.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===t)break e;for(;_.sibling===null;){if(_.return===null||_.return===t)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}t.stateNode=f;e:switch(is(f,d,i),d){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ga(t)}}return on(t),Wf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ga(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(e=Ie.current,Pl(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,d=Vn,d!==null)switch(d.tag){case 27:case 5:i=d.memoizedProps}e[Ft]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||nx(e.nodeValue,s)),e||Jl(t,!0)}else e=hd(e).createTextNode(i),e[Ft]=t,t.stateNode=e}return on(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Pl(t),s!==null){if(e===null){if(!i)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[Ft]=t}else Ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;on(t),e=!1}else s=pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(xs(t),t):(xs(t),null);if((t.flags&128)!==0)throw Error(c(558))}return on(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Pl(t),i!==null&&i.dehydrated!==null){if(e===null){if(!d)throw Error(c(318));if(d=t.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(c(317));d[Ft]=t}else Ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;on(t),d=!1}else d=pi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return t.flags&256?(xs(t),t):(xs(t),null)}return xs(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,d=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(d=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==d&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Pu(t,t.updateQueue),on(t),null);case 4:return Ue(),e===null&&vh(t.stateNode.containerInfo),on(t),null;case 10:return Ol(t.type),on(t),null;case 19:if(Z(ue),i=t.memoizedState,i===null)return on(t),null;if(d=(t.flags&128)!==0,f=i.rendering,f===null)if(d)To(i,!1);else{if(Tn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Se(e),f!==null){for(t.flags|=128,To(i,!1),e=f.updateQueue,t.updateQueue=e,Pu(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Ru(s,e),s=s.sibling;return de(ue,ue.current&1|2),ht&&Rl(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&De()>sd&&(t.flags|=128,d=!0,To(i,!1),t.lanes=4194304)}else{if(!d)if(e=Se(f),e!==null){if(t.flags|=128,d=!0,e=e.updateQueue,t.updateQueue=e,Pu(t,e),To(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ht)return on(t),null}else 2*De()-i.renderingStartTime>sd&&s!==536870912&&(t.flags|=128,d=!0,To(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=De(),e.sibling=null,s=ue.current,de(ue,d?s&1|2:s&1),ht&&Rl(t,i.treeForkCount),e):(on(t),null);case 22:case 23:return xs(t),Ha(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(on(t),t.subtreeFlags&6&&(t.flags|=8192)):on(t),s=t.updateQueue,s!==null&&Pu(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&Z(pl),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Ol(vn),on(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Hy(e,t){switch(ho(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ol(vn),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ze(t),null;case 31:if(t.memoizedState!==null){if(xs(t),t.alternate===null)throw Error(c(340));Ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Z(ue),null;case 4:return Ue(),null;case 10:return Ol(t.type),null;case 22:case 23:return xs(t),Ha(),e!==null&&Z(pl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ol(vn),null;case 25:return null;default:return null}}function rg(e,t){switch(ho(t),t.tag){case 3:Ol(vn),Ue();break;case 26:case 27:case 5:Ze(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&xs(t);break;case 13:xs(t);break;case 19:Z(ue);break;case 10:Ol(t.type);break;case 22:case 23:xs(t),Ha(),e!==null&&Z(pl);break;case 24:Ol(vn)}}function Co(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var d=i.next;s=d;do{if((s.tag&e)===e){i=void 0;var f=s.create,_=s.inst;i=f(),_.destroy=i}s=s.next}while(s!==d)}}catch(w){Gt(t,t.return,w)}}function bi(e,t,s){try{var i=t.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var f=d.next;i=f;do{if((i.tag&e)===e){var _=i.inst,w=_.destroy;if(w!==void 0){_.destroy=void 0,d=t;var M=s,W=w;try{W()}catch(oe){Gt(d,M,oe)}}}i=i.next}while(i!==f)}}catch(oe){Gt(t,t.return,oe)}}function cg(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{re(t,s)}catch(i){Gt(e,e.return,i)}}}function og(e,t,s){s.props=gr(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Gt(e,t,i)}}function Ao(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(d){Gt(e,t,d)}}function aa(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(d){Gt(e,t,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(d){Gt(e,t,d)}else s.current=null}function ug(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(d){Gt(e,e.return,d)}}function eh(e,t,s){try{var i=e.stateNode;r0(i,e.type,s,t),i[at]=t}catch(d){Gt(e,e.return,d)}}function dg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ki(e.type)||e.tag===4}function th(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ki(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function nh(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Bt));else if(i!==4&&(i===27&&ki(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(nh(e,t,s),e=e.sibling;e!==null;)nh(e,t,s),e=e.sibling}function Wu(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(i!==4&&(i===27&&ki(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Wu(e,t,s),e=e.sibling;e!==null;)Wu(e,t,s),e=e.sibling}function fg(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,d=t.attributes;d.length;)t.removeAttributeNode(d[0]);is(t,i,s),t[Ft]=e,t[at]=s}catch(f){Gt(e,e.return,f)}}var $a=!1,Hn=!1,sh=!1,hg=typeof WeakSet=="function"?WeakSet:Set,Zn=null;function By(e,t){if(e=e.containerInfo,Nh=yd,e=ri(e),Sa(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var d=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{s.nodeType,f.nodeType}catch{s=null;break e}var _=0,w=-1,M=-1,W=0,oe=0,me=e,te=null;t:for(;;){for(var le;me!==s||d!==0&&me.nodeType!==3||(w=_+d),me!==f||i!==0&&me.nodeType!==3||(M=_+i),me.nodeType===3&&(_+=me.nodeValue.length),(le=me.firstChild)!==null;)te=me,me=le;for(;;){if(me===e)break t;if(te===s&&++W===d&&(w=_),te===f&&++oe===i&&(M=_),(le=me.nextSibling)!==null)break;me=te,te=me.parentNode}me=le}s=w===-1||M===-1?null:{start:w,end:M}}else s=null}s=s||{start:0,end:0}}else s=null;for(kh={focusedElem:e,selectionRange:s},yd=!1,Zn=t;Zn!==null;)if(t=Zn,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Zn=e;else for(;Zn!==null;){switch(t=Zn,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)d=e[s],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,s=t,d=f.memoizedProps,f=f.memoizedState,i=s.stateNode;try{var ze=gr(s.type,d);e=i.getSnapshotBeforeUpdate(ze,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(We){Gt(s,s.return,We)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Th(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Th(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=t.sibling,e!==null){e.return=t.return,Zn=e;break}Zn=t.return}}function pg(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Va(e,s),i&4&&Co(5,s);break;case 1:if(Va(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(_){Gt(s,s.return,_)}else{var d=gr(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(d,t,e.__reactInternalSnapshotBeforeUpdate)}catch(_){Gt(s,s.return,_)}}i&64&&cg(s),i&512&&Ao(s,s.return);break;case 3:if(Va(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{re(e,t)}catch(_){Gt(s,s.return,_)}}break;case 27:t===null&&i&4&&fg(s);case 26:case 5:Va(e,s),t===null&&i&4&&ug(s),i&512&&Ao(s,s.return);break;case 12:Va(e,s);break;case 31:Va(e,s),i&4&&xg(e,s);break;case 13:Va(e,s),i&4&&bg(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=Zy.bind(null,s),m0(e,s))));break;case 22:if(i=s.memoizedState!==null||$a,!i){t=t!==null&&t.memoizedState!==null||Hn,d=$a;var f=Hn;$a=i,(Hn=t)&&!f?Xa(e,s,(s.subtreeFlags&8772)!==0):Va(e,s),$a=d,Hn=f}break;case 30:break;default:Va(e,s)}}function mg(e){var t=e.alternate;t!==null&&(e.alternate=null,mg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&rl(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var gn=null,Hs=!1;function Ya(e,t,s){for(s=s.child;s!==null;)gg(e,t,s),s=s.sibling}function gg(e,t,s){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(ln,s)}catch{}switch(s.tag){case 26:Hn||aa(s,t),Ya(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Hn||aa(s,t);var i=gn,d=Hs;ki(s.type)&&(gn=s.stateNode,Hs=!1),Ya(e,t,s),Ho(s.stateNode),gn=i,Hs=d;break;case 5:Hn||aa(s,t);case 6:if(i=gn,d=Hs,gn=null,Ya(e,t,s),gn=i,Hs=d,gn!==null)if(Hs)try{(gn.nodeType===9?gn.body:gn.nodeName==="HTML"?gn.ownerDocument.body:gn).removeChild(s.stateNode)}catch(f){Gt(s,t,f)}else try{gn.removeChild(s.stateNode)}catch(f){Gt(s,t,f)}break;case 18:gn!==null&&(Hs?(e=gn,cx(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),kc(e)):cx(gn,s.stateNode));break;case 4:i=gn,d=Hs,gn=s.stateNode.containerInfo,Hs=!0,Ya(e,t,s),gn=i,Hs=d;break;case 0:case 11:case 14:case 15:bi(2,s,t),Hn||bi(4,s,t),Ya(e,t,s);break;case 1:Hn||(aa(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&og(s,t,i)),Ya(e,t,s);break;case 21:Ya(e,t,s);break;case 22:Hn=(i=Hn)||s.memoizedState!==null,Ya(e,t,s),Hn=i;break;default:Ya(e,t,s)}}function xg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{kc(e)}catch(s){Gt(t,t.return,s)}}}function bg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{kc(e)}catch(s){Gt(t,t.return,s)}}function qy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hg),t;default:throw Error(c(435,e.tag))}}function ed(e,t){var s=qy(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var d=Fy.bind(null,e,i);i.then(d,d)}})}function Bs(e,t){var s=t.deletions;if(s!==null)for(var i=0;i<s.length;i++){var d=s[i],f=e,_=t,w=_;e:for(;w!==null;){switch(w.tag){case 27:if(ki(w.type)){gn=w.stateNode,Hs=!1;break e}break;case 5:gn=w.stateNode,Hs=!1;break e;case 3:case 4:gn=w.stateNode.containerInfo,Hs=!0;break e}w=w.return}if(gn===null)throw Error(c(160));gg(f,_,d),gn=null,Hs=!1,f=d.alternate,f!==null&&(f.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_g(t,e),t=t.sibling}var Il=null;function _g(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Bs(t,e),qs(e),i&4&&(bi(3,e,e.return),Co(3,e),bi(5,e,e.return));break;case 1:Bs(t,e),qs(e),i&512&&(Hn||s===null||aa(s,s.return)),i&64&&$a&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?i:s.concat(i))));break;case 26:var d=Il;if(Bs(t,e),qs(e),i&512&&(Hn||s===null||aa(s,s.return)),i&4){var f=s!==null?s.memoizedState:null;if(i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null){e:{i=e.type,s=e.memoizedProps,d=d.ownerDocument||d;t:switch(i){case"title":f=d.getElementsByTagName("title")[0],(!f||f[Dt]||f[Ft]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=d.createElement(i),d.head.insertBefore(f,d.querySelector("head > title"))),is(f,i,s),f[Ft]=e,xt(f),i=f;break e;case"link":var _=_x("link","href",d).get(i+(s.href||""));if(_){for(var w=0;w<_.length;w++)if(f=_[w],f.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&f.getAttribute("rel")===(s.rel==null?null:s.rel)&&f.getAttribute("title")===(s.title==null?null:s.title)&&f.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){_.splice(w,1);break t}}f=d.createElement(i),is(f,i,s),d.head.appendChild(f);break;case"meta":if(_=_x("meta","content",d).get(i+(s.content||""))){for(w=0;w<_.length;w++)if(f=_[w],f.getAttribute("content")===(s.content==null?null:""+s.content)&&f.getAttribute("name")===(s.name==null?null:s.name)&&f.getAttribute("property")===(s.property==null?null:s.property)&&f.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&f.getAttribute("charset")===(s.charSet==null?null:s.charSet)){_.splice(w,1);break t}}f=d.createElement(i),is(f,i,s),d.head.appendChild(f);break;default:throw Error(c(468,i))}f[Ft]=e,xt(f),i=f}e.stateNode=i}else yx(d,e.type,e.stateNode);else e.stateNode=bx(d,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?yx(d,e.type,e.stateNode):bx(d,i,e.memoizedProps)):i===null&&e.stateNode!==null&&eh(e,e.memoizedProps,s.memoizedProps)}break;case 27:Bs(t,e),qs(e),i&512&&(Hn||s===null||aa(s,s.return)),s!==null&&i&4&&eh(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Bs(t,e),qs(e),i&512&&(Hn||s===null||aa(s,s.return)),e.flags&32){d=e.stateNode;try{J(d,"")}catch(ze){Gt(e,e.return,ze)}}i&4&&e.stateNode!=null&&(d=e.memoizedProps,eh(e,d,s!==null?s.memoizedProps:d)),i&1024&&(sh=!0);break;case 6:if(Bs(t,e),qs(e),i&4){if(e.stateNode===null)throw Error(c(162));i=e.memoizedProps,s=e.stateNode;try{s.nodeValue=i}catch(ze){Gt(e,e.return,ze)}}break;case 3:if(gd=null,d=Il,Il=pd(t.containerInfo),Bs(t,e),Il=d,qs(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{kc(t.containerInfo)}catch(ze){Gt(e,e.return,ze)}sh&&(sh=!1,yg(e));break;case 4:i=Il,Il=pd(e.stateNode.containerInfo),Bs(t,e),qs(e),Il=i;break;case 12:Bs(t,e),qs(e);break;case 31:Bs(t,e),qs(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ed(e,i)));break;case 13:Bs(t,e),qs(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(nd=De()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ed(e,i)));break;case 22:d=e.memoizedState!==null;var M=s!==null&&s.memoizedState!==null,W=$a,oe=Hn;if($a=W||d,Hn=oe||M,Bs(t,e),Hn=oe,$a=W,qs(e),i&8192)e:for(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,d&&(s===null||M||$a||Hn||xr(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){M=s=t;try{if(f=M.stateNode,d)_=f.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=M.stateNode;var me=M.memoizedProps.style,te=me!=null&&me.hasOwnProperty("display")?me.display:null;w.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(ze){Gt(M,M.return,ze)}}}else if(t.tag===6){if(s===null){M=t;try{M.stateNode.nodeValue=d?"":M.memoizedProps}catch(ze){Gt(M,M.return,ze)}}}else if(t.tag===18){if(s===null){M=t;try{var le=M.stateNode;d?ox(le,!0):ox(M.stateNode,!1)}catch(ze){Gt(M,M.return,ze)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(s=i.retryQueue,s!==null&&(i.retryQueue=null,ed(e,s))));break;case 19:Bs(t,e),qs(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ed(e,i)));break;case 30:break;case 21:break;default:Bs(t,e),qs(e)}}function qs(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(dg(i)){s=i;break}i=i.return}if(s==null)throw Error(c(160));switch(s.tag){case 27:var d=s.stateNode,f=th(e);Wu(e,f,d);break;case 5:var _=s.stateNode;s.flags&32&&(J(_,""),s.flags&=-33);var w=th(e);Wu(e,w,_);break;case 3:case 4:var M=s.stateNode.containerInfo,W=th(e);nh(e,W,M);break;default:throw Error(c(161))}}catch(oe){Gt(e,e.return,oe)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yg(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Va(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pg(e,t.alternate,t),t=t.sibling}function xr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bi(4,t,t.return),xr(t);break;case 1:aa(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&og(t,t.return,s),xr(t);break;case 27:Ho(t.stateNode);case 26:case 5:aa(t,t.return),xr(t);break;case 22:t.memoizedState===null&&xr(t);break;case 30:xr(t);break;default:xr(t)}e=e.sibling}}function Xa(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,d=e,f=t,_=f.flags;switch(f.tag){case 0:case 11:case 15:Xa(d,f,s),Co(4,f);break;case 1:if(Xa(d,f,s),i=f,d=i.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){Gt(i,i.return,W)}if(i=f,d=i.updateQueue,d!==null){var w=i.stateNode;try{var M=d.shared.hiddenCallbacks;if(M!==null)for(d.shared.hiddenCallbacks=null,d=0;d<M.length;d++)H(M[d],w)}catch(W){Gt(i,i.return,W)}}s&&_&64&&cg(f),Ao(f,f.return);break;case 27:fg(f);case 26:case 5:Xa(d,f,s),s&&i===null&&_&4&&ug(f),Ao(f,f.return);break;case 12:Xa(d,f,s);break;case 31:Xa(d,f,s),s&&_&4&&xg(d,f);break;case 13:Xa(d,f,s),s&&_&4&&bg(d,f);break;case 22:f.memoizedState===null&&Xa(d,f,s),Ao(f,f.return);break;case 30:break;default:Xa(d,f,s)}t=t.sibling}}function lh(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&ea(s))}function ah(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e))}function Ul(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vg(e,t,s,i),t=t.sibling}function vg(e,t,s,i){var d=t.flags;switch(t.tag){case 0:case 11:case 15:Ul(e,t,s,i),d&2048&&Co(9,t);break;case 1:Ul(e,t,s,i);break;case 3:Ul(e,t,s,i),d&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e)));break;case 12:if(d&2048){Ul(e,t,s,i),e=t.stateNode;try{var f=t.memoizedProps,_=f.id,w=f.onPostCommit;typeof w=="function"&&w(_,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){Gt(t,t.return,M)}}else Ul(e,t,s,i);break;case 31:Ul(e,t,s,i);break;case 13:Ul(e,t,s,i);break;case 23:break;case 22:f=t.stateNode,_=t.alternate,t.memoizedState!==null?f._visibility&2?Ul(e,t,s,i):Ro(e,t):f._visibility&2?Ul(e,t,s,i):(f._visibility|=2,pc(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),d&2048&&lh(_,t);break;case 24:Ul(e,t,s,i),d&2048&&ah(t.alternate,t);break;default:Ul(e,t,s,i)}}function pc(e,t,s,i,d){for(d=d&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,_=t,w=s,M=i,W=_.flags;switch(_.tag){case 0:case 11:case 15:pc(f,_,w,M,d),Co(8,_);break;case 23:break;case 22:var oe=_.stateNode;_.memoizedState!==null?oe._visibility&2?pc(f,_,w,M,d):Ro(f,_):(oe._visibility|=2,pc(f,_,w,M,d)),d&&W&2048&&lh(_.alternate,_);break;case 24:pc(f,_,w,M,d),d&&W&2048&&ah(_.alternate,_);break;default:pc(f,_,w,M,d)}t=t.sibling}}function Ro(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,d=i.flags;switch(i.tag){case 22:Ro(s,i),d&2048&&lh(i.alternate,i);break;case 24:Ro(s,i),d&2048&&ah(i.alternate,i);break;default:Ro(s,i)}t=t.sibling}}var Mo=8192;function mc(e,t,s){if(e.subtreeFlags&Mo)for(e=e.child;e!==null;)jg(e,t,s),e=e.sibling}function jg(e,t,s){switch(e.tag){case 26:mc(e,t,s),e.flags&Mo&&e.memoizedState!==null&&E0(s,Il,e.memoizedState,e.memoizedProps);break;case 5:mc(e,t,s);break;case 3:case 4:var i=Il;Il=pd(e.stateNode.containerInfo),mc(e,t,s),Il=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Mo,Mo=16777216,mc(e,t,s),Mo=i):mc(e,t,s));break;default:mc(e,t,s)}}function wg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Do(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];Zn=i,kg(i,e)}wg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ng(e),e=e.sibling}function Ng(e){switch(e.tag){case 0:case 11:case 15:Do(e),e.flags&2048&&bi(9,e,e.return);break;case 3:Do(e);break;case 12:Do(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,td(e)):Do(e);break;default:Do(e)}}function td(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];Zn=i,kg(i,e)}wg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bi(8,t,t.return),td(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,td(t));break;default:td(t)}e=e.sibling}}function kg(e,t){for(;Zn!==null;){var s=Zn;switch(s.tag){case 0:case 11:case 15:bi(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ea(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,Zn=i;else e:for(s=e;Zn!==null;){i=Zn;var d=i.sibling,f=i.return;if(mg(i),i===s){Zn=null;break e}if(d!==null){d.return=f,Zn=d;break e}Zn=f}}}var Gy={getCacheForType:function(e){var t=Xn(vn),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return Xn(vn).controller.signal}},$y=typeof WeakMap=="function"?WeakMap:Map,Lt=0,sn=null,pt=null,bt=0,qt=0,nl=null,_i=!1,gc=!1,ih=!1,Qa=0,Tn=0,yi=0,br=0,rh=0,sl=0,xc=0,Oo=null,Gs=null,ch=!1,nd=0,Sg=0,sd=1/0,ld=null,vi=null,Qn=0,ji=null,bc=null,Ka=0,oh=0,uh=null,Eg=null,Lo=0,dh=null;function ll(){return(Lt&2)!==0&&bt!==0?bt&-bt:F.T!==null?xh():Wa()}function Tg(){if(sl===0)if((bt&536870912)===0||ht){var e=it;it<<=1,(it&3932160)===0&&(it=262144),sl=e}else sl=536870912;return e=gs.current,e!==null&&(e.flags|=32),sl}function $s(e,t,s){(e===sn&&(qt===2||qt===9)||e.cancelPendingCommit!==null)&&(_c(e,0),wi(e,bt,sl,!1)),Cn(e,s),((Lt&2)===0||e!==sn)&&(e===sn&&((Lt&2)===0&&(br|=s),Tn===4&&wi(e,bt,sl,!1)),ia(e))}function Cg(e,t,s){if((Lt&6)!==0)throw Error(c(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||fe(e,t),d=i?Xy(e,t):hh(e,t,!0),f=i;do{if(d===0){gc&&!i&&wi(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!Yy(s)){d=hh(e,t,!1),f=!1;continue}if(d===2){if(f=t,e.errorRecoveryDisabledLanes&f)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){t=_;e:{var w=e;d=Oo;var M=w.current.memoizedState.isDehydrated;if(M&&(_c(w,_).flags|=256),_=hh(w,_,!1),_!==2){if(ih&&!M){w.errorRecoveryDisabledLanes|=f,br|=f,d=4;break e}f=Gs,Gs=d,f!==null&&(Gs===null?Gs=f:Gs.push.apply(Gs,f))}d=_}if(f=!1,d!==2)continue}}if(d===1){_c(e,0),wi(e,t,0,!0);break}e:{switch(i=e,f=d,f){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:wi(i,t,sl,!_i);break e;case 2:Gs=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(d=nd+300-De(),10<d)){if(wi(i,t,sl,!_i),K(i,0,!0)!==0)break e;Ka=t,i.timeoutHandle=ix(Ag.bind(null,i,s,Gs,ld,ch,t,sl,br,xc,_i,f,"Throttled",-0,0),d);break e}Ag(i,s,Gs,ld,ch,t,sl,br,xc,_i,f,null,-0,0)}}break}while(!0);ia(e)}function Ag(e,t,s,i,d,f,_,w,M,W,oe,me,te,le){if(e.timeoutHandle=-1,me=t.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bt},jg(t,f,me);var ze=(f&62914560)===f?nd-De():(f&4194048)===f?Sg-De():0;if(ze=T0(me,ze),ze!==null){Ka=f,e.cancelPendingCommit=ze(Ug.bind(null,e,t,f,s,i,d,_,w,M,oe,me,null,te,le)),wi(e,f,_,!W);return}}Ug(e,t,f,s,i,d,_,w,M)}function Yy(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var d=s[i],f=d.getSnapshot;d=d.value;try{if(!zn(f(),d))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wi(e,t,s,i){t&=~rh,t&=~br,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var d=t;0<d;){var f=31-yt(d),_=1<<f;i[f]=-1,d&=~_}s!==0&&Vs(e,s,t)}function ad(){return(Lt&6)===0?(zo(0),!1):!0}function fh(){if(pt!==null){if(qt===0)var e=pt.return;else e=pt,Dl=Ra=null,Tf(e),za=null,gi=0,e=pt;for(;e!==null;)rg(e.alternate,e),e=e.return;pt=null}}function _c(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,u0(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Ka=0,fh(),sn=e,pt=s=dl(e.current,null),bt=t,qt=0,nl=null,_i=!1,gc=fe(e,t),ih=!1,xc=sl=rh=br=yi=Tn=0,Gs=Oo=null,ch=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var d=31-yt(i),f=1<<d;t|=e[d],i&=~f}return Qa=t,ui(),s}function Rg(e,t){Te=null,F.H=So,t===Da||t===na?(t=La(),qt=3):t===_o?(t=La(),qt=4):qt=t===Yf?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,nl=t,pt===null&&(Tn=1,Ku(e,Is(t,e.current)))}function Mg(){var e=gs.current;return e===null?!0:(bt&4194048)===bt?Rs===null:(bt&62914560)===bt||(bt&536870912)!==0?e===Rs:!1}function Dg(){var e=F.H;return F.H=So,e===null?So:e}function Og(){var e=F.A;return F.A=Gy,e}function id(){Tn=4,_i||(bt&4194048)!==bt&&gs.current!==null||(gc=!0),(yi&134217727)===0&&(br&134217727)===0||sn===null||wi(sn,bt,sl,!1)}function hh(e,t,s){var i=Lt;Lt|=2;var d=Dg(),f=Og();(sn!==e||bt!==t)&&(ld=null,_c(e,t)),t=!1;var _=Tn;e:do try{if(qt!==0&&pt!==null){var w=pt,M=nl;switch(qt){case 8:fh(),_=6;break e;case 3:case 2:case 9:case 6:gs.current===null&&(t=!0);var W=qt;if(qt=0,nl=null,yc(e,w,M,W),s&&gc){_=0;break e}break;default:W=qt,qt=0,nl=null,yc(e,w,M,W)}}Vy(),_=Tn;break}catch(oe){Rg(e,oe)}while(!0);return t&&e.shellSuspendCounter++,Dl=Ra=null,Lt=i,F.H=d,F.A=f,pt===null&&(sn=null,bt=0,ui()),_}function Vy(){for(;pt!==null;)Lg(pt)}function Xy(e,t){var s=Lt;Lt|=2;var i=Dg(),d=Og();sn!==e||bt!==t?(ld=null,sd=De()+500,_c(e,t)):gc=fe(e,t);e:do try{if(qt!==0&&pt!==null){t=pt;var f=nl;t:switch(qt){case 1:qt=0,nl=null,yc(e,t,f,1);break;case 2:case 9:if(Uu(f)){qt=0,nl=null,zg(t);break}t=function(){qt!==2&&qt!==9||sn!==e||(qt=7),ia(e)},f.then(t,t);break e;case 3:qt=7;break e;case 4:qt=5;break e;case 7:Uu(f)?(qt=0,nl=null,zg(t)):(qt=0,nl=null,yc(e,t,f,7));break;case 5:var _=null;switch(pt.tag){case 26:_=pt.memoizedState;case 5:case 27:var w=pt;if(_?vx(_):w.stateNode.complete){qt=0,nl=null;var M=w.sibling;if(M!==null)pt=M;else{var W=w.return;W!==null?(pt=W,rd(W)):pt=null}break t}}qt=0,nl=null,yc(e,t,f,5);break;case 6:qt=0,nl=null,yc(e,t,f,6);break;case 8:fh(),Tn=6;break e;default:throw Error(c(462))}}Qy();break}catch(oe){Rg(e,oe)}while(!0);return Dl=Ra=null,F.H=i,F.A=d,Lt=s,pt!==null?0:(sn=null,bt=0,ui(),Tn)}function Qy(){for(;pt!==null&&!Qe();)Lg(pt)}function Lg(e){var t=ag(e.alternate,e,Qa);e.memoizedProps=e.pendingProps,t===null?rd(e):pt=t}function zg(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Wm(s,t,t.pendingProps,t.type,void 0,bt);break;case 11:t=Wm(s,t,t.pendingProps,t.type.render,t.ref,bt);break;case 5:Tf(t);default:rg(s,t),t=pt=Ru(t,Qa),t=ag(s,t,Qa)}e.memoizedProps=e.pendingProps,t===null?rd(e):pt=t}function yc(e,t,s,i){Dl=Ra=null,Tf(t),za=null,gi=0;var d=t.return;try{if(Ly(e,d,t,s,bt)){Tn=1,Ku(e,Is(s,e.current)),pt=null;return}}catch(f){if(d!==null)throw pt=d,f;Tn=1,Ku(e,Is(s,e.current)),pt=null;return}t.flags&32768?(ht||i===1?e=!0:gc||(bt&536870912)!==0?e=!1:(_i=e=!0,(i===2||i===9||i===3||i===6)&&(i=gs.current,i!==null&&i.tag===13&&(i.flags|=16384))),Ig(t,e)):rd(t)}function rd(e){var t=e;do{if((t.flags&32768)!==0){Ig(t,_i);return}e=t.return;var s=Uy(t.alternate,t,Qa);if(s!==null){pt=s;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);Tn===0&&(Tn=5)}function Ig(e,t){do{var s=Hy(e.alternate,e);if(s!==null){s.flags&=32767,pt=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){pt=e;return}pt=e=s}while(e!==null);Tn=6,pt=null}function Ug(e,t,s,i,d,f,_,w,M){e.cancelPendingCommit=null;do cd();while(Qn!==0);if((Lt&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(f=t.lanes|t.childLanes,f|=co,il(e,s,f,_,w,M),e===sn&&(pt=sn=null,bt=0),bc=t,ji=e,Ka=s,oh=f,uh=d,Eg=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Jy(Kt,function(){return $g(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=F.T,F.T=null,d=$.p,$.p=2,_=Lt,Lt|=4;try{By(e,t,s)}finally{Lt=_,$.p=d,F.T=i}}Qn=1,Hg(),Bg(),qg()}}function Hg(){if(Qn===1){Qn=0;var e=ji,t=bc,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=F.T,F.T=null;var i=$.p;$.p=2;var d=Lt;Lt|=4;try{_g(t,e);var f=kh,_=ri(e.containerInfo),w=f.focusedElem,M=f.selectionRange;if(_!==w&&w&&w.ownerDocument&&Y(w.ownerDocument.documentElement,w)){if(M!==null&&Sa(w)){var W=M.start,oe=M.end;if(oe===void 0&&(oe=W),"selectionStart"in w)w.selectionStart=W,w.selectionEnd=Math.min(oe,w.value.length);else{var me=w.ownerDocument||document,te=me&&me.defaultView||window;if(te.getSelection){var le=te.getSelection(),ze=w.textContent.length,We=Math.min(M.start,ze),Xt=M.end===void 0?We:Math.min(M.end,ze);!le.extend&&We>Xt&&(_=Xt,Xt=We,We=_);var X=no(w,We),B=no(w,Xt);if(X&&B&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==B.node||le.focusOffset!==B.offset)){var P=me.createRange();P.setStart(X.node,X.offset),le.removeAllRanges(),We>Xt?(le.addRange(P),le.extend(B.node,B.offset)):(P.setEnd(B.node,B.offset),le.addRange(P))}}}}for(me=[],le=w;le=le.parentNode;)le.nodeType===1&&me.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<me.length;w++){var he=me[w];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}yd=!!Nh,kh=Nh=null}finally{Lt=d,$.p=i,F.T=s}}e.current=t,Qn=2}}function Bg(){if(Qn===2){Qn=0;var e=ji,t=bc,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=F.T,F.T=null;var i=$.p;$.p=2;var d=Lt;Lt|=4;try{pg(e,t.alternate,t)}finally{Lt=d,$.p=i,F.T=s}}Qn=3}}function qg(){if(Qn===4||Qn===3){Qn=0,ft();var e=ji,t=bc,s=Ka,i=Eg;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Qn=5:(Qn=0,bc=ji=null,Gg(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(vi=null),Qs(s),t=t.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(ln,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=F.T,d=$.p,$.p=2,F.T=null;try{for(var f=e.onRecoverableError,_=0;_<i.length;_++){var w=i[_];f(w.value,{componentStack:w.stack})}}finally{F.T=t,$.p=d}}(Ka&3)!==0&&cd(),ia(e),d=e.pendingLanes,(s&261930)!==0&&(d&42)!==0?e===dh?Lo++:(Lo=0,dh=e):Lo=0,zo(0)}}function Gg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ea(t)))}function cd(){return Hg(),Bg(),qg(),$g()}function $g(){if(Qn!==5)return!1;var e=ji,t=oh;oh=0;var s=Qs(Ka),i=F.T,d=$.p;try{$.p=32>s?32:s,F.T=null,s=uh,uh=null;var f=ji,_=Ka;if(Qn=0,bc=ji=null,Ka=0,(Lt&6)!==0)throw Error(c(331));var w=Lt;if(Lt|=4,Ng(f.current),vg(f,f.current,_,s),Lt=w,zo(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(ln,f)}catch{}return!0}finally{$.p=d,F.T=i,Gg(e,t)}}function Yg(e,t,s){t=Is(s,t),t=$f(e.stateNode,t,2),e=Cs(e,t,2),e!==null&&(Cn(e,2),ia(e))}function Gt(e,t,s){if(e.tag===3)Yg(e,e,s);else for(;t!==null;){if(t.tag===3){Yg(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(vi===null||!vi.has(i))){e=Is(s,e),s=Vm(2),i=Cs(t,s,2),i!==null&&(Xm(s,i,t,e),Cn(i,2),ia(i));break}}t=t.return}}function ph(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new $y;var d=new Set;i.set(t,d)}else d=i.get(t),d===void 0&&(d=new Set,i.set(t,d));d.has(s)||(ih=!0,d.add(s),e=Ky.bind(null,e,t,s),t.then(e,e))}function Ky(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,sn===e&&(bt&s)===s&&(Tn===4||Tn===3&&(bt&62914560)===bt&&300>De()-nd?(Lt&2)===0&&_c(e,0):rh|=s,xc===bt&&(xc=0)),ia(e)}function Vg(e,t){t===0&&(t=Ve()),e=ul(e,t),e!==null&&(Cn(e,t),ia(e))}function Zy(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Vg(e,s)}function Fy(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Vg(e,s)}function Jy(e,t){return $e(e,t)}var od=null,vc=null,mh=!1,ud=!1,gh=!1,Ni=0;function ia(e){e!==vc&&e.next===null&&(vc===null?od=vc=e:vc=vc.next=e),ud=!0,mh||(mh=!0,Wy())}function zo(e,t){if(!gh&&ud){gh=!0;do for(var s=!1,i=od;i!==null;){if(e!==0){var d=i.pendingLanes;if(d===0)var f=0;else{var _=i.suspendedLanes,w=i.pingedLanes;f=(1<<31-yt(42|e)+1)-1,f&=d&~(_&~w),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,Zg(i,f))}else f=bt,f=K(i,i===sn?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||fe(i,f)||(s=!0,Zg(i,f));i=i.next}while(s);gh=!1}}function Py(){Xg()}function Xg(){ud=mh=!1;var e=0;Ni!==0&&o0()&&(e=Ni);for(var t=De(),s=null,i=od;i!==null;){var d=i.next,f=Qg(i,t);f===0?(i.next=null,s===null?od=d:s.next=d,d===null&&(vc=s)):(s=i,(e!==0||(f&3)!==0)&&(ud=!0)),i=d}Qn!==0&&Qn!==5||zo(e),Ni!==0&&(Ni=0)}function Qg(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,d=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var _=31-yt(f),w=1<<_,M=d[_];M===-1?((w&s)===0||(w&i)!==0)&&(d[_]=ke(w,t)):M<=t&&(e.expiredLanes|=w),f&=~w}if(t=sn,s=bt,s=K(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(qt===2||qt===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Je(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||fe(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&Je(i),Qs(s)){case 2:case 8:s=Ht;break;case 32:s=Kt;break;case 268435456:s=ot;break;default:s=Kt}return i=Kg.bind(null,e),s=$e(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&Je(i),e.callbackPriority=2,e.callbackNode=null,2}function Kg(e,t){if(Qn!==0&&Qn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(cd()&&e.callbackNode!==s)return null;var i=bt;return i=K(e,e===sn?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Cg(e,i,t),Qg(e,De()),e.callbackNode!=null&&e.callbackNode===s?Kg.bind(null,e):null)}function Zg(e,t){if(cd())return null;Cg(e,t,!0)}function Wy(){d0(function(){(Lt&6)!==0?$e(Nt,Py):Xg()})}function xh(){if(Ni===0){var e=Ot;e===0&&(e=qe,qe<<=1,(qe&261888)===0&&(qe=256)),Ni=e}return Ni}function Fg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bn(""+e)}function Jg(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function e0(e,t,s,i,d){if(t==="submit"&&s&&s.stateNode===d){var f=Fg((d[at]||null).action),_=i.submitter;_&&(t=(t=_[at]||null)?Fg(t.formAction):_.getAttribute("formAction"),t!==null&&(f=t,_=null));var w=new ti("action","action",null,i,d);e.push({event:w,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ni!==0){var M=_?Jg(d,_):new FormData(d);If(s,{pending:!0,data:M,method:d.method,action:f},null,M)}}else typeof f=="function"&&(w.preventDefault(),M=_?Jg(d,_):new FormData(d),If(s,{pending:!0,data:M,method:d.method,action:f},f,M))},currentTarget:d}]})}}for(var bh=0;bh<ro.length;bh++){var _h=ro[bh],t0=_h.toLowerCase(),n0=_h[0].toUpperCase()+_h.slice(1);el(t0,"on"+n0)}el(ku,"onAnimationEnd"),el(Su,"onAnimationIteration"),el(Eu,"onAnimationStart"),el("dblclick","onDoubleClick"),el("focusin","onFocus"),el("focusout","onBlur"),el(xf,"onTransitionRun"),el(bf,"onTransitionStart"),el(_f,"onTransitionCancel"),el(Tu,"onTransitionEnd"),Pt("onMouseEnter",["mouseout","mouseover"]),Pt("onMouseLeave",["mouseout","mouseover"]),Pt("onPointerEnter",["pointerout","pointerover"]),Pt("onPointerLeave",["pointerout","pointerover"]),ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ts("onBeforeInput",["compositionend","keypress","textInput","paste"]),ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Io="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),s0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Io));function Pg(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],d=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var _=i.length-1;0<=_;_--){var w=i[_],M=w.instance,W=w.currentTarget;if(w=w.listener,M!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=W;try{f(d)}catch(oe){Pr(oe)}d.currentTarget=null,f=M}else for(_=0;_<i.length;_++){if(w=i[_],M=w.instance,W=w.currentTarget,w=w.listener,M!==f&&d.isPropagationStopped())break e;f=w,d.currentTarget=W;try{f(d)}catch(oe){Pr(oe)}d.currentTarget=null,f=M}}}}function mt(e,t){var s=t[Ks];s===void 0&&(s=t[Ks]=new Set);var i=e+"__bubble";s.has(i)||(Wg(t,e,2,!1),s.add(i))}function yh(e,t,s){var i=0;t&&(i|=4),Wg(s,e,i,t)}var dd="_reactListening"+Math.random().toString(36).slice(2);function vh(e){if(!e[dd]){e[dd]=!0,Kn.forEach(function(s){s!=="selectionchange"&&(s0.has(s)||yh(s,!1,e),yh(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[dd]||(t[dd]=!0,yh("selectionchange",!1,t))}}function Wg(e,t,s,i){switch(Tx(t)){case 2:var d=R0;break;case 8:d=M0;break;default:d=zh}s=d.bind(null,t,s,e),d=void 0,!Re||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(d=!0),i?d!==void 0?e.addEventListener(t,s,{capture:!0,passive:d}):e.addEventListener(t,s,!0):d!==void 0?e.addEventListener(t,s,{passive:d}):e.addEventListener(t,s,!1)}function jh(e,t,s,i,d){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var _=i.tag;if(_===3||_===4){var w=i.stateNode.containerInfo;if(w===d)break;if(_===4)for(_=i.return;_!==null;){var M=_.tag;if((M===3||M===4)&&_.stateNode.containerInfo===d)return;_=_.return}for(;w!==null;){if(_=rn(w),_===null)return;if(M=_.tag,M===5||M===6||M===26||M===27){i=f=_;continue e}w=w.parentNode}}i=i.return}Nl(function(){var W=f,oe=mn(s),me=[];e:{var te=io.get(e);if(te!==void 0){var le=ti,ze=e;switch(e){case"keypress":if(Yl(s)===0)break e;case"keydown":case"keyup":le=va;break;case"focusin":ze="focus",le=Ur;break;case"focusout":ze="blur",le=Ur;break;case"beforeblur":case"afterblur":le=Ur;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=mu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Ir;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=ja;break;case ku:case Su:case Eu:le=si;break;case Tu:le=xu;break;case"scroll":case"scrollend":le=pu;break;case"wheel":le=bu;break;case"copy":case"cut":case"paste":le=Br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Vr;break;case"toggle":case"beforetoggle":le=El}var We=(t&4)!==0,Xt=!We&&(e==="scroll"||e==="scrollend"),X=We?te!==null?te+"Capture":null:te;We=[];for(var B=W,P;B!==null;){var he=B;if(P=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||P===null||X===null||(he=k(B,X),he!=null&&We.push(Uo(B,he,P))),Xt)break;B=B.return}0<We.length&&(te=new le(te,ze,null,s,oe),me.push({event:te,listeners:We}))}}if((t&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",te&&s!==Sn&&(ze=s.relatedTarget||s.fromElement)&&(rn(ze)||ze[Nn]))break e;if((le||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,le?(ze=s.relatedTarget||s.toElement,le=W,ze=ze?rn(ze):null,ze!==null&&(Xt=u(ze),We=ze.tag,ze!==Xt||We!==5&&We!==27&&We!==6)&&(ze=null)):(le=null,ze=W),le!==ze)){if(We=mu,he="onMouseLeave",X="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(We=Vr,he="onPointerLeave",X="onPointerEnter",B="pointer"),Xt=le==null?te:Ct(le),P=ze==null?te:Ct(ze),te=new We(he,B+"leave",le,s,oe),te.target=Xt,te.relatedTarget=P,he=null,rn(oe)===W&&(We=new We(X,B+"enter",ze,s,oe),We.target=P,We.relatedTarget=Xt,he=We),Xt=he,le&&ze)t:{for(We=l0,X=le,B=ze,P=0,he=X;he;he=We(he))P++;he=0;for(var Xe=B;Xe;Xe=We(Xe))he++;for(;0<P-he;)X=We(X),P--;for(;0<he-P;)B=We(B),he--;for(;P--;){if(X===B||B!==null&&X===B.alternate){We=X;break t}X=We(X),B=We(B)}We=null}else We=null;le!==null&&ex(me,te,le,We,!1),ze!==null&&Xt!==null&&ex(me,Xt,ze,We,!0)}}e:{if(te=W?Ct(W):window,le=te.nodeName&&te.nodeName.toLowerCase(),le==="select"||le==="input"&&te.type==="file")var At=Fi;else if(eo(te))if(Ji)At=tr;else{At=er;var He=Wi}else le=te.nodeName,!le||le.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?W&&Le(W.elementType)&&(At=Fi):At=vu;if(At&&(At=At(e,W))){Rn(me,At,s,oe);break e}He&&He(e,te,W),e==="focusout"&&W&&te.type==="number"&&W.memoizedProps.value!=null&&Ls(te,"number",te.value)}switch(He=W?Ct(W):window,e){case"focusin":(eo(He)||He.contentEditable==="true")&&(Ea=He,so=W,Ss=null);break;case"focusout":Ss=so=Ea=null;break;case"mousedown":lo=!0;break;case"contextmenu":case"mouseup":case"dragend":lo=!1,Nu(me,s,oe);break;case"selectionchange":if(wu)break;case"keydown":case"keyup":Nu(me,s,oe)}var ut;if(wa)e:{switch(e){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else Tl?yu(e,s)&&(_t="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(_t="onCompositionStart");_t&&(cn&&s.locale!=="ko"&&(Tl||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&Tl&&(ut=Sl()):(yn=oe,kl="value"in yn?yn.value:yn.textContent,Tl=!0)),He=fd(W,_t),0<He.length&&(_t=new gu(_t,e,null,s,oe),me.push({event:_t,listeners:He}),ut?_t.data=ut:(ut=Fr(s),ut!==null&&(_t.data=ut)))),(ut=Qi?Ln(e,s):Ki(e,s))&&(_t=fd(W,"onBeforeInput"),0<_t.length&&(He=new gu("onBeforeInput","beforeinput",null,s,oe),me.push({event:He,listeners:_t}),He.data=ut)),e0(me,e,W,s,oe)}Pg(me,t)})}function Uo(e,t,s){return{instance:e,listener:t,currentTarget:s}}function fd(e,t){for(var s=t+"Capture",i=[];e!==null;){var d=e,f=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||f===null||(d=k(e,s),d!=null&&i.unshift(Uo(e,d,f)),d=k(e,t),d!=null&&i.push(Uo(e,d,f))),e.tag===3)return i;e=e.return}return[]}function l0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ex(e,t,s,i,d){for(var f=t._reactName,_=[];s!==null&&s!==i;){var w=s,M=w.alternate,W=w.stateNode;if(w=w.tag,M!==null&&M===i)break;w!==5&&w!==26&&w!==27||W===null||(M=W,d?(W=k(s,f),W!=null&&_.unshift(Uo(s,W,M))):d||(W=k(s,f),W!=null&&_.push(Uo(s,W,M)))),s=s.return}_.length!==0&&e.push({event:t,listeners:_})}var a0=/\r\n?/g,i0=/\u0000|\uFFFD/g;function tx(e){return(typeof e=="string"?e:""+e).replace(a0,`
50
+ `).replace(i0,"")}function nx(e,t){return t=tx(t),tx(e)===t}function Vt(e,t,s,i,d,f){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||J(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&J(e,""+i);break;case"className":hs(e,"class",i);break;case"tabIndex":hs(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":hs(e,s,i);break;case"style":Ye(e,i,f);break;case"data":if(t!=="object"){hs(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=bn(""+i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(s==="formAction"?(t!=="input"&&Vt(e,t,"name",d.name,d,null),Vt(e,t,"formEncType",d.formEncType,d,null),Vt(e,t,"formMethod",d.formMethod,d,null),Vt(e,t,"formTarget",d.formTarget,d,null)):(Vt(e,t,"encType",d.encType,d,null),Vt(e,t,"method",d.method,d,null),Vt(e,t,"target",d.target,d,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=bn(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=Bt);break;case"onScroll":i!=null&&mt("scroll",e);break;case"onScrollEnd":i!=null&&mt("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(s=i.__html,s!=null){if(d.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=bn(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""+i):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":mt("beforetoggle",e),mt("toggle",e),fs(e,"popover",i);break;case"xlinkActuate":Gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Gn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Gn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Gn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Gn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Gn(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":fs(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Yt.get(s)||s,fs(e,s,i))}}function wh(e,t,s,i,d,f){switch(s){case"style":Ye(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(s=i.__html,s!=null){if(d.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"children":typeof i=="string"?J(e,i):(typeof i=="number"||typeof i=="bigint")&&J(e,""+i);break;case"onScroll":i!=null&&mt("scroll",e);break;case"onScrollEnd":i!=null&&mt("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!es.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(d=s.endsWith("Capture"),t=s.slice(2,d?s.length-7:void 0),f=e[at]||null,f=f!=null?f[s]:null,typeof f=="function"&&e.removeEventListener(t,f,d),typeof i=="function")){typeof f!="function"&&f!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,i,d);break e}s in e?e[s]=i:i===!0?e.setAttribute(s,""):fs(e,s,i)}}}function is(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":mt("error",e),mt("load",e);var i=!1,d=!1,f;for(f in s)if(s.hasOwnProperty(f)){var _=s[f];if(_!=null)switch(f){case"src":i=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Vt(e,t,f,_,s,null)}}d&&Vt(e,t,"srcSet",s.srcSet,s,null),i&&Vt(e,t,"src",s.src,s,null);return;case"input":mt("invalid",e);var w=f=_=d=null,M=null,W=null;for(i in s)if(s.hasOwnProperty(i)){var oe=s[i];if(oe!=null)switch(i){case"name":d=oe;break;case"type":_=oe;break;case"checked":M=oe;break;case"defaultChecked":W=oe;break;case"value":f=oe;break;case"defaultValue":w=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(c(137,t));break;default:Vt(e,t,i,oe,s,null)}}ol(e,f,w,M,W,_,d,!1);return;case"select":mt("invalid",e),i=_=f=null;for(d in s)if(s.hasOwnProperty(d)&&(w=s[d],w!=null))switch(d){case"value":f=w;break;case"defaultValue":_=w;break;case"multiple":i=w;default:Vt(e,t,d,w,s,null)}t=f,s=_,e.multiple=!!i,t!=null?tn(e,!!i,t,!1):s!=null&&tn(e,!!i,s,!0);return;case"textarea":mt("invalid",e),f=d=i=null;for(_ in s)if(s.hasOwnProperty(_)&&(w=s[_],w!=null))switch(_){case"value":i=w;break;case"defaultValue":d=w;break;case"children":f=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(c(91));break;default:Vt(e,t,_,w,s,null)}C(e,i,d,f);return;case"option":for(M in s)if(s.hasOwnProperty(M)&&(i=s[M],i!=null))switch(M){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Vt(e,t,M,i,s,null)}return;case"dialog":mt("beforetoggle",e),mt("toggle",e),mt("cancel",e),mt("close",e);break;case"iframe":case"object":mt("load",e);break;case"video":case"audio":for(i=0;i<Io.length;i++)mt(Io[i],e);break;case"image":mt("error",e),mt("load",e);break;case"details":mt("toggle",e);break;case"embed":case"source":case"link":mt("error",e),mt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in s)if(s.hasOwnProperty(W)&&(i=s[W],i!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Vt(e,t,W,i,s,null)}return;default:if(Le(t)){for(oe in s)s.hasOwnProperty(oe)&&(i=s[oe],i!==void 0&&wh(e,t,oe,i,s,void 0));return}}for(w in s)s.hasOwnProperty(w)&&(i=s[w],i!=null&&Vt(e,t,w,i,s,null))}function r0(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,_=null,w=null,M=null,W=null,oe=null;for(le in s){var me=s[le];if(s.hasOwnProperty(le)&&me!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":M=me;default:i.hasOwnProperty(le)||Vt(e,t,le,null,i,me)}}for(var te in i){var le=i[te];if(me=s[te],i.hasOwnProperty(te)&&(le!=null||me!=null))switch(te){case"type":f=le;break;case"name":d=le;break;case"checked":W=le;break;case"defaultChecked":oe=le;break;case"value":_=le;break;case"defaultValue":w=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(c(137,t));break;default:le!==me&&Vt(e,t,te,le,i,me)}}wl(e,_,w,M,W,oe,f,d);return;case"select":le=_=w=te=null;for(f in s)if(M=s[f],s.hasOwnProperty(f)&&M!=null)switch(f){case"value":break;case"multiple":le=M;default:i.hasOwnProperty(f)||Vt(e,t,f,null,i,M)}for(d in i)if(f=i[d],M=s[d],i.hasOwnProperty(d)&&(f!=null||M!=null))switch(d){case"value":te=f;break;case"defaultValue":w=f;break;case"multiple":_=f;default:f!==M&&Vt(e,t,d,f,i,M)}t=w,s=_,i=le,te!=null?tn(e,!!s,te,!1):!!i!=!!s&&(t!=null?tn(e,!!s,t,!0):tn(e,!!s,s?[]:"",!1));return;case"textarea":le=te=null;for(w in s)if(d=s[w],s.hasOwnProperty(w)&&d!=null&&!i.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Vt(e,t,w,null,i,d)}for(_ in i)if(d=i[_],f=s[_],i.hasOwnProperty(_)&&(d!=null||f!=null))switch(_){case"value":te=d;break;case"defaultValue":le=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(c(91));break;default:d!==f&&Vt(e,t,_,d,i,f)}ye(e,te,le);return;case"option":for(var ze in s)if(te=s[ze],s.hasOwnProperty(ze)&&te!=null&&!i.hasOwnProperty(ze))switch(ze){case"selected":e.selected=!1;break;default:Vt(e,t,ze,null,i,te)}for(M in i)if(te=i[M],le=s[M],i.hasOwnProperty(M)&&te!==le&&(te!=null||le!=null))switch(M){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Vt(e,t,M,te,i,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var We in s)te=s[We],s.hasOwnProperty(We)&&te!=null&&!i.hasOwnProperty(We)&&Vt(e,t,We,null,i,te);for(W in i)if(te=i[W],le=s[W],i.hasOwnProperty(W)&&te!==le&&(te!=null||le!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(c(137,t));break;default:Vt(e,t,W,te,i,le)}return;default:if(Le(t)){for(var Xt in s)te=s[Xt],s.hasOwnProperty(Xt)&&te!==void 0&&!i.hasOwnProperty(Xt)&&wh(e,t,Xt,void 0,i,te);for(oe in i)te=i[oe],le=s[oe],!i.hasOwnProperty(oe)||te===le||te===void 0&&le===void 0||wh(e,t,oe,te,i,le);return}}for(var X in s)te=s[X],s.hasOwnProperty(X)&&te!=null&&!i.hasOwnProperty(X)&&Vt(e,t,X,null,i,te);for(me in i)te=i[me],le=s[me],!i.hasOwnProperty(me)||te===le||te==null&&le==null||Vt(e,t,me,te,i,le)}function sx(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var d=s[i],f=d.transferSize,_=d.initiatorType,w=d.duration;if(f&&w&&sx(_)){for(_=0,w=d.responseEnd,i+=1;i<s.length;i++){var M=s[i],W=M.startTime;if(W>w)break;var oe=M.transferSize,me=M.initiatorType;oe&&sx(me)&&(M=M.responseEnd,_+=oe*(M<w?1:(w-W)/(M-W)))}if(--i,t+=8*(f+_)/(d.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Nh=null,kh=null;function hd(e){return e.nodeType===9?e:e.ownerDocument}function lx(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ax(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Sh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Eh=null;function o0(){var e=window.event;return e&&e.type==="popstate"?e===Eh?!1:(Eh=e,!0):(Eh=null,!1)}var ix=typeof setTimeout=="function"?setTimeout:void 0,u0=typeof clearTimeout=="function"?clearTimeout:void 0,rx=typeof Promise=="function"?Promise:void 0,d0=typeof queueMicrotask=="function"?queueMicrotask:typeof rx<"u"?function(e){return rx.resolve(null).then(e).catch(f0)}:ix;function f0(e){setTimeout(function(){throw e})}function ki(e){return e==="head"}function cx(e,t){var s=t,i=0;do{var d=s.nextSibling;if(e.removeChild(s),d&&d.nodeType===8)if(s=d.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(d),kc(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")Ho(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Ho(s);for(var f=s.firstChild;f;){var _=f.nextSibling,w=f.nodeName;f[Dt]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=_}}else s==="body"&&Ho(e.ownerDocument.body);s=d}while(s);kc(t)}function ox(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function Th(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Th(s),rl(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function h0(e,t,s,i){for(;e.nodeType===1;){var d=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Dt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ml(e.nextSibling),e===null)break}return null}function p0(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ml(e.nextSibling),e===null))return null;return e}function ux(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ml(e.nextSibling),e===null))return null;return e}function Ch(e){return e.data==="$?"||e.data==="$~"}function Ah(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function m0(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ml(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Rh=null;function dx(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return ml(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function fx(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function hx(e,t,s){switch(t=hd(s),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function Ho(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rl(e)}var gl=new Map,px=new Set;function pd(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Za=$.d;$.d={f:g0,r:x0,D:b0,C:_0,L:y0,m:v0,X:w0,S:j0,M:N0};function g0(){var e=Za.f(),t=ad();return e||t}function x0(e){var t=Jt(e);t!==null&&t.tag===5&&t.type==="form"?Rm(t):Za.r(e)}var jc=typeof document>"u"?null:document;function mx(e,t,s){var i=jc;if(i&&typeof t=="string"&&t){var d=kn(t);d='link[rel="'+e+'"][href="'+d+'"]',typeof s=="string"&&(d+='[crossorigin="'+s+'"]'),px.has(d)||(px.add(d),e={rel:e,crossOrigin:s,href:t},i.querySelector(d)===null&&(t=i.createElement("link"),is(t,"link",e),xt(t),i.head.appendChild(t)))}}function b0(e){Za.D(e),mx("dns-prefetch",e,null)}function _0(e,t){Za.C(e,t),mx("preconnect",e,t)}function y0(e,t,s){Za.L(e,t,s);var i=jc;if(i&&e&&t){var d='link[rel="preload"][as="'+kn(t)+'"]';t==="image"&&s&&s.imageSrcSet?(d+='[imagesrcset="'+kn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(d+='[imagesizes="'+kn(s.imageSizes)+'"]')):d+='[href="'+kn(e)+'"]';var f=d;switch(t){case"style":f=wc(e);break;case"script":f=Nc(e)}gl.has(f)||(e=j({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),gl.set(f,e),i.querySelector(d)!==null||t==="style"&&i.querySelector(Bo(f))||t==="script"&&i.querySelector(qo(f))||(t=i.createElement("link"),is(t,"link",e),xt(t),i.head.appendChild(t)))}}function v0(e,t){Za.m(e,t);var s=jc;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",d='link[rel="modulepreload"][as="'+kn(i)+'"][href="'+kn(e)+'"]',f=d;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Nc(e)}if(!gl.has(f)&&(e=j({rel:"modulepreload",href:e},t),gl.set(f,e),s.querySelector(d)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(qo(f)))return}i=s.createElement("link"),is(i,"link",e),xt(i),s.head.appendChild(i)}}}function j0(e,t,s){Za.S(e,t,s);var i=jc;if(i&&e){var d=pn(i).hoistableStyles,f=wc(e);t=t||"default";var _=d.get(f);if(!_){var w={loading:0,preload:null};if(_=i.querySelector(Bo(f)))w.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},s),(s=gl.get(f))&&Mh(e,s);var M=_=i.createElement("link");xt(M),is(M,"link",e),M._p=new Promise(function(W,oe){M.onload=W,M.onerror=oe}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,md(_,t,i)}_={type:"stylesheet",instance:_,count:1,state:w},d.set(f,_)}}}function w0(e,t){Za.X(e,t);var s=jc;if(s&&e){var i=pn(s).hoistableScripts,d=Nc(e),f=i.get(d);f||(f=s.querySelector(qo(d)),f||(e=j({src:e,async:!0},t),(t=gl.get(d))&&Dh(e,t),f=s.createElement("script"),xt(f),is(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(d,f))}}function N0(e,t){Za.M(e,t);var s=jc;if(s&&e){var i=pn(s).hoistableScripts,d=Nc(e),f=i.get(d);f||(f=s.querySelector(qo(d)),f||(e=j({src:e,async:!0,type:"module"},t),(t=gl.get(d))&&Dh(e,t),f=s.createElement("script"),xt(f),is(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(d,f))}}function gx(e,t,s,i){var d=(d=Ie.current)?pd(d):null;if(!d)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=wc(s.href),s=pn(d).hoistableStyles,i=s.get(t),i||(i={type:"style",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=wc(s.href);var f=pn(d).hoistableStyles,_=f.get(e);if(_||(d=d.ownerDocument||d,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,_),(f=d.querySelector(Bo(e)))&&!f._p&&(_.instance=f,_.state.loading=5),gl.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},gl.set(e,s),f||k0(d,e,s,_.state))),t&&i===null)throw Error(c(528,""));return _}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Nc(s),s=pn(d).hoistableScripts,i=s.get(t),i||(i={type:"script",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function wc(e){return'href="'+kn(e)+'"'}function Bo(e){return'link[rel="stylesheet"]['+e+"]"}function xx(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function k0(e,t,s,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),is(t,"link",s),xt(t),e.head.appendChild(t))}function Nc(e){return'[src="'+kn(e)+'"]'}function qo(e){return"script[async]"+e}function bx(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+kn(s.href)+'"]');if(i)return t.instance=i,xt(i),i;var d=j({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),xt(i),is(i,"style",d),md(i,s.precedence,e),t.instance=i;case"stylesheet":d=wc(s.href);var f=e.querySelector(Bo(d));if(f)return t.state.loading|=4,t.instance=f,xt(f),f;i=xx(s),(d=gl.get(d))&&Mh(i,d),f=(e.ownerDocument||e).createElement("link"),xt(f);var _=f;return _._p=new Promise(function(w,M){_.onload=w,_.onerror=M}),is(f,"link",i),t.state.loading|=4,md(f,s.precedence,e),t.instance=f;case"script":return f=Nc(s.src),(d=e.querySelector(qo(f)))?(t.instance=d,xt(d),d):(i=s,(d=gl.get(f))&&(i=j({},s),Dh(i,d)),e=e.ownerDocument||e,d=e.createElement("script"),xt(d),is(d,"link",i),e.head.appendChild(d),t.instance=d);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,md(i,s.precedence,e));return t.instance}function md(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=i.length?i[i.length-1]:null,f=d,_=0;_<i.length;_++){var w=i[_];if(w.dataset.precedence===t)f=w;else if(f!==d)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Mh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Dh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var gd=null;function _x(e,t,s){if(gd===null){var i=new Map,d=gd=new Map;d.set(s,i)}else d=gd,i=d.get(s),i||(i=new Map,d.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),d=0;d<s.length;d++){var f=s[d];if(!(f[Dt]||f[Ft]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var _=f.getAttribute(t)||"";_=e+_;var w=i.get(_);w?w.push(f):i.set(_,[f])}}return i}function yx(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function S0(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function vx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function E0(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var d=wc(i.href),f=t.querySelector(Bo(d));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=xd.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,xt(f);return}f=t.ownerDocument||t,i=xx(i),(d=gl.get(d))&&Mh(i,d),f=f.createElement("link"),xt(f);var _=f;_._p=new Promise(function(w,M){_.onload=w,_.onerror=M}),is(f,"link",i),s.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=xd.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Oh=0;function T0(e,t){return e.stylesheets&&e.count===0&&_d(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&_d(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Oh===0&&(Oh=62500*c0());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_d(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Oh?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(d)}}:null}function xd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_d(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bd=null;function _d(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bd=new Map,t.forEach(C0,e),bd=null,xd.call(e))}function C0(e,t){if(!(t.state.loading&4)){var s=bd.get(e);if(s)var i=s.get(null);else{s=new Map,bd.set(e,s);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var _=d[f];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(s.set(_.dataset.precedence,_),i=_)}i&&s.set(null,i)}d=t.instance,_=d.getAttribute("data-precedence"),f=s.get(_)||i,f===i&&s.set(null,d),s.set(_,d),this.count++,i=xd.bind(this),d.addEventListener("load",i),d.addEventListener("error",i),f?f.parentNode.insertBefore(d,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),t.state.loading|=4}}var Go={$$typeof:Q,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function A0(e,t,s,i,d,f,_,w,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.hiddenUpdates=Mt(null),this.identifierPrefix=i,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function jx(e,t,s,i,d,f,_,w,M,W,oe,me){return e=new A0(e,t,s,_,M,W,oe,me,w),t=1,f===!0&&(t|=24),f=ps(3,null,null,t),e.current=f,f.stateNode=e,t=lc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},pr(f),e}function wx(e){return e?(e=Xl,e):Xl}function Nx(e,t,s,i,d,f){d=wx(d),i.context===null?i.context=d:i.pendingContext=d,i=la(t),i.payload={element:s},f=f===void 0?null:f,f!==null&&(i.callback=f),s=Cs(e,i,t),s!==null&&($s(s,e,t),Ua(s,e,t))}function kx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Lh(e,t){kx(e,t),(e=e.alternate)&&kx(e,t)}function Sx(e){if(e.tag===13||e.tag===31){var t=ul(e,67108864);t!==null&&$s(t,e,67108864),Lh(e,67108864)}}function Ex(e){if(e.tag===13||e.tag===31){var t=ll();t=Xs(t);var s=ul(e,t);s!==null&&$s(s,e,t),Lh(e,t)}}var yd=!0;function R0(e,t,s,i){var d=F.T;F.T=null;var f=$.p;try{$.p=2,zh(e,t,s,i)}finally{$.p=f,F.T=d}}function M0(e,t,s,i){var d=F.T;F.T=null;var f=$.p;try{$.p=8,zh(e,t,s,i)}finally{$.p=f,F.T=d}}function zh(e,t,s,i){if(yd){var d=Ih(i);if(d===null)jh(e,t,i,vd,s),Cx(e,i);else if(O0(d,e,t,s,i))i.stopPropagation();else if(Cx(e,i),t&4&&-1<D0.indexOf(e)){for(;d!==null;){var f=Jt(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var _=Zt(f.pendingLanes);if(_!==0){var w=f;for(w.pendingLanes|=2,w.entangledLanes|=2;_;){var M=1<<31-yt(_);w.entanglements[1]|=M,_&=~M}ia(f),(Lt&6)===0&&(sd=De()+500,zo(0))}}break;case 31:case 13:w=ul(f,2),w!==null&&$s(w,f,2),ad(),Lh(f,2)}if(f=Ih(i),f===null&&jh(e,t,i,vd,s),f===d)break;d=f}d!==null&&i.stopPropagation()}else jh(e,t,i,null,s)}}function Ih(e){return e=mn(e),Uh(e)}var vd=null;function Uh(e){if(vd=null,e=rn(e),e!==null){var t=u(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=p(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vd=e,null}function Tx(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(wt()){case Nt:return 2;case Ht:return 8;case Kt:case kt:return 32;case ot:return 268435456;default:return 32}default:return 32}}var Hh=!1,Si=null,Ei=null,Ti=null,$o=new Map,Yo=new Map,Ci=[],D0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Cx(e,t){switch(e){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":$o.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yo.delete(t.pointerId)}}function Vo(e,t,s,i,d,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:f,targetContainers:[d]},t!==null&&(t=Jt(t),t!==null&&Sx(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,d!==null&&t.indexOf(d)===-1&&t.push(d),e)}function O0(e,t,s,i,d){switch(t){case"focusin":return Si=Vo(Si,e,t,s,i,d),!0;case"dragenter":return Ei=Vo(Ei,e,t,s,i,d),!0;case"mouseover":return Ti=Vo(Ti,e,t,s,i,d),!0;case"pointerover":var f=d.pointerId;return $o.set(f,Vo($o.get(f)||null,e,t,s,i,d)),!0;case"gotpointercapture":return f=d.pointerId,Yo.set(f,Vo(Yo.get(f)||null,e,t,s,i,d)),!0}return!1}function Ax(e){var t=rn(e.target);if(t!==null){var s=u(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,us(e.priority,function(){Ex(s)});return}}else if(t===31){if(t=p(s),t!==null){e.blockedOn=t,us(e.priority,function(){Ex(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Ih(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);Sn=i,s.target.dispatchEvent(i),Sn=null}else return t=Jt(s),t!==null&&Sx(t),e.blockedOn=s,!1;t.shift()}return!0}function Rx(e,t,s){jd(e)&&s.delete(t)}function L0(){Hh=!1,Si!==null&&jd(Si)&&(Si=null),Ei!==null&&jd(Ei)&&(Ei=null),Ti!==null&&jd(Ti)&&(Ti=null),$o.forEach(Rx),Yo.forEach(Rx)}function wd(e,t){e.blockedOn===t&&(e.blockedOn=null,Hh||(Hh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,L0)))}var Nd=null;function Mx(e){Nd!==e&&(Nd=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Nd===e&&(Nd=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],d=e[t+2];if(typeof i!="function"){if(Uh(i||s)===null)continue;break}var f=Jt(s);f!==null&&(e.splice(t,3),t-=3,If(f,{pending:!0,data:d,method:s.method,action:i},i,d))}}))}function kc(e){function t(M){return wd(M,e)}Si!==null&&wd(Si,e),Ei!==null&&wd(Ei,e),Ti!==null&&wd(Ti,e),$o.forEach(t),Yo.forEach(t);for(var s=0;s<Ci.length;s++){var i=Ci[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Ci.length&&(s=Ci[0],s.blockedOn===null);)Ax(s),s.blockedOn===null&&Ci.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var d=s[i],f=s[i+1],_=d[at]||null;if(typeof f=="function")_||Mx(s);else if(_){var w=null;if(f&&f.hasAttribute("formAction")){if(d=f,_=f[at]||null)w=_.formAction;else if(Uh(d)!==null)continue}else w=_.action;typeof w=="function"?s[i+1]=w:(s.splice(i,3),i-=3),Mx(s)}}}function Dx(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(_){return d=_})},focusReset:"manual",scroll:"manual"})}function t(){d!==null&&(d(),d=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),d!==null&&(d(),d=null)}}}function Bh(e){this._internalRoot=e}kd.prototype.render=Bh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var s=t.current,i=ll();Nx(s,i,e,t,null,null)},kd.prototype.unmount=Bh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nx(e.current,2,null,e,null,null),ad(),t[Nn]=null}};function kd(e){this._internalRoot=e}kd.prototype.unstable_scheduleHydration=function(e){if(e){var t=Wa();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Ci.length&&t!==0&&t<Ci[s].priority;s++);Ci.splice(s,0,e),s===0&&Ax(e)}};var Ox=l.version;if(Ox!=="19.2.8")throw Error(c(527,Ox,"19.2.8"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=x(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var z0={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sd.isDisabled&&Sd.supportsFiber)try{ln=Sd.inject(z0),$t=Sd}catch{}}return Qo.createRoot=function(e,t){if(!o(e))throw Error(c(299));var s=!1,i="",d=qm,f=Gm,_=$m;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(d=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(_=t.onRecoverableError)),t=jx(e,1,!1,null,null,s,i,null,d,f,_,Dx),e[Nn]=t.current,vh(e),new Bh(t)},Qo.hydrateRoot=function(e,t,s){if(!o(e))throw Error(c(299));var i=!1,d="",f=qm,_=Gm,w=$m,M=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(_=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError),s.formState!==void 0&&(M=s.formState)),t=jx(e,1,!0,t,s??null,i,d,M,f,_,w,Dx),t.context=wx(null),s=t.current,i=ll(),i=Xs(i),d=la(i),d.callback=null,Cs(s,d,i),s=i,t.current.lanes=s,Cn(t,s),ia(t),e[Nn]=t.current,vh(e),new kd(t)},Qo.version="19.2.8",Qo}var Vx;function K0(){if(Vx)return Yh.exports;Vx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),Yh.exports=Q0(),Yh.exports}var Z0=K0();const m_=1;function F0(n){return`${n.replace(/[^\p{L}\p{N}\p{M}]/gu,"-").replace(/-+/g,"-").toLowerCase().replace(/^-|-$/g,"")||"project"}-${g_(n)}`}function J0(n){const l=n.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").toLowerCase(),r=`${l.replace(/^-+|-+$/g,"")||"project"}-${g_(n)}`,c=F0(n);return[l,r].filter(o=>o!==c)}function g_(n){const l=/^[a-zA-Z]:[\\/]|^\\\\/.test(n);return P0(l?n.toLowerCase():n)}function P0(n){let l=3735928559,r=1103547991;for(let c=0;c<n.length;c++){const o=n.charCodeAt(c);l=Math.imul(l^o,2654435761),r=Math.imul(r^o,1597334677)}return l=Math.imul(l^l>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(l^l>>>13,3266489909),(4294967296*(2097151&r)+(l>>>0)).toString(36)}var Pa,Hc,Bc,qc,Gc,du,$c,cf,x_;class W0{constructor(l){jn(this,cf);jn(this,Pa,null);jn(this,Hc,new Set);jn(this,Bc,500);jn(this,qc,null);jn(this,Gc,!1);jn(this,du,null);jn(this,$c,null);this.url=l}get statusText(){return this.connected?"Хост на связи":"Нет связи с хостом"}onStatus(l){zt(this,$c,l)}connect(){if(st(this,Gc))return;const l=new WebSocket(this.url);zt(this,Pa,l),l.addEventListener("open",()=>{var r,c;zt(this,Bc,500),this.send({type:"hello",protocol:m_,clientName:"ccv-web"}),(r=st(this,du))==null||r.call(this),(c=st(this,$c))==null||c.call(this)}),l.addEventListener("message",r=>{let c;try{c=JSON.parse(String(r.data))}catch{return}for(const o of st(this,Hc))o(c)}),l.addEventListener("close",()=>{var r;zt(this,Pa,null),(r=st(this,$c))==null||r.call(this),Bn(this,cf,x_).call(this)}),l.addEventListener("error",()=>l.close())}onReconnect(l){zt(this,du,l)}on(l){return st(this,Hc).add(l),()=>st(this,Hc).delete(l)}send(l){var r;((r=st(this,Pa))==null?void 0:r.readyState)===WebSocket.OPEN&&st(this,Pa).send(JSON.stringify(l))}get connected(){var l;return((l=st(this,Pa))==null?void 0:l.readyState)===WebSocket.OPEN}close(){var l;zt(this,Gc,!0),(l=st(this,Pa))==null||l.close()}}Pa=new WeakMap,Hc=new WeakMap,Bc=new WeakMap,qc=new WeakMap,Gc=new WeakMap,du=new WeakMap,$c=new WeakMap,cf=new WeakSet,x_=function(){if(st(this,Gc)||st(this,qc)!==null)return;const l=st(this,Bc);zt(this,Bc,Math.min(l*2,1e4)),zt(this,qc,window.setTimeout(()=>{zt(this,qc,null),this.connect()},l))};const ev=1,b_="ccv:relay",Kd="ccv:relay.host";function tv(){try{const n=localStorage.getItem(b_);if(!n)return null;const l=JSON.parse(n);return typeof(l==null?void 0:l.token)!="string"||typeof l.expiresAt=="number"&&l.expiresAt<=Date.now()?null:l}catch{return null}}function __(){localStorage.removeItem(b_)}var pa,Yc,ma,Vc,Xc,Hi,Nr,kr,Bi,Sr,Qc,Er,Tr,dn,Di,fp,y_,jr,hp;class nv{constructor(l){jn(this,dn);jn(this,pa,null);jn(this,Yc,new Set);jn(this,ma,null);jn(this,Vc,null);jn(this,Xc,500);jn(this,Hi,null);jn(this,Nr,!1);jn(this,kr,!1);jn(this,Bi,!1);jn(this,Sr,null);jn(this,Qc,"Подключаемся…");jn(this,Er,0);jn(this,Tr,[]);this.session=l}get connected(){return st(this,kr)&&st(this,Bi)}get statusText(){return st(this,Qc)}get hostId(){return st(this,Sr)}on(l){return st(this,Yc).add(l),()=>st(this,Yc).delete(l)}onReconnect(l){zt(this,Vc,l)}onStatus(l){zt(this,ma,l)}connect(){st(this,Nr)||Bn(this,dn,fp).call(this)}send(l){if(!st(this,kr)){st(this,Tr).length<64&&st(this,Tr).push(l);return}Bn(this,dn,jr).call(this,{t:"client.frame",body:l})}close(){var l;zt(this,Nr,!0),st(this,Hi)!==null&&window.clearTimeout(st(this,Hi)),(l=st(this,pa))==null||l.close()}}pa=new WeakMap,Yc=new WeakMap,ma=new WeakMap,Vc=new WeakMap,Xc=new WeakMap,Hi=new WeakMap,Nr=new WeakMap,kr=new WeakMap,Bi=new WeakMap,Sr=new WeakMap,Qc=new WeakMap,Er=new WeakMap,Tr=new WeakMap,dn=new WeakSet,Di=function(l){var r;st(this,Qc)!==l&&(zt(this,Qc,l),(r=st(this,ma))==null||r.call(this))},fp=async function(){if(st(this,pa))return;if(!st(this,Sr))try{zt(this,Sr,await sv(this.session.token))}catch(c){Bn(this,dn,Di).call(this,c instanceof Error?c.message:String(c)),Bn(this,dn,hp).call(this);return}const l=location.protocol==="https:"?"wss":"ws",r=new WebSocket(`${l}://${location.host}/relay/client`);zt(this,pa,r),r.addEventListener("open",()=>{Bn(this,dn,jr).call(this,{t:"client.hello",protocol:ev,token:this.session.token})}),r.addEventListener("message",c=>{let o;try{o=JSON.parse(String(c.data))}catch{return}Bn(this,dn,y_).call(this,o)}),r.addEventListener("close",()=>{var c;zt(this,pa,null),zt(this,kr,!1),zt(this,Bi,!1),Bn(this,dn,Di).call(this,"Нет связи с сервером"),(c=st(this,ma))==null||c.call(this),Bn(this,dn,hp).call(this)}),r.addEventListener("error",()=>r.close())},y_=function(l){var r,c,o,u,h,p,g;switch(l.t){case"client.ok":zt(this,Xc,500),Bn(this,dn,jr).call(this,{t:"client.attach",hostId:st(this,Sr)??"",...st(this,Er)>0?{sinceRseq:st(this,Er)}:{}});return;case"client.attached":zt(this,kr,!0),zt(this,Bi,l.online),zt(this,Er,l.rseq),Bn(this,dn,Di).call(this,l.online?"Хост на связи":"Компьютер не на связи"),Bn(this,dn,jr).call(this,{t:"client.frame",body:{type:"hello",protocol:m_,clientName:"ccv-web-relay"}});const x=st(this,Tr);zt(this,Tr,[]);for(const v of x)Bn(this,dn,jr).call(this,{t:"client.frame",body:v});(r=st(this,Vc))==null||r.call(this),(c=st(this,ma))==null||c.call(this);return;case"host.frame":{l.rseq>0&&zt(this,Er,l.rseq);const v=l.body;for(const j of st(this,Yc))j(v);return}case"host.online":zt(this,Bi,!0),Bn(this,dn,Di).call(this,"Хост на связи"),(o=st(this,Vc))==null||o.call(this),(u=st(this,ma))==null||u.call(this);return;case"host.offline":zt(this,Bi,!1),Bn(this,dn,Di).call(this,"Компьютер не на связи"),(h=st(this,ma))==null||h.call(this);return;case"ping":Bn(this,dn,jr).call(this,{t:"pong",nonce:l.nonce});return;case"error":if(l.code==="auth"){__(),location.href="/login";return}if(l.code==="not_found"){localStorage.removeItem(Kd),Bn(this,dn,Di).call(this,"Этот компьютер отвязан от аккаунта"),zt(this,Nr,!0),(p=st(this,pa))==null||p.close();return}l.code!=="offline"&&Bn(this,dn,Di).call(this,l.message),(g=st(this,ma))==null||g.call(this);return}},jr=function(l){var r;((r=st(this,pa))==null?void 0:r.readyState)===WebSocket.OPEN&&st(this,pa).send(JSON.stringify(l))},hp=function(){if(st(this,Nr)||st(this,Hi)!==null)return;const l=st(this,Xc);zt(this,Xc,Math.min(l*2,1e4)),zt(this,Hi,window.setTimeout(()=>{zt(this,Hi,null),Bn(this,dn,fp).call(this)},l))};async function sv(n){const l=new URLSearchParams(location.search).get("host");if(l)return localStorage.setItem(Kd,l),l;const r=localStorage.getItem(Kd);if(r)return r;const c=await fetch("/api/hosts",{headers:{authorization:`Bearer ${n}`}});if(c.status===401)throw __(),location.href="/login",new Error("нужен вход");const u=(await c.json()).hosts??[];if(u.length===1&&u[0])return localStorage.setItem(Kd,u[0].id),u[0].id;throw location.href="/hosts",new Error("выберите компьютер")}function Zd(){return location.pathname==="/app"||location.pathname.startsWith("/app/")?"relay":"local"}const lv=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;function av(){if(Zd()==="local")return new W0(lv);const n=tv();return n?new nv(n):(location.replace(`/login?next=${encodeURIComponent(location.pathname+location.search)}`),null)}const v_="ccv:drafts",iv=40,rv=2e4,cv=500;let lu=null,au=null;function Ap(){if(lu)return lu;const n=new Map;try{const l=localStorage.getItem(v_);if(l){const r=JSON.parse(l);if(typeof r=="object"&&r!==null)for(const[c,o]of Object.entries(r))typeof o=="string"&&o!==""&&n.set(c,o)}}catch{}return lu=n,window.addEventListener("pagehide",w_),n}function Kh(n){return Ap().get(n)??""}function pp(n,l){const r=Ap(),c=l.slice(0,rv),o=r.has(n);if(o&&r.delete(n),c!=="")r.set(n,c);else if(!o)return;for(;r.size>iv;){const u=r.keys().next();if(u.done)break;r.delete(u.value)}dv(),uv()}function j_(){const n=new Set;for(const l of Ap().keys())n.add(l.startsWith("side:")?l.slice(5):l);return[...n].sort()}const mp=new Set;let Xx="";function ov(n){return mp.add(n),()=>mp.delete(n)}function uv(){const n=j_(),l=n.join(`
51
+ `);if(l!==Xx){Xx=l;for(const r of mp)r(n)}}function dv(){au===null&&(au=window.setTimeout(w_,cv))}function w_(){if(au!==null&&window.clearTimeout(au),au=null,!!lu)try{localStorage.setItem(v_,JSON.stringify(Object.fromEntries(lu)))}catch{}}const Jn={items:[],pending:[],lastSeq:0,contextTokens:null},qi={entries:[],total:0,loading:!1};function Rp(n){var l;return((l=n.entries[0])==null?void 0:l.seq)??1}function gp(n){return n.total>0&&Rp(n)>1}function N_(n,l){const r=new Set(n.entries.map(o=>o.seq));return{entries:[...n.entries,...l.entries.filter(o=>!r.has(o.seq))].sort((o,u)=>o.seq-u.seq),total:l.total,loading:!1}}function Mp(n){return iu(Jn,n).items.map(l=>({...l,id:`h:${l.id}`}))}function iu(n,l){let r=n;for(const c of l)c.seq<=r.lastSeq||(r={...fv(r,c.event,c.seq),lastSeq:c.seq});return r}function fv(n,l,r){var o,u;const c=n.items;switch(l.kind){case"user.message":return ra(n,{id:`u${r}`,kind:"user",text:l.text,images:l.images});case"assistant.delta":{const h=c.findIndex(g=>g.id===l.blockId);if(h===-1)return ra(n,{id:l.blockId,kind:"assistant",text:l.text,streaming:!0});const p=c[h];return Sc(n,h,{...p,text:p.text+l.text})}case"assistant.text":{const h=c.findIndex(g=>g.id===l.blockId),p={id:l.blockId,kind:"assistant",text:l.text,streaming:!1};return h===-1?ra(n,p):Sc(n,h,p)}case"thinking.delta":{const h=c.findIndex(g=>g.id===l.blockId);if(h===-1)return ra(n,{id:l.blockId,kind:"thinking",text:l.text});const p=c[h];return Sc(n,h,{...p,text:p.text+l.text})}case"assistant.thinking":{const h=c.findIndex(g=>g.id===l.blockId),p={id:l.blockId,kind:"thinking",text:l.text};return h===-1?ra(n,p):Sc(n,h,p)}case"tool.use":return ra(n,{id:`t${l.toolUseId}`,kind:"tool",toolUseId:l.toolUseId,name:l.name,input:l.input,result:null,isError:!1,awaitingPermission:!1});case"tool.result":{const h=c.findIndex(g=>g.kind==="tool"&&g.toolUseId===l.toolUseId);if(h===-1)return n;const p=c[h];return Sc(n,h,{...p,result:l.content,isError:l.isError,awaitingPermission:!1})}case"permission.request":return{...n,pending:[...n.pending,{requestId:l.requestId,toolName:l.toolName,input:l.input,...l.reason?{reason:l.reason}:{},...l.questions?{questions:l.questions}:{},...l.toolUseId?{toolUseId:l.toolUseId}:{}}]};case"permission.resolved":{const h=n.pending.find(g=>g.requestId===l.requestId),p=n.pending.filter(g=>g.requestId!==l.requestId);if(l.answers&&(h!=null&&h.toolUseId)){const g=c.findIndex(x=>x.kind==="tool"&&x.toolUseId===h.toolUseId);if(g!==-1){const x=c[g];return Sc({...n,pending:p},g,{...x,answers:l.answers})}}return l.decision==="allow"?{...n,pending:p}:ra({...n,pending:p},{id:`p${r}`,kind:"notice",tone:"info",text:`Отклонено${l.reason?`: ${l.reason}`:""}`})}case"result":{const h=n.items.map(g=>g.kind==="assistant"&&g.streaming?{...g,streaming:!1}:g),p=l.contextTokens??n.contextTokens;return ra({...n,items:h,contextTokens:p},{id:`r${r}`,kind:"result",subtype:l.subtype,isError:l.isError,durationMs:l.durationMs,costUsd:l.costUsd,inputTokens:((o=l.usage)==null?void 0:o.inputTokens)??0,outputTokens:((u=l.usage)==null?void 0:u.outputTokens)??0})}case"system":return l.subtype!=="compact_boundary"?n:ra(n,{id:`s${r}`,kind:"notice",tone:"info",text:"Контекст сжат"});case"error":return ra(n,{id:`e${r}`,kind:"notice",tone:"error",text:l.message});case"state":return n;case"rewound":return n;default:return n}}function k_(n,l){let r=0;for(let c=0;c<n.length;c++)if(n[c].event.kind==="user.message"){if(r===l)return n.slice(0,c);r++}return n}function S_(n,l,r){const c=l-r;if(c<=0)return[];let o=0;for(let u=0;u<n.length;u++)if(n[u].kind==="user"){if(o===c)return n.slice(0,u);o++}return n}function ra(n,l){return{...n,items:[...n.items,l]}}function Sc(n,l,r){const c=n.items.slice();return c[l]=r,{...n,items:c}}const xp="ccv:theme",Zh=["system","light","dark"];function hv(){const[n,l]=b.useState(pv);b.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{var p;const h=n==="dark"||n==="system"&&o.matches;document.documentElement.dataset.theme=h?"dark":"light",(p=document.querySelector('meta[name="theme-color"]'))==null||p.setAttribute("content",h?"#101115":"#f3f4f0")};return u(),o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[n]);const r=b.useCallback(o=>{try{localStorage.setItem(xp,o)}catch{}l(o)},[]),c=b.useCallback(()=>{l(o=>{const u=Zh[(Zh.indexOf(o)+1)%Zh.length];try{localStorage.setItem(xp,u)}catch{}return u})},[]);return[n,r,c]}function pv(){try{const n=localStorage.getItem(xp);if(n==="gpt")return"dark";if(n==="light"||n==="dark"||n==="system")return n}catch{}return"dark"}const E_=[{value:"default",hint:"спрашивать перед каждым действием"},{value:"acceptEdits",hint:"правки файлов без подтверждения"},{value:"plan",hint:"только чтение и план, без изменений"},{value:"auto",hint:"спрашивать только о рискованном — решает сам"},{value:"bypassPermissions",hint:"ничего не спрашивать"}],mv=[{value:"default",hint:"чтение свободно, изменения и выход из песочницы — с разрешения"},{value:"acceptEdits",hint:"работа внутри проекта, выход за границы — с разрешения"},{value:"plan",hint:"песочница только для чтения; изменения требуют разрешения"},{value:"bypassPermissions",hint:"полный доступ без подтверждений"}],gv=[{value:"default",hint:"рискованное agy отклоняет сам: спросить он не может"},{value:"acceptEdits",hint:"правки файлов без подтверждения, команды — нет"},{value:"plan",hint:"только план, без изменений"},{value:"bypassPermissions",hint:"разрешено всё, включая команды"}],Cr={sidebar:{side:"left",min:200,max:520,width:276,label:"сессий"},files:{side:"left",min:180,max:560,width:260,label:"файлов"},search:{side:"left",min:220,max:640,width:320,label:"поиска"},git:{side:"left",min:220,max:640,width:320,label:"истории"},ask:{side:"right",min:260,max:720,width:380,label:"вопроса"}},xv=320,T_="ccv:panes";function bv(n){return`--${n}-w`}function C_(n,l){const r=Cr[n];return Math.round(Math.min(r.max,Math.max(r.min,l)))}function _v(){const n={};for(const l of Object.keys(Cr))n[l]=Cr[l].width;try{const l=localStorage.getItem(T_);if(l){const r=JSON.parse(l);for(const c of Object.keys(Cr)){const o=r[c];typeof o=="number"&&Number.isFinite(o)&&(n[c]=C_(c,o))}}}catch{}return n}function yv(){const[n,l]=b.useState(_v),r=b.useCallback(h=>{try{localStorage.setItem(T_,JSON.stringify(h))}catch{}},[]),c=b.useCallback((h,p)=>{l(g=>{const x=C_(h,p);if(g[h]===x)return g;const v={...g,[h]:x};return r(v),v})},[r]),o=b.useCallback(h=>{l(p=>{const g={...p,[h]:Cr[h].width};return r(g),g})},[r]),u={};for(const h of Object.keys(Cr))u[bv(h)]=`${n[h]}px`;return{widths:n,style:u,setWidth:c,reset:o}}const Fh=260,A_=120,vv=200,Qx="ccv:terminal-h";function Kx(n,l){return Math.round(Math.min(l,Math.max(A_,n)))}function jv(){const[n,l]=b.useState(()=>{try{const u=localStorage.getItem(Qx);if(u){const h=Number(u);if(Number.isFinite(h))return Kx(h,1/0)}}catch{}return Fh}),r=b.useCallback(u=>{try{localStorage.setItem(Qx,String(u))}catch{}},[]),c=b.useCallback((u,h)=>{const p=Kx(u,h);l(g=>g===p?g:(r(p),p))},[r]),o=b.useCallback(()=>{l(Fh),r(Fh)},[r]);return{height:n,setHeight:c,reset:o}}function of(n){const[l,r]=b.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return b.useEffect(()=>{const c=window.matchMedia(n),o=()=>r(c.matches);return o(),c.addEventListener("change",o),()=>c.removeEventListener("change",o)},[n]),l}const wv=500,Nv=6;function R_({onLongPress:n,onClick:l,disabled:r=!1,thresholdMs:c=wv,moveCancelPx:o=Nv}){const u=b.useRef(null),[h,p]=b.useState(!1),g=b.useCallback(()=>{u.current&&window.clearTimeout(u.current.timer),u.current=null,p(!1)},[]),x=b.useCallback(E=>{if(r||E.button!==0)return;const A={timer:0,x:E.clientX,y:E.clientY,fired:!1};A.timer=window.setTimeout(()=>{A.fired=!0,p(!1),n()},c),u.current=A,p(!0)},[r,c,n]),v=b.useCallback(E=>{const A=u.current;!A||A.fired||Math.hypot(E.clientX-A.x,E.clientY-A.y)>o&&g()},[o,g]),j=b.useCallback(()=>{u.current&&!u.current.fired?g():p(!1)},[g]),y=b.useCallback(E=>{var A;if((A=u.current)!=null&&A.fired){u.current=null,E.preventDefault();return}if(!r){if(E.shiftKey){n();return}l()}},[r,l,n]),T=b.useCallback(E=>{E.preventDefault()},[]),N=b.useCallback(E=>{r||E.shiftKey&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),n())},[r,n]);return{holding:h,thresholdMs:c,handlers:{onPointerDown:x,onPointerMove:v,onPointerUp:j,onPointerCancel:j,onPointerLeave:j,onClick:y,onContextMenu:T,onKeyDown:N}}}const kv={height:0,offsetTop:0,offsetLeft:0};function Zx(){if(typeof window>"u")return kv;const n=window.visualViewport;return n?{height:n.height,offsetTop:n.offsetTop,offsetLeft:n.offsetLeft}:{height:window.innerHeight,offsetTop:0,offsetLeft:0}}function Sv(n){const[l,r]=b.useState(Zx);return b.useEffect(()=>{if(!n)return;const c=window.visualViewport,o=()=>{const u=Zx();r(h=>h.height===u.height&&h.offsetTop===u.offsetTop&&h.offsetLeft===u.offsetLeft?h:u)};return o(),c?(c.addEventListener("resize",o),c.addEventListener("scroll",o),()=>{c.removeEventListener("resize",o),c.removeEventListener("scroll",o)}):(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o))},[n]),l}function Dp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Dr=Dp();function M_(n){Dr=n}var wr={exec:()=>null};function Ec(n){let l=[];return r=>{let c=Math.max(0,Math.min(3,r-1)),o=l[c];return o||(o=n(c),l[c]=o),o}}function Et(n,l=""){let r=typeof n=="string"?n:n.source,c={replace:(o,u)=>{let h=typeof u=="string"?u:u.source;return h=h.replace(_s.caret,"$1"),r=r.replace(o,h),c},getRegex:()=>new RegExp(r,l)};return c}var Ev=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),_s={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Ec(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ec(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ec(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ec(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Ec(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Ec(n=>new RegExp(`^ {0,${n}}>`))},Tv=/^(?:[ \t]*(?:\n|$))+/,Cv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Av=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Op=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,D_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,O_=Et(D_).replace(/bull/g,Op).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Mv=Et(D_).replace(/bull/g,Op).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Lp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Dv=/^[^\n]+/,zp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ov=Et(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Lv=Et(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Op).getRegex(),uf="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ip=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zv=Et("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ip).replace("tag",uf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),L_=n=>Et(Lp).replace("hr",fu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",uf).getRegex(),Iv=L_(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Uv=L_(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Hv=Et(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Uv).getRegex(),Up={blockquote:Hv,code:Cv,def:Ov,fences:Av,heading:Rv,hr:fu,html:zv,lheading:O_,list:Lv,newline:Tv,paragraph:Iv,table:wr,text:Dv},Fx=Et("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",uf).getRegex(),Bv={...Up,lheading:Mv,table:Fx,paragraph:Et(Lp).replace("hr",fu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Fx).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",uf).getRegex()},qv={...Up,html:Et(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ip).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Et(Lp).replace("hr",fu).replace("heading",` *#{1,6} *[^
52
+ ]`).replace("lheading",O_).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Gv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$v=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,z_=/^( {2,}|\\)\n(?!\s*$)/,Yv=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Zc=/[\p{P}\p{S}]/u,df=/[\s\p{P}\p{S}]/u,Hp=/[^\s\p{P}\p{S}]/u,Vv=Et(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,df).getRegex(),I_=/(?!~)[\p{P}\p{S}]/u,Xv=/(?!~)[\s\p{P}\p{S}]/u,Qv=/(?:[^\s\p{P}\p{S}]|~)/u,Kv=Et(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ev?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),U_=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zv=Et(U_,"u").replace(/punct/g,Zc).getRegex(),Fv=Et(U_,"u").replace(/punct/g,I_).getRegex(),H_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Jv=Et(H_,"gu").replace(/notPunctSpace/g,Hp).replace(/punctSpace/g,df).replace(/punct/g,Zc).getRegex(),Pv=Et(H_,"gu").replace(/notPunctSpace/g,Qv).replace(/punctSpace/g,Xv).replace(/punct/g,I_).getRegex(),Wv=Et("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Hp).replace(/punctSpace/g,df).replace(/punct/g,Zc).getRegex(),ej=Et(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Zc).getRegex(),tj="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",nj=Et(tj,"gu").replace(/notPunctSpace/g,Hp).replace(/punctSpace/g,df).replace(/punct/g,Zc).getRegex(),sj=Et(/\\(punct)/,"gu").replace(/punct/g,Zc).getRegex(),lj=Et(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),aj=Et(Ip).replace("(?:-->|$)","-->").getRegex(),ij=Et("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",aj).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,rj=Et(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Pd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),B_=Et(/^!?\[(label)\]\[(ref)\]/).replace("label",Pd).replace("ref",zp).getRegex(),q_=Et(/^!?\[(ref)\](?:\[\])?/).replace("ref",zp).getRegex(),cj=Et("reflink|nolink(?!\\()","g").replace("reflink",B_).replace("nolink",q_).getRegex(),Jx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bp={_backpedal:wr,anyPunctuation:sj,autolink:lj,blockSkip:Kv,br:z_,code:$v,del:wr,delLDelim:wr,delRDelim:wr,emStrongLDelim:Zv,emStrongRDelimAst:Jv,emStrongRDelimUnd:Wv,escape:Gv,link:rj,nolink:q_,punctuation:Vv,reflink:B_,reflinkSearch:cj,tag:ij,text:Yv,url:wr},oj={...Bp,link:Et(/^!?\[(label)\]\((.*?)\)/).replace("label",Pd).getRegex(),reflink:Et(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pd).getRegex()},bp={...Bp,emStrongRDelimAst:Pv,emStrongLDelim:Fv,delLDelim:ej,delRDelim:nj,url:Et(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Et(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jx).getRegex()},uj={...bp,br:Et(z_).replace("{2,}","*").getRegex(),text:Et(bp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ed={normal:Up,gfm:Bv,pedantic:qv},Ko={normal:Bp,gfm:bp,breaks:uj,pedantic:oj},dj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Px=n=>dj[n];function da(n,l){if(l){if(_s.escapeTest.test(n))return n.replace(_s.escapeReplace,Px)}else if(_s.escapeTestNoEncode.test(n))return n.replace(_s.escapeReplaceNoEncode,Px);return n}function Wx(n){try{n=encodeURI(n).replace(_s.percentDecode,"%")}catch{return null}return n}function eb(n,l){var u;let r=n.replace(_s.findPipe,(h,p,g)=>{let x=!1,v=p;for(;--v>=0&&g[v]==="\\";)x=!x;return x?"|":" |"}),c=r.split(_s.splitPipe),o=0;if(c[0].trim()||c.shift(),c.length>0&&!((u=c.at(-1))!=null&&u.trim())&&c.pop(),l)if(c.length>l)c.splice(l);else for(;c.length<l;)c.push("");for(;o<c.length;o++)c[o]=c[o].trim().replace(_s.slashPipe,"|");return c}function Ri(n,l,r){let c=n.length;if(c===0)return"";let o=0;for(;o<c&&n.charAt(c-o-1)===l;)o++;return n.slice(0,c-o)}function tb(n){let l=n.split(`
53
+ `),r=l.length-1;for(;r>=0&&_s.blankLine.test(l[r]);)r--;return l.length-r<=2?n:l.slice(0,r+1).join(`
54
+ `)}function fj(n,l){if(n.indexOf(l[1])===-1)return-1;let r=0;for(let c=0;c<n.length;c++)if(n[c]==="\\")c++;else if(n[c]===l[0])r++;else if(n[c]===l[1]&&(r--,r<0))return c;return r>0?-2:-1}function hj(n,l=0){let r=l,c="";for(let o of n)if(o===" "){let u=4-r%4;c+=" ".repeat(u),r+=u}else c+=o,r++;return c}function nb(n,l,r,c,o){let u=l.href,h=l.title||null,p=n[1].replace(o.other.outputLinkReplace,"$1");c.state.inLink=!0;let g={type:n[0].charAt(0)==="!"?"image":"link",raw:r,href:u,title:h,text:p,tokens:c.inlineTokens(p)};return c.state.inLink=!1,g}function pj(n,l,r){let c=n.match(r.other.indentCodeCompensation);if(c===null)return l;let o=c[1];return l.split(`
55
+ `).map(u=>{let h=u.match(r.other.beginningSpace);if(h===null)return u;let[p]=h;return p.length>=o.length?u.slice(o.length):u}).join(`
56
+ `)}var Wd=class{constructor(n){Qt(this,"options");Qt(this,"rules");Qt(this,"lexer");this.options=n||Dr}space(n){let l=this.rules.block.newline.exec(n);if(l&&l[0].length>0)return{type:"space",raw:l[0]}}code(n){let l=this.rules.block.code.exec(n);if(l){let r=this.options.pedantic?l[0]:tb(l[0]),c=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:c}}}fences(n){let l=this.rules.block.fences.exec(n);if(l){let r=l[0],c=pj(r,l[3]||"",this.rules);return{type:"code",raw:r,lang:l[2]?l[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):l[2],text:c}}}heading(n){let l=this.rules.block.heading.exec(n);if(l){let r=l[2].trim();if(this.rules.other.endingHash.test(r)){let c=Ri(r,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceChar.test(c))&&(r=c.trim())}return{type:"heading",raw:Ri(l[0],`
57
+ `),depth:l[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(n){let l=this.rules.block.hr.exec(n);if(l)return{type:"hr",raw:Ri(l[0],`
58
+ `)}}blockquote(n){let l=this.rules.block.blockquote.exec(n);if(l){let r=Ri(l[0],`
59
+ `).split(`
60
+ `),c="",o="",u=[];for(;r.length>0;){let h=!1,p=[],g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))p.push(r[g]),h=!0;else if(!h)p.push(r[g]);else break;r=r.slice(g);let x=p.join(`
61
+ `),v=x.replace(this.rules.other.blockquoteSetextReplace,`
62
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
63
+ ${x}`:x,o=o?`${o}
64
+ ${v}`:v;let j=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,u,!0),this.lexer.state.top=j,r.length===0)break;let y=u.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let T=y,N=T.raw+`
65
+ `+r.join(`
66
+ `),E=this.blockquote(N);u[u.length-1]=E,c=c.substring(0,c.length-T.raw.length)+E.raw,o=o.substring(0,o.length-T.text.length)+E.text;break}else if((y==null?void 0:y.type)==="list"){let T=y,N=T.raw+`
67
+ `+r.join(`
68
+ `),E=this.list(N);u[u.length-1]=E,c=c.substring(0,c.length-y.raw.length)+E.raw,o=o.substring(0,o.length-T.raw.length)+E.raw,r=N.substring(u.at(-1).raw.length).split(`
69
+ `);continue}}return{type:"blockquote",raw:c,tokens:u,text:o}}}list(n){let l=this.rules.block.list.exec(n);if(l){let r=l[1].trim(),c=r.length>1,o={type:"list",raw:"",ordered:c,start:c?+r.slice(0,-1):"",loose:!1,items:[]};r=c?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=c?r:"[*+-]");let u=this.rules.other.listItemRegex(r),h=!1;for(;n;){let g=!1,x="",v="";if(!(l=u.exec(n))||this.rules.block.hr.test(n))break;x=l[0],n=n.substring(x.length);let j=hj(l[2].split(`
70
+ `,1)[0],l[1].length),y=n.split(`
71
+ `,1)[0],T=!j.trim(),N=0;if(this.options.pedantic?(N=2,v=j.trimStart()):T?N=l[1].length+1:(N=j.search(this.rules.other.nonSpaceChar),N=N>4?1:N,v=j.slice(N),N+=l[1].length),T&&this.rules.other.blankLine.test(y)&&(x+=y+`
72
+ `,n=n.substring(y.length+1),g=!0),!g){let E=this.rules.other.nextBulletRegex(N),A=this.rules.other.hrRegex(N),D=this.rules.other.fencesBeginRegex(N),q=this.rules.other.headingBeginRegex(N),Q=this.rules.other.htmlBeginRegex(N),z=this.rules.other.blockquoteBeginRegex(N);for(;n;){let U=n.split(`
73
+ `,1)[0],O;if(y=U,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),O=y):O=y.replace(this.rules.other.tabCharGlobal," "),D.test(y)||q.test(y)||Q.test(y)||z.test(y)||E.test(y)||A.test(y))break;if(O.search(this.rules.other.nonSpaceChar)>=N||!y.trim())v+=`
74
+ `+O.slice(N);else{if(T||j.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||D.test(j)||q.test(j)||A.test(j))break;v+=`
75
+ `+y}T=!y.trim(),x+=U+`
76
+ `,n=n.substring(U.length+1),j=O.slice(N)}}o.loose||(h?o.loose=!0:this.rules.other.doubleBlankLine.test(x)&&(h=!0)),o.items.push({type:"list_item",raw:x,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),o.raw+=x}let p=o.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let g of o.items){this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]);let x=g.tokens[0];if(g.task&&((x==null?void 0:x.type)==="text"||(x==null?void 0:x.type)==="paragraph")){g.text=g.text.replace(this.rules.other.listReplaceTask,""),x.raw=x.raw.replace(this.rules.other.listReplaceTask,""),x.text=x.text.replace(this.rules.other.listReplaceTask,"");for(let j=this.lexer.inlineQueue.length-1;j>=0;j--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[j].src)){this.lexer.inlineQueue[j].src=this.lexer.inlineQueue[j].src.replace(this.rules.other.listReplaceTask,"");break}let v=this.rules.other.listTaskCheckbox.exec(g.raw);if(v){let j={type:"checkbox",raw:v[0]+" ",checked:v[0]!=="[ ]"};g.checked=j.checked,o.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=j.raw+g.tokens[0].raw,g.tokens[0].text=j.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(j)):g.tokens.unshift({type:"paragraph",raw:j.raw,text:j.raw,tokens:[j]}):g.tokens.unshift(j)}}else g.task&&(g.task=!1);if(!o.loose){let v=g.tokens.filter(y=>y.type==="space"),j=v.length>0&&v.some(y=>this.rules.other.anyLine.test(y.raw));o.loose=j}}if(o.loose)for(let g of o.items){g.loose=!0;for(let x of g.tokens)x.type==="text"&&(x.type="paragraph")}return o}}html(n){let l=this.rules.block.html.exec(n);if(l){let r=tb(l[0]);return{type:"html",block:!0,raw:r,pre:l[1]==="pre"||l[1]==="script"||l[1]==="style",text:r}}}def(n){let l=this.rules.block.def.exec(n);if(l){let r=l[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),c=l[2]?l[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=l[3]?l[3].substring(1,l[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):l[3];return{type:"def",tag:r,raw:Ri(l[0],`
77
+ `),href:c,title:o}}}table(n){var h;let l=this.rules.block.table.exec(n);if(!l||!this.rules.other.tableDelimiter.test(l[2]))return;let r=eb(l[1]),c=l[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(h=l[3])!=null&&h.trim()?l[3].replace(this.rules.other.tableRowBlankLine,"").split(`
78
+ `):[],u={type:"table",raw:Ri(l[0],`
79
+ `),header:[],align:[],rows:[]};if(r.length===c.length){for(let p of c)this.rules.other.tableAlignRight.test(p)?u.align.push("right"):this.rules.other.tableAlignCenter.test(p)?u.align.push("center"):this.rules.other.tableAlignLeft.test(p)?u.align.push("left"):u.align.push(null);for(let p=0;p<r.length;p++)u.header.push({text:r[p],tokens:this.lexer.inline(r[p]),header:!0,align:u.align[p]});for(let p of o)u.rows.push(eb(p,u.header.length).map((g,x)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:u.align[x]})));return u}}lheading(n){let l=this.rules.block.lheading.exec(n);if(l){let r=l[1].trim();return{type:"heading",raw:Ri(l[0],`
80
+ `),depth:l[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(n){let l=this.rules.block.paragraph.exec(n);if(l){let r=l[1].charAt(l[1].length-1)===`
81
+ `?l[1].slice(0,-1):l[1];return{type:"paragraph",raw:l[0],text:r,tokens:this.lexer.inline(r)}}}text(n){let l=this.rules.block.text.exec(n);if(l)return{type:"text",raw:l[0],text:l[0],tokens:this.lexer.inline(l[0])}}escape(n){let l=this.rules.inline.escape.exec(n);if(l)return{type:"escape",raw:l[0],text:l[1]}}tag(n){let l=this.rules.inline.tag.exec(n);if(l)return!this.lexer.state.inLink&&this.rules.other.startATag.test(l[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(l[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(l[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(l[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:l[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:l[0]}}link(n){let l=this.rules.inline.link.exec(n);if(l){let r=l[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let u=Ri(r.slice(0,-1),"\\");if((r.length-u.length)%2===0)return}else{let u=fj(l[2],"()");if(u===-2)return;if(u>-1){let h=(l[0].indexOf("!")===0?5:4)+l[1].length+u;l[2]=l[2].substring(0,u),l[0]=l[0].substring(0,h).trim(),l[3]=""}}let c=l[2],o="";if(this.options.pedantic){let u=this.rules.other.pedanticHrefTitle.exec(c);u&&(c=u[1],o=u[3])}else o=l[3]?l[3].slice(1,-1):"";return c=c.trim(),this.rules.other.startAngleBracket.test(c)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?c=c.slice(1):c=c.slice(1,-1)),nb(l,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},l[0],this.lexer,this.rules)}}reflink(n,l){let r;if((r=this.rules.inline.reflink.exec(n))||(r=this.rules.inline.nolink.exec(n))){let c=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=l[c.toLowerCase()];if(!o){let u=r[0].charAt(0);return{type:"text",raw:u,text:u}}return nb(r,o,r[0],this.lexer,this.rules)}}emStrong(n,l,r=""){let c=this.rules.inline.emStrongLDelim.exec(n);if(!(!c||!c[1]&&!c[2]&&!c[3]&&!c[4]||c[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(c[1]||c[3])||!r||this.rules.inline.punctuation.exec(r))){let o=[...c[0]].length-1,u,h,p=o,g=0,x=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(x.lastIndex=0,l=l.slice(-1*n.length+o);(c=x.exec(l))!==null;){if(u=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!u)continue;if(h=[...u].length,c[3]||c[4]){p+=h;continue}else if((c[5]||c[6])&&o%3&&!((o+h)%3)){g+=h;continue}if(p-=h,p>0)continue;h=Math.min(h,h+p+g);let v=[...c[0]][0].length,j=n.slice(0,o+c.index+v+h);if(Math.min(o,h)%2){let T=j.slice(1,-1);return{type:"em",raw:j,text:T,tokens:this.lexer.inlineTokens(T)}}let y=j.slice(2,-2);return{type:"strong",raw:j,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(n){let l=this.rules.inline.code.exec(n);if(l){let r=l[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(r),o=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return c&&o&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:l[0],text:r}}}br(n){let l=this.rules.inline.br.exec(n);if(l)return{type:"br",raw:l[0]}}del(n,l,r=""){let c=this.rules.inline.delLDelim.exec(n);if(c&&(!c[1]||!r||this.rules.inline.punctuation.exec(r))){let o=[...c[0]].length-1,u,h,p=o,g=this.rules.inline.delRDelim;for(g.lastIndex=0,l=l.slice(-1*n.length+o);(c=g.exec(l))!==null;){if(u=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!u||(h=[...u].length,h!==o))continue;if(c[3]||c[4]){p+=h;continue}if(p-=h,p>0)continue;h=Math.min(h,h+p);let x=[...c[0]][0].length,v=n.slice(0,o+c.index+x+h),j=v.slice(o,-o);return{type:"del",raw:v,text:j,tokens:this.lexer.inlineTokens(j)}}}}autolink(n){let l=this.rules.inline.autolink.exec(n);if(l){let r,c;return l[2]==="@"?(r=l[1],c="mailto:"+r):(r=l[1],c=r),{type:"link",raw:l[0],text:r,href:c,tokens:[{type:"text",raw:r,text:r}]}}}url(n){var r;let l;if(l=this.rules.inline.url.exec(n)){let c,o;if(l[2]==="@")c=l[0],o="mailto:"+c;else{let u;do u=l[0],l[0]=((r=this.rules.inline._backpedal.exec(l[0]))==null?void 0:r[0])??"";while(u!==l[0]);c=l[0],l[1]==="www."?o="http://"+l[0]:o=l[0]}return{type:"link",raw:l[0],text:c,href:o,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(n){let l=this.rules.inline.text.exec(n);if(l){let r=this.lexer.state.inRawBlock;return{type:"text",raw:l[0],text:l[0],escaped:r}}}},Bl=class _p{constructor(l){Qt(this,"tokens");Qt(this,"options");Qt(this,"state");Qt(this,"inlineQueue");Qt(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=l||Dr,this.options.tokenizer=this.options.tokenizer||new Wd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:_s,block:Ed.normal,inline:Ko.normal};this.options.pedantic?(r.block=Ed.pedantic,r.inline=Ko.pedantic):this.options.gfm&&(r.block=Ed.gfm,this.options.breaks?r.inline=Ko.breaks:r.inline=Ko.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ed,inline:Ko}}static lex(l,r){return new _p(r).lex(l)}static lexInline(l,r){return new _p(r).inlineTokens(l)}lex(l){l=l.replace(_s.carriageReturn,`
82
+ `),this.blockTokens(l,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let c=this.inlineQueue[r];this.inlineTokens(c.src,c.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(l,r=[],c=!1){var u,h,p;this.tokenizer.lexer=this,this.options.pedantic&&(l=l.replace(_s.tabCharGlobal," ").replace(_s.spaceLine,""));let o=1/0;for(;l;){if(l.length<o)o=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}let g;if((h=(u=this.options.extensions)==null?void 0:u.block)!=null&&h.some(v=>(g=v.call({lexer:this},l,r))?(l=l.substring(g.raw.length),r.push(g),!0):!1))continue;if(g=this.tokenizer.space(l)){l=l.substring(g.raw.length);let v=r.at(-1);g.raw.length===1&&v!==void 0?v.raw+=`
83
+ `:r.push(g);continue}if(g=this.tokenizer.code(l)){l=l.substring(g.raw.length);let v=r.at(-1);(v==null?void 0:v.type)==="paragraph"||(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
84
+ `)?"":`
85
+ `)+g.raw,v.text+=`
86
+ `+g.text,this.inlineQueue.at(-1).src=v.text):r.push(g);continue}if(g=this.tokenizer.fences(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.heading(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.hr(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.blockquote(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.list(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.html(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.def(l)){l=l.substring(g.raw.length);let v=r.at(-1);(v==null?void 0:v.type)==="paragraph"||(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
87
+ `)?"":`
88
+ `)+g.raw,v.text+=`
89
+ `+g.raw,this.inlineQueue.at(-1).src=v.text):this.tokens.links[g.tag]||(this.tokens.links[g.tag]={href:g.href,title:g.title},r.push(g));continue}if(g=this.tokenizer.table(l)){l=l.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.lheading(l)){l=l.substring(g.raw.length),r.push(g);continue}let x=l;if((p=this.options.extensions)!=null&&p.startBlock){let v=1/0,j=l.slice(1),y;this.options.extensions.startBlock.forEach(T=>{y=T.call({lexer:this},j),typeof y=="number"&&y>=0&&(v=Math.min(v,y))}),v<1/0&&v>=0&&(x=l.substring(0,v+1))}if(this.state.top&&(g=this.tokenizer.paragraph(x))){let v=r.at(-1);c&&(v==null?void 0:v.type)==="paragraph"?(v.raw+=(v.raw.endsWith(`
90
+ `)?"":`
91
+ `)+g.raw,v.text+=`
92
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=v.text):r.push(g),c=x.length!==l.length,l=l.substring(g.raw.length);continue}if(g=this.tokenizer.text(l)){l=l.substring(g.raw.length);let v=r.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=(v.raw.endsWith(`
93
+ `)?"":`
94
+ `)+g.raw,v.text+=`
95
+ `+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=v.text):r.push(g);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return this.state.top=!0,r}inline(l,r=[]){return this.inlineQueue.push({src:l,tokens:r}),r}inlineTokens(l,r=[]){var p,g,x,v,j;this.tokenizer.lexer=this;let c=l;if(this.tokens.links){let y=Object.keys(this.tokens.links);y.length>0&&(c=c.replace(this.tokenizer.rules.inline.reflinkSearch,T=>y.includes(T.slice(T.lastIndexOf("[")+1,-1))?"["+"a".repeat(T.length-2)+"]":T))}c=c.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),c=c.replace(this.tokenizer.rules.inline.blockSkip,(y,T,N)=>{let E=N?N.length:0;return y.slice(0,E)+"["+"a".repeat(y.length-E-2)+"]"}),c=((g=(p=this.options.hooks)==null?void 0:p.emStrongMask)==null?void 0:g.call({lexer:this},c))??c;let o=!1,u="",h=1/0;for(;l;){if(l.length<h)h=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}o||(u=""),o=!1;let y;if((v=(x=this.options.extensions)==null?void 0:x.inline)!=null&&v.some(N=>(y=N.call({lexer:this},l,r))?(l=l.substring(y.raw.length),r.push(y),!0):!1))continue;if(y=this.tokenizer.escape(l)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.tag(l)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.link(l)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.reflink(l,this.tokens.links)){l=l.substring(y.raw.length);let N=r.at(-1);y.type==="text"&&(N==null?void 0:N.type)==="text"?(N.raw+=y.raw,N.text+=y.text):r.push(y);continue}if(y=this.tokenizer.emStrong(l,c,u)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.codespan(l)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.br(l)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.del(l,c,u)){l=l.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.autolink(l)){l=l.substring(y.raw.length),r.push(y);continue}if(!this.state.inLink&&(y=this.tokenizer.url(l))){l=l.substring(y.raw.length),r.push(y);continue}let T=l;if((j=this.options.extensions)!=null&&j.startInline){let N=1/0,E=l.slice(1),A;this.options.extensions.startInline.forEach(D=>{A=D.call({lexer:this},E),typeof A=="number"&&A>=0&&(N=Math.min(N,A))}),N<1/0&&N>=0&&(T=l.substring(0,N+1))}if(y=this.tokenizer.inlineText(T)){l=l.substring(y.raw.length),y.raw.slice(-1)!=="_"&&(u=y.raw.slice(-1)),o=!0;let N=r.at(-1);(N==null?void 0:N.type)==="text"?(N.raw+=y.raw,N.text+=y.text):r.push(y);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return r}infiniteLoopError(l){let r="Infinite loop on byte: "+l;if(this.options.silent)console.error(r);else throw new Error(r)}},ef=class{constructor(n){Qt(this,"options");Qt(this,"parser");this.options=n||Dr}space(n){return""}code({text:n,lang:l,escaped:r}){var u;let c=(u=(l||"").match(_s.notSpaceStart))==null?void 0:u[0],o=n.replace(_s.endingNewline,"")+`
96
+ `;return c?'<pre><code class="language-'+da(c)+'">'+(r?o:da(o,!0))+`</code></pre>
97
+ `:"<pre><code>"+(r?o:da(o,!0))+`</code></pre>
98
+ `}blockquote({tokens:n}){return`<blockquote>
99
+ ${this.parser.parse(n)}</blockquote>
100
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:l}){return`<h${l}>${this.parser.parseInline(n)}</h${l}>
101
+ `}hr(n){return`<hr>
102
+ `}list(n){let l=n.ordered,r=n.start,c="";for(let h=0;h<n.items.length;h++){let p=n.items[h];c+=this.listitem(p)}let o=l?"ol":"ul",u=l&&r!==1?' start="'+r+'"':"";return"<"+o+u+`>
103
+ `+c+"</"+o+`>
104
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
105
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
106
+ `}table(n){let l="",r="";for(let o=0;o<n.header.length;o++)r+=this.tablecell(n.header[o]);l+=this.tablerow({text:r});let c="";for(let o=0;o<n.rows.length;o++){let u=n.rows[o];r="";for(let h=0;h<u.length;h++)r+=this.tablecell(u[h]);c+=this.tablerow({text:r})}return c&&(c=`<tbody>${c}</tbody>`),`<table>
107
+ <thead>
108
+ `+l+`</thead>
109
+ `+c+`</table>
110
+ `}tablerow({text:n}){return`<tr>
111
+ ${n}</tr>
112
+ `}tablecell(n){let l=this.parser.parseInline(n.tokens),r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+l+`</${r}>
113
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${da(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:l,tokens:r}){let c=this.parser.parseInline(r),o=Wx(n);if(o===null)return c;n=o;let u='<a href="'+n+'"';return l&&(u+=' title="'+da(l)+'"'),u+=">"+c+"</a>",u}image({href:n,title:l,text:r,tokens:c}){c&&(r=this.parser.parseInline(c,this.parser.textRenderer));let o=Wx(n);if(o===null)return da(r);n=o;let u=`<img src="${n}" alt="${da(r)}"`;return l&&(u+=` title="${da(l)}"`),u+=">",u}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:da(n.text)}},qp=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},ql=class yp{constructor(l){Qt(this,"options");Qt(this,"renderer");Qt(this,"textRenderer");this.options=l||Dr,this.options.renderer=this.options.renderer||new ef,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qp}static parse(l,r){return new yp(r).parse(l)}static parseInline(l,r){return new yp(r).parseInline(l)}parse(l){var c,o;this.renderer.parser=this;let r="";for(let u=0;u<l.length;u++){let h=l[u];if((o=(c=this.options.extensions)==null?void 0:c.renderers)!=null&&o[h.type]){let g=h,x=this.options.extensions.renderers[g.type].call({parser:this},g);if(x!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(g.type)){r+=x||"";continue}}let p=h;switch(p.type){case"space":{r+=this.renderer.space(p);break}case"hr":{r+=this.renderer.hr(p);break}case"heading":{r+=this.renderer.heading(p);break}case"code":{r+=this.renderer.code(p);break}case"table":{r+=this.renderer.table(p);break}case"blockquote":{r+=this.renderer.blockquote(p);break}case"list":{r+=this.renderer.list(p);break}case"checkbox":{r+=this.renderer.checkbox(p);break}case"html":{r+=this.renderer.html(p);break}case"def":{r+=this.renderer.def(p);break}case"paragraph":{r+=this.renderer.paragraph(p);break}case"text":{r+=this.renderer.text(p);break}default:{let g='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}parseInline(l,r=this.renderer){var o,u;this.renderer.parser=this;let c="";for(let h=0;h<l.length;h++){let p=l[h];if((u=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&u[p.type]){let x=this.options.extensions.renderers[p.type].call({parser:this},p);if(x!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){c+=x||"";continue}}let g=p;switch(g.type){case"escape":{c+=r.text(g);break}case"html":{c+=r.html(g);break}case"link":{c+=r.link(g);break}case"image":{c+=r.image(g);break}case"checkbox":{c+=r.checkbox(g);break}case"strong":{c+=r.strong(g);break}case"em":{c+=r.em(g);break}case"codespan":{c+=r.codespan(g);break}case"br":{c+=r.br(g);break}case"del":{c+=r.del(g);break}case"text":{c+=r.text(g);break}default:{let x='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(x),"";throw new Error(x)}}}return c}},Qd,nu=(Qd=class{constructor(n){Qt(this,"options");Qt(this,"block");this.options=n||Dr}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Bl.lex:Bl.lexInline}provideParser(n=this.block){return n?ql.parse:ql.parseInline}},Qt(Qd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Qt(Qd,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Qd),mj=class{constructor(...n){Qt(this,"defaults",Dp());Qt(this,"options",this.setOptions);Qt(this,"parse",this.parseMarkdown(!0));Qt(this,"parseInline",this.parseMarkdown(!1));Qt(this,"Parser",ql);Qt(this,"Renderer",ef);Qt(this,"TextRenderer",qp);Qt(this,"Lexer",Bl);Qt(this,"Tokenizer",Wd);Qt(this,"Hooks",nu);this.use(...n)}walkTokens(n,l){var c,o;let r=[];for(let u of n)switch(r=r.concat(l.call(this,u)),u.type){case"table":{let h=u;for(let p of h.header)r=r.concat(this.walkTokens(p.tokens,l));for(let p of h.rows)for(let g of p)r=r.concat(this.walkTokens(g.tokens,l));break}case"list":{let h=u;r=r.concat(this.walkTokens(h.items,l));break}default:{let h=u;(o=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&o[h.type]?this.defaults.extensions.childTokens[h.type].forEach(p=>{let g=h[p].flat(1/0);r=r.concat(this.walkTokens(g,l))}):h.tokens&&(r=r.concat(this.walkTokens(h.tokens,l)))}}return r}use(...n){let l=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(r=>{let c={...r};if(c.async=this.defaults.async||c.async||!1,r.extensions&&(r.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let u=l.renderers[o.name];u?l.renderers[o.name]=function(...h){let p=o.renderer.apply(this,h);return p===!1&&(p=u.apply(this,h)),p}:l.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=l[o.level];u?u.unshift(o.tokenizer):l[o.level]=[o.tokenizer],o.start&&(o.level==="block"?l.startBlock?l.startBlock.push(o.start):l.startBlock=[o.start]:o.level==="inline"&&(l.startInline?l.startInline.push(o.start):l.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(l.childTokens[o.name]=o.childTokens)}),c.extensions=l),r.renderer){let o=this.defaults.renderer||new ef(this.defaults);for(let u in r.renderer){if(!(u in o))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let h=u,p=r.renderer[h],g=o[h];o[h]=(...x)=>{let v=p.apply(o,x);return v===!1&&(v=g.apply(o,x)),v||""}}c.renderer=o}if(r.tokenizer){let o=this.defaults.tokenizer||new Wd(this.defaults);for(let u in r.tokenizer){if(!(u in o))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let h=u,p=r.tokenizer[h],g=o[h];o[h]=(...x)=>{let v=p.apply(o,x);return v===!1&&(v=g.apply(o,x)),v}}c.tokenizer=o}if(r.hooks){let o=this.defaults.hooks||new nu;for(let u in r.hooks){if(!(u in o))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let h=u,p=r.hooks[h],g=o[h];nu.passThroughHooks.has(u)?o[h]=x=>{if(this.defaults.async&&nu.passThroughHooksRespectAsync.has(u))return(async()=>{let j=await p.call(o,x);return g.call(o,j)})();let v=p.call(o,x);return g.call(o,v)}:o[h]=(...x)=>{if(this.defaults.async)return(async()=>{let j=await p.apply(o,x);return j===!1&&(j=await g.apply(o,x)),j})();let v=p.apply(o,x);return v===!1&&(v=g.apply(o,x)),v}}c.hooks=o}if(r.walkTokens){let o=this.defaults.walkTokens,u=r.walkTokens;c.walkTokens=function(h){let p=[];return p.push(u.call(this,h)),o&&(p=p.concat(o.call(this,h))),p}}this.defaults={...this.defaults,...c}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,l){return Bl.lex(n,l??this.defaults)}parser(n,l){return ql.parse(n,l??this.defaults)}parseMarkdown(n){return(l,r)=>{let c={...r},o={...this.defaults,...c},u=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&c.async===!1)return u(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof l>"u"||l===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof l!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(l)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=n),o.async)return(async()=>{let h=o.hooks?await o.hooks.preprocess(l):l,p=await(o.hooks?await o.hooks.provideLexer(n):n?Bl.lex:Bl.lexInline)(h,o),g=o.hooks?await o.hooks.processAllTokens(p):p;o.walkTokens&&await Promise.all(this.walkTokens(g,o.walkTokens));let x=await(o.hooks?await o.hooks.provideParser(n):n?ql.parse:ql.parseInline)(g,o);return o.hooks?await o.hooks.postprocess(x):x})().catch(u);try{o.hooks&&(l=o.hooks.preprocess(l));let h=(o.hooks?o.hooks.provideLexer(n):n?Bl.lex:Bl.lexInline)(l,o);o.hooks&&(h=o.hooks.processAllTokens(h)),o.walkTokens&&this.walkTokens(h,o.walkTokens);let p=(o.hooks?o.hooks.provideParser(n):n?ql.parse:ql.parseInline)(h,o);return o.hooks&&(p=o.hooks.postprocess(p)),p}catch(h){return u(h)}}}onError(n,l){return r=>{if(r.message+=`
114
+ Please report this to https://github.com/markedjs/marked.`,n){let c="<p>An error occurred:</p><pre>"+da(r.message+"",!0)+"</pre>";return l?Promise.resolve(c):c}if(l)return Promise.reject(r);throw r}}},Mr=new mj;function Ut(n,l){return Mr.parse(n,l)}Ut.options=Ut.setOptions=function(n){return Mr.setOptions(n),Ut.defaults=Mr.defaults,M_(Ut.defaults),Ut};Ut.getDefaults=Dp;Ut.defaults=Dr;Ut.use=function(...n){return Mr.use(...n),Ut.defaults=Mr.defaults,M_(Ut.defaults),Ut};Ut.walkTokens=function(n,l){return Mr.walkTokens(n,l)};Ut.parseInline=Mr.parseInline;Ut.Parser=ql;Ut.parser=ql.parse;Ut.Renderer=ef;Ut.TextRenderer=qp;Ut.Lexer=Bl;Ut.lexer=Bl.lex;Ut.Tokenizer=Wd;Ut.Hooks=nu;Ut.parse=Ut;Ut.options;Ut.setOptions;Ut.use;Ut.walkTokens;Ut.parseInline;ql.parse;Bl.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 sb(n,l){(l==null||l>n.length)&&(l=n.length);for(var r=0,c=Array(l);r<l;r++)c[r]=n[r];return c}function gj(n){if(Array.isArray(n))return n}function xj(n,l){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var c,o,u,h,p=[],g=!0,x=!1;try{if(u=(r=r.call(n)).next,l!==0)for(;!(g=(c=u.call(r)).done)&&(p.push(c.value),p.length!==l);g=!0);}catch(v){x=!0,o=v}finally{try{if(!g&&r.return!=null&&(h=r.return(),Object(h)!==h))return}finally{if(x)throw o}}return p}}function bj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
115
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _j(n,l){return gj(n)||xj(n,l)||yj(n,l)||bj()}function yj(n,l){if(n){if(typeof n=="string")return sb(n,l);var r={}.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sb(n,l):void 0}}const G_=Object.entries,lb=Object.setPrototypeOf,vj=Object.isFrozen,jj=Object.getPrototypeOf,wj=Object.getOwnPropertyDescriptor;let cs=Object.freeze,os=Object.seal,Dc=Object.create,$_=typeof Reflect<"u"&&Reflect,vp=$_.apply,jp=$_.construct;cs||(cs=function(l){return l});os||(os=function(l){return l});vp||(vp=function(l,r){for(var c=arguments.length,o=new Array(c>2?c-2:0),u=2;u<c;u++)o[u-2]=arguments[u];return l.apply(r,o)});jp||(jp=function(l){for(var r=arguments.length,c=new Array(r>1?r-1:0),o=1;o<r;o++)c[o-1]=arguments[o];return new l(...c)});const Tc=qn(Array.prototype.forEach),Nj=qn(Array.prototype.lastIndexOf),ab=qn(Array.prototype.pop),Cc=qn(Array.prototype.push),kj=qn(Array.prototype.splice),Ii=Array.isArray,su=qn(String.prototype.toLowerCase),Jh=qn(String.prototype.toString),ib=qn(String.prototype.match),Zo=qn(String.prototype.replace),rb=qn(String.prototype.indexOf),Sj=qn(String.prototype.trim),Ej=qn(Number.prototype.toString),Tj=qn(Boolean.prototype.toString),cb=typeof BigInt>"u"?null:qn(BigInt.prototype.toString),ob=typeof Symbol>"u"?null:qn(Symbol.prototype.toString),Pn=qn(Object.prototype.hasOwnProperty),Fo=qn(Object.prototype.toString),Fn=qn(RegExp.prototype.test),_r=Cj(TypeError);function qn(n){return function(l){l instanceof RegExp&&(l.lastIndex=0);for(var r=arguments.length,c=new Array(r>1?r-1:0),o=1;o<r;o++)c[o-1]=arguments[o];return vp(n,l,c)}}function Cj(n){return function(){for(var l=arguments.length,r=new Array(l),c=0;c<l;c++)r[c]=arguments[c];return jp(n,r)}}function St(n,l){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:su;if(lb&&lb(n,null),!Ii(l))return n;let c=l.length;for(;c--;){let o=l[c];if(typeof o=="string"){const u=r(o);u!==o&&(vj(l)||(l[c]=u),o=u)}n[o]=!0}return n}function Aj(n){for(let l=0;l<n.length;l++)Pn(n,l)||(n[l]=null);return n}function Ds(n){const l=Dc(null);for(const c of G_(n)){var r=_j(c,2);const o=r[0],u=r[1];Pn(n,o)&&(Ii(u)?l[o]=Aj(u):u&&typeof u=="object"&&u.constructor===Object?l[o]=Ds(u):l[o]=u)}return l}function Rj(n){switch(typeof n){case"string":return n;case"number":return Ej(n);case"boolean":return Tj(n);case"bigint":return cb?cb(n):"0";case"symbol":return ob?ob(n):"Symbol()";case"undefined":return Fo(n);case"function":case"object":{if(n===null)return Fo(n);const l=n,r=fa(l,"toString");if(typeof r=="function"){const c=r(l);return typeof c=="string"?c:Fo(c)}return Fo(n)}default:return Fo(n)}}function fa(n,l){for(;n!==null;){const c=wj(n,l);if(c){if(c.get)return qn(c.get);if(typeof c.value=="function")return qn(c.value)}n=jj(n)}function r(){return null}return r}function Mj(n){try{return Fn(n,""),!0}catch{return!1}}const ub=cs(["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"]),Ph=cs(["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"]),Wh=cs(["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"]),Dj=cs(["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"]),ep=cs(["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"]),Oj=cs(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),db=cs(["#text"]),fb=cs(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),tp=cs(["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"]),hb=cs(["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"]),Td=cs(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Lj=os(/{{[\w\W]*|^[\w\W]*}}/g),zj=os(/<%[\w\W]*|^[\w\W]*%>/g),Ij=os(/\${[\w\W]*/g),Uj=os(/^data-[\-\w.\u00B7-\uFFFF]+$/),Hj=os(/^aria-[\-\w]+$/),pb=os(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bj=os(/^(?:\w+script|data):/i),qj=os(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gj=os(/^html$/i),$j=os(/^[a-z][.\w]*(-[.\w]+)+$/i),mb=os(/<[/\w!]/g),gb=os(/<[/\w]/g),Yj=os(/<\/no(script|embed|frames)/i),Vj=os(/\/>/i),al={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Xj=function(){return typeof window>"u"?null:window},Qj=function(l,r){if(typeof l!="object"||typeof l.createPolicy!="function")return null;let c=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(c=r.getAttribute(o));const u="dompurify"+(c?"#"+c:"");try{return l.createPolicy(u,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},xb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Mi=function(l,r,c,o){return Pn(l,r)&&Ii(l[r])?St(o.base?Ds(o.base):{},l[r],o.transform):c};function Y_(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xj();const l=ye=>Y_(ye);if(l.version="3.4.12",l.removed=[],!n||!n.document||n.document.nodeType!==al.document||!n.Element)return l.isSupported=!1,l;let r=n.document;const c=r,o=c.currentScript;n.DocumentFragment;const u=n.HTMLTemplateElement,h=n.Node,p=n.Element,g=n.NodeFilter,x=n.NamedNodeMap;x===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const v=n.DOMParser,j=n.trustedTypes,y=p.prototype,T=fa(y,"cloneNode"),N=fa(y,"remove"),E=fa(y,"nextSibling"),A=fa(y,"childNodes"),D=fa(y,"parentNode"),q=fa(y,"shadowRoot"),Q=fa(y,"attributes"),z=h&&h.prototype?fa(h.prototype,"nodeType"):null,U=h&&h.prototype?fa(h.prototype,"nodeName"):null;if(typeof u=="function"){const ye=r.createElement("template");ye.content&&ye.content.ownerDocument&&(r=ye.content.ownerDocument)}let O,I="",V,R=!1,L=0;const G=function(){if(L>0)throw _r('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.')},se=function(C){G(),L++;try{return O.createHTML(C)}finally{L--}},ve=function(C){G(),L++;try{return O.createScriptURL(C)}finally{L--}},je=function(){return R||(V=Qj(j,o),R=!0),V},we=r,F=we.implementation,$=we.createNodeIterator,ne=we.createDocumentFragment,pe=we.getElementsByTagName,Ne=c.importNode;let S=xb();l.isSupported=typeof G_=="function"&&typeof D=="function"&&F&&F.createHTMLDocument!==void 0;const Z=Lj,de=zj,be=Ij,Me=Uj,Ie=Hj,Ke=Bj,ce=qj,Ue=$j;let ge=pb,Ze=null;const dt=St({},[...ub,...Ph,...Wh,...ep,...db]);let lt=null;const gt=St({},[...fb,...tp,...hb,...Td]);let et=Object.seal(Dc(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}})),Tt=null,ee=null;const tt=Object.seal(Dc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,$e=!0,Je=!1,Qe=!0,ft=!1,De=!0,wt=!1,Nt=!1,Ht=null,Kt=null,kt=!1,ot=!1,wn=!1,Dn=!1,ln=!0,$t=!1;const hn="user-content-";let yt=!0,Wn=!1,ae={},_e=null;const qe=St({},["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 it=null;const Pe=St({},["audio","video","img","source","image","track"]);let Zt=null;const K=St({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ke="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let Mt=Ve,Cn=!1,il=null;const Vs=St({},[fe,ke,Ve],Jh),vs=cs(["mi","mo","mn","ms","mtext"]);let js=St({},vs);const Xs=cs(["annotation-xml"]);let Qs=St({},Xs);const Wa=St({},["title","style","font","a","script"]);let us=null;const ds=["application/xhtml+xml","text/html"],Ft="text/html";let at=null,Nn=null;const Ks=r.createElement("form"),Zs=function(C){return C instanceof RegExp||C instanceof Function},ws=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Nn&&Nn===C)return;(!C||typeof C!="object")&&(C={}),C=Ds(C),us=ds.indexOf(C.PARSER_MEDIA_TYPE)===-1?Ft:C.PARSER_MEDIA_TYPE,at=us==="application/xhtml+xml"?Jh:su,Ze=Mi(C,"ALLOWED_TAGS",dt,{transform:at}),lt=Mi(C,"ALLOWED_ATTR",gt,{transform:at}),il=Mi(C,"ALLOWED_NAMESPACES",Vs,{transform:Jh}),Zt=Mi(C,"ADD_URI_SAFE_ATTR",K,{transform:at,base:K}),it=Mi(C,"ADD_DATA_URI_TAGS",Pe,{transform:at,base:Pe}),_e=Mi(C,"FORBID_CONTENTS",qe,{transform:at}),Tt=Mi(C,"FORBID_TAGS",Ds({}),{transform:at}),ee=Mi(C,"FORBID_ATTR",Ds({}),{transform:at}),ae=Pn(C,"USE_PROFILES")?C.USE_PROFILES&&typeof C.USE_PROFILES=="object"?Ds(C.USE_PROFILES):C.USE_PROFILES:!1,Fe=C.ALLOW_ARIA_ATTR!==!1,$e=C.ALLOW_DATA_ATTR!==!1,Je=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Qe=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ft=C.SAFE_FOR_TEMPLATES||!1,De=C.SAFE_FOR_XML!==!1,wt=C.WHOLE_DOCUMENT||!1,ot=C.RETURN_DOM||!1,wn=C.RETURN_DOM_FRAGMENT||!1,Dn=C.RETURN_TRUSTED_TYPE||!1,kt=C.FORCE_BODY||!1,ln=C.SANITIZE_DOM!==!1,$t=C.SANITIZE_NAMED_PROPS||!1,yt=C.KEEP_CONTENT!==!1,Wn=C.IN_PLACE||!1,ge=Mj(C.ALLOWED_URI_REGEXP)?C.ALLOWED_URI_REGEXP:pb,Mt=typeof C.NAMESPACE=="string"?C.NAMESPACE:Ve,js=Pn(C,"MATHML_TEXT_INTEGRATION_POINTS")&&C.MATHML_TEXT_INTEGRATION_POINTS&&typeof C.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ds(C.MATHML_TEXT_INTEGRATION_POINTS):St({},vs),Qs=Pn(C,"HTML_INTEGRATION_POINTS")&&C.HTML_INTEGRATION_POINTS&&typeof C.HTML_INTEGRATION_POINTS=="object"?Ds(C.HTML_INTEGRATION_POINTS):St({},Xs);const J=Pn(C,"CUSTOM_ELEMENT_HANDLING")&&C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING=="object"?Ds(C.CUSTOM_ELEMENT_HANDLING):Dc(null);if(et=Dc(null),Pn(J,"tagNameCheck")&&Zs(J.tagNameCheck)&&(et.tagNameCheck=J.tagNameCheck),Pn(J,"attributeNameCheck")&&Zs(J.attributeNameCheck)&&(et.attributeNameCheck=J.attributeNameCheck),Pn(J,"allowCustomizedBuiltInElements")&&typeof J.allowCustomizedBuiltInElements=="boolean"&&(et.allowCustomizedBuiltInElements=J.allowCustomizedBuiltInElements),os(et),ft&&($e=!1),wn&&(ot=!0),ae&&(Ze=St({},db),lt=Dc(null),ae.html===!0&&(St(Ze,ub),St(lt,fb)),ae.svg===!0&&(St(Ze,Ph),St(lt,tp),St(lt,Td)),ae.svgFilters===!0&&(St(Ze,Wh),St(lt,tp),St(lt,Td)),ae.mathMl===!0&&(St(Ze,ep),St(lt,hb),St(lt,Td))),tt.tagCheck=null,tt.attributeCheck=null,Pn(C,"ADD_TAGS")&&(typeof C.ADD_TAGS=="function"?tt.tagCheck=C.ADD_TAGS:Ii(C.ADD_TAGS)&&(Ze===dt&&(Ze=Ds(Ze)),St(Ze,C.ADD_TAGS,at))),Pn(C,"ADD_ATTR")&&(typeof C.ADD_ATTR=="function"?tt.attributeCheck=C.ADD_ATTR:Ii(C.ADD_ATTR)&&(lt===gt&&(lt=Ds(lt)),St(lt,C.ADD_ATTR,at))),Pn(C,"ADD_URI_SAFE_ATTR")&&Ii(C.ADD_URI_SAFE_ATTR)&&St(Zt,C.ADD_URI_SAFE_ATTR,at),Pn(C,"FORBID_CONTENTS")&&Ii(C.FORBID_CONTENTS)&&(_e===qe&&(_e=Ds(_e)),St(_e,C.FORBID_CONTENTS,at)),Pn(C,"ADD_FORBID_CONTENTS")&&Ii(C.ADD_FORBID_CONTENTS)&&(_e===qe&&(_e=Ds(_e)),St(_e,C.ADD_FORBID_CONTENTS,at)),yt&&(Ze["#text"]=!0),wt&&St(Ze,["html","head","body"]),Ze.table&&(St(Ze,["tbody"]),delete Tt.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw _r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const xe=O;O=C.TRUSTED_TYPES_POLICY;try{I=se("")}catch(Oe){throw O=xe,Oe}}else C.TRUSTED_TYPES_POLICY===null?(O=void 0,I=""):(O===void 0&&(O=je()),O&&typeof I=="string"&&(I=se("")));cs&&cs(C),Nn=C},Ns=St({},[...Ph,...Wh,...Dj]),Dt=St({},[...ep,...Oj]),rl=function(C,J,xe){return J.namespaceURI===Ve?C==="svg":J.namespaceURI===fe?C==="svg"&&(xe==="annotation-xml"||js[xe]):!!Ns[C]},rn=function(C,J,xe){return J.namespaceURI===Ve?C==="math":J.namespaceURI===ke?C==="math"&&Qs[xe]:!!Dt[C]},Jt=function(C,J,xe){return J.namespaceURI===ke&&!Qs[xe]||J.namespaceURI===fe&&!js[xe]?!1:!Dt[C]&&(Wa[C]||!Ns[C])},Ct=function(C){let J=D(C);(!J||!J.tagName)&&(J={namespaceURI:Mt,tagName:"template"});const xe=su(C.tagName),Oe=su(J.tagName);return il[C.namespaceURI]?C.namespaceURI===ke?rl(xe,J,Oe):C.namespaceURI===fe?rn(xe,J,Oe):C.namespaceURI===Ve?Jt(xe,J,Oe):!!(us==="application/xhtml+xml"&&il[C.namespaceURI]):!1},pn=function(C){Cc(l.removed,{element:C});try{D(C).removeChild(C)}catch{if(N(C),!D(C))throw _r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},xt=function(C){ts(C);const J=A(C);if(J){const Oe=[];Tc(J,Ye=>{Cc(Oe,Ye)}),Tc(Oe,Ye=>{try{N(Ye)}catch{}})}const xe=Q(C);if(xe)for(let Oe=xe.length-1;Oe>=0;--Oe){const Ye=xe[Oe],Le=Ye&&Ye.name;if(typeof Le=="string")try{C.removeAttribute(Le)}catch{}}},Kn=function(C,J){try{Cc(l.removed,{attribute:J.getAttributeNode(C),from:J})}catch{Cc(l.removed,{attribute:null,from:J})}if(J.removeAttribute(C),C==="is")if(ot||wn)try{pn(J)}catch{}else try{J.setAttribute(C,"")}catch{}},es=function(C){const J=Q(C);if(J)for(let xe=J.length-1;xe>=0;--xe){const Oe=J[xe],Ye=Oe&&Oe.name;if(!(typeof Ye!="string"||lt[at(Ye)]))try{C.removeAttribute(Ye)}catch{}}},ts=function(C){const J=[C];for(;J.length>0;){const xe=J.pop();(z?z(xe):xe.nodeType)===al.element&&es(xe);const Ye=A(xe);if(Ye)for(let Le=Ye.length-1;Le>=0;--Le)J.push(Ye[Le])}},Pt=function(C){if(!De)return;const J=[C];for(;J.length>0;){const xe=J.pop(),Oe=z?z(xe):xe.nodeType;if(Oe===al.processingInstruction||Oe===al.comment&&Fn(gb,xe.data)){try{N(xe)}catch{}continue}if(Oe===al.element){const Le=xe,Yt=at(U?U(xe):xe.nodeName);try{Le.hasAttribute&&Le.hasAttribute("patchsrc")&&Le.removeAttribute("patchsrc"),Le.hasAttribute&&Le.hasAttribute("for")&&Yt!=="label"&&Yt!=="output"&&Le.removeAttribute("for")}catch{}}const Ye=A(xe);if(Ye)for(let Le=Ye.length-1;Le>=0;--Le)J.push(Ye[Le])}},cl=function(C){let J=null,xe=null;if(kt)C="<remove></remove>"+C;else{const Le=ib(C,/^[\r\n\t ]+/);xe=Le&&Le[0]}us==="application/xhtml+xml"&&Mt===Ve&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const Oe=O?se(C):C;if(Mt===Ve)try{J=new v().parseFromString(Oe,us)}catch{}if(!J||!J.documentElement){J=F.createDocument(Mt,"template",null);try{J.documentElement.innerHTML=Cn?I:Oe}catch{}}const Ye=J.body||J.documentElement;return C&&xe&&Ye.insertBefore(r.createTextNode(xe),Ye.childNodes[0]||null),Mt===Ve?pe.call(J,wt?"html":"body")[0]:wt?J.documentElement:Ye},Wt=function(C){return $.call(C.ownerDocument||C,C,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},An=function(C){return C=Zo(C,Z," "),C=Zo(C,de," "),C=Zo(C,be," "),C},On=function(C){var J;C.normalize();const xe=$.call(C.ownerDocument||C,C,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let Oe=xe.nextNode();for(;Oe;)Oe.data=An(Oe.data),Oe=xe.nextNode();const Ye=(J=C.querySelectorAll)===null||J===void 0?void 0:J.call(C,"template");Ye&&Tc(Ye,Le=>{hs(Le.content)&&On(Le.content)})},fs=function(C){const J=U?U(C):null;return typeof J!="string"||at(J)!=="form"?!1:typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||C.attributes!==Q(C)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function"||C.nodeType!==z(C)||C.childNodes!==A(C)},hs=function(C){if(!z||typeof C!="object"||C===null)return!1;try{return z(C)===al.documentFragment}catch{return!1}},Gn=function(C){if(!z||typeof C!="object"||C===null)return!1;try{return typeof z(C)=="number"}catch{return!1}};function en(ye,C,J){ye.length!==0&&Tc(ye,xe=>{xe.call(l,C,J,Nn)})}const vl=function(C,J){return!!(De&&C.hasChildNodes()&&!Gn(C.firstElementChild)&&Fn(mb,C.textContent)&&Fn(mb,C.innerHTML)||De&&C.namespaceURI===Ve&&J==="style"&&Gn(C.firstElementChild)||C.nodeType===al.processingInstruction||De&&C.nodeType===al.comment&&Fn(gb,C.data))},ks=function(C,J){if(!Tt[J]&&$l(J)&&(et.tagNameCheck instanceof RegExp&&Fn(et.tagNameCheck,J)||et.tagNameCheck instanceof Function&&et.tagNameCheck(J)))return!1;if(yt&&!_e[J]){const xe=D(C),Oe=A(C);if(Oe&&xe){const Ye=Oe.length;for(let Le=Ye-1;Le>=0;--Le){const Yt=Wn?Oe[Le]:T(Oe[Le],!0);xe.insertBefore(Yt,E(C))}}}return pn(C),!0},ns=function(C,J){if(en(S.beforeSanitizeElements,C,null),C!==J&&D(C)===null)return!0;if(fs(C))return pn(C),!0;const xe=at(U?U(C):C.nodeName);if(en(S.uponSanitizeElement,C,{tagName:xe,allowedTags:Ze}),C!==J&&D(C)===null)return!0;if(vl(C,xe))return pn(C),!0;if(Tt[xe]||!(tt.tagCheck instanceof Function&&tt.tagCheck(xe))&&!Ze[xe]){const Ye=ks(C,xe);return Ye===!1&&en(S.afterSanitizeElements,C,null),Ye}if((z?z(C):C.nodeType)===al.element&&!Ct(C)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&Fn(Yj,C.innerHTML))return pn(C),!0;if(ft&&C.nodeType===al.text){const Ye=An(C.textContent);C.textContent!==Ye&&(Cc(l.removed,{element:C.cloneNode()}),C.textContent=Ye)}return en(S.afterSanitizeElements,C,null),!1},xn=function(C,J,xe){if(ee[J]||De&&J==="patchsrc"||De&&J==="for"&&C!=="label"&&C!=="output"||ln&&(J==="id"||J==="name")&&(xe in r||xe in Ks))return!1;const Oe=lt[J]||tt.attributeCheck instanceof Function&&tt.attributeCheck(J,C);if(!($e&&Fn(Me,J))){if(!(Fe&&Fn(Ie,J))){if(Oe){if(!Zt[J]){if(!Fn(ge,Zo(xe,ce,""))){if(!((J==="src"||J==="xlink:href"||J==="href")&&C!=="script"&&rb(xe,"data:")===0&&it[C])){if(!(Je&&!Fn(Ke,Zo(xe,ce,"")))){if(xe)return!1}}}}}else if(!($l(C)&&(et.tagNameCheck instanceof RegExp&&Fn(et.tagNameCheck,C)||et.tagNameCheck instanceof Function&&et.tagNameCheck(C))&&(et.attributeNameCheck instanceof RegExp&&Fn(et.attributeNameCheck,J)||et.attributeNameCheck instanceof Function&&et.attributeNameCheck(J,C))||J==="is"&&et.allowCustomizedBuiltInElements&&(et.tagNameCheck instanceof RegExp&&Fn(et.tagNameCheck,xe)||et.tagNameCheck instanceof Function&&et.tagNameCheck(xe))))return!1}}return!0},jl=St({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),$l=function(C){return!jl[su(C)]&&Fn(Ue,C)},kn=function(C,J,xe,Oe){if(O&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!xe)switch(j.getAttributeType(C,J)){case"TrustedHTML":return se(Oe);case"TrustedScriptURL":return ve(Oe)}return Oe},wl=function(C,J,xe,Oe){try{xe?C.setAttributeNS(xe,J,Oe):C.setAttribute(J,Oe),fs(C)?pn(C):ab(l.removed)}catch{Kn(J,C)}},ol=function(C){en(S.beforeSanitizeAttributes,C,null);const J=C.attributes;if(!J||fs(C))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:lt,forceKeepAttr:void 0};let Oe=J.length;const Ye=at(C.nodeName);for(;Oe--;){const Le=J[Oe],Yt=Le.name,vt=Le.namespaceURI,bn=Le.value,Bt=at(Yt),Sn=bn;let mn=Yt==="value"?Sn:Sj(Sn);if(xe.attrName=Bt,xe.attrValue=mn,xe.keepAttr=!0,xe.forceKeepAttr=void 0,en(S.uponSanitizeAttribute,C,xe),mn=xe.attrValue,$t&&(Bt==="id"||Bt==="name")&&rb(mn,hn)!==0&&(Kn(Yt,C),mn=hn+mn),De&&Fn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,mn)){Kn(Yt,C);continue}if(Bt==="attributename"&&ib(mn,"href")){Kn(Yt,C);continue}if(!xe.forceKeepAttr){if(!xe.keepAttr){Kn(Yt,C);continue}if(!Qe&&Fn(Vj,mn)){Kn(Yt,C);continue}if(ft&&(mn=An(mn)),!xn(Ye,Bt,mn)){Kn(Yt,C);continue}mn=kn(Ye,Bt,vt,mn),mn!==Sn&&wl(C,Yt,vt,mn)}}en(S.afterSanitizeAttributes,C,null)},Ls=function(C){let J=null;const xe=Wt(C);for(en(S.beforeSanitizeShadowDOM,C,null);J=xe.nextNode();)if(en(S.uponSanitizeShadowNode,J,null),ns(J,C),ol(J),hs(J.content)&&Ls(J.content),(z?z(J):J.nodeType)===al.element){const Ye=q(J);hs(Ye)&&(tn(Ye),Ls(Ye))}en(S.afterSanitizeShadowDOM,C,null)},tn=function(C){const J=[{node:C,shadow:null}];for(;J.length>0;){const xe=J.pop();if(xe.shadow){Ls(xe.shadow);continue}const Oe=xe.node,Le=(z?z(Oe):Oe.nodeType)===al.element,Yt=A(Oe);if(Yt)for(let vt=Yt.length-1;vt>=0;--vt)J.push({node:Yt[vt],shadow:null});if(Le){const vt=U?U(Oe):null;if(typeof vt=="string"&&at(vt)==="template"){const bn=Oe.content;hs(bn)&&J.push({node:bn,shadow:null})}}if(Le){const vt=q(Oe);hs(vt)&&J.push({node:null,shadow:vt},{node:vt,shadow:null})}}};return l.sanitize=function(ye){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=null,xe=null,Oe=null,Ye=null;if(Cn=!ye,Cn&&(ye="<!-->"),typeof ye!="string"&&!Gn(ye)&&(ye=Rj(ye),typeof ye!="string"))throw _r("dirty is not a string, aborting");if(!l.isSupported)return ye;Nt?(Ze=Ht,lt=Kt):ws(C),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(Ze=Ds(Ze)),S.uponSanitizeAttribute.length>0&&(lt=Ds(lt)),l.removed=[];const Le=Wn&&typeof ye!="string"&&Gn(ye);if(Le){Pt(ye);const Bt=U?U(ye):ye.nodeName;if(typeof Bt=="string"){const Sn=at(Bt);if(!Ze[Sn]||Tt[Sn])throw xt(ye),_r("root node is forbidden and cannot be sanitized in-place")}if(fs(ye))throw xt(ye),_r("root node is clobbered and cannot be sanitized in-place");try{tn(ye)}catch(Sn){throw xt(ye),Sn}}else if(Gn(ye))J=cl("<!---->"),xe=J.ownerDocument.importNode(ye,!0),xe.nodeType===al.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?J=xe:J.appendChild(xe),tn(xe);else{if(!ot&&!ft&&!wt&&ye.indexOf("<")===-1)return O&&Dn?se(ye):ye;if(J=cl(ye),!J)return ot?null:Dn?I:""}J&&kt&&pn(J.firstChild);const Yt=Le?ye:J,vt=Wt(Yt);try{for(;Oe=vt.nextNode();)ns(Oe,Yt),ol(Oe),hs(Oe.content)&&Ls(Oe.content)}catch(Bt){throw Le&&(xt(ye),Tc(l.removed,Sn=>{Sn.element&&ts(Sn.element)})),Bt}if(Le)return Tc(l.removed,Bt=>{Bt.element&&ts(Bt.element)}),ft&&On(ye),ye;if(ot){if(ft&&On(J),wn)for(Ye=ne.call(J.ownerDocument);J.firstChild;)Ye.appendChild(J.firstChild);else Ye=J;return(lt.shadowroot||lt.shadowrootmode)&&(Ye=Ne.call(c,Ye,!0)),Ye}let bn=wt?J.outerHTML:J.innerHTML;return wt&&Ze["!doctype"]&&J.ownerDocument&&J.ownerDocument.doctype&&J.ownerDocument.doctype.name&&Fn(Gj,J.ownerDocument.doctype.name)&&(bn="<!DOCTYPE "+J.ownerDocument.doctype.name+`>
116
+ `+bn),ft&&(bn=An(bn)),O&&Dn?se(bn):bn},l.setConfig=function(){let ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ws(ye),Nt=!0,Ht=Ze,Kt=lt},l.clearConfig=function(){Nn=null,Nt=!1,Ht=null,Kt=null,O=V,I=""},l.isValidAttribute=function(ye,C,J){Nn||ws({});const xe=at(ye),Oe=at(C);return xn(xe,Oe,J)},l.addHook=function(ye,C){typeof C=="function"&&Pn(S,ye)&&Cc(S[ye],C)},l.removeHook=function(ye,C){if(Pn(S,ye)){if(C!==void 0){const J=Nj(S[ye],C);return J===-1?void 0:kj(S[ye],J,1)[0]}return ab(S[ye])}},l.removeHooks=function(ye){Pn(S,ye)&&(S[ye]=[])},l.removeAllHooks=function(){S=xb()},l}var Kj=Y_();const Zj=1024;let Fj=0;class yl{constructor(l,r){this.from=l,this.to=r}}class fn{constructor(l={}){this.id=Fj++,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=Gl.match(l)),r=>{let c=l(r);return c===void 0?null:[this,c]}}}fn.closedBy=new fn({deserialize:n=>n.split(" ")});fn.openedBy=new fn({deserialize:n=>n.split(" ")});fn.group=new fn({deserialize:n=>n.split(" ")});fn.isolate=new fn({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});fn.contextHash=new fn({perNode:!0});fn.lookAhead=new fn({perNode:!0});fn.mounted=new fn({perNode:!0});class Ic{constructor(l,r,c,o=!1){this.tree=l,this.overlay=r,this.parser=c,this.bracketed=o}static get(l){return l&&l.props&&l.props[fn.mounted.id]}}const Jj=Object.create(null);class Gl{constructor(l,r,c,o=0){this.name=l,this.props=r,this.id=c,this.flags=o}static define(l){let r=l.props&&l.props.length?Object.create(null):Jj,c=(l.top?1:0)|(l.skipped?2:0)|(l.error?4:0)|(l.name==null?8:0),o=new Gl(l.name||"",r,l.id,c);if(l.props){for(let u of l.props)if(Array.isArray(u)||(u=u(o)),u){if(u[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[u[0].id]=u[1]}}return o}prop(l){return this.props[l.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(l){if(typeof l=="string"){if(this.name==l)return!0;let r=this.prop(fn.group);return r?r.indexOf(l)>-1:!1}return this.id==l}static match(l){let r=Object.create(null);for(let c in l)for(let o of c.split(" "))r[o]=l[c];return c=>{for(let o=c.prop(fn.group),u=-1;u<(o?o.length:0);u++){let h=r[u<0?c.name:o[u]];if(h)return h}}}}Gl.none=new Gl("",Object.create(null),0,8);class V_{constructor(l){this.types=l;for(let r=0;r<l.length;r++)if(l[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...l){let r=[];for(let c of this.types){let o=null;for(let u of l){let h=u(c);if(h){o||(o=Object.assign({},c.props));let p=h[1],g=h[0];g.combine&&g.id in o&&(p=g.combine(o[g.id],p)),o[g.id]=p}}r.push(o?new Gl(c.name,o,c.id,c.flags):c)}return new V_(r)}}const Cd=new WeakMap,bb=new WeakMap;var un;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(un||(un={}));class Ys{constructor(l,r,c,o,u){if(this.type=l,this.children=r,this.positions=c,this.length=o,this.props=null,u&&u.length){this.props=Object.create(null);for(let[h,p]of u)this.props[typeof h=="number"?h:h.id]=p}}toString(){let l=Ic.get(this);if(l&&!l.overlay)return l.tree.toString();let r="";for(let c of this.children){let o=c.toString();o&&(r&&(r+=","),r+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(l=0){return new tf(this.topNode,l)}cursorAt(l,r=0,c=0){let o=Cd.get(this)||this.topNode,u=new tf(o);return u.moveTo(l,r),Cd.set(this,u._tree),u}get topNode(){return new ys(this,0,0,null)}resolve(l,r=0){let c=cu(Cd.get(this)||this.topNode,l,r,!1);return Cd.set(this,c),c}resolveInner(l,r=0){let c=cu(bb.get(this)||this.topNode,l,r,!0);return bb.set(this,c),c}resolveStack(l,r=0){return e1(this,l,r)}iterate(l){let{enter:r,leave:c,from:o=0,to:u=this.length}=l,h=l.mode||0,p=(h&un.IncludeAnonymous)>0;for(let g=this.cursor(h|un.IncludeAnonymous);;){let x=!1;if(g.from<=u&&g.to>=o&&(!p&&g.type.isAnonymous||r(g)!==!1)){if(g.firstChild())continue;x=!0}for(;x&&c&&(p||!g.type.isAnonymous)&&c(g),!g.nextSibling();){if(!g.parent())return;x=!0}}}prop(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 r in this.props)l.push([+r,this.props[r]]);return l}balance(l={}){return this.children.length<=8?this:Yp(Gl.none,this.children,this.positions,0,this.children.length,0,this.length,(r,c,o)=>new Ys(this.type,r,c,o,this.propValues),l.makeTree||((r,c,o)=>new Ys(Gl.none,r,c,o)))}static build(l){return t1(l)}}Ys.empty=new Ys(Gl.none,[],[],0);class Gp{constructor(l,r){this.buffer=l,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Gp(this.buffer,this.index)}}class Gi{constructor(l,r,c){this.buffer=l,this.length=r,this.set=c}get type(){return Gl.none}toString(){let l=[];for(let r=0;r<this.buffer.length;)l.push(this.childString(r)),r=this.buffer[r+3];return l.join(",")}childString(l){let r=this.buffer[l],c=this.buffer[l+3],o=this.set.types[r],u=o.name;if(/\W/.test(u)&&!o.isError&&(u=JSON.stringify(u)),l+=4,c==l)return u;let h=[];for(;l<c;)h.push(this.childString(l)),l=this.buffer[l+3];return u+"("+h.join(",")+")"}findChild(l,r,c,o,u){let{buffer:h}=this,p=-1;for(let g=l;g!=r&&!(X_(u,o,h[g+1],h[g+2])&&(p=g,c>0));g=h[g+3]);return p}slice(l,r,c){let o=this.buffer,u=new Uint16Array(r-l),h=0;for(let p=l,g=0;p<r;){u[g++]=o[p++],u[g++]=o[p++]-c;let x=u[g++]=o[p++]-c;u[g++]=o[p++]-l,h=Math.max(h,x)}return new Gi(u,h,this.set)}}function X_(n,l,r,c){switch(n){case-2:return r<l;case-1:return c>=l&&r<l;case 0:return r<l&&c>l;case 1:return r<=l&&c>l;case 2:return c>l;case 4:return!0}}function cu(n,l,r,c){for(var o;n.from==n.to||(r<1?n.from>=l:n.from>l)||(r>-1?n.to<=l:n.to<l);){let h=!c&&n instanceof ys&&n.index<0?null:n.parent;if(!h)return n;n=h}let u=c?0:un.IgnoreOverlays;if(c)for(let h=n,p=h.parent;p;h=p,p=h.parent)h instanceof ys&&h.index<0&&((o=p.enter(l,r,u))===null||o===void 0?void 0:o.from)!=h.from&&(n=p);for(;;){let h=n.enter(l,r,u);if(!h)return n;n=h}}class Q_{cursor(l=0){return new tf(this,l)}getChild(l,r=null,c=null){let o=_b(this,l,r,c);return o.length?o[0]:null}getChildren(l,r=null,c=null){return _b(this,l,r,c)}resolve(l,r=0){return cu(this,l,r,!1)}resolveInner(l,r=0){return cu(this,l,r,!0)}matchContext(l){return wp(this.parent,l)}enterUnfinishedNodesBefore(l){let r=this.childBefore(l),c=this;for(;r;){let o=r.lastChild;if(!o||o.to!=r.to)break;o.type.isError&&o.from==o.to?(c=r,r=o.prevSibling):r=o}return c}get node(){return this}get next(){return this.parent}}class ys extends Q_{constructor(l,r,c,o){super(),this._tree=l,this.from=r,this.index=c,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(l,r,c,o,u=0){for(let h=this;;){for(let{children:p,positions:g}=h._tree,x=r>0?p.length:-1;l!=x;l+=r){let v=p[l],j=g[l]+h.from,y;if(!(!(u&un.EnterBracketed&&v instanceof Ys&&(y=Ic.get(v))&&!y.overlay&&y.bracketed&&c>=j&&c<=j+v.length)&&!X_(o,c,j,j+v.length))){if(v instanceof Gi){if(u&un.ExcludeBuffers)continue;let T=v.findChild(0,v.buffer.length,r,c-j,o);if(T>-1)return new xa(new Pj(h,v,l,j),null,T)}else if(u&un.IncludeAnonymous||!v.type.isAnonymous||$p(v)){let T;if(!(u&un.IgnoreMounts)&&(T=Ic.get(v))&&!T.overlay)return new ys(T.tree,j,l,h);let N=new ys(v,j,l,h);return u&un.IncludeAnonymous||!N.type.isAnonymous?N:N.nextChild(r<0?v.children.length-1:0,r,c,o,u)}}}if(u&un.IncludeAnonymous||!h.type.isAnonymous||(h.index>=0?l=h.index+r:l=r<0?-1:h._parent._tree.children.length,h=h._parent,!h))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(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,r,c=0){let o;if(!(c&un.IgnoreOverlays)&&(o=Ic.get(this._tree))&&o.overlay){let u=l-this.from,h=c&un.EnterBracketed&&o.bracketed;for(let{from:p,to:g}of o.overlay)if((r>0||h?p<=u:p<u)&&(r<0||h?g>=u:g>u))return new ys(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,l,r,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 _b(n,l,r,c){let o=n.cursor(),u=[];if(!o.firstChild())return u;if(r!=null){for(let h=!1;!h;)if(h=o.type.is(r),!o.nextSibling())return u}for(;;){if(c!=null&&o.type.is(c))return u;if(o.type.is(l)&&u.push(o.node),!o.nextSibling())return c==null?u:[]}}function wp(n,l,r=l.length-1){for(let c=n;r>=0;c=c.parent){if(!c)return!1;if(!c.type.isAnonymous){if(l[r]&&l[r]!=c.name)return!1;r--}}return!0}class Pj{constructor(l,r,c,o){this.parent=l,this.buffer=r,this.index=c,this.start=o}}class xa extends Q_{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,r,c){super(),this.context=l,this._parent=r,this.index=c,this.type=l.buffer.set.types[l.buffer.buffer[c]]}child(l,r,c){let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],l,r-this.context.start,c);return u<0?null:new xa(this.context,this,u)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(l){return this.child(1,l,2)}childBefore(l){return this.child(-1,l,-2)}prop(l){return this.type.prop(l)}enter(l,r,c=0){if(c&un.ExcludeBuffers)return null;let{buffer:o}=this.context,u=o.findChild(this.index+4,o.buffer[this.index+3],r>0?1:-1,l-this.context.start,r);return u<0?null:new xa(this.context,this,u)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(l){return this._parent?null:this.context.parent.nextChild(this.context.index+l,l,0,4)}get nextSibling(){let{buffer:l}=this.context,r=l.buffer[this.index+3];return r<(this._parent?l.buffer[this._parent.index+3]:l.buffer.length)?new xa(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:l}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new xa(this.context,this._parent,l.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let l=[],r=[],{buffer:c}=this.context,o=this.index+4,u=c.buffer[this.index+3];if(u>o){let h=c.buffer[this.index+1];l.push(c.slice(o,u,h)),r.push(0)}return new Ys(this.type,l,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function K_(n){if(!n.length)return null;let l=0,r=n[0];for(let u=1;u<n.length;u++){let h=n[u];(h.from>r.from||h.to<r.to)&&(r=h,l=u)}let c=r instanceof ys&&r.index<0?null:r.parent,o=n.slice();return c?o[l]=c:o.splice(l,1),new Wj(o,r)}class Wj{constructor(l,r){this.heads=l,this.node=r}get next(){return K_(this.heads)}}function e1(n,l,r){let c=n.resolveInner(l,r),o=null;for(let u=c instanceof ys?c:c.context.parent;u;u=u.parent)if(u.index<0){let h=u.parent;(o||(o=[c])).push(h.resolve(l,r)),u=h}else{let h=Ic.get(u.tree);if(h&&h.overlay&&h.overlay[0].from<=l&&h.overlay[h.overlay.length-1].to>=l){let p=new ys(h.tree,h.overlay[0].from+u.from,-1,u);(o||(o=[c])).push(cu(p,l,r,!1))}}return o?K_(o):c}class tf{get name(){return this.type.name}constructor(l,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~un.EnterBracketed,l instanceof ys)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,r){this.index=l;let{start:c,buffer:o}=this.buffer;return this.type=r||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 ys?(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,r,c){if(!this.buffer)return this.yield(this._tree.nextChild(l<0?this._tree._tree.children.length-1:0,l,r,c,this.mode));let{buffer:o}=this.buffer,u=o.findChild(this.index+4,o.buffer[this.index+3],l,r-this.buffer.start,c);return u<0?!1:(this.stack.push(this.index),this.yieldBuf(u))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(l){return this.enterChild(1,l,2)}childBefore(l){return this.enterChild(-1,l,-2)}enter(l,r,c=this.mode){return this.buffer?c&un.ExcludeBuffers?!1:this.enterChild(1,l,r):this.yield(this._tree.enter(l,r,c))}parent(){if(!this.buffer)return this.yieldNode(this.mode&un.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let l=this.mode&un.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:r}=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(r.findChild(o,this.index,-1,0,4))}else{let o=r.buffer[this.index+3];if(o<(c<0?r.buffer.length:r.buffer[this.stack[c]+3]))return this.yieldBuf(o)}return c<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+l,l,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(l){let r,c,{buffer:o}=this;if(o){if(l>0){if(this.index<o.buffer.buffer.length)return!1}else for(let u=0;u<this.index;u++)if(o.buffer.buffer[u+3]<this.index)return!1;({index:r,parent:c}=o)}else({index:r,_parent:c}=this._tree);for(;c;{index:r,_parent:c}=c)if(r>-1)for(let u=r+l,h=l<0?-1:c._tree.children.length;u!=h;u+=l){let p=c._tree.children[u];if(this.mode&un.IncludeAnonymous||p instanceof Gi||!p.type.isAnonymous||$p(p))return!1}return!0}move(l,r){if(r&&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,r=0){for(;(this.from==this.to||(r<1?this.from>=l:this.from>l)||(r>-1?this.to<=l:this.to<l))&&this.parent(););for(;this.enterChild(1,l,r););return this}get node(){if(!this.buffer)return this._tree;let l=this.bufferNode,r=null,c=0;if(l&&l.context==this.buffer)e:for(let o=this.index,u=this.stack.length;u>=0;){for(let h=l;h;h=h._parent)if(h.index==o){if(o==this.index)return h;r=h,c=u+1;break e}o=this.stack[--u]}for(let o=c;o<this.stack.length;o++)r=new xa(this.buffer,r,this.stack[o]);return this.bufferNode=new xa(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(l,r){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&&r&&r(this),o=this.type.isAnonymous,!c)return;if(this.nextSibling())break;this.parent(),c--,o=!0}}}matchContext(l){if(!this.buffer)return wp(this.node.parent,l);let{buffer:r}=this.buffer,{types:c}=r.set;for(let o=l.length-1,u=this.stack.length-1;o>=0;u--){if(u<0)return wp(this._tree,l,o);let h=c[r.buffer[this.stack[u]]];if(!h.isAnonymous){if(l[o]&&l[o]!=h.name)return!1;o--}}return!0}}function $p(n){return n.children.some(l=>l instanceof Gi||!l.type.isAnonymous||$p(l))}function t1(n){var l;let{buffer:r,nodeSet:c,maxBufferLength:o=Zj,reused:u=[],minRepeatType:h=c.types.length}=n,p=Array.isArray(r)?new Gp(r,r.length):r,g=c.types,x=0,v=0;function j(U,O,I,V,R,L){let{id:G,start:se,end:ve,size:je}=p,we=v,F=x;if(je<0)if(p.next(),je==-1){let S=u[G];I.push(S),V.push(se-U);return}else if(je==-3){x=G;return}else if(je==-4){v=G;return}else throw new RangeError(`Unrecognized record size: ${je}`);let $=g[G],ne,pe,Ne=se-U;if(ve-se<=o&&(pe=A(p.pos-O,R))){let S=new Uint16Array(pe.size-pe.skip),Z=p.pos-pe.size,de=S.length;for(;p.pos>Z;)de=D(pe.start,S,de);ne=new Gi(S,ve-pe.start,c),Ne=pe.start-U}else{let S=p.pos-je;p.next();let Z=[],de=[],be=G>=h?G:-1,Me=0,Ie=ve;for(;p.pos>S;)be>=0&&p.id==be&&p.size>=0?(p.end<=Ie-o&&(N(Z,de,se,Me,p.end,Ie,be,we,F),Me=Z.length,Ie=p.end),p.next()):L>2500?y(se,S,Z,de):j(se,S,Z,de,be,L+1);if(be>=0&&Me>0&&Me<Z.length&&N(Z,de,se,Me,se,Ie,be,we,F),Z.reverse(),de.reverse(),be>-1&&Me>0){let Ke=T($,F);ne=Yp($,Z,de,0,Z.length,0,ve-se,Ke,Ke)}else ne=E($,Z,de,ve-se,we-ve,F)}I.push(ne),V.push(Ne)}function y(U,O,I,V){let R=[],L=0,G=-1;for(;p.pos>O;){let{id:se,start:ve,end:je,size:we}=p;if(we>4)p.next();else{if(G>-1&&ve<G)break;G<0&&(G=je-o),R.push(se,ve,je),L++,p.next()}}if(L){let se=new Uint16Array(L*4),ve=R[R.length-2];for(let je=R.length-3,we=0;je>=0;je-=3)se[we++]=R[je],se[we++]=R[je+1]-ve,se[we++]=R[je+2]-ve,se[we++]=we;I.push(new Gi(se,R[2]-ve,c)),V.push(ve-U)}}function T(U,O){return(I,V,R)=>{let L=0,G=I.length-1,se,ve;if(G>=0&&(se=I[G])instanceof Ys){if(!G&&se.type==U&&se.length==R)return se;(ve=se.prop(fn.lookAhead))&&(L=V[G]+se.length+ve)}return E(U,I,V,R,L,O)}}function N(U,O,I,V,R,L,G,se,ve){let je=[],we=[];for(;U.length>V;)je.push(U.pop()),we.push(O.pop()+I-R);U.push(E(c.types[G],je,we,L-R,se-L,ve)),O.push(R-I)}function E(U,O,I,V,R,L,G){if(L){let se=[fn.contextHash,L];G=G?[se].concat(G):[se]}if(R>25){let se=[fn.lookAhead,R];G=G?[se].concat(G):[se]}return new Ys(U,O,I,V,G)}function A(U,O){let I=p.fork(),V=0,R=0,L=0,G=I.end-o,se={size:0,start:0,skip:0};e:for(let ve=I.pos-U;I.pos>ve;){let je=I.size;if(I.id==O&&je>=0){se.size=V,se.start=R,se.skip=L,L+=4,V+=4,I.next();continue}let we=I.pos-je;if(je<0||we<ve||I.start<G)break;let F=I.id>=h?4:0,$=I.start;for(I.next();I.pos>we;){if(I.size<0)if(I.size==-3||I.size==-4)F+=4;else break e;else I.id>=h&&(F+=4);I.next()}R=$,V+=je,L+=F}return(O<0||V==U)&&(se.size=V,se.start=R,se.skip=L),se.size>4?se:void 0}function D(U,O,I){let{id:V,start:R,end:L,size:G}=p;if(p.next(),G>=0&&V<h){let se=I;if(G>4){let ve=p.pos-(G-4);for(;p.pos>ve;)I=D(U,O,I)}O[--I]=se,O[--I]=L-U,O[--I]=R-U,O[--I]=V}else G==-3?x=V:G==-4&&(v=V);return I}let q=[],Q=[];for(;p.pos>0;)j(n.start||0,n.bufferStart||0,q,Q,-1,0);let z=(l=n.length)!==null&&l!==void 0?l:q.length?Q[0]+q[0].length:0;return new Ys(g[n.topID],q.reverse(),Q.reverse(),z)}const yb=new WeakMap;function Fd(n,l){if(!n.isAnonymous||l instanceof Gi||l.type!=n)return 1;let r=yb.get(l);if(r==null){r=1;for(let c of l.children){if(c.type!=n||!(c instanceof Ys)){r=1;break}r+=Fd(n,c)}yb.set(l,r)}return r}function Yp(n,l,r,c,o,u,h,p,g){let x=0;for(let N=c;N<o;N++)x+=Fd(n,l[N]);let v=Math.ceil(x*1.5/8),j=[],y=[];function T(N,E,A,D,q){for(let Q=A;Q<D;){let z=Q,U=E[Q],O=Fd(n,N[Q]);for(Q++;Q<D;Q++){let I=Fd(n,N[Q]);if(O+I>=v)break;O+=I}if(Q==z+1){if(O>v){let I=N[z];T(I.children,I.positions,0,I.children.length,E[z]+q);continue}j.push(N[z])}else{let I=E[Q-1]+N[Q-1].length-U;j.push(Yp(n,N,E,z,Q,U,I,null,g))}y.push(U+q-u)}}return T(l,r,c,o,0),(p||g)(j,y,h)}class pE{constructor(){this.map=new WeakMap}setBuffer(l,r,c){let o=this.map.get(l);o||this.map.set(l,o=new Map),o.set(r,c)}getBuffer(l,r){let c=this.map.get(l);return c&&c.get(r)}set(l,r){l instanceof xa?this.setBuffer(l.context.buffer,l.index,r):l instanceof ys&&this.map.set(l.tree,r)}get(l){return l instanceof xa?this.getBuffer(l.context.buffer,l.index):l instanceof ys?this.map.get(l.tree):void 0}cursorSet(l,r){l.buffer?this.setBuffer(l.buffer.buffer,l.index,r):this.map.set(l.tree,r)}cursorGet(l){return l.buffer?this.getBuffer(l.buffer.buffer,l.index):this.map.get(l.tree)}}class ou{constructor(l,r,c,o,u=!1,h=!1){this.from=l,this.to=r,this.tree=c,this.offset=o,this.open=(u?1:0)|(h?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(l,r=[],c=!1){let o=[new ou(0,l.length,l,0,!1,c)];for(let u of r)u.to>l.length&&o.push(u);return o}static applyChanges(l,r,c=128){if(!r.length)return l;let o=[],u=1,h=l.length?l[0]:null;for(let p=0,g=0,x=0;;p++){let v=p<r.length?r[p]:null,j=v?v.fromA:1e9;if(j-g>=c)for(;h&&h.from<j;){let y=h;if(g>=y.from||j<=y.to||x){let T=Math.max(y.from,g)-x,N=Math.min(y.to,j)-x;y=T>=N?null:new ou(T,N,y.tree,y.offset+x,p>0,!!v)}if(y&&o.push(y),h.to>j)break;h=u<l.length?l[u++]:null}if(!v)break;g=v.toA,x=v.toA-v.toB}return o}}class mE{startParse(l,r,c){return typeof l=="string"&&(l=new n1(l)),c=c?c.length?c.map(o=>new yl(o.from,o.to)):[new yl(0,0)]:[new yl(0,l.length)],this.createParse(l,r||[],c)}parse(l,r,c){let o=this.startParse(l,r,c);for(;;){let u=o.advance();if(u)return u}}}class n1{constructor(l){this.string=l}get length(){return this.string.length}chunk(l){return this.string.slice(l)}get lineChunks(){return!1}read(l,r){return this.string.slice(l,r)}}function gE(n){return(l,r,c,o)=>new l1(l,n,r,c,o)}class vb{constructor(l,r,c,o,u,h){this.parser=l,this.parse=r,this.overlay=c,this.bracketed=o,this.target=u,this.from=h}}function jb(n){if(!n.length||n.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class s1{constructor(l,r,c,o,u,h,p,g){this.parser=l,this.predicate=r,this.mounts=c,this.index=o,this.start=u,this.bracketed=h,this.target=p,this.prev=g,this.depth=0,this.ranges=[]}}const Np=new fn({perNode:!0});class l1{constructor(l,r,c,o,u){this.nest=r,this.input=c,this.fragments=o,this.ranges=u,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=l}advance(){if(this.baseParse){let 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 Ys(c.type,c.children,c.positions,c.length,c.propValues.concat([[Np,this.stoppedAt]]))),c}let l=this.inner[this.innerDone],r=l.parse.advance();if(r){this.innerDone++;let c=Object.assign(Object.create(null),l.target.props);c[fn.mounted.id]=new Ic(r,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 r=this.innerDone;r<this.inner.length;r++)this.inner[r].from<l&&(l=Math.min(l,this.inner[r].parse.parsedPos));return l}stopAt(l){if(this.stoppedAt=l,this.baseParse)this.baseParse.stopAt(l);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(l)}startInner(){let l=new r1(this.fragments),r=null,c=null,o=new tf(new ys(this.baseTree,this.ranges[0].from,0,null),un.IncludeAnonymous|un.IgnoreMounts);e:for(let u,h;;){let p=!0,g;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)p=!1;else if(l.hasNode(o)){if(r){let x=r.mounts.find(v=>v.frag.from<=o.from&&v.frag.to>=o.to&&v.mount.overlay);if(x)for(let v of x.mount.overlay){let j=v.from+x.pos,y=v.to+x.pos;j>=o.from&&y<=o.to&&!r.ranges.some(T=>T.from<y&&T.to>j)&&r.ranges.push({from:j,to:y})}}p=!1}else if(c&&(h=a1(c.ranges,o.from,o.to)))p=h!=2;else if(!o.type.isAnonymous&&(u=this.nest(o,this.input))&&(o.from<o.to||!u.overlay)){o.tree||(i1(o),r&&r.depth++,c&&c.depth++);let x=l.findMounts(o.from,u.parser);if(typeof u.overlay=="function")r=new s1(u.parser,u.overlay,x,this.inner.length,o.from,!!u.bracketed,o.tree,r);else{let v=kb(this.ranges,u.overlay||(o.from<o.to?[new yl(o.from,o.to)]:[]));v.length&&jb(v),(v.length||!u.overlay)&&this.inner.push(new vb(u.parser,v.length?u.parser.startParse(this.input,Sb(x,v),v):u.parser.startParse(""),u.overlay?u.overlay.map(j=>new yl(j.from-o.from,j.to-o.from)):null,!!u.bracketed,o.tree,v.length?v[0].from:o.from)),u.overlay?v.length&&(c={ranges:v,depth:0,prev:c}):p=!1}}else if(r&&(g=r.predicate(o))&&(g===!0&&(g=new yl(o.from,o.to)),g.from<g.to)){let x=r.ranges.length-1;x>=0&&r.ranges[x].to==g.from?r.ranges[x]={from:r.ranges[x].from,to:g.to}:r.ranges.push(g)}if(p&&o.firstChild())r&&r.depth++,c&&c.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(r&&!--r.depth){let x=kb(this.ranges,r.ranges);x.length&&(jb(x),this.inner.splice(r.index,0,new vb(r.parser,r.parser.startParse(this.input,Sb(r.mounts,x),x),r.ranges.map(v=>new yl(v.from-r.start,v.to-r.start)),r.bracketed,r.target,x[0].from))),r=r.prev}c&&!--c.depth&&(c=c.prev)}}}}function a1(n,l,r){for(let c of n){if(c.from>=r)break;if(c.to>l)return c.from<=l&&c.to>=r?2:1}return 0}function wb(n,l,r,c,o,u){if(l<r){let h=n.buffer[l+1];c.push(n.slice(l,r,h)),o.push(h-u)}}function i1(n){let{node:l}=n,r=[],c=l.context.buffer;do r.push(n.index),n.parent();while(!n.tree);let o=n.tree,u=o.children.indexOf(c),h=o.children[u],p=h.buffer,g=[u];function x(v,j,y,T,N,E){let A=r[E],D=[],q=[];wb(h,v,A,D,q,T);let Q=p[A+1],z=p[A+2];g.push(D.length);let U=E?x(A+4,p[A+3],h.set.types[p[A]],Q,z-Q,E-1):l.toTree();return D.push(U),q.push(Q-T),wb(h,p[A+3],j,D,q,T),new Ys(y,D,q,N)}o.children[u]=x(0,p.length,Gl.none,0,h.length,r.length-1);for(let v of g){let j=n.tree.children[v],y=n.tree.positions[v];n.yield(new ys(j,y+n.from,v,n._tree))}}class Nb{constructor(l,r){this.offset=r,this.done=!1,this.cursor=l.cursor(un.IncludeAnonymous|un.IgnoreMounts)}moveTo(l){let{cursor:r}=this,c=l-this.offset;for(;!this.done&&r.from<c;)if(!(r.to>=l&&r.enter(c,1,un.IgnoreOverlays|un.ExcludeBuffers)))if(r.to<=l)r.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 r=this.cursor.tree;;){if(r==l.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof Ys)r=r.children[0];else break}return!1}}class r1{constructor(l){var r;if(this.fragments=l,this.curTo=0,this.fragI=0,l.length){let c=this.curFrag=l[0];this.curTo=(r=c.tree.prop(Np))!==null&&r!==void 0?r:c.to,this.inner=new Nb(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 r=this.curFrag=this.fragments[this.fragI];this.curTo=(l=r.tree.prop(Np))!==null&&l!==void 0?l:r.to,this.inner=new Nb(r.tree,-r.offset)}}findMounts(l,r){var c;let o=[];if(this.inner){this.inner.cursor.moveTo(l,1);for(let u=this.inner.cursor.node;u;u=u.parent){let h=(c=u.tree)===null||c===void 0?void 0:c.prop(fn.mounted);if(h&&h.parser==r)for(let p=this.fragI;p<this.fragments.length;p++){let g=this.fragments[p];if(g.from>=u.to)break;g.tree==this.curFrag.tree&&o.push({frag:g,pos:u.from-g.offset,mount:h})}}}return o}}function kb(n,l){let r=null,c=l;for(let o=1,u=0;o<n.length;o++){let h=n[o-1].to,p=n[o].from;for(;u<c.length;u++){let g=c[u];if(g.from>=p)break;g.to<=h||(r||(c=r=l.slice()),g.from<h?(r[u]=new yl(g.from,h),g.to>p&&r.splice(u+1,0,new yl(p,g.to))):g.to>p?r[u--]=new yl(p,g.to):r.splice(u--,1))}}return c}function c1(n,l,r,c){let o=0,u=0,h=!1,p=!1,g=-1e9,x=[];for(;;){let v=o==n.length?1e9:h?n[o].to:n[o].from,j=u==l.length?1e9:p?l[u].to:l[u].from;if(h!=p){let y=Math.max(g,r),T=Math.min(v,j,c);y<T&&x.push(new yl(y,T))}if(g=Math.min(v,j),g==1e9)break;v==g&&(h?(h=!1,o++):h=!0),j==g&&(p?(p=!1,u++):p=!0)}return x}function Sb(n,l){let r=[];for(let{pos:c,mount:o,frag:u}of n){let h=c+(o.overlay?o.overlay[0].from:0),p=h+o.tree.length,g=Math.max(u.from,h),x=Math.min(u.to,p);if(o.overlay){let v=o.overlay.map(y=>new yl(y.from+c,y.to+c)),j=c1(l,v,g,x);for(let y=0,T=g;;y++){let N=y==j.length,E=N?x:j[y].from;if(E>T&&r.push(new ou(T,E,o.tree,-h,u.from>=T||u.openStart,u.to<=E||u.openEnd)),N)break;T=j[y].to}}else r.push(new ou(g,x,o.tree,-h,u.from>=h||u.openStart,u.to<=p||u.openEnd))}return r}let o1=0;class bl{constructor(l,r,c,o){this.name=l,this.set=r,this.base=c,this.modified=o,this.id=o1++}toString(){let{name:l}=this;for(let r of this.modified)r.name&&(l=`${r.name}(${l})`);return l}static define(l,r){let c=typeof l=="string"?l:"?";if(l instanceof bl&&(r=l),r!=null&&r.base)throw new Error("Can not derive from a modified tag");let o=new bl(c,[],null,[]);if(o.set.push(o),r)for(let u of r.set)o.set.push(u);return o}static defineModifier(l){let r=new nf(l);return c=>c.modified.indexOf(r)>-1?c:nf.get(c.base||c,c.modified.concat(r).sort((o,u)=>o.id-u.id))}}let u1=0;class nf{constructor(l){this.name=l,this.instances=[],this.id=u1++}static get(l,r){if(!r.length)return l;let c=r[0].instances.find(p=>p.base==l&&d1(r,p.modified));if(c)return c;let o=[],u=new bl(l.name,o,l,r);for(let p of r)p.instances.push(u);let h=f1(r);for(let p of l.set)if(!p.modified.length)for(let g of h)o.push(nf.get(p,g));return u}}function d1(n,l){return n.length==l.length&&n.every((r,c)=>r==l[c])}function f1(n){let l=[[]];for(let r=0;r<n.length;r++)for(let c=0,o=l.length;c<o;c++)l.push(l[c].concat(n[r]));return l.sort((r,c)=>c.length-r.length)}function xE(n){let l=Object.create(null);for(let r in n){let c=n[r];Array.isArray(c)||(c=[c]);for(let o of r.split(" "))if(o){let u=[],h=2,p=o;for(let j=0;;){if(p=="..."&&j>0&&j+3==o.length){h=1;break}let y=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(p);if(!y)throw new RangeError("Invalid path: "+o);if(u.push(y[0]=="*"?"":y[0][0]=='"'?JSON.parse(y[0]):y[0]),j+=y[0].length,j==o.length)break;let T=o[j++];if(j==o.length&&T=="!"){h=0;break}if(T!="/")throw new RangeError("Invalid path: "+o);p=o.slice(j)}let g=u.length-1,x=u[g];if(!x)throw new RangeError("Invalid path: "+o);let v=new uu(c,h,g>0?u.slice(0,g):null);l[x]=v.sort(l[x])}}return Z_.add(l)}const Z_=new fn({combine(n,l){let r,c,o;for(;n||l;){if(!n||l&&n.depth>=l.depth?(o=l,l=l.next):(o=n,n=n.next),r&&r.mode==o.mode&&!o.context&&!r.context)continue;let u=new uu(o.tags,o.mode,o.context);r?r.next=u:c=u,r=u}return c}});class uu{constructor(l,r,c,o){this.tags=l,this.mode=r,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}}uu.empty=new uu([],2,null);function F_(n,l){let r=Object.create(null);for(let u of n)if(!Array.isArray(u.tag))r[u.tag.id]=u.class;else for(let h of u.tag)r[h.id]=u.class;let{scope:c,all:o=null}=l||{};return{style:u=>{let h=o;for(let p of u)for(let g of p.set){let x=r[g.id];if(x){h=h?h+" "+x:x;break}}return h},scope:c}}function h1(n,l){let r=null;for(let c of n){let o=c.style(l);o&&(r=r?r+" "+o:o)}return r}function p1(n,l,r,c=0,o=n.length){let u=new g1(c,Array.isArray(l)?l:[l],r);u.highlightRange(n.cursor(),c,o,"",u.highlighters),u.flush(o)}function m1(n,l,r,c,o,u=0,h=n.length){let p=u;function g(x,v){if(!(x<=p)){for(let j=n.slice(p,x),y=0;;){let T=j.indexOf(`
117
+ `,y),N=T<0?j.length:T;if(N>y&&c(j.slice(y,N),v),T<0)break;o(),y=T+1}p=x}}p1(l,r,(x,v,j)=>{g(x,""),g(v,j)},u,h),g(h,"")}class g1{constructor(l,r,c){this.at=l,this.highlighters=r,this.span=c,this.class=""}startSpan(l,r){r!=this.class&&(this.flush(l),l>this.at&&(this.at=l),this.class=r)}flush(l){l>this.at&&this.class&&this.span(this.at,l,this.class)}highlightRange(l,r,c,o,u){let{type:h,from:p,to:g}=l;if(p>=c||g<=r)return;h.isTop&&(u=this.highlighters.filter(T=>!T.scope||T.scope(h)));let x=o,v=x1(l)||uu.empty,j=h1(u,v.tags);if(j&&(x&&(x+=" "),x+=j,v.mode==1&&(o+=(o?" ":"")+j)),this.startSpan(Math.max(r,p),x),v.opaque)return;let y=l.tree&&l.tree.prop(fn.mounted);if(y&&y.overlay){let T=l.node.enter(y.overlay[0].from+p,1),N=this.highlighters.filter(A=>!A.scope||A.scope(y.tree.type)),E=l.firstChild();for(let A=0,D=p;;A++){let q=A<y.overlay.length?y.overlay[A]:null,Q=q?q.from+p:g,z=Math.max(r,D),U=Math.min(c,Q);if(z<U&&E)for(;l.from<U&&(this.highlightRange(l,z,U,o,u),this.startSpan(Math.min(U,l.to),x),!(l.to>=Q||!l.nextSibling())););if(!q||Q>c)break;D=q.to+p,D>r&&(this.highlightRange(T.cursor(),Math.max(r,q.from+p),Math.min(c,D),"",N),this.startSpan(Math.min(c,D),x))}E&&l.parent()}else if(l.firstChild()){y&&(o="");do if(!(l.to<=r)){if(l.from>=c)break;this.highlightRange(l,r,c,o,u),this.startSpan(Math.min(c,l.to),x)}while(l.nextSibling());l.parent()}}}function x1(n){let l=n.type.prop(Z_);for(;l&&l.context&&!n.matchContext(l.context);)l=l.next;return l||null}const Ee=bl.define,Ad=Ee(),Li=Ee(),Eb=Ee(Li),Tb=Ee(Li),zi=Ee(),Rd=Ee(zi),np=Ee(zi),ha=Ee(),yr=Ee(ha),ca=Ee(),oa=Ee(),kp=Ee(),Jo=Ee(kp),Md=Ee(),Ae={comment:Ad,lineComment:Ee(Ad),blockComment:Ee(Ad),docComment:Ee(Ad),name:Li,variableName:Ee(Li),typeName:Eb,tagName:Ee(Eb),propertyName:Tb,attributeName:Ee(Tb),className:Ee(Li),labelName:Ee(Li),namespace:Ee(Li),macroName:Ee(Li),literal:zi,string:Rd,docString:Ee(Rd),character:Ee(Rd),attributeValue:Ee(Rd),number:np,integer:Ee(np),float:Ee(np),bool:Ee(zi),regexp:Ee(zi),escape:Ee(zi),color:Ee(zi),url:Ee(zi),keyword:ca,self:Ee(ca),null:Ee(ca),atom:Ee(ca),unit:Ee(ca),modifier:Ee(ca),operatorKeyword:Ee(ca),controlKeyword:Ee(ca),definitionKeyword:Ee(ca),moduleKeyword:Ee(ca),operator:oa,derefOperator:Ee(oa),arithmeticOperator:Ee(oa),logicOperator:Ee(oa),bitwiseOperator:Ee(oa),compareOperator:Ee(oa),updateOperator:Ee(oa),definitionOperator:Ee(oa),typeOperator:Ee(oa),controlOperator:Ee(oa),punctuation:kp,separator:Ee(kp),bracket:Jo,angleBracket:Ee(Jo),squareBracket:Ee(Jo),paren:Ee(Jo),brace:Ee(Jo),content:ha,heading:yr,heading1:Ee(yr),heading2:Ee(yr),heading3:Ee(yr),heading4:Ee(yr),heading5:Ee(yr),heading6:Ee(yr),contentSeparator:Ee(ha),list:Ee(ha),quote:Ee(ha),emphasis:Ee(ha),strong:Ee(ha),link:Ee(ha),monospace:Ee(ha),strikethrough:Ee(ha),inserted:Ee(),deleted:Ee(),changed:Ee(),invalid:Ee(),meta:Md,documentMeta:Ee(Md),annotation:Ee(Md),processingInstruction:Ee(Md),definition:bl.defineModifier("definition"),constant:bl.defineModifier("constant"),function:bl.defineModifier("function"),standard:bl.defineModifier("standard"),local:bl.defineModifier("local"),special:bl.defineModifier("special")};for(let n in Ae){let l=Ae[n];l instanceof bl&&(l.name=n)}F_([{tag:Ae.link,class:"tok-link"},{tag:Ae.heading,class:"tok-heading"},{tag:Ae.emphasis,class:"tok-emphasis"},{tag:Ae.strong,class:"tok-strong"},{tag:Ae.keyword,class:"tok-keyword"},{tag:Ae.atom,class:"tok-atom"},{tag:Ae.bool,class:"tok-bool"},{tag:Ae.url,class:"tok-url"},{tag:Ae.labelName,class:"tok-labelName"},{tag:Ae.inserted,class:"tok-inserted"},{tag:Ae.deleted,class:"tok-deleted"},{tag:Ae.literal,class:"tok-literal"},{tag:Ae.string,class:"tok-string"},{tag:Ae.number,class:"tok-number"},{tag:[Ae.regexp,Ae.escape,Ae.special(Ae.string)],class:"tok-string2"},{tag:Ae.variableName,class:"tok-variableName"},{tag:Ae.local(Ae.variableName),class:"tok-variableName tok-local"},{tag:Ae.definition(Ae.variableName),class:"tok-variableName tok-definition"},{tag:Ae.special(Ae.variableName),class:"tok-variableName2"},{tag:Ae.definition(Ae.propertyName),class:"tok-propertyName tok-definition"},{tag:Ae.typeName,class:"tok-typeName"},{tag:Ae.namespace,class:"tok-namespace"},{tag:Ae.className,class:"tok-className"},{tag:Ae.macroName,class:"tok-macroName"},{tag:Ae.propertyName,class:"tok-propertyName"},{tag:Ae.operator,class:"tok-operator"},{tag:Ae.comment,class:"tok-comment"},{tag:Ae.meta,class:"tok-meta"},{tag:Ae.invalid,class:"tok-invalid"},{tag:Ae.punctuation,class:"tok-punctuation"}]);const b1="modulepreload",_1=function(n,l){return new URL(n,l).href},Cb={},ct=function(l,r,c){let o=Promise.resolve();if(r&&r.length>0){let h=function(v){return Promise.all(v.map(j=>Promise.resolve(j).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),x=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(r.map(v=>{if(v=_1(v,c),v in Cb)return;Cb[v]=!0;const j=v.endsWith(".css"),y=j?'[rel="stylesheet"]':"";if(!!c)for(let E=p.length-1;E>=0;E--){const A=p[E];if(A.href===v&&(!j||A.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${v}"]${y}`))return;const N=document.createElement("link");if(N.rel=j?"stylesheet":b1,j||(N.as="script"),N.crossOrigin="",N.href=v,x&&N.setAttribute("nonce",x),document.head.appendChild(N),j)return new Promise((E,A)=>{N.addEventListener("load",E),N.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${v}`)))})}))}function u(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"&&u(p.reason);return l().catch(u)})},J_={js:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),cjs:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),mjs:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript(),jsx:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({jsx:!0}),ts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),mts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),cts:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0}),tsx:async()=>(await ct(async()=>{const{javascript:n}=await import("./index-aEpkBsNa.js");return{javascript:n}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).javascript({typescript:!0,jsx:!0}),json:async()=>(await ct(async()=>{const{json:n}=await import("./index-n7R3xkAJ.js");return{json:n}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),jsonc:async()=>(await ct(async()=>{const{json:n}=await import("./index-n7R3xkAJ.js");return{json:n}},__vite__mapDeps([6,1,2,3,4]),import.meta.url)).json(),css:async()=>(await ct(async()=>{const{css:n}=await import("./index-SnbL_sGM.js");return{css:n}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),scss:async()=>(await ct(async()=>{const{css:n}=await import("./index-SnbL_sGM.js");return{css:n}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),less:async()=>(await ct(async()=>{const{css:n}=await import("./index-SnbL_sGM.js");return{css:n}},__vite__mapDeps([7,1,2,3,4]),import.meta.url)).css(),html:async()=>(await ct(async()=>{const{html:n}=await import("./index-P-Bcy60v.js");return{html:n}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),htm:async()=>(await ct(async()=>{const{html:n}=await import("./index-P-Bcy60v.js");return{html:n}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),vue:async()=>(await ct(async()=>{const{html:n}=await import("./index-P-Bcy60v.js");return{html:n}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),svelte:async()=>(await ct(async()=>{const{html:n}=await import("./index-P-Bcy60v.js");return{html:n}},__vite__mapDeps([8,1,7,2,3,4,0,5]),import.meta.url)).html(),md:async()=>(await ct(async()=>{const{markdown:n}=await import("./index-CfBtWXkv.js");return{markdown:n}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),markdown:async()=>(await ct(async()=>{const{markdown:n}=await import("./index-CfBtWXkv.js");return{markdown:n}},__vite__mapDeps([9,3,4,2,5,8,1,7,0]),import.meta.url)).markdown(),py:async()=>(await ct(async()=>{const{python:n}=await import("./index-DkcdGFc4.js");return{python:n}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),pyi:async()=>(await ct(async()=>{const{python:n}=await import("./index-DkcdGFc4.js");return{python:n}},__vite__mapDeps([10,1,2,3,4,5]),import.meta.url)).python(),yaml:async()=>(await ct(async()=>{const{yaml:n}=await import("./index-OpaL2d_i.js");return{yaml:n}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),yml:async()=>(await ct(async()=>{const{yaml:n}=await import("./index-OpaL2d_i.js");return{yaml:n}},__vite__mapDeps([11,1,2,3,4]),import.meta.url)).yaml(),rs:async()=>(await ct(async()=>{const{rust:n}=await import("./index-CaVGDL0G.js");return{rust:n}},__vite__mapDeps([12,1,2,3,4]),import.meta.url)).rust(),c:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-Bt0SR_BE.js");return{cpp:n}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),h:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-Bt0SR_BE.js");return{cpp:n}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cc:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-Bt0SR_BE.js");return{cpp:n}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),cpp:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-Bt0SR_BE.js");return{cpp:n}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),hpp:async()=>(await ct(async()=>{const{cpp:n}=await import("./index-Bt0SR_BE.js");return{cpp:n}},__vite__mapDeps([13,1,2,3,4]),import.meta.url)).cpp(),java:async()=>(await ct(async()=>{const{java:n}=await import("./index-DdTtoxsO.js");return{java:n}},__vite__mapDeps([14,1,2,3,4]),import.meta.url)).java(),go:async()=>(await ct(async()=>{const{go:n}=await import("./index-C6yiLJP6.js");return{go:n}},__vite__mapDeps([15,1,2,3,4,5]),import.meta.url)).go(),php:async()=>(await ct(async()=>{const{php:n}=await import("./index-CckLujnN.js");return{php:n}},__vite__mapDeps([16,1,8,7,2,3,4,0,5]),import.meta.url)).php(),sql:async()=>(await ct(async()=>{const{sql:n}=await import("./index-DIt15fZq.js");return{sql:n}},__vite__mapDeps([17,2,3,4,1,5]),import.meta.url)).sql(),xml:async()=>(await ct(async()=>{const{xml:n}=await import("./index-BP4uDvBo.js");return{xml:n}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml(),svg:async()=>(await ct(async()=>{const{xml:n}=await import("./index-BP4uDvBo.js");return{xml:n}},__vite__mapDeps([18,1,2,3,4]),import.meta.url)).xml()},y1={".mcp.json":"json",dockerfile:"yaml",makefile:"yaml"},v1={javascript:"js",node:"js",typescript:"ts",python:"py",python3:"py",yml:"yaml",rust:"rs",golang:"go","c++":"cpp",cplusplus:"cpp"};async function j1(n){const l=v1[n.toLowerCase()]??n.toLowerCase(),r=J_[l];return r?r().catch(()=>null):null}async function w1(n){const l=(n.split("/").pop()??"").toLowerCase(),r=y1[l]??l.split(".").pop()??"",c=J_[r];return c?c().catch(()=>null):null}const N1=F_([{tag:[Ae.keyword,Ae.modifier,Ae.controlKeyword,Ae.moduleKeyword],class:"cmh-key"},{tag:[Ae.propertyName],class:"cmh-prop"},{tag:[Ae.function(Ae.variableName),Ae.labelName],class:"cmh-fn"},{tag:[Ae.color,Ae.constant(Ae.name),Ae.standard(Ae.name),Ae.bool],class:"cmh-const"},{tag:[Ae.typeName,Ae.className,Ae.changed,Ae.annotation,Ae.self,Ae.namespace],class:"cmh-type"},{tag:[Ae.number,Ae.integer,Ae.float],class:"cmh-num"},{tag:[Ae.string,Ae.special(Ae.string),Ae.regexp],class:"cmh-str"},{tag:[Ae.operator,Ae.operatorKeyword,Ae.escape],class:"cmh-op"},{tag:[Ae.meta,Ae.comment],class:"cmh-comment"},{tag:Ae.invalid,class:"cmh-invalid"}]);function Dd(n){return n.replace(/[&<>]/g,l=>l==="&"?"&amp;":l==="<"?"&lt;":"&gt;")}async function k1(n,l){const r=l?await j1(l):null;if(!r)return Dd(n);try{const c=r.language.parser.parse(n);let o="";return m1(n,c,N1,(u,h)=>{o+=h?`<span class="${h}">${Dd(u)}</span>`:Dd(u)},()=>{o+=`
118
+ `}),o}catch{return Dd(n)}}Ut.setOptions({gfm:!0,breaks:!1});function P_(n){var r;const l=(r=n.split(".").pop())==null?void 0:r.toLowerCase();return l==="md"||l==="markdown"}async function ff(n){const l=await Ut.parse(n,{async:!0,walkTokens:async r=>{if(r.type!=="code")return;const c=r;c.text=await k1(c.text,c.lang??""),c.escaped=!0}});return Kj.sanitize(l)}function Ab(n,l){return{path:n.path,text:n.content,saved:n.content,eol:n.eol,encoding:n.encoding,mtime:n.mtime,size:n.size,binary:n.binary,tooLarge:n.tooLarge,mediaMime:n.mediaMime,mediaTooLarge:n.mediaTooLarge,stale:!1,revision:l,previewMode:P_(n.path)}}function Fa(n){return!n.binary&&!n.tooLarge&&n.text!==n.saved}function S1(n){return n.split("/").pop()??n}function Ar(n){const l=n.lastIndexOf("/");return l===-1?"":n.slice(0,l)}function Jd(n){return n<1024?`${n} Б`:n<1024*1024?`${(n/1024).toFixed(1)} КБ`:`${(n/1024/1024).toFixed(1)} МБ`}function Ui({x:n,y:l,items:r,note:c,onClose:o}){const u=b.useRef(null),[h,p]=b.useState({left:n,top:l}),[g,x]=b.useState(()=>{const y=r.findIndex(T=>!T.disabled);return y===-1?0:y});b.useLayoutEffect(()=>{const y=u.current;if(!y)return;const T=y.getBoundingClientRect(),N=8,E=Math.max(N,Math.min(n,window.innerWidth-T.width-N)),A=Math.max(N,Math.min(l,window.innerHeight-T.height-N));p({left:E,top:A})},[n,l]),b.useLayoutEffect(()=>{var y;(y=u.current)==null||y.focus()},[]),b.useLayoutEffect(()=>{function y(N){var E;(E=u.current)!=null&&E.contains(N.target)||o()}function T(){o()}return document.addEventListener("mousedown",y),document.addEventListener("scroll",T,!0),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("scroll",T,!0)}},[o]);function v(y){y.disabled||(y.onSelect(),o())}function j(y){if(y.key==="Escape"){y.preventDefault(),y.stopPropagation(),o();return}const T=r.map((N,E)=>({item:N,index:E})).filter(N=>!N.item.disabled);if(T.length!==0){if(y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();const N=y.key==="ArrowDown"?1:-1,E=T.findIndex(D=>D.index===g),A=T[(((E===-1?0:E)+N)%T.length+T.length)%T.length];A&&x(A.index);return}if(y.key==="Enter"||y.key===" "){y.preventDefault();const N=r[g];N&&v(N)}}}return a.jsxs("div",{ref:u,className:"ctxmenu",style:{left:h.left,top:h.top},role:"menu",tabIndex:-1,onKeyDown:j,children:[c&&a.jsx("div",{className:"ctxmenu__note",children:c}),r.map((y,T)=>a.jsxs("button",{type:"button",role:"menuitem","aria-disabled":y.disabled,className:"ctxmenu__item"+(T===g?" is-cursor":""),onMouseEnter:()=>x(T),onClick:()=>v(y),children:[a.jsx("span",{className:"ctxmenu__label",children:y.label}),y.hint&&a.jsx("span",{className:"ctxmenu__hint",children:y.hint})]},y.id))]})}const E1=3500,T1=9e3,Rb=220;function Or({result:n,onDismiss:l}){const[r,c]=b.useState(n),[o,u]=b.useState(!1);if(b.useEffect(()=>{if(!n){c(null),u(!1);return}if(c(n),u(!1),n.url)return;const p=n.ok?E1:T1,g=setTimeout(()=>u(!0),p),x=setTimeout(()=>c(null),p+Rb);return()=>{clearTimeout(g),clearTimeout(x)}},[n]),!r)return null;const h=()=>{u(!0),setTimeout(()=>{c(null),l==null||l()},Rb)};return a.jsxs("div",{className:"oplog "+(r.ok?"oplog--ok":"oplog--bad")+(o?" oplog--leaving":"")+(r.url?" oplog--dismissible":""),role:"status","aria-live":r.ok?"polite":"assertive",children:[r.message,r.url&&a.jsxs("a",{className:"oplog__link",href:r.url,target:"_blank",rel:"noreferrer",onClick:p=>p.stopPropagation(),children:[r.url.replace(/^https?:\/\//,"")," ↗"]}),r.url&&l&&a.jsx("button",{type:"button",className:"oplog__dismiss",title:"Закрыть","aria-label":"Закрыть сообщение",onClick:h,children:"✕"})]})}function ga({value:n,className:l,placeholder:r="Название сессии",onCommit:c,onCancel:o}){const[u,h]=b.useState(n),p=b.useRef(null);b.useEffect(()=>{var x;(x=p.current)==null||x.select()},[]);function g(){const x=u.trim();if(!x||x===n)return o();c(x)}return a.jsx("input",{ref:p,className:l?`rename ${l}`:"rename",value:u,autoFocus:!0,spellCheck:!1,placeholder:r,onChange:x=>h(x.target.value),onBlur:g,onKeyDown:x=>{x.stopPropagation(),x.key==="Enter"?(x.preventDefault(),g()):x.key==="Escape"&&(x.preventDefault(),o())}})}function Fc({active:n}){return n?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 5h3V2"}),a.jsx("path",{d:"M14 5h-3V2"}),a.jsx("path",{d:"M2 11h3v3"}),a.jsx("path",{d:"M14 11h-3v3"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2H2v3"}),a.jsx("path",{d:"M11 2h3v3"}),a.jsx("path",{d:"M2 11v3h3"}),a.jsx("path",{d:"M14 11v3h-3"})]})}const C1=500,vr="application/x-ccv-fs-path",A1=200;function R1({open:n,tree:l,expanded:r,activePath:c,dirty:o,gitChanges:u,result:h,searchResult:p,onSearch:g,onReveal:x,onToggle:v,onOpen:j,onCreate:y,onRename:T,onMove:N,onCopy:E,onDelete:A,onRefresh:D,onClose:q,zoomed:Q,onToggleZoom:z}){const[U,O]=b.useState(""),[I,V]=b.useState(null),[R,L]=b.useState(null),[G,se]=b.useState(null),[ve,je]=b.useState(null),[we,F]=b.useState(null),[$,ne]=b.useState(null),pe=of("(hover: hover)"),Ne=b.useRef(null),S=b.useMemo(()=>O1(u),[u]);function Z(ae){return!(!G||ae===G.path||G.kind==="dir"&&ae.startsWith(`${G.path}/`)||ae===Ar(G.path))}function de(ae){return!(!we||ae===we.path||we.kind==="dir"&&ae.startsWith(`${we.path}/`)||we.mode==="cut"&&ae===Ar(we.path))}function be(ae){F({path:ae.path,kind:ae.kind,mode:"copy"})}function Me(ae){F({path:ae.path,kind:ae.kind,mode:"cut"})}function Ie(ae){!we||!de(ae)||(ae&&!r.has(ae)&&v(ae),we.mode==="cut"?(N(we.path,ae),F(null)):E(we.path,ae))}function Ke(ae,_e){const qe=ae.touches[0];if(!qe)return;const it={timer:0,x:qe.clientX,y:qe.clientY,el:ae.currentTarget,fired:!1};it.timer=window.setTimeout(()=>{it.fired=!0,_e(it.x,it.y,it.el)},C1),Ne.current=it}function ce(ae){const _e=Ne.current,qe=ae.touches[0];!_e||!qe||Math.hypot(qe.clientX-_e.x,qe.clientY-_e.y)>10&&(window.clearTimeout(_e.timer),Ne.current=null)}function Ue(ae){const _e=Ne.current;_e&&(window.clearTimeout(_e.timer),_e.fired&&ae.preventDefault())}function ge(){var ae;return(ae=Ne.current)!=null&&ae.fired?(Ne.current=null,!0):!1}function Ze(ae,_e,qe,it){O((it==null?void 0:it.path)??""),ne({x:ae,y:_e,opener:qe,entry:it})}function dt(){const ae=$==null?void 0:$.opener;ne(null),ae!=null&&ae.isConnected&&ae.focus()}function lt(ae){return{onContextMenu:_e=>{_e.preventDefault(),Ze(_e.clientX,_e.clientY,_e.currentTarget,ae)},onTouchStart:_e=>Ke(_e,(qe,it,Pe)=>Ze(qe,it,Pe,ae)),onTouchMove:ce,onTouchEnd:Ue,onTouchCancel:Ue}}function gt(ae){ae.target===ae.currentTarget&&(ae.preventDefault(),Ze(ae.clientX,ae.clientY,ae.currentTarget,null))}function et(ae){ae.target===ae.currentTarget&&Ke(ae,(_e,qe,it)=>Ze(_e,qe,it,null))}function Tt(ae){if(!(ae.ctrlKey||ae.metaKey)||ae.target instanceof HTMLInputElement)return;const _e=ae.key.toLowerCase();if(_e==="v"){ae.preventDefault(),Ie(Dn());return}if(!U)return;const qe=Mb(l,U);qe&&(_e==="c"?(ae.preventDefault(),be(qe)):_e==="x"&&(ae.preventDefault(),Me(qe)))}function ee(ae){return _e=>{_e.dataTransfer.effectAllowed="move",_e.dataTransfer.setData(vr,ae.path),se({path:ae.path,kind:ae.kind})}}function tt(){se(null),je(null)}function Fe(ae){return _e=>{_e.dataTransfer.types.includes(vr)&&(_e.stopPropagation(),!(ae.kind!=="dir"||!Z(ae.path))&&(_e.preventDefault(),je(ae.path)))}}function $e(ae){return _e=>{if(!_e.dataTransfer.types.includes(vr)||(_e.stopPropagation(),ae.kind!=="dir"||!Z(ae.path)))return;_e.preventDefault();const qe=_e.dataTransfer.getData(vr);je(null),qe&&N(qe,ae.path)}}function Je(ae){!ae.dataTransfer.types.includes(vr)||!Z("")||(ae.preventDefault(),je(""))}function Qe(ae){if(!ae.dataTransfer.types.includes(vr)||!Z(""))return;ae.preventDefault();const _e=ae.dataTransfer.getData(vr);je(null),_e&&N(_e,"")}const[ft,De]=b.useState(""),wt=ft.trim(),Nt=wt.length>0,Ht=b.useRef(null),Kt=b.useRef(g);Kt.current=g;function kt(ae){De(ae),Ht.current&&clearTimeout(Ht.current);const _e=ae.trim();if(!_e){Kt.current("");return}Ht.current=setTimeout(()=>Kt.current(_e),A1)}function ot(ae){Ht.current&&clearTimeout(Ht.current),De(""),Kt.current(""),O(ae.path),x(ae)}const wn=Nt&&(p==null?void 0:p.query)===wt?p:null;function Dn(){if(U==="")return"";const ae=Mb(l,U);if((ae==null?void 0:ae.kind)==="dir")return U;const _e=U.lastIndexOf("/");return _e===-1?"":U.slice(0,_e)}function ln(ae,_e){const qe=_e??Dn();qe&&!r.has(qe)&&v(qe),L({parent:qe,kind:ae})}function $t(){if(!$)return[];const ae=it=>pe?it:void 0;if(!$.entry)return[{id:"paste",label:"Вставить в корень проекта",hint:ae("Ctrl+V"),disabled:!de(""),onSelect:()=>Ie("")},{id:"new-file",label:"Создать файл",onSelect:()=>ln("file","")},{id:"new-dir",label:"Создать каталог",onSelect:()=>ln("dir","")}];const _e=$.entry,qe=[_e.kind==="file"?{id:"open",label:"Открыть",onSelect:()=>j(_e.path)}:{id:"toggle",label:r.has(_e.path)?"Свернуть":"Развернуть",onSelect:()=>v(_e.path)},{id:"copy",label:"Копировать",hint:ae("Ctrl+C"),onSelect:()=>be(_e)},{id:"cut",label:"Вырезать",hint:ae("Ctrl+X"),onSelect:()=>Me(_e)}];return _e.kind==="dir"&&(qe.push({id:"paste",label:"Вставить",hint:ae("Ctrl+V"),disabled:!de(_e.path),onSelect:()=>Ie(_e.path)}),qe.push({id:"new-file",label:"Создать файл",onSelect:()=>ln("file",_e.path)}),qe.push({id:"new-dir",label:"Создать каталог",onSelect:()=>ln("dir",_e.path)})),qe.push({id:"rename",label:"Переименовать",onSelect:()=>V(_e.path)}),qe.push({id:"delete",label:"Удалить",onSelect:()=>A(_e)}),qe}const hn=Nt?[]:yt("",0);function yt(ae,_e){const qe=l[ae],it=[];if(R&&R.parent===ae&&it.push(a.jsxs("div",{className:"fsrow fsrow--draft",style:Ja(_e),children:[a.jsx("span",{className:"fsrow__icon",children:R.kind==="dir"?a.jsx(lf,{}):a.jsx(af,{})}),a.jsx(ga,{className:"rename--file",value:"",placeholder:R.kind==="dir"?"имя каталога":"имя файла",onCommit:Pe=>{L(null),y(ae,R.kind,Pe)},onCancel:()=>L(null)})]},`draft:${ae}`)),!qe)return it.push(a.jsx("p",{className:"fsrow__pending",style:Ja(_e),children:"читаем…"},`wait:${ae}`)),it;qe.length===0&&!R&&it.push(a.jsx("p",{className:"fsrow__pending",style:Ja(_e),children:"пусто"},`empty:${ae}`));for(const Pe of qe){const Zt=Pe.kind==="dir"&&r.has(Pe.path);it.push(I===Pe.path?a.jsxs("div",{className:"fsrow fsrow--draft",style:Ja(_e),children:[a.jsx("span",{className:"fsrow__icon",children:Pe.kind==="dir"?a.jsx(lf,{open:Zt}):a.jsx(af,{})}),a.jsx(ga,{className:"rename--file",value:Pe.name,placeholder:"новое имя",onCommit:K=>{V(null),T(Pe.path,K)},onCancel:()=>V(null)})]},Pe.path):a.jsx(M1,{entry:Pe,depth:_e,open:Zt,active:Pe.path===c,selected:Pe.path===U,dirty:o.has(Pe.path),gitStatus:S.get(Pe.path),dragging:(G==null?void 0:G.path)===Pe.path,dropTarget:ve===Pe.path,cut:(we==null?void 0:we.mode)==="cut"&&we.path===Pe.path,onClick:()=>{ge()||(O(Pe.path),Pe.kind==="dir"?v(Pe.path):j(Pe.path))},onRename:()=>V(Pe.path),onDelete:()=>A(Pe),onDragStart:ee(Pe),onDragEnd:tt,onDragOver:Fe(Pe),onDrop:$e(Pe),...lt(Pe)},Pe.path)),Zt&&it.push(...yt(Pe.path,_e+1))}return it}function Wn(){if(!wn)return[a.jsx("p",{className:"fsrow__pending",style:Ja(0),children:"ищем…"},"search:wait")];if(wn.entries.length===0)return[a.jsx("p",{className:"fsrow__pending",style:Ja(0),children:"ничего не найдено"},"search:empty")];const ae=wn.entries.map(_e=>a.jsx(D1,{entry:_e,gitStatus:S.get(_e.path),onClick:()=>ot(_e)},_e.path));return wn.truncated&&ae.push(a.jsxs("p",{className:"fsrow__pending",style:Ja(0),children:["показаны первые ",wn.entries.length," — уточните запрос"]},"search:truncated")),ae}return a.jsxs("aside",{className:(n?"sidepane sidepane--files sidepane--open":"sidepane sidepane--files")+(Q?" sidepane--zoomed":""),"aria-label":"Файлы проекта",onKeyDown:Tt,children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:ae=>{z&&(ae.target.closest("button")||z())},children:[a.jsx(U1,{}),a.jsx("span",{className:"sidepane__title",children:"Файлы"}),a.jsx("button",{className:"sidepane__btn",title:"Новый файл","aria-label":"Новый файл",onClick:()=>ln("file"),children:a.jsx(z1,{})}),a.jsx("button",{className:"sidepane__btn",title:"Новый каталог","aria-label":"Новый каталог",onClick:()=>ln("dir"),children:a.jsx(I1,{})}),a.jsx("button",{className:"sidepane__btn",title:"Перечитать дерево","aria-label":"Перечитать дерево",onClick:D,children:"↻"}),z&&a.jsx("button",{className:"sidepane__btn",title:Q?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":Q?"Свернуть панель файлов":"Развернуть панель файлов на весь экран","aria-pressed":Q,onClick:z,children:a.jsx(Fc,{active:Q})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель файлов",onClick:q,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(H1,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:ft,spellCheck:!1,placeholder:"Поиск файлов и папок…","aria-label":"Поиск файлов и папок",onChange:ae=>kt(ae.target.value),onKeyDown:ae=>{ae.stopPropagation(),ae.key==="Escape"&&(ae.preventDefault(),ft?kt(""):ae.currentTarget.blur())}}),ft&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>kt(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree"+(ve===""?" fstree--drop-target":""),tabIndex:-1,onDragOver:Je,onDrop:Qe,onContextMenu:gt,onTouchStart:et,onTouchMove:ce,onTouchEnd:Ue,onTouchCancel:Ue,children:Nt?Wn():hn}),a.jsx(Or,{result:h}),$&&a.jsx(Ui,{x:$.x,y:$.y,items:$t(),onClose:dt})]})}function M1({entry:n,depth:l,open:r,active:c,selected:o,dirty:u,gitStatus:h,dragging:p,dropTarget:g,cut:x,onClick:v,onRename:j,onDelete:y,onDragStart:T,onDragEnd:N,onDragOver:E,onDrop:A,onContextMenu:D,onTouchStart:q,onTouchMove:Q,onTouchEnd:z,onTouchCancel:U}){const O="fsrow"+(c?" is-open":"")+(o&&!c?" is-selected":"")+(n.ignored?" fsrow--ignored":"")+(p?" fsrow--dragging":"")+(g?" fsrow--drop-target":"")+(x?" fsrow--cut":"");return a.jsxs("div",{className:O,style:Ja(l),draggable:!0,onDragStart:T,onDragEnd:N,onDragOver:E,onDrop:A,onContextMenu:D,onTouchStart:q,onTouchMove:Q,onTouchEnd:z,onTouchCancel:U,children:[a.jsxs("button",{className:"fsrow__main",onClick:v,title:W_(n),children:[a.jsx("span",{className:"fsrow__icon"+sf("fsrow__icon",h),children:n.kind==="dir"?a.jsx(lf,{open:r}):a.jsx(af,{})}),a.jsx("span",{className:"fsrow__name"+sf("fsrow__name",h),children:n.name}),n.ignored&&a.jsx("span",{className:"fsrow__tag",title:"Игнорируется git (.gitignore)",children:"git-ignore"}),u&&a.jsx("span",{className:"fsrow__dot",title:"Есть несохранённые правки"})]}),a.jsx("button",{className:"fsrow__act",title:"Переименовать","aria-label":`Переименовать ${n.name}`,onClick:j,children:"✎"}),a.jsx("button",{className:"fsrow__act",title:"Удалить","aria-label":`Удалить ${n.name}`,onClick:y,children:"✕"})]})}function D1({entry:n,gitStatus:l,onClick:r}){const c=n.path.slice(0,n.path.length-n.name.length-1);return a.jsxs("button",{className:"fsrow fsrow--search"+(n.ignored?" fsrow--ignored":""),style:Ja(0),onClick:r,title:W_(n),children:[a.jsx("span",{className:"fsrow__icon"+sf("fsrow__icon",l),children:n.kind==="dir"?a.jsx(lf,{}):a.jsx(af,{})}),a.jsx("span",{className:"fsrow__name"+sf("fsrow__name",l),children:n.name}),n.ignored&&a.jsx("span",{className:"fsrow__tag",children:"git-ignore"}),c&&a.jsx("span",{className:"fsrow__path",children:c})]})}function W_(n){return n.ignored?`${n.path} — игнорируется git (.gitignore)`:n.path}function Ja(n){return{"--depth":n}}function Mb(n,l){var o;const r=l.lastIndexOf("/"),c=r===-1?"":l.slice(0,r);return((o=n[c])==null?void 0:o.find(u=>u.path===l))??null}function O1(n){const l=new Map,r={added:1,modified:2},c=(o,u)=>{const h=l.get(o);(!h||r[u]>r[h])&&l.set(o,u)};for(const o of n){const u=L1(o.status);if(!u)continue;c(o.path,u);let h=Ar(o.path);for(;c(h,u),!!h;)h=Ar(h)}return l}function L1(n){if(n==="??")return"added";const[l="",r=""]=n;return l==="A"||l==="R"||l==="C"?"added":l==="M"||r==="M"?"modified":null}function sf(n,l){return l?` ${n}--git-${l}`:""}function lf({open:n=!1}){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:n?a.jsx("path",{d:"M2 12.5V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h4.4a.7.7 0 0 1 .7.7v1.2M2 12.5l1.7-4.6a.7.7 0 0 1 .66-.46h9.2a.5.5 0 0 1 .47.66L12.4 12.5Z"}):a.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})})}function af(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]})}function z1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsxs("g",{transform:"translate(-1.3,-1.6) scale(0.78)",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 2H4.4a.7.7 0 0 0-.7.7v10.6a.7.7 0 0 0 .7.7h7.2a.7.7 0 0 0 .7-.7V5.2Z"}),a.jsx("path",{d:"M9 2v3.2h3.3"})]}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function I1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,"aria-hidden":"true",children:[a.jsx("g",{transform:"translate(-1.3,-1.6) scale(0.78)",children:a.jsx("path",{d:"M2 12.4V4.2a.7.7 0 0 1 .7-.7h3.1l1.5 1.6h5.9a.7.7 0 0 1 .7.7v6.6a.7.7 0 0 1-.7.7H2.7a.7.7 0 0 1-.7-.7Z"})}),a.jsx("path",{d:"M12.2 10.3v3.8M10.3 12.2h3.8",strokeLinecap:"round"})]})}function U1(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),a.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function H1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}const B1=200;function q1({open:n,result:l,onSearch:r,onOpenMatch:c,onClose:o,zoomed:u,onToggleZoom:h}){const[p,g]=b.useState(""),x=p.trim(),v=x.length>0,j=b.useRef(null),y=b.useRef(r);y.current=r;function T(A){g(A),j.current&&clearTimeout(j.current);const D=A.trim();if(!D){y.current("");return}j.current=setTimeout(()=>y.current(D),B1)}const N=v&&(l==null?void 0:l.query)===x?l:null;function E(){if(!N)return[a.jsx("p",{className:"fsrow__pending",children:"ищем…"},"grep:wait")];if(N.matches.length===0)return[a.jsx("p",{className:"fsrow__pending",children:"ничего не найдено"},"grep:empty")];const A=[];let D="";for(const q of N.matches)q.path!==D&&(D=q.path,A.push(a.jsx("p",{className:"searchgroup__path",title:q.path,children:q.path},`path:${q.path}`))),A.push(a.jsx(G1,{match:q,onClick:()=>c(q)},`${q.path}:${q.line}:${q.column}`));return N.truncated&&A.push(a.jsxs("p",{className:"fsrow__pending",children:["показаны первые ",N.matches.length," — уточните запрос"]},"grep:truncated")),A}return a.jsxs("aside",{className:(n?"sidepane sidepane--search sidepane--open":"sidepane sidepane--search")+(u?" sidepane--zoomed":""),"aria-label":"Поиск по тексту в проекте",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:A=>{h&&(A.target.closest("button")||h())},children:[a.jsx($1,{}),a.jsx("span",{className:"sidepane__title",children:"Поиск по тексту"}),h&&a.jsx("button",{className:"sidepane__btn",title:u?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":u?"Свернуть панель поиска":"Развернуть панель поиска на весь экран","aria-pressed":u,onClick:h,children:a.jsx(Fc,{active:u})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель поиска",onClick:o,children:"✕"})]}),a.jsxs("div",{className:"fssearch",children:[a.jsx(Y1,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:p,spellCheck:!1,placeholder:"Поиск по тексту во всех файлах…","aria-label":"Поиск по тексту во всех файлах",onChange:A=>T(A.target.value),onKeyDown:A=>{A.stopPropagation(),A.key==="Escape"&&(A.preventDefault(),p?T(""):A.currentTarget.blur())}}),p&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>T(""),children:"✕"})]}),a.jsx("div",{className:"sidepane__scroll fstree",children:v?E():a.jsx("p",{className:"sidepane__empty",children:"Введите текст, чтобы найти его во всех файлах проекта."})})]})}function G1({match:n,onClick:l}){const r=n.lineText.slice(0,n.column-1),c=n.lineText.slice(n.column-1,n.column-1+n.matchLength),o=n.lineText.slice(n.column-1+n.matchLength);return a.jsxs("button",{className:"searchmatch",onClick:l,title:`${n.path}:${n.line}`,children:[a.jsx("span",{className:"searchmatch__line",children:n.line}),a.jsxs("span",{className:"searchmatch__text",children:[r,a.jsx("mark",{children:c}),o]})]})}function $1(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.8",cy:"6.8",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1"})]})}function Y1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}let Od=null;function V1(){return Od||(Od=Promise.all([ct(()=>import("./index-DP1WFH_k.js"),__vite__mapDeps([19,4,3,2,20,5]),import.meta.url),ct(()=>import("./index-891wE-Rj.js").then(n=>n.v),__vite__mapDeps([4,3]),import.meta.url),ct(()=>import("./index-BHot-lnj.js"),[],import.meta.url),ct(()=>import("./index-CB9Ecmwu.js"),__vite__mapDeps([20,3,4,2]),import.meta.url),ct(()=>import("./codemirror-Jn-nlEEo.js"),__vite__mapDeps([21,2,3,4]),import.meta.url)]).then(([n,l,r,c,o])=>({EditorView:l.EditorView,EditorState:r.EditorState,Compartment:r.Compartment,EditorSelection:r.EditorSelection,Prec:r.Prec,keymap:l.keymap,indentWithTab:c.indentWithTab,basicSetup:n.basicSetup,editorTheme:o.editorTheme,editorHighlight:o.editorHighlight})).catch(n=>{throw Od=null,n})),Od}function X1({path:n,doc:l,revision:r,goto:c,onChange:o,onSave:u}){const h=b.useRef(null),p=b.useRef(null),g=b.useRef(null),x=b.useRef(new Map),v=b.useRef(new Map),j=b.useRef(new Set),y=b.useRef(null),T=b.useRef(o),N=b.useRef(u),E=b.useRef(n),A=b.useRef(r),D=b.useRef(l);T.current=o,N.current=u,E.current=n,A.current=r,D.current=l;const[q,Q]=b.useState("loading"),[z,U]=b.useState(!1);function O(V,R,L,G,se){const ve=x.current.get(G),je=v.current.get(G)===se;if(ve&&je)L.setState(ve);else{const F=V.EditorState.create({doc:D.current,extensions:[V.basicSetup,V.Prec.highest(V.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(N.current(E.current),!0)}])),V.keymap.of([V.indentWithTab]),R.of([]),V.editorTheme,V.editorHighlight,V.EditorView.updateListener.of($=>{$.docChanged&&T.current(E.current,$.state.doc.toString())})]});x.current.set(G,F),v.current.set(G,se),L.setState(F),j.current.delete(G)}if(j.current.has(G))return()=>{};let we=!1;return w1(G).then(F=>{we||!F||E.current!==G||(L.dispatch({effects:R.reconfigure(F)}),x.current.set(G,L.state),j.current.add(G))}),()=>{we=!0}}b.useEffect(()=>{if(!h.current)return;let R=!1,L=null,G=null;Q("loading"),U(!1);const se=window.setTimeout(()=>{R||U(!0)},200);return(async()=>{let ve;try{ve=await V1()}catch{window.clearTimeout(se),R||Q("error");return}if(R||!h.current)return;window.clearTimeout(se);const je=new ve.Compartment;y.current=je,g.current=ve,G=new ve.EditorView({parent:h.current}),p.current=G,L=O(ve,je,G,E.current,A.current),Q("ready")})(),()=>{R=!0,window.clearTimeout(se),L==null||L(),G==null||G.destroy(),p.current===G&&(p.current=null),g.current=null,y.current=null}},[]),b.useEffect(()=>{const V=g.current,R=p.current,L=y.current;if(!(!V||!R||!L))return O(V,L,R,n,r)},[n,r]);const I=b.useRef(0);return b.useEffect(()=>{const V=p.current,R=g.current;if(!V||!R||!c||c.token===I.current)return;I.current=c.token;const L=V.state.doc.lines,G=Math.min(Math.max(c.line,1),L),se=V.state.doc.line(G),ve=Math.min(se.from+Math.max(c.column-1,0),se.to);V.dispatch({selection:R.EditorSelection.cursor(ve),effects:R.EditorView.scrollIntoView(ve,{y:"center"})}),V.focus()},[c]),b.useEffect(()=>()=>{const V=p.current;V&&x.current.set(n,V.state)},[n]),a.jsxs("div",{className:"editor__code",children:[a.jsx("div",{ref:h,className:"editor__code-surface"+(q==="ready"?"":" is-hidden")}),q==="loading"&&z&&a.jsxs("div",{className:"editor__state work",role:"status",children:[a.jsxs("div",{className:"work__dots",children:[a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"})]}),a.jsx("span",{className:"work__label",children:"Загружается редактор…"})]}),q==="error"&&a.jsxs("div",{className:"editor__fallback",children:[a.jsxs("div",{className:"editor__fallback-banner",role:"alert",children:[a.jsx("span",{children:"Редактор не загрузился — ниже только просмотр, без сохранения правок."}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]}),a.jsx("pre",{className:"editor__fallback-text",children:l})]})]})}function _l({value:n,options:l,onChange:r,className:c,title:o,ariaLabel:u,placeholder:h="—"}){const[p,g]=b.useState(!1),[x,v]=b.useState(0),j=b.useRef(null),y=b.useRef(null),T=l.find(A=>A.value===n)??null;b.useEffect(()=>{if(!p)return;const A=l.findIndex(D=>D.value===n);v(A===-1?0:A)},[p]),b.useEffect(()=>{if(!p)return;function A(D){var q;(q=j.current)!=null&&q.contains(D.target)||g(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[p]),b.useEffect(()=>{var A,D;p&&((D=(A=y.current)==null?void 0:A.querySelector(".is-cursor"))==null||D.scrollIntoView({block:"nearest"}))},[p,x]),b.useEffect(()=>{if(!p)return;const A=y.current,D=Q1(j.current);if(!A||!D)return;const q=A.getBoundingClientRect().bottom-D.getBoundingClientRect().bottom;q>0&&(D.scrollTop+=Math.min(q+8,A.offsetHeight))},[p]);function N(A){g(!1),A.value!==n&&r(A.value)}function E(A){if(A.key==="Escape"){if(!p)return;A.preventDefault(),A.stopPropagation(),g(!1);return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),!p)return g(!0);const D=A.key==="ArrowDown"?1:l.length-1;return v(q=>(q+D)%l.length)}if(A.key==="Enter"||A.key===" "){if(A.preventDefault(),!p)return g(!0);const D=l[x];D&&N(D)}}return a.jsxs("div",{ref:j,className:"select"+(p?" select--open":"")+(c?` ${c}`:""),children:[a.jsxs("button",{type:"button",className:"select__trigger",title:o,"aria-label":u??o,"aria-haspopup":"listbox","aria-expanded":p,onClick:()=>g(A=>!A),onKeyDown:E,children:[a.jsx("span",{className:"select__value",children:(T==null?void 0:T.label)??h}),a.jsx(K1,{})]}),p&&a.jsx("div",{ref:y,className:"select__menu",role:"listbox","aria-label":u??o,children:l.map((A,D)=>a.jsxs("button",{type:"button",role:"option","aria-selected":A.value===n,className:"select__option"+(D===x?" is-cursor":"")+(A.value===n?" is-on":""),onMouseEnter:()=>v(D),onClick:()=>N(A),children:[a.jsx("span",{className:"select__check","aria-hidden":"true",children:A.value===n?"✓":""}),a.jsx("span",{className:"select__label",children:A.label}),A.hint&&a.jsx("span",{className:"select__hint",children:A.hint})]},A.value))})]})}function Q1(n){let l=(n==null?void 0:n.parentElement)??null;for(;l;){if(l.scrollHeight>l.clientHeight&&getComputedStyle(l).overflowY!=="visible")return l;l=l.parentElement}return null}function K1(){return a.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Z1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M6.6 4.6v4M4.6 6.6h4"})]})}function F1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"6.6",cy:"6.6",r:"4.3"}),a.jsx("path",{d:"M9.7 9.7 14 14"}),a.jsx("path",{d:"M4.6 6.6h4"})]})}function J1(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7"}),a.jsx("path",{d:"M13 2.5v3.3h-3.3"})]})}function P1({path:n,mime:l,base64:r,error:c,tooLarge:o,size:u,onRequestMedia:h}){b.useEffect(()=>{!o&&r===void 0&&c===void 0&&h(n)},[]);const p=W1(r,l);return o?a.jsx("div",{className:"mediaview mediaview--message",children:a.jsxs("p",{className:"mediaview__error",children:["Файл слишком велик для просмотра (",Jd(u),"). Лимит — 64 МБ."]})}):c?a.jsxs("div",{className:"mediaview mediaview--message",role:"alert",children:[a.jsx("p",{className:"mediaview__error",children:c}),a.jsx("button",{className:"btn btn--sm btn--primary",onClick:()=>h(n),children:"Повторить"})]}):p?l.startsWith("image/")?a.jsx(tw,{url:p}):l.startsWith("video/")?a.jsx(sw,{url:p}):null:a.jsxs("div",{className:"mediaview mediaview--message",role:"status",children:[a.jsx("div",{className:"mediaview__progress",children:a.jsx("div",{className:"mediaview__progress-fill"})}),a.jsx("span",{className:"mediaview__label",children:"Загружается…"})]})}function W1(n,l){const[r,c]=b.useState(null);return b.useEffect(()=>{if(n===void 0){c(null);return}const o=atob(n),u=new Uint8Array(o.length);for(let p=0;p<o.length;p++)u[p]=o.charCodeAt(p);const h=URL.createObjectURL(new Blob([u],{type:l}));return c(h),()=>URL.revokeObjectURL(h)},[n,l]),r}const Oi=1,ey=8,Ld=1.25;function ew(n){return Math.min(ey,Math.max(Oi,n))}function tw({url:n}){const[l,r]=b.useState({scale:Oi,x:0,y:0}),[c,o]=b.useState(!1),u=b.useRef(null),h=b.useRef(null);function p(T,N,E){r(A=>{const D=ew(A.scale*T);if(D===A.scale)return A;if(D<=Oi)return{scale:Oi,x:0,y:0};const q=(N-A.x)/A.scale,Q=(E-A.y)/A.scale;return{scale:D,x:N-D*q,y:E-D*Q}})}b.useEffect(()=>{const T=u.current;if(!T)return;function N(E){E.preventDefault();const A=T.getBoundingClientRect(),D=E.clientX-A.left-A.width/2,q=E.clientY-A.top-A.height/2;p(E.deltaY<0?Ld:1/Ld,D,q)}return T.addEventListener("wheel",N,{passive:!1}),()=>T.removeEventListener("wheel",N)},[]);function g(T){l.scale<=Oi||(T.currentTarget.setPointerCapture(T.pointerId),h.current={pointerId:T.pointerId,startX:T.clientX,startY:T.clientY,origX:l.x,origY:l.y},o(!0))}function x(T){const N=h.current;!N||N.pointerId!==T.pointerId||r(E=>({...E,x:N.origX+(T.clientX-N.startX),y:N.origY+(T.clientY-N.startY)}))}function v(){h.current=null,o(!1)}const j=l.scale>Oi,y=!j&&l.x===0&&l.y===0;return a.jsxs("div",{className:"mediaview mediaview--image",children:[a.jsx("div",{ref:u,className:"mediaview__stage"+(j?c?" is-dragging":" is-zoomed":""),onPointerDown:g,onPointerMove:x,onPointerUp:v,onPointerCancel:v,children:a.jsx("img",{src:n,alt:"",className:"mediaview__image",draggable:!1,style:{transform:`translate(${l.x}px, ${l.y}px) scale(${l.scale})`}})}),a.jsxs("div",{className:"mediaview__toolbar",children:[a.jsx("button",{className:"btn btn--sm",disabled:l.scale<=Oi,title:"Уменьшить","aria-label":"Уменьшить",onClick:()=>p(1/Ld,0,0),children:a.jsx(F1,{})}),a.jsxs("span",{className:"mediaview__zoomlabel",children:[Math.round(l.scale*100),"%"]}),a.jsx("button",{className:"btn btn--sm",disabled:l.scale>=ey,title:"Увеличить","aria-label":"Увеличить",onClick:()=>p(Ld,0,0),children:a.jsx(Z1,{})}),a.jsx("button",{className:"btn btn--sm",disabled:y,title:"Вписать в окно","aria-label":"Сбросить масштаб — вписать в окно",onClick:()=>r({scale:Oi,x:0,y:0}),children:a.jsx(J1,{})})]})]})}const nw=[{value:"0.5",label:"0.5×"},{value:"0.75",label:"0.75×"},{value:"1",label:"1× — обычная"},{value:"1.25",label:"1.25×"},{value:"1.5",label:"1.5×"},{value:"2",label:"2×"}];function sw({url:n}){const l=b.useRef(null),[r,c]=b.useState("1");return b.useEffect(()=>{l.current&&(l.current.playbackRate=Number(r))},[r]),a.jsxs("div",{className:"mediaview mediaview--video",children:[a.jsx("video",{ref:l,className:"mediaview__video",src:n,controls:!0}),a.jsxs("div",{className:"mediaview__speedbar",children:[a.jsx("span",{className:"mediaview__speedlabel",children:"Скорость"}),a.jsx(_l,{className:"mediaview__speedselect",value:r,onChange:c,ariaLabel:"Скорость воспроизведения",options:nw})]})]})}function lw({file:n,goto:l,onChange:r,onSave:c,onReload:o,onOverwrite:u,onRequestMedia:h,onTogglePreview:p}){const g=Fa(n),x=P_(n.path)&&!n.binary&&!n.tooLarge;return a.jsxs("div",{className:"editor",children:[a.jsxs("div",{className:"editor__bar",children:[a.jsx("span",{className:"editor__path",title:n.path,children:n.path}),a.jsxs("span",{className:"editor__meta",children:[Jd(n.size),n.eol==="crlf"&&" · CRLF"]}),x&&a.jsxs("div",{className:"editor__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[a.jsx("button",{className:"btn btn--sm"+(n.previewMode?" is-on":""),role:"tab","aria-selected":n.previewMode,onClick:()=>!n.previewMode&&p(n.path),children:"Просмотр"}),a.jsx("button",{className:"btn btn--sm"+(n.previewMode?"":" is-on"),role:"tab","aria-selected":!n.previewMode,onClick:()=>n.previewMode&&p(n.path),children:"Код"})]}),a.jsx("button",{className:"btn btn--sm",disabled:!g,title:"Сохранить (Ctrl+S)",onClick:()=>c(n.path),children:g?"Сохранить":"Сохранено"})]}),n.stale&&a.jsxs("div",{className:"editor__warn",children:[a.jsxs("span",{children:["Файл изменился на диске",g?" — а здесь есть несохранённые правки.":"."]}),a.jsx("button",{className:"btn btn--sm",onClick:()=>o(n.path),children:"Взять с диска"}),g&&a.jsx("button",{className:"btn btn--sm btn--danger",onClick:()=>u(n.path),children:"Сохранить поверх"})]}),n.binary&&n.mediaMime?a.jsx(P1,{path:n.path,mime:n.mediaMime,base64:n.mediaBase64,error:n.mediaError,tooLarge:n.mediaTooLarge,size:n.size,onRequestMedia:h},n.path):n.binary?a.jsxs("p",{className:"editor__empty",children:["Это не текстовый файл — редактировать его здесь нечем. ",Jd(n.size)," на диске."]}):n.tooLarge?a.jsxs("p",{className:"editor__empty",children:["Файл слишком велик для редактора (",Jd(n.size),"). Такие правит агент, а не браузер."]}):x&&n.previewMode?a.jsx(aw,{text:n.text}):a.jsx(X1,{path:n.path,doc:n.text,revision:n.revision,goto:l,onChange:r,onSave:c})]})}function aw({text:n}){const[l,r]=b.useState("");return b.useEffect(()=>{let c=!1;return ff(n).then(o=>{c||r(o)}),()=>{c=!0}},[n]),a.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:l}})}function iw({files:n,activePath:l,busy:r,onSelect:c,onClose:o,zoomed:u,onToggleZoom:h}){return a.jsxs("div",{className:"worktabs",role:"tablist",onDoubleClick:p=>{h&&(p.target.closest("button")||h())},children:[a.jsxs("button",{className:"worktab"+(l===null?" is-on":""),role:"tab","aria-selected":l===null,onClick:()=>c(null),onDoubleClick:()=>h==null?void 0:h(),children:[a.jsx("span",{className:"worktab__name",children:"Разговор"}),r&&a.jsx("span",{className:"worktab__dot worktab__dot--busy",title:"Агент работает"})]}),n.map(p=>a.jsxs("div",{className:"worktab"+(p.path===l?" is-on":""),role:"tab","aria-selected":p.path===l,onDoubleClick:g=>{h&&(g.target.closest(".worktab__close, .worktab__dot")||h())},children:[a.jsx("button",{className:"worktab__name",title:p.path,onClick:()=>c(p.path),children:S1(p.path)}),Fa(p)?a.jsx("button",{className:"worktab__dot",title:"Не сохранено — закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path)}):a.jsx("button",{className:"worktab__close",title:"Закрыть","aria-label":`Закрыть ${p.path}`,onClick:()=>o(p.path),children:"✕"})]},p.path)),a.jsx("div",{className:"worktabs__spacer"}),h&&a.jsx("button",{className:"worktabs__zoom",title:u?"Свернуть — то же самое, что двойной клик по вкладке":"Развернуть на весь экран — то же самое, что двойной клик по вкладке","aria-label":u?"Свернуть колонку разговора":"Развернуть колонку разговора на весь экран","aria-pressed":u,onClick:h,children:a.jsx(Fc,{active:u})})]})}function xl(n){return n.claudeSessionId??n.id}function zd(n,l,r,c){if(!l||l.length===0)return n;const o=new Map(l.map((p,g)=>[p,g])),u=[],h=[];for(const p of n)(o.has(r(p))?u:h).push(p);return u.sort((p,g)=>o.get(r(p))-o.get(r(g))),c==="top"?[...h,...u]:[...u,...h]}function Db(n){return n.state!=="closed"}function Ob(n){return[...n.filter(Db),...n.filter(l=>!Db(l))]}function Id(n,l,r,c){if(l===r||!n.includes(l)||!n.includes(r))return null;const o=n.filter(p=>p!==l),u=o.indexOf(r)+(c==="after"?1:0),h=[...o.slice(0,u),l,...o.slice(u)];return h.every((p,g)=>p===n[g])?null:h}function Vp(n,l,r,c){const o=n%10,u=n%100;return o===1&&u!==11?l:o>=2&&o<=4&&(u<12||u>14)?r:c}function ty(n){return`${n} ${Vp(n,"агент","агента","агентов")}`}function rw(n){const l=n.filter(o=>o.kind==="agent").length,r=n.length-l,c=[];return l>0&&c.push(ty(l)),r>0&&c.push(`${r} ${Vp(r,"задача","задачи","задач")} в фоне`),c.join(" · ")}function cw(n){switch(n.kind){case"agent":return n.agentType??"агент";case"shell":return"команда";case"workflow":return"сценарий";default:return"задача"}}function ow(n){const l=Math.max(0,Math.floor(n/1e3)),r=Math.floor(l/3600),c=Math.floor(l%3600/60),o=l%60,u=String(o).padStart(2,"0");return r>0?`${r}:${String(c).padStart(2,"0")}:${u}`:`${c}:${u}`}function uw(n){return n<1e3?`${n} ток.`:`${(n/1e3).toFixed(1).replace(".",",")} k ток.`}function dw({tasks:n,onStop:l}){const[r,c]=b.useState(!1),[o,u]=b.useState(()=>Date.now()),[h,p]=b.useState(()=>new Set);b.useEffect(()=>{const x=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(x)},[]),b.useEffect(()=>{p(x=>{const v=new Set(n.map(y=>y.id)),j=new Set([...x].filter(y=>v.has(y)));return j.size===x.size?x:j})},[n]);const g=x=>{p(v=>new Set(v).add(x)),l(x),window.setTimeout(()=>{p(v=>{if(!v.has(x))return v;const j=new Set(v);return j.delete(x),j})},1e4)};return a.jsxs("div",{className:r?"tasks is-open":"tasks",children:[a.jsxs("button",{type:"button",className:"tasks__toggle","aria-expanded":r,"aria-controls":"tasks-list",onClick:()=>c(x=>!x),children:[a.jsx("span",{className:"tasks__dot","aria-hidden":"true"}),a.jsx("span",{className:"tasks__summary",children:rw(n)}),a.jsx("svg",{className:"tasks__chev",viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M4 6.5l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),r&&a.jsx("ul",{className:"tasks__list",id:"tasks-list",children:n.map(x=>{const v=h.has(x.id);return a.jsxs("li",{className:v?"task is-stopping":"task",children:[a.jsxs("div",{className:"task__main",children:[a.jsxs("div",{className:"task__head",children:[a.jsx("span",{className:"task__kind",children:cw(x)}),x.background&&a.jsx("span",{className:"task__bg",children:"фон"}),a.jsx("span",{className:"task__time",children:ow(o-x.startedAt)})]}),a.jsx("div",{className:"task__desc",title:x.description,children:x.description}),(x.activity||x.lastTool)&&a.jsx("div",{className:"task__activity",title:x.activity??x.lastTool??void 0,children:x.activity??x.lastTool}),a.jsxs("div",{className:"task__stats",children:[uw(x.tokens)," · ",x.toolUses," ",Vp(x.toolUses,"вызов","вызова","вызовов")]})]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--danger task__stop",disabled:v,"aria-label":`Остановить: ${x.description}`,onClick:()=>g(x.id),children:v?"Останавливается":"Стоп"})]},x.id)})})]})}const fw=""+new URL("antigravity-logo-DRKQga2U.png",import.meta.url).href;function Xp({className:n}){return a.jsx("img",{src:fw,alt:"","aria-hidden":"true",className:n,style:{aspectRatio:"200 / 184"}})}const hw=450,pw=6,mw=[{id:"claude",label:"Claude",hint:"Claude Code — как обычно"},{id:"antigravity",label:"Antigravity",hint:"Google agy · разговоры и инструменты"},{id:"codex",label:"Codex",hint:"OpenAI · сессии, инструменты и разрешения"}];function gw({disabled:n,providers:l,onStart:r}){const c=[...new Set(l)].flatMap(R=>mw.filter(L=>L.id===R)),o=c.length>1,[u,h]=b.useState(!1),[p,g]=b.useState(0),[x,v]=b.useState({left:0,top:0}),j=b.useRef(null),y=b.useRef(null),T=b.useRef(null);function N(){T.current&&window.clearTimeout(T.current.timer),T.current=null}function E(R=!1){R||N(),g(0),h(!0)}function A(R){var L;h(!1),R&&((L=j.current)==null||L.focus())}function D(R){if(n||!o||R.button!==0)return;const L={timer:0,x:R.clientX,y:R.clientY,fired:!1};L.timer=window.setTimeout(()=>{L.fired=!0,E(!0)},hw),T.current=L}function q(R){const L=T.current;!L||L.fired||Math.hypot(R.clientX-L.x,R.clientY-L.y)>pw&&N()}function Q(){T.current&&!T.current.fired&&N()}function z(R){var G;if((G=T.current)!=null&&G.fired){T.current=null,R.preventDefault();return}if(n)return;const L=c[0];L&&r(L.id)}function U(R){o&&(R.preventDefault(),!n&&E())}function O(R){if(n||!o)return;(R.key==="ArrowDown"||R.key==="ArrowUp"||R.key==="Enter"&&R.shiftKey)&&(R.preventDefault(),E())}b.useLayoutEffect(()=>{if(!u)return;const R=j.current,L=y.current;if(!R||!L)return;const G=R.getBoundingClientRect(),se=L.getBoundingClientRect(),ve=8,je=Math.max(ve,Math.min(G.right-se.width,window.innerWidth-se.width-ve));let we=G.top-se.height-8;we<ve&&(we=Math.min(G.bottom+8,window.innerHeight-se.height-ve)),v({left:je,top:we})},[u]),b.useLayoutEffect(()=>{var R;u&&((R=y.current)==null||R.focus())},[u]),b.useLayoutEffect(()=>{if(!u)return;function R(L){var se,ve;const G=L.target;!((se=y.current)!=null&&se.contains(G))&&!((ve=j.current)!=null&&ve.contains(G))&&A(!1)}return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[u]);function I(R){A(!1),r(R.id)}function V(R){if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),A(!0);return}if(R.key==="ArrowDown"||R.key==="ArrowUp"){R.preventDefault();const L=R.key==="ArrowDown"?1:-1;g(G=>(G+L+c.length)%c.length);return}if(R.key==="Enter"||R.key===" "){R.preventDefault();const L=c[p];L&&I(L);return}R.key==="Tab"&&A(!1)}return a.jsxs("div",{className:"newsession",role:"group","aria-label":"Создать сессию",children:[a.jsx("button",{ref:j,type:"button",className:"btn btn--primary newsession__btn",disabled:n,title:o?"Удерживайте, чтобы выбрать агента":void 0,"aria-haspopup":o?"menu":void 0,"aria-expanded":o?u:void 0,onClick:z,onContextMenu:U,onPointerDown:D,onPointerMove:q,onPointerUp:Q,onPointerCancel:Q,onPointerLeave:Q,onKeyDown:O,children:"+ Сессия"}),o&&a.jsx("button",{type:"button",className:"btn btn--primary newsession__choose","aria-label":"Выбрать агента","aria-haspopup":"menu","aria-expanded":u,disabled:n,onClick:()=>u?A(!0):E(),children:a.jsx(xw,{})}),u&&o&&a.jsx("div",{ref:y,className:"newsession__menu",style:{left:x.left,top:x.top},role:"menu","aria-label":"Выбрать агента для новой сессии",tabIndex:-1,onKeyDown:V,children:c.map((R,L)=>a.jsxs("button",{type:"button",role:"menuitem",className:"newsession__item"+(L===p?" is-cursor":""),onMouseEnter:()=>g(L),onClick:()=>I(R),children:[a.jsx("span",{className:`newsession__mark newsession__mark--${R.id}`,"aria-hidden":"true",children:R.id==="codex"?a.jsx("span",{className:"codex-mark",children:"C"}):R.id==="antigravity"?a.jsx(Xp,{className:"newsession__mark-logo"}):a.jsx(bw,{})}),a.jsxs("span",{className:"newsession__text",children:[a.jsx("span",{className:"newsession__label",children:R.label}),a.jsx("span",{className:"newsession__hint",children:R.hint})]})]},R.id))})]})}function xw(){return a.jsx("svg",{className:"newsession__caret",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1 1.2 5 5 9 1.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function bw(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}const ny="ccv:sidebar.collapsed",sy="ccv:sidebar.mode",ly="ccv:sidebar.foldersCollapsed",_w=500,sp="транскрипт остаётся на диске — сессию можно вернуть из архива в любой момент.";function yw({open:n,connected:l,status:r,workspaces:c,archivedWorkspaces:o,workspaceFolders:u,sessionFolders:h,pinnedFolders:p,sessions:g,archived:x,pinned:v,live:j,listOrder:y,liveSessionsFirst:T,onReorder:N,activeWorkspaceId:E,activeSessionId:A,onSelectWorkspace:D,onSelectSession:q,onRenameSession:Q,onStopSession:z,onPinSessions:U,onSelectPinned:O,onCloseWorkspaces:I,onRestoreWorkspaces:V,onArchiveSessions:R,onUnarchiveSessions:L,onCreateFolder:G,onRenameFolder:se,onSetFolderColor:ve,onDeleteFolder:je,onAssignToFolder:we,onOpenWorkspace:F,onNewSession:$,enabledProviders:ne,onOpenExtensions:pe,account:Ne,onOpenAccount:S,relay:Z,onOpenRelay:de,onOpenSettings:be,themeMode:Me,onCycleTheme:Ie,navigation:Ke}){var Nl;const[ce,Ue]=b.useState(null),[ge,Ze]=b.useState(null),[dt,lt]=b.useState(null);function gt(k){return(dt==null?void 0:dt.folderId)===k.id?dt.color??void 0:k.color}function et(k){const ie=k&&gt(k);return ie?{"--folder-color":ie}:void 0}function Tt(k){return k?a.jsx("span",{className:"row__stripe","aria-hidden":"true"}):null}const ee=b.useRef(void 0),[tt,Fe]=b.useState(null),[$e,Je]=b.useState(""),[Qe,ft]=b.useState(Lw),[De,wt]=b.useState(zw),[Nt,Ht]=b.useState(Iw);function Kt(k){Ht(k);try{localStorage.setItem(sy,k)}catch{}}const kt=$e.trim().toLowerCase(),ot=kt!=="",wn=b.useMemo(()=>zd(c,y==null?void 0:y.workspaces,k=>k.id,"bottom"),[c,y]),Dn=b.useMemo(()=>{const k=zd(g,E?y==null?void 0:y.sessions[E]:void 0,xl,"top");return T?Ob(k):k},[g,y,E,T]),ln=b.useMemo(()=>{const k=zd(v,y==null?void 0:y.pinned,xl,"bottom");return T?Ob(k):k},[v,y,T]),$t=b.useMemo(()=>zd(j,y==null?void 0:y.live,xl,"bottom"),[j,y]),hn=b.useMemo(()=>ot?wn.filter(k=>k.name.toLowerCase().includes(kt)||k.path.toLowerCase().includes(kt)):wn,[wn,kt,ot]),yt=b.useMemo(()=>ot?o.filter(k=>k.name.toLowerCase().includes(kt)||k.path.toLowerCase().includes(kt)):o,[o,kt,ot]),Wn=b.useMemo(()=>{if(!ot)return!1;const k=c.find(ie=>ie.id===E);return!!k&&(k.name.toLowerCase().includes(kt)||k.path.toLowerCase().includes(kt))},[c,E,kt,ot]),ae=b.useMemo(()=>ot&&!Wn?Dn.filter(k=>(k.title??"").toLowerCase().includes(kt)):Dn,[Dn,kt,ot,Wn]),_e=b.useMemo(()=>ot&&!Wn?x.filter(k=>(k.title??"").toLowerCase().includes(kt)):x,[x,kt,ot,Wn]),qe=k=>{var ie;return((ie=c.find(Re=>Re.id===k))==null?void 0:ie.name)??"—"},it=k=>{var ie;return(ie=c.find(Re=>Re.id===k))==null?void 0:ie.path},Pe=b.useMemo(()=>ot?ln.filter(k=>(k.title??"").toLowerCase().includes(kt)||qe(k.workspaceId).toLowerCase().includes(kt)):ln,[ln,c,kt,ot]),Zt=b.useMemo(()=>ot?$t.filter(k=>(k.title??"").toLowerCase().includes(kt)||qe(k.workspaceId).toLowerCase().includes(kt)):$t,[$t,c,kt,ot]),K=!ot;function fe(k){ft(ie=>{const Re=ie.includes(k)?ie.filter(nt=>nt!==k):[...ie,k];try{localStorage.setItem(ny,JSON.stringify(Re))}catch{}return Re})}const ke=k=>!Qe.includes(k);function Ve(k){wt(ie=>{const Re=ie.includes(k)?ie.filter(nt=>nt!==k):[...ie,k];try{localStorage.setItem(ly,JSON.stringify(Re))}catch{}return Re})}const Mt=k=>!De.includes(k),Cn=b.useMemo(()=>Po(hn,u),[hn,u]),il=b.useMemo(()=>Po(yt,u),[yt,u]),Vs=b.useMemo(()=>Po(ae,h),[ae,h]),vs=b.useMemo(()=>Po(_e,h),[_e,h]),js=b.useMemo(()=>Po(Pe,p,k=>k.pinnedFolderId),[Pe,p]),Xs=b.useMemo(()=>({groups:[],ungrouped:Zt}),[Zt]),Qs=((y==null?void 0:y.workspaces.length)??0)>0,Wa=E?(((Nl=y==null?void 0:y.sessions[E])==null?void 0:Nl.length)??0)>0:!1,us=((y==null?void 0:y.pinned.length)??0)>0,ds=((y==null?void 0:y.live.length)??0)>0,Ft=Ud({enabled:K,scope:"workspaces",itemKey:k=>k.id,groups:Cn.groups,ungrouped:Cn.ungrouped,onReorder:N}),at=Ud({enabled:K,scope:"sessions",workspaceId:E??void 0,itemKey:xl,groups:Vs.groups,ungrouped:Vs.ungrouped,onReorder:N}),Nn=Ud({enabled:K,scope:"pinned",itemKey:xl,groups:js.groups,ungrouped:js.ungrouped,onReorder:N}),Ks=Ud({enabled:K,scope:"live",itemKey:xl,groups:Xs.groups,ungrouped:Xs.ungrouped,onReorder:N});b.useEffect(()=>{var Re;if(!dt)return;const ie=(Re=[...js.groups,...Cn.groups,...il.groups,...Vs.groups,...vs.groups].find(nt=>nt.folder.id===dt.folderId))==null?void 0:Re.folder;ie&&ie.color===(dt.color??void 0)&&lt(null)},[dt,js,Cn,il,Vs,vs]),b.useEffect(()=>()=>window.clearTimeout(ee.current),[]);const Zs=ap(hn),ws=ap(yt),Ns=ap(ae),[Dt,rl]=b.useState(null),[rn,Jt]=b.useState(null),[Ct,pn]=b.useState(null),[xt,Kn]=b.useState(null),[es,ts]=b.useState(null),Pt=b.useRef(null);function cl(k,ie){const Re=k.touches[0];if(!Re)return;const nt={timer:0,x:Re.clientX,y:Re.clientY,el:k.currentTarget,fired:!1};nt.timer=window.setTimeout(()=>{nt.fired=!0,ie(nt.x,nt.y,nt.el)},_w),Pt.current=nt}function Wt(k){const ie=Pt.current,Re=k.touches[0];!ie||!Re||Math.hypot(Re.clientX-ie.x,Re.clientY-ie.y)>10&&(window.clearTimeout(ie.timer),Pt.current=null)}function An(k){const ie=Pt.current;ie&&(window.clearTimeout(ie.timer),ie.fired&&k.preventDefault())}function On(){var k;return(k=Pt.current)!=null&&k.fired?(Pt.current=null,!0):!1}function fs(){const k=Dt==null?void 0:Dt.opener;rl(null),k!=null&&k.isConnected&&k.focus()}function hs(){const k=rn==null?void 0:rn.opener;Jt(null),k!=null&&k.isConnected&&k.focus()}function Gn(){const k=Ct==null?void 0:Ct.opener;pn(null),k!=null&&k.isConnected&&k.focus()}function en(){const k=xt==null?void 0:xt.opener;Kn(null),k!=null&&k.isConnected&&k.focus()}function vl(){const k=es==null?void 0:es.opener;ts(null),k!=null&&k.isConnected&&k.focus()}function ks(k){return{onContextMenu:ie=>{ie.preventDefault(),rl({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:Zs.targetsFor(k)})},onTouchStart:ie=>cl(ie,(Re,nt,yn)=>rl({x:Re,y:nt,opener:yn,ids:Zs.targetsFor(k)})),onTouchMove:Wt,onTouchEnd:An,onTouchCancel:An}}function ns(k){return{onContextMenu:ie=>{ie.preventDefault(),Jt({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:ws.targetsFor(k)})},onTouchStart:ie=>cl(ie,(Re,nt,yn)=>Jt({x:Re,y:nt,opener:yn,ids:ws.targetsFor(k)})),onTouchMove:Wt,onTouchEnd:An,onTouchCancel:An}}function xn(k){return{onContextMenu:ie=>{ie.preventDefault(),pn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:Ns.targetsFor(k)})},onTouchStart:ie=>cl(ie,(Re,nt,yn)=>pn({x:Re,y:nt,opener:yn,ids:Ns.targetsFor(k)})),onTouchMove:Wt,onTouchEnd:An,onTouchCancel:An}}function jl(k){return{onContextMenu:ie=>{ie.preventDefault(),Kn({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[k.id]})},onTouchStart:ie=>cl(ie,(Re,nt,yn)=>Kn({x:Re,y:nt,opener:yn,ids:[k.id]})),onTouchMove:Wt,onTouchEnd:An,onTouchCancel:An}}function $l(k){return{onContextMenu:ie=>{ie.preventDefault(),ts({x:ie.clientX,y:ie.clientY,opener:ie.currentTarget,ids:[k.id]})},onTouchStart:ie=>cl(ie,(Re,nt,yn)=>ts({x:Re,y:nt,opener:yn,ids:[k.id]})),onTouchMove:Wt,onTouchEnd:An,onTouchCancel:An}}const kn=g.filter(k=>k.state!=="closed").length,wl=Dt?hn.find(k=>k.id===Dt.ids[0]):void 0,ol=Dt?[{id:"close",label:Dt.ids.length>1?`Закрыть проекты (${Dt.ids.length})`:"Закрыть проект",onSelect:()=>{I(Dt.ids),Zs.clear()}},...Wo({folders:u,ids:Dt.ids,hasFolder:(wl==null?void 0:wl.folderId)!=null,assign:(k,ie)=>we("workspace",k,ie),onClear:()=>Zs.clear(),onNewFolder:()=>Fe("workspace")}),...Dt.ids.length===1&&K?Ft.menuItems(Dt.ids[0],Qs):[]]:[],Ls=Dt?"закрытие не удаляет проект: каталог и история сессий остаются на диске — открыть его снова можно кнопкой «+ Проект»."+(E&&Dt.ids.includes(E)&&kn>0?` в нём сейчас незавершённых сессий: ${kn} — при закрытии они остановятся на хосте.`:""):void 0,tn=rn?yt.find(k=>k.id===rn.ids[0]):void 0,ye=rn?[{id:"restore",label:rn.ids.length>1?`Вернуть проекты (${rn.ids.length})`:"Вернуть проект",onSelect:()=>{V(rn.ids),ws.clear()}},...Wo({folders:u,ids:rn.ids,hasFolder:(tn==null?void 0:tn.folderId)!=null,assign:(k,ie)=>we("workspace",k,ie),onClear:()=>ws.clear(),onNewFolder:()=>Fe("workspace")})]:[],C=rn?"каталог и история сессий всё это время оставались на диске — восстановление их не трогает.":void 0,J=Ct?ae.find(k=>k.id===Ct.ids[0]):void 0,xe=(J==null?void 0:J.pinned)!==!0,Oe=Ct?[...Ct.ids.length===1?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(Ct.ids[0])}]:[],{id:"pin",label:xe?Ct.ids.length>1?`Закрепить (${Ct.ids.length})`:"Закрепить":Ct.ids.length>1?`Открепить (${Ct.ids.length})`:"Открепить",onSelect:()=>{J&&U(J.workspaceId,Ct.ids,xe),Ns.clear()}},{id:"archive",label:Ct.ids.length>1?`Убрать в архив (${Ct.ids.length})`:"Убрать в архив",onSelect:()=>{R(E,Ct.ids),Ns.clear()}},...Wo({folders:h,ids:Ct.ids,hasFolder:(J==null?void 0:J.folderId)!=null,assign:(k,ie)=>we("session",k,ie,E),onClear:()=>Ns.clear(),onNewFolder:()=>Fe("session")}),...Ct.ids.length===1&&K&&J?at.menuItems(xl(J),Wa):[]]:[],Ye=Ct?sp:void 0,Le=xt?Pe.find(k=>k.id===xt.ids[0]):void 0,Yt=xt?[{id:"rename",label:"Переименовать",onSelect:()=>Ue(xt.ids[0])},{id:"unpin",label:"Открепить",onSelect:()=>{Le&&U(Le.workspaceId,[Le.id],!1)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{Le&&R(Le.workspaceId,[Le.id])}},...Le&&Le.workspaceId===E?Wo({folders:h,ids:[Le.id],hasFolder:Le.folderId!=null,assign:(k,ie)=>we("session",k,ie,Le.workspaceId),onClear:()=>{},onNewFolder:()=>Fe("session")}):[],...Nw(Le?Wo({folders:p,ids:[Le.id],hasFolder:Le.pinnedFolderId!=null,assign:(k,ie)=>we("pinned",k,ie),onClear:()=>{},onNewFolder:()=>Fe("pinned")}):[]),...K&&Le?Nn.menuItems(xl(Le),us):[]]:[],vt=es?Zt.find(k=>k.id===es.ids[0]):void 0,bn=es?[{id:"stop",label:"Остановить",onSelect:()=>{vt&&z(vt)}},{id:"rename",label:"Переименовать",onSelect:()=>Ue(es.ids[0])},{id:"pin",label:(vt==null?void 0:vt.pinned)===!0?"Открепить":"Закрепить",onSelect:()=>{vt&&U(vt.workspaceId,[vt.id],vt.pinned!==!0)}},{id:"archive",label:"Убрать в архив",onSelect:()=>{vt&&R(vt.workspaceId,[vt.id])}},...K&&vt?Ks.menuItems(xl(vt),ds):[]]:[];function Bt(k,ie){return a.jsxs("div",{"data-row-key":k.id,className:Ac(k.id===E,Zs.selected.includes(k.id),!1,!!ie)+Ft.dropClass(k.id),style:et(ie),...ks(k),children:[Tt(ie),K&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить проект, чтобы изменить порядок в списке",...Ft.gripHandlers(k.id),children:a.jsx(Hd,{})}),a.jsxs("button",{className:"row__main",onClick:Re=>{On()||Zs.click(Re,k,()=>D(k.id))},onKeyDown:Re=>Ft.onKeyDown(k.id,Re),children:[a.jsxs("span",{className:"row__title",children:[k.name,k.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",title:k.path,children:k.path})]})]},k.id)}function Sn(k,ie){return a.jsxs("div",{className:Ac(k.id===E,ws.selected.includes(k.id),!1,!!ie),style:et(ie),...ns(k),children:[Tt(ie),a.jsxs("button",{className:"row__main",onClick:Re=>{On()||ws.click(Re,k,()=>D(k.id))},children:[a.jsxs("span",{className:"row__title",children:[k.name,k.hasClaudeMd&&" ·"]}),a.jsx("span",{className:"row__meta",children:Vw(k)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть проект из архива",onClick:()=>V([k.id]),children:"Вернуть"})]},k.id)}function mn(k,ie){const Re=xl(k);return a.jsxs("div",{"data-row-key":Re,className:Ac(k.id===A,Ns.selected.includes(k.id),k.provider==="antigravity",!!ie)+at.dropClass(Re),style:et(ie),...ce===k.id?{}:xn(k),children:[Tt(ie),ce===k.id?a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:k.title??"",onCommit:nt=>{Q(k,nt),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[K&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...at.gripHandlers(Re),children:a.jsx(Hd,{})}),a.jsxs("button",{className:"row__main",onClick:nt=>{On()||Ns.click(nt,k,()=>q(k))},onKeyDown:nt=>at.onKeyDown(Re,nt),children:[a.jsx(Bd,{title:k.title??"Без названия",pinned:k.pinned===!0,provider:k.provider,projectName:qe(k.workspaceId),projectPath:it(k.workspaceId)}),a.jsx(ip,{session:k,tail:new Date(k.updatedAt).toLocaleString()})]}),a.jsx("button",{className:"row__edit",title:"Переименовать","aria-label":"Переименовать сессию",onClick:()=>{On()||Ue(k.id)},children:"✎"})]})]},k.id)}function zs(k,ie){return a.jsxs("div",{className:Ac(k.id===A,!1,k.provider==="antigravity",!!ie),style:et(ie),children:[Tt(ie),a.jsxs("button",{className:"row__main",onClick:()=>q(k),children:[a.jsx(Bd,{title:k.title??"Без названия",pinned:!1,provider:k.provider,projectName:qe(k.workspaceId),projectPath:it(k.workspaceId)}),a.jsx("span",{className:"row__meta",children:Yw(k)})]}),a.jsx("button",{className:"row__restore",title:"Вернуть сессию из архива",onClick:()=>L([k.id]),children:"Вернуть"})]},k.id)}function _n(k,ie){const Re=xl(k);return a.jsxs("div",{"data-row-key":Re,className:Ac(k.id===A,!1,k.provider==="antigravity",!!ie)+Nn.dropClass(Re),style:et(ie),...ce===k.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...jl(k)},children:[Tt(ie),ce===k.id?a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:k.title??"",onCommit:nt=>{Q(k,nt),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[K&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Nn.gripHandlers(Re),children:a.jsx(Hd,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{On()||O(k)},onKeyDown:nt=>Nn.onKeyDown(Re,nt),children:[a.jsx(Bd,{title:k.title??"Без названия",pinned:!1,provider:k.provider,projectName:qe(k.workspaceId),projectPath:it(k.workspaceId)}),a.jsx(ip,{session:k,tail:new Date(k.updatedAt).toLocaleString()})]})]})]},k.id)}function Fs(k){const ie=xl(k);return a.jsx("div",{"data-row-key":ie,className:Ac(k.id===A,!1,k.provider==="antigravity")+Ks.dropClass(ie),...ce===k.id?{}:{title:"Действия со строкой — правый клик или долгое нажатие",...$l(k)},children:ce===k.id?a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:k.title??"",onCommit:Re=>{Q(k,Re),Ue(null)},onCancel:()=>Ue(null)})}):a.jsxs(a.Fragment,{children:[K&&a.jsx("button",{type:"button",className:"row__grip",title:"Перетащить, чтобы изменить порядок","aria-label":"Перетащить сессию, чтобы изменить порядок в списке",...Ks.gripHandlers(ie),children:a.jsx(Hd,{})}),a.jsxs("button",{className:"row__main",onClick:()=>{On()||O(k)},onKeyDown:Re=>Ks.onKeyDown(ie,Re),children:[a.jsx(Bd,{title:k.title??"Без названия",pinned:k.pinned===!0,provider:k.provider,projectName:qe(k.workspaceId),projectPath:it(k.workspaceId)}),a.jsx(ip,{session:k,tail:new Date(k.updatedAt).toLocaleString()})]}),a.jsx("button",{type:"button",className:"row__stop",title:"Остановить сессию","aria-label":"Остановить сессию",onClick:Re=>{Re.stopPropagation(),!On()&&z(k)},children:a.jsx(Rw,{})})]})},k.id)}function ss(k,ie){return a.jsx(Cw,{folder:k,count:ie,open:Mt(k.id),renaming:ge===k.id,onToggle:()=>Ve(k.id),onStartRename:()=>Ze(k.id),onCommitRename:Re=>{se(k.id,Re),Ze(null)},onCancelRename:()=>Ze(null),onDelete:()=>je(k.id),color:gt(k),onPreviewColor:Re=>{window.clearTimeout(ee.current),lt({folderId:k.id,color:Re})},onCommitColor:Re=>{lt({folderId:k.id,color:Re}),ve(k.id,Re),window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>lt(null),4e3)},onResetColor:()=>{window.clearTimeout(ee.current),lt(null),ve(k.id,null)}},k.id)}return a.jsxs("aside",{className:n?"sidebar sidebar--open":"sidebar",children:[a.jsxs("div",{className:"sidebar__head",children:[a.jsx("span",{className:"brand__symbol","aria-hidden":"true"}),a.jsxs("span",{className:"brand",children:["ЭФИР",a.jsx("span",{className:"brand__caption",children:"пространство возможностей"})]}),a.jsx("button",{className:"theme-btn",title:`Тема: ${zb[Me]}`,"aria-label":`Тема: ${zb[Me]}. Переключить`,onClick:Ie,children:a.jsx(Uw,{mode:Me})})]}),a.jsxs("div",{className:"sidebar__connection",role:"status",children:[a.jsx("span",{className:l?"dot dot--on":"dot"}),a.jsx("span",{children:l?"Пространство подключено":r})]}),Ke,a.jsxs("div",{className:"sidebar__tabs",role:"tablist","aria-label":"Что показывать в списке",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":Nt==="default",className:Nt==="default"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Kt("default"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Все"})}),a.jsx("button",{type:"button",role:"tab","aria-selected":Nt==="pinned",className:Nt==="pinned"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Kt("pinned"),children:a.jsx("span",{className:"sidebar__tab-label",children:"Закреплённые"})}),a.jsxs("button",{type:"button",role:"tab","aria-selected":Nt==="live",className:Nt==="live"?"sidebar__tab is-active":"sidebar__tab",onClick:()=>Kt("live"),children:[a.jsx("span",{className:"sidebar__tab-label",children:"Запущенные"}),j.length>0&&a.jsx("span",{className:"sidebar__tab-count",children:j.length})]})]}),a.jsxs("div",{className:"fssearch fssearch--sidebar",children:[a.jsx(Dw,{}),a.jsx("input",{className:"fssearch__input",type:"text",value:$e,spellCheck:!1,placeholder:"Проект или сессия…","aria-label":"Поиск по проектам и сессиям",onChange:k=>Je(k.target.value),onKeyDown:k=>{k.stopPropagation(),k.key==="Escape"&&(k.preventDefault(),$e?Je(""):k.currentTarget.blur())}}),$e&&a.jsx("button",{className:"fssearch__clear",title:"Очистить поиск","aria-label":"Очистить поиск",onClick:()=>Je(""),children:"✕"})]}),a.jsx("div",{className:"sidebar__scroll",children:Nt==="pinned"?a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Закреплённые",count:Pe.length,open:ke("pinned"),onToggle:()=>fe("pinned"),action:{label:"Новая папка закреплённых",onClick:()=>{Fe("pinned"),ke("pinned")||fe("pinned")}}}),ke("pinned")&&a.jsxs(a.Fragment,{children:[tt==="pinned"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:"",placeholder:"Название папки",onCommit:k=>{G("pinned",k),Fe(null)},onCancel:()=>Fe(null)})})}),Pe.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"закрепите сессию через её меню (правый клик или долгое нажатие) — она останется под рукой из любого проекта"})}),js.groups.map(k=>a.jsxs(b.Fragment,{children:[ss(k.folder,k.items.length),Mt(k.folder.id)&&k.items.map(ie=>_n(ie,k.folder))]},k.folder.id)),js.ungrouped.map(k=>_n(k))]})]}):Nt==="live"?a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Запущенные",count:Zt.length,open:ke("live"),onToggle:()=>fe("live")}),ke("live")&&a.jsxs(a.Fragment,{children:[Zt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"Нет запущенных сессий"})}),Zt.map(k=>Fs(k))]})]}):a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Проекты",count:hn.length,open:ke("workspaces"),onToggle:()=>fe("workspaces"),action:{label:"Новая папка проектов",onClick:()=>{Fe("workspace"),ke("workspaces")||fe("workspaces")}}}),ke("workspaces")&&a.jsxs(a.Fragment,{children:[tt==="workspace"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:"",placeholder:"Название папки",onCommit:k=>{G("workspace",k),Fe(null)},onCancel:()=>Fe(null)})})}),hn.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"Пока ни одного"})}),Cn.groups.map(k=>a.jsxs(b.Fragment,{children:[ss(k.folder,k.items.length),Mt(k.folder.id)&&k.items.map(ie=>Bt(ie,k.folder))]},k.folder.id)),Cn.ungrouped.map(k=>Bt(k))]}),o.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Архив проектов",count:yt.length,open:ke("workspacesArchive"),onToggle:()=>fe("workspacesArchive"),hint:"проект закрывают вручную; каталог и история сессий остаются на диске и открываются заново отсюда или через «+ Проект»"}),ke("workspacesArchive")&&a.jsxs(a.Fragment,{children:[yt.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"Пока пусто"})}),il.groups.map(k=>a.jsxs(b.Fragment,{children:[ss(k.folder,k.items.length),Mt(k.folder.id)&&k.items.map(ie=>Sn(ie,k.folder))]},k.folder.id)),il.ungrouped.map(k=>Sn(k))]})]}),E&&a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Сессии",count:ae.length,open:ke("sessions"),onToggle:()=>fe("sessions"),action:{label:"Новая папка сессий",onClick:()=>{Fe("session"),ke("sessions")||fe("sessions")}}}),ke("sessions")&&a.jsxs(a.Fragment,{children:[tt==="session"&&a.jsx("div",{className:"row",children:a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:"",placeholder:"Название папки",onCommit:k=>{G("session",k,E),Fe(null)},onCancel:()=>Fe(null)})})}),ae.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"Пока ни одной"})}),Vs.groups.map(k=>a.jsxs(b.Fragment,{children:[ss(k.folder,k.items.length),Mt(k.folder.id)&&k.items.map(ie=>mn(ie,k.folder))]},k.folder.id)),Vs.ungrouped.map(k=>mn(k))]}),x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Rc,{title:"Архив",count:_e.length,open:ke("archive"),onToggle:()=>fe("archive"),hint:"сессии без обращения дольше двух суток уезжают сюда сами; ничего не удаляется"}),ke("archive")&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:"сюда сами уезжают сессии без обращения дольше двух суток; транскрипт остаётся на диске, ничего не удаляется"})}),_e.length===0&&a.jsx("div",{className:"row",children:a.jsx("span",{className:"row__meta",children:ot?"Ничего не найдено":"Пока пусто"})}),vs.groups.map(k=>a.jsxs(b.Fragment,{children:[ss(k.folder,k.items.length),Mt(k.folder.id)&&k.items.map(ie=>zs(ie,k.folder))]},k.folder.id)),vs.ungrouped.map(k=>zs(k))]})]})]})]})}),a.jsxs("div",{className:"sidebar__foot",children:[a.jsxs("button",{className:"account-btn",title:"Аккаунт Claude",onClick:S,children:[a.jsx("span",{className:Ne!=null&&Ne.loggedIn?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Ne===null?"Аккаунт":Ne.loggedIn?Ne.email||"Вход выполнен":"Войти в аккаунт"}),(Ne==null?void 0:Ne.plan)&&a.jsx("span",{className:"chip",children:Ne.plan})]}),de&&a.jsxs("button",{className:"account-btn",title:"Доступ с телефона и из браузера",onClick:de,children:[a.jsx("span",{className:Z!=null&&Z.connected?"dot dot--on":"dot"}),a.jsx("span",{className:"account-btn__id",children:Z===null?"Удалённый доступ":Z.paired?Z.connected?Z.name||"Удалённый доступ включён":"Удалённый доступ · нет связи":"Удалённый доступ"}),(Z==null?void 0:Z.connected)&&Z.clients>0&&a.jsx("span",{className:"chip",children:Z.clients})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",disabled:!pe,title:"MCP-серверы и плагины",onClick:()=>pe==null?void 0:pe(),children:"Расширения"}),a.jsx("button",{className:"btn btn--ghost",title:"Настройки приложения",onClick:be,children:"Настройки"})]}),a.jsxs("div",{className:"sidebar__foot-row",children:[a.jsx("button",{className:"btn btn--ghost",onClick:F,children:"+ Проект"}),a.jsx(gw,{disabled:!E,providers:ne,onStart:$})]})]}),Dt&&a.jsx(Ui,{x:Dt.x,y:Dt.y,items:ol,note:Ls,onClose:fs}),rn&&a.jsx(Ui,{x:rn.x,y:rn.y,items:ye,note:C,onClose:hs}),Ct&&a.jsx(Ui,{x:Ct.x,y:Ct.y,items:Oe,note:Ye,onClose:Gn}),xt&&a.jsx(Ui,{x:xt.x,y:xt.y,items:Yt,note:sp,onClose:en}),es&&a.jsx(Ui,{x:es.x,y:es.y,items:bn,note:sp,onClose:vl})]})}function Ac(n,l,r,c){const o=["row"];return c&&o.push("row--foldered"),n&&o.push("row--active"),l&&o.push("row--selected"),r&&o.push("row--antigravity"),o.join(" ")}function Po(n,l,r=c=>c.folderId){const c=new Map(l.map(p=>[p.id,p])),o=new Map,u=[];for(const p of n){const g=r(p),x=g?c.get(g):void 0;if(!x){u.push(p);continue}const v=o.get(x.id);v?v.push(p):o.set(x.id,[p])}return{groups:[...o.entries()].map(([p,g])=>({folder:c.get(p),items:g})).sort((p,g)=>p.folder.name.localeCompare(g.folder.name,"ru")),ungrouped:u}}function vw(n,l,r){return[...n.flatMap(c=>c.items.map(r)),...l.map(r)]}const jw="\0ungrouped";function ww(n,l,r){const c=new Map;for(const o of n)for(const u of o.items)c.set(r(u),o.folder.id);for(const o of l)c.set(r(o),jw);return c}function lp(n,l,r,c,o){const u=[...l.map(p=>p.items),r].find(p=>p.some(g=>c(g)===n));if(!u)return null;const h=u.findIndex(p=>c(p)===n);return o==="up"?h<=0?null:{target:c(u[h-1]),position:"before"}:h===-1||h>=u.length-1?null:{target:c(u[h+1]),position:"after"}}function Ud(n){const[l,r]=b.useState(null),[c,o]=b.useState(null),u=b.useMemo(()=>vw(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]),h=b.useMemo(()=>ww(n.groups,n.ungrouped,n.itemKey),[n.groups,n.ungrouped,n.itemKey]);function p(){r(null),o(null)}function g(D,q){n.enabled&&(q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),r(D),o(null))}function x(D,q){var I;if(!l)return;const Q=(I=document.elementFromPoint(D,q))==null?void 0:I.closest("[data-row-key]"),z=Q==null?void 0:Q.dataset.rowKey;if(!z||z===l||h.get(z)!==h.get(l)){o(null);return}const U=Q.getBoundingClientRect(),O=q-U.top<U.height/2?"before":"after";o(V=>(V==null?void 0:V.key)===z&&V.position===O?V:{key:z,position:O})}function v(D){x(D.clientX,D.clientY)}function j(){if(l&&c){const D=Id(u,l,c.key,c.position);D&&n.onReorder(n.scope,D,n.workspaceId)}p()}function y(D,q){if(!n.enabled)return;const Q=lp(D,n.groups,n.ungrouped,n.itemKey,q);if(!Q)return;const z=Id(u,D,Q.target,Q.position);z&&n.onReorder(n.scope,z,n.workspaceId)}function T(D,q){const Q=lp(D,n.groups,n.ungrouped,n.itemKey,"up"),z=lp(D,n.groups,n.ungrouped,n.itemKey,"down"),U=[{id:"move-up",label:"Переместить выше",disabled:!Q,onSelect:()=>{if(!Q)return;const O=Id(u,D,Q.target,Q.position);O&&n.onReorder(n.scope,O,n.workspaceId)}},{id:"move-down",label:"Переместить ниже",disabled:!z,onSelect:()=>{if(!z)return;const O=Id(u,D,z.target,z.position);O&&n.onReorder(n.scope,O,n.workspaceId)}}];return q&&U.push({id:"reset-order",label:"Сбросить порядок",onSelect:()=>n.onReorder(n.scope,null,n.workspaceId)}),U}function N(D){return l===D?" row--dragging":(c==null?void 0:c.key)===D?c.position==="before"?" row--drop-before":" row--drop-after":""}function E(D){return{onPointerDown:q=>g(D,q),onPointerMove:v,onPointerUp:j,onPointerCancel:p}}function A(D,q){!q.altKey||q.key!=="ArrowUp"&&q.key!=="ArrowDown"||(q.preventDefault(),y(D,q.key==="ArrowUp"?"up":"down"))}return{dragging:l!==null,dropClass:N,gripHandlers:E,onKeyDown:A,menuItems:T}}function Wo(n){return[...[...n.folders].sort((r,c)=>r.name.localeCompare(c.name,"ru")).map(r=>({id:`folder:${r.id}`,label:`В папку «${r.name}»`,onSelect:()=>{n.ids.forEach(c=>n.assign(c,r.id)),n.onClear()}})),...n.hasFolder?[{id:"folder:none",label:"Без папки",onSelect:()=>{n.ids.forEach(r=>n.assign(r,null)),n.onClear()}}]:[],{id:"folder:new",label:"Новая папка…",onSelect:n.onNewFolder}]}function Nw(n){return n.map(l=>({...l,id:`pinned:${l.id}`,label:l.id==="folder:new"?"Новая папка закреплённых…":l.id==="folder:none"?"Без папки закреплённых":l.label}))}function ap(n){const[l,r]=b.useState([]),c=b.useRef(null);function o(){r([]),c.current=null}function u(p,g,x){if(p.ctrlKey||p.metaKey){r(v=>v.includes(g.id)?v.filter(j=>j!==g.id):[...v,g.id]),c.current=g.id;return}if(p.shiftKey&&c.current){const v=n.findIndex(y=>y.id===c.current),j=n.findIndex(y=>y.id===g.id);if(v!==-1&&j!==-1){const[y,T]=v<j?[v,j]:[j,v];r(n.slice(y,T+1).map(N=>N.id));return}}o(),c.current=g.id,x()}function h(p){return l.includes(p.id)?l:(r([p.id]),c.current=p.id,[p.id])}return{selected:l,click:u,targetsFor:h,clear:o}}const kw={display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,textAlign:"left"},Sw={width:22,height:22,borderRadius:6};function Rc({title:n,count:l,open:r,onToggle:c,hint:o,action:u}){const h=r?`Свернуть «${n}»`:`Развернуть «${n}»`;return a.jsxs("div",{className:"sidebar__section",children:[a.jsxs("button",{className:"sidebar__section--btn",style:kw,"aria-expanded":r,title:o?`${h} — ${o}`:h,onClick:c,children:[a.jsx(ay,{open:r}),a.jsx("span",{className:"sidebar__section-name",children:n}),a.jsx("span",{className:"sidebar__count",children:l})]}),u&&a.jsx("button",{className:"theme-btn",style:Sw,title:u.label,"aria-label":u.label,onClick:u.onClick,children:a.jsx(Ow,{})})]})}const Lb={paddingLeft:22},Ew={display:"flex",alignItems:"center",gap:6,width:"100%"},Tw={flex:1,minWidth:0,color:"var(--text-2)",fontWeight:500};function Cw({folder:n,count:l,open:r,renaming:c,onToggle:o,onStartRename:u,onCommitRename:h,onCancelRename:p,onDelete:g,color:x,onPreviewColor:v,onCommitColor:j,onResetColor:y}){const T=b.useRef(null),N=b.useRef(j);return N.current=j,b.useEffect(()=>{const E=T.current;if(!E)return;const A=()=>N.current(E.value);return E.addEventListener("change",A),()=>E.removeEventListener("change",A)},[c]),c?a.jsx("div",{className:"row",style:Lb,children:a.jsx("div",{className:"row__main",children:a.jsx(ga,{value:n.name,placeholder:"Название папки",onCommit:h,onCancel:p})})}):a.jsxs("div",{className:"row",style:Lb,children:[a.jsxs("button",{className:"row__main",style:Ew,"aria-expanded":r,title:r?`Свернуть папку «${n.name}»`:`Развернуть папку «${n.name}»`,onClick:o,children:[a.jsx(ay,{open:r}),a.jsx("span",{style:Tw,children:n.name}),a.jsx("span",{className:"sidebar__count",children:l})]}),a.jsx("button",{className:"row__edit",title:"Переименовать папку","aria-label":`Переименовать папку «${n.name}»`,onClick:u,children:"✎"}),a.jsxs("label",{className:x?"row__swatch row__swatch--set":"row__swatch",title:`Цвет папки «${n.name}»`,children:[a.jsx("span",{className:"row__swatch-dot",style:x?{background:x}:void 0}),a.jsx("input",{ref:T,type:"color",value:x??Aw(),"aria-label":`Цвет папки «${n.name}»`,onChange:E=>v(E.target.value)})]}),n.color&&a.jsx("button",{className:"row__edit",title:"Сбросить цвет папки","aria-label":`Сбросить цвет папки «${n.name}»`,onClick:y,children:"↺"}),a.jsx("button",{className:"row__edit",title:"Удалить папку — содержимое останется, просто станет без папки","aria-label":`Удалить папку «${n.name}»`,onClick:g,children:"✕"})]})}function Aw(){const n=getComputedStyle(document.documentElement).getPropertyValue("--folder-default").trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():"#9a978d"}function ay({open:n}){return a.jsx("svg",{className:n?"sidebar__chev sidebar__chev--open":"sidebar__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}function Hd(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("circle",{cx:"5.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"5.5",cy:"12",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"4",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"8",r:"1.15"}),a.jsx("circle",{cx:"10.5",cy:"12",r:"1.15"})]})}function Rw(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:a.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function Mw({className:n}){return a.jsxs("svg",{className:n,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"4.5",y:"2.4",width:"7",height:"4.2",rx:"1.6"}),a.jsx("path",{d:"M5.4 6.6 8 12.2 10.6 6.6"}),a.jsx("path",{d:"M8 12.2v1.4"})]})}function Dw(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function Ow(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3.2v9.6M3.2 8h9.6"})})}function Lw(){try{const n=localStorage.getItem(ny);if(n===null)return["archive","workspacesArchive"];const l=JSON.parse(n);return Array.isArray(l)?l.filter(r=>r==="workspaces"||r==="workspacesArchive"||r==="sessions"||r==="archive"||r==="pinned"||r==="live"):["archive","workspacesArchive"]}catch{return["archive","workspacesArchive"]}}function zw(){try{const n=localStorage.getItem(ly);if(n===null)return[];const l=JSON.parse(n);return Array.isArray(l)?l.filter(r=>typeof r=="string"):[]}catch{return[]}}function Iw(){try{const n=localStorage.getItem(sy);return n==="pinned"||n==="live"?n:"default"}catch{return"default"}}const zb={system:"ритм системы",light:"свет",dark:"тьма"};function Uw({mode:n}){const l={viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return n==="dark"?a.jsx("svg",{...l,children:a.jsx("path",{d:"M13.2 9.7A5.4 5.4 0 0 1 6.3 2.8a5.6 5.6 0 1 0 6.9 6.9Z"})}):n==="light"?a.jsxs("svg",{...l,children:[a.jsx("circle",{cx:"8",cy:"8",r:"3.1"}),a.jsx("path",{d:"M8 1.4v1.4M8 13.2v1.4M2.4 8H1M15 8h-1.4M4 4l-1-1M13 13l-1-1M12 4l1-1M3 13l1-1"})]}):a.jsxs("svg",{...l,children:[a.jsx("rect",{x:"1.8",y:"2.6",width:"12.4",height:"8.4",rx:"1.4"}),a.jsx("path",{d:"M5.6 13.4h4.8"})]})}function Hw(n){const l=Bw(n),r=(n.tasks??[]).filter(c=>c.kind==="agent").length;return r>0?`${l} · ${ty(r)}`:l}function Bw(n){switch(n.state){case"running":return"работает";case"waiting_permission":return"ждёт разрешения";case"idle":return n.backgroundWork?"работает в фоне":qw(n.lastTurn);case"starting":return"запускается";case"reconnecting":return"переподключается";case"error":return"ошибка";case"closed":return"на диске"}}function qw(n){switch(n){case"interrupted":return"прервана";case"stopped":return"остановлена";case"failed":return"оборвалась";case"completed":return"готова";case null:return"ждёт задачу"}}function Gw(n){switch(n.state){case"running":return"running";case"starting":return"starting";case"reconnecting":return"reconnecting";case"waiting_permission":return"waiting";case"idle":return n.backgroundWork?"background":$w(n.lastTurn);case"error":return"error";case"closed":return"closed"}}function $w(n){switch(n){case"interrupted":case"stopped":return"halted";case"failed":return"error";case"completed":return"ready";case null:return"fresh"}}function ip({session:n,tail:l}){return a.jsxs("span",{className:"row__meta",children:[a.jsxs("span",{className:`row__state row__state--${Gw(n)}`,children:[a.jsx("span",{className:"row__state-dot","aria-hidden":"true"}),Hw(n)]})," · ",l]})}function Bd({title:n,pinned:l,provider:r,projectName:c,projectPath:o}){return a.jsxs("span",{className:"row__head",children:[a.jsxs("span",{className:"row__title",children:[l&&a.jsx(Mw,{className:"row__pin"}),r==="codex"&&a.jsx("span",{className:"row__provider codex-mark",title:"Codex",children:"C"}),r==="antigravity"&&a.jsx(Xp,{className:"row__provider"}),n]}),a.jsx("span",{className:"row__project",title:o,children:c})]})}function Yw(n){const l=n.archivedAuto?"сама, по сроку молчания":"убрана вручную";return n.archivedAt?`${new Date(n.archivedAt).toLocaleString()} · ${l}`:l}function Vw(n){return n.archivedAt?`закрыт ${new Date(n.archivedAt).toLocaleString()}`:"закрыт"}const Ib=3,Xw=15e5;function iy(n,l){if(!l||typeof l!="object")return null;const r=l,c=typeof r.file_path=="string"?r.file_path:"";if(!c)return null;if(n==="Write"){if(typeof r.content!="string")return null;const o=rp(r.content).map(u=>({type:"add",text:u}));return{kind:"create",filePath:c,rows:o,added:o.length,removed:0,note:"файл записывается целиком"}}if(n==="Edit"){if(typeof r.old_string!="string"||typeof r.new_string!="string")return null;const o=Fw(Qw(rp(r.old_string),rp(r.new_string)));return{kind:"edit",filePath:c,rows:o,added:o.filter(u=>u.type==="add").length,removed:o.filter(u=>u.type==="del").length,note:r.replace_all===!0?"все вхождения":null}}return null}function rp(n){if(n==="")return[];const l=n.split(/\r?\n/);return l.length>1&&l[l.length-1]===""&&l.pop(),l}function Qw(n,l){let r=0;for(;r<n.length&&r<l.length&&n[r]===l[r];)r++;let c=n.length,o=l.length;for(;c>r&&o>r&&n[c-1]===l[o-1];)c--,o--;const u=h=>({type:"ctx",text:h});return[...n.slice(0,r).map(u),...Kw(n.slice(r,c),l.slice(r,o)),...n.slice(c).map(u)]}function Kw(n,l){if(n.length===0&&l.length===0)return[];if(n.length===0)return l.map(v=>({type:"add",text:v}));if(l.length===0)return n.map(v=>({type:"del",text:v}));if((n.length+1)*(l.length+1)>Xw)return[...n.map(v=>({type:"del",text:v})),...l.map(v=>({type:"add",text:v}))];const r=n.length,c=l.length,o=c+1,u=new Uint32Array((r+1)*o),h=(v,j)=>u[v*o+j]??0;for(let v=r-1;v>=0;v--)for(let j=c-1;j>=0;j--)u[v*o+j]=n[v]===l[j]?h(v+1,j+1)+1:Math.max(h(v+1,j),h(v,j+1));const p=[];let g=0,x=0;for(;g<r&&x<c;){const v=n[g],j=l[x];v===j?(p.push({type:"ctx",text:v}),g++,x++):h(g+1,x)>=h(g,x+1)?(p.push({type:"del",text:v}),g++):(p.push({type:"add",text:j}),x++)}for(;g<r;)p.push({type:"del",text:n[g++]});for(;x<c;)p.push({type:"add",text:l[x++]});return Zw(p)}function Zw(n){const l=[];let r=[];function c(){l.push(...r.filter(o=>o.type==="del")),l.push(...r.filter(o=>o.type==="add")),r=[]}for(const o of n)o.type==="ctx"?(c(),l.push(o)):r.push(o);return c(),l}function Fw(n){if(!n.some(u=>u.type!=="ctx"))return n;const l=n.map(()=>!1);n.forEach((u,h)=>{if(u.type!=="ctx")for(let p=Math.max(0,h-Ib);p<=Math.min(n.length-1,h+Ib);p++)l[p]=!0});const r=[];let c=[];function o(){c.length===1?r.push(...c):c.length>1&&r.push({type:"gap",text:`⋯ ${c.length} ${Jw(c.length)} без изменений`}),c=[]}return n.forEach((u,h)=>{l[h]?(o(),r.push(u)):c.push(u)}),o(),r}function Jw(n){const l=n%100;if(l>=11&&l<=14)return"строк";switch(n%10){case 1:return"строка";case 2:case 3:case 4:return"строки";default:return"строк"}}async function ba(n){try{return await navigator.clipboard.writeText(n),!0}catch{}const l=document.createElement("textarea");l.value=n,l.setAttribute("readonly",""),l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l);try{return l.select(),document.execCommand("copy")}catch{return!1}finally{l.remove()}}async function Sp(){try{return await navigator.clipboard.readText()}catch{return null}}const Qp=1600,Rr="Копировать",Uc="Скопировано";function Kc({text:n,hint:l,className:r}){const[c,o]=b.useState(!1);return b.useEffect(()=>{if(!c)return;const u=setTimeout(()=>o(!1),Qp);return()=>clearTimeout(u)},[c]),b.useEffect(()=>o(!1),[n]),a.jsx("button",{type:"button",className:"copybtn"+(c?" copybtn--done":"")+(r?` ${r}`:""),"aria-label":c?Uc:`${Rr} ${l}`,title:c?Uc:`${Rr} ${l}`,onClick:()=>{ba(n).then(u=>{u&&o(!0)})},children:c?Uc:Rr})}function Kp({diff:n}){return a.jsxs("div",{className:"diff",children:[a.jsxs("div",{className:"diff__head",children:[a.jsx("span",{className:"diff__path",title:n.filePath,children:n.filePath}),a.jsxs("span",{className:"diff__stat",children:[n.added>0&&a.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&a.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]})]}),n.note&&a.jsx("div",{className:"diff__note",children:n.note}),a.jsx("div",{className:"diff__body",children:n.rows.length===0?a.jsx("div",{className:"diff__row diff__row--gap",children:a.jsx("span",{className:"diff__text",children:"пустое содержимое"})}):n.rows.map((l,r)=>a.jsxs("div",{className:`diff__row diff__row--${l.type}`,children:[a.jsx("span",{className:"diff__mark","aria-hidden":"true",children:l.type==="add"?"+":l.type==="del"?"−":""}),a.jsx("span",{className:"diff__text",children:l.text===""?" ":l.text})]},r))})]})}function Zp(n){return/read|glob|grep|search|list|fetch|browse/i.test(n)?{title:"Исследует контекст",detail:"Читает материалы и собирает сведения для вашей задачи."}:/write|edit|patch|create/i.test(n)?{title:"Вносит изменения",detail:"Работает с содержимым проекта. Детали доступны в карточке действия."}:/bash|shell|exec|command|terminal/i.test(n)?{title:"Выполняет команду",detail:"Ожидает результат выполнения. Вывод появится в журнале действий."}:/question|ask/i.test(n)?{title:"Уточняет детали",detail:"Готовит вопрос, чтобы точнее выполнить вашу задачу."}:{title:"Выполняет действие",detail:"Результат и подробности появятся в журнале по мере выполнения."}}function Pw({waiting:n,activity:l,responding:r=!1}){const[c]=b.useState(Date.now),[o,u]=b.useState(0);b.useEffect(()=>{const g=window.setInterval(()=>u(Math.floor((Date.now()-c)/1e3)),1e3);return()=>window.clearInterval(g)},[c]);const h=n?{title:"Нужен ваш ответ",detail:"Процесс приостановлен. Ответьте на вопрос или рассмотрите запрос разрешения, чтобы продолжить."}:l?Zp(l):r?{title:"Формирует ответ",detail:"Ответ появляется постепенно. Вы можете читать его уже сейчас."}:{title:"Работает над задачей",detail:"Обрабатывает ваш запрос. Новые действия и результаты появятся здесь."},p=o<60?`${o} с`:`${Math.floor(o/60)} мин ${o%60} с`;return a.jsxs("div",{className:n?"process process--waiting":"process","aria-busy":!n,children:[a.jsxs("div",{className:"process__visual","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("i",{})]}),a.jsxs("div",{className:"process__content",children:[a.jsxs("div",{className:"process__heading",children:[a.jsx("span",{className:"process__eyebrow",children:n?"ОЖИДАНИЕ РЕШЕНИЯ":"ПРОЦЕСС В ДВИЖЕНИИ"}),a.jsx("span",{className:"process__time","aria-label":`С начала работы: ${p}`,children:p})]}),a.jsxs("div",{role:"status",className:"process__status",children:[a.jsx("strong",{children:h.title}),a.jsx("p",{children:h.detail})]}),l&&a.jsxs("span",{className:"process__activity",children:["Действие: ",l]}),a.jsxs("div",{className:"process__steps","aria-hidden":"true",children:[a.jsx("span",{className:"is-done",children:"Запрос принят"}),a.jsx("i",{}),a.jsx("span",{className:"is-current",children:n?"Ваше решение":"В работе"}),a.jsx("i",{}),a.jsx("span",{children:"Результат"})]})]})]})}function hf({items:n,busy:l,waiting:r,history:c=[],historyHasMore:o=!1,historyLoading:u=!1,onLoadHistory:h,sessionId:p,onEditMessage:g,empty:x="Опишите задачу — ответы, действия и результаты появятся здесь.",welcome:v}){var O;const j=b.useRef(null),y=b.useRef(null),T=b.useRef(!1);T.current=!!v&&n.length===0&&c.length===0;const N=b.useRef(!0),E=b.useRef(null),A=b.useRef(null),D=b.useRef(!1);b.useEffect(()=>{N.current=!0,E.current=null,D.current=!1,A.current!==null&&(clearTimeout(A.current),A.current=null)},[p]),b.useEffect(()=>{const I=j.current,V=y.current;if(!I||!V)return;function R(se){!I||se===I.scrollTop||(D.current=!0,I.scrollTop=se)}function L(){if(!I)return;const se=E.current;if(se){const ve=Hb(I,se.id);if(ve){const je=ve.getBoundingClientRect().top-I.getBoundingClientRect().top;R(I.scrollTop+(je-se.top))}A.current!==null&&clearTimeout(A.current),A.current=setTimeout(()=>{E.current=null},500);return}N.current&&R(T.current?0:I.scrollHeight)}const G=new ResizeObserver(L);return G.observe(V),()=>{G.disconnect(),A.current!==null&&clearTimeout(A.current)}},[]);function q(){const I=j.current;if(I){if(D.current){D.current=!1;return}N.current=I.scrollHeight-I.scrollTop-I.clientHeight<80}}function Q(){if(u)return;const I=j.current,V=c[0];if(I&&V){const R=Hb(I,V.id);R&&(E.current={id:V.id,top:R.getBoundingClientRect().top-I.getBoundingClientRect().top})}h==null||h()}let z=0;function U(I){return I.kind==="user"?z++:-1}return a.jsx("div",{className:"transcript",ref:j,onScroll:q,children:a.jsxs("div",{className:"stream",ref:y,children:[o&&a.jsx("button",{type:"button",className:"transcript__more",onClick:Q,disabled:u,children:u?"Загружаем…":"Показать более раннее"}),c.map(I=>a.jsx(Ub,{item:I,userIndex:U(I),onEditMessage:g},I.id)),c.length>0&&n.length>0&&a.jsx("div",{className:"transcript__divider",children:a.jsx("span",{children:"дальше — сессия открыта заново"})}),c.length===0&&n.length===0&&(v??a.jsx("p",{className:"empty",children:x})),n.map(I=>a.jsx(Ub,{item:I,userIndex:U(I),onEditMessage:g},I.id)),l&&a.jsx(Pw,{waiting:r,activity:(O=[...n].reverse().find(I=>I.kind==="tool"&&I.result===null))==null?void 0:O.name,responding:n.some(I=>I.kind==="assistant"&&I.streaming)},p)]})})}function Ub({item:n,userIndex:l,onEditMessage:r}){switch(n.kind){case"user":return a.jsx(eN,{item:n,userIndex:l,onEditMessage:r});case"assistant":return a.jsxs("div",{className:"msg--assistant","data-item-id":n.id,children:[a.jsx(tN,{text:n.text}),n.streaming&&a.jsx("span",{className:"caret"}),n.text.trim()!==""&&a.jsx("div",{className:"msg--assistant__foot",children:a.jsx(Kc,{text:n.text,hint:"ответ целиком"})})]});case"thinking":return a.jsx("div",{className:"thinking","data-item-id":n.id,children:n.text});case"tool":return a.jsx(sN,{item:n});case"result":return a.jsxs("div",{className:"result-line","data-item-id":n.id,children:[a.jsx("span",{children:n.isError?"✗ "+n.subtype:"✓ готово"}),a.jsxs("span",{children:[(n.durationMs/1e3).toFixed(1)," с"]}),n.costUsd!==null&&a.jsxs("span",{children:["$",n.costUsd.toFixed(4)]}),a.jsxs("span",{children:["↑",qb(n.inputTokens)," ↓",qb(n.outputTokens)]})]});case"notice":return a.jsx("div",{className:n.tone==="error"?"notice notice--error":"notice","data-item-id":n.id,children:n.text})}}const Ww=500;function eN({item:n,userIndex:l,onEditMessage:r}){const[c,o]=b.useState(null),[u,h]=b.useState(!1),[p,g]=b.useState(n.text),x=b.useRef(null),v=b.useRef(!1),j=of("(max-width: 860px)"),y=b.useRef(null);function T(V,R){o({x:V,y:R})}function N(V){V.preventDefault(),T(V.clientX,V.clientY)}function E(V){const R=V.touches[0];if(!R)return;const L={timer:0,x:R.clientX,y:R.clientY,fired:!1};L.timer=window.setTimeout(()=>{L.fired=!0,T(L.x,L.y)},Ww),y.current=L}function A(V){const R=y.current,L=V.touches[0];!R||!L||Math.hypot(L.clientX-R.x,L.clientY-R.y)>10&&(window.clearTimeout(R.timer),y.current=null)}function D(V){const R=y.current;R&&(window.clearTimeout(R.timer),R.fired&&V.preventDefault())}function q(){g(n.text),h(!0)}function Q(){h(!1)}function z(){const V=p.trim();if(V===""&&!(n.images&&n.images.length>0))return;const R=r==null?void 0:r(l,V,n.images);if(R instanceof Promise){if(v.current)return;v.current=!0,R.then(L=>{v.current=!1,L&&h(!1)},()=>{v.current=!1});return}R!==!1&&h(!1)}b.useEffect(()=>{const V=x.current;!V||!u||(V.style.height="auto",V.style.height=`${V.scrollHeight}px`)},[p,u]),b.useEffect(()=>{if(!u)return;const V=x.current;V&&(V.focus(),V.setSelectionRange(V.value.length,V.value.length))},[u]);function U(V){if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),Q();return}V.key==="Enter"&&!V.shiftKey&&!j&&(V.preventDefault(),z())}const O=n.images&&n.images.length>0&&a.jsx("div",{className:"msg--user__images",children:n.images.map((V,R)=>a.jsx("img",{className:"msg--user__image",src:`data:${V.mediaType};base64,${V.data}`,alt:"Вложение"},R))});if(u){const V=p.trim()!==""||!!(n.images&&n.images.length>0);return a.jsxs("div",{className:"msg--user msg--user--editing","data-item-id":n.id,children:[O,a.jsxs("div",{className:"msg--user__edit",children:[a.jsx("textarea",{ref:x,className:"msg--user__edit-field",value:p,onChange:R=>g(R.target.value),onKeyDown:U,rows:1}),a.jsxs("div",{className:"msg--user__edit-actions",children:[a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:Q,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:z,disabled:!V,children:"Сохранить"})]})]})]})}const I=[{id:"copy",label:"Копировать",onSelect:()=>void ba(n.text)},...r?[{id:"edit",label:"Изменить",onSelect:q}]:[]];return a.jsxs("div",{className:"msg--user","data-item-id":n.id,onContextMenu:N,onTouchStart:E,onTouchMove:A,onTouchEnd:D,onTouchCancel:D,children:[O,n.text,c&&a.jsx(Ui,{x:c.x,y:c.y,items:I,onClose:()=>o(null)})]})}function Hb(n,l){const r=n.querySelectorAll("[data-item-id]");for(const c of r)if(c.dataset.itemId===l)return c;return null}function tN({text:n}){const[l,r]=b.useState(""),c=b.useRef([]);b.useEffect(()=>{let u=!1;return ff(n).then(h=>{u||r(nN(h))}),()=>{u=!0}},[n]),b.useEffect(()=>{const u=c.current;return()=>u.forEach(h=>clearTimeout(h))},[]);function o(u){var g,x;const h=u.target.closest(".codeblock__copy");if(!(h instanceof HTMLElement))return;const p=((x=(g=h.parentElement)==null?void 0:g.querySelector("pre"))==null?void 0:x.textContent)??"";p!==""&&ba(p).then(v=>{if(!v)return;h.textContent=Uc,h.setAttribute("aria-label",Uc),h.classList.add("copybtn--done");const j=window.setTimeout(()=>{h.isConnected&&(h.textContent=Rr,h.setAttribute("aria-label",Ep),h.classList.remove("copybtn--done"))},Qp);c.current.push(j)})}return a.jsx("div",{className:"markdown-preview msg--assistant__body",onClick:o,dangerouslySetInnerHTML:{__html:l}})}const Ep=`${Rr} блок кода`;function nN(n){if(!n.includes("<pre"))return n;const l=new DOMParser().parseFromString(n,"text/html");for(const r of l.body.querySelectorAll("pre")){const c=l.createElement("div");c.className="codeblock",r.replaceWith(c),c.append(r);const o=l.createElement("button");o.type="button",o.className="copybtn codeblock__copy",o.setAttribute("aria-label",Ep),o.title=Ep,o.textContent=Rr,c.append(o)}return l.body.innerHTML}function sN({item:n}){const[l,r]=b.useState(!1),c=n.result===null,o=iy(n.name,n.input),u=n.name==="AskUserQuestion"?iN(n.input):null;return a.jsxs("div",{className:"tool"+(c&&!n.awaitingPermission?" tool--running":"")+(n.isError?" tool--error":"")+(n.awaitingPermission?" tool--wait":""),"data-item-id":n.id,children:[a.jsxs("button",{className:"tool__head","aria-expanded":l,onClick:()=>r(h=>!h),children:[a.jsx("span",{className:"tool__indicator","aria-hidden":"true",children:n.awaitingPermission?"Ⅱ":c?"◌":n.isError?"!":"✓"}),a.jsxs("span",{className:"tool__identity",children:[a.jsx("span",{className:"tool__name",children:Zp(n.name).title}),a.jsx("span",{className:"tool__technical",children:n.name})]}),a.jsx("span",{className:"tool__arg",children:u?aN(u):lN(n.input)}),a.jsx("span",{className:"tool__status",children:n.awaitingPermission?"Ваше решение":c?"Выполняется":n.isError?"Ошибка":"Готово"}),a.jsx("span",{className:"tool__chevron","aria-hidden":"true",children:l?"−":"+"})]}),l&&a.jsxs("div",{className:"tool__body",children:[u?a.jsx(rN,{questions:u,answers:n.answers}):o?a.jsx(Kp,{diff:o}):a.jsx(Bb,{text:JSON.stringify(n.input,null,2),hint:"аргументы вызова"}),n.result!==null&&(!u||n.isError)&&a.jsx(Bb,{text:n.result,hint:"результат вызова",style:{marginTop:10}})]})]})}function Bb({text:n,hint:l,style:r}){return a.jsxs("div",{className:"codeblock",style:r,children:[a.jsx("pre",{className:"code",children:n}),a.jsx(Kc,{text:n,hint:l,className:"codeblock__copy"})]})}function lN(n){if(!n||typeof n!="object")return"";const l=n;for(const r of["file_path","command","pattern","path","url","prompt"]){const c=l[r];if(typeof c=="string")return c.replace(/\s+/g," ").slice(0,160)}return JSON.stringify(l).slice(0,160)}function aN(n){var r;const l=n.map(c=>c.header).filter(c=>c.length>0);return l.length===n.length?l.join(" · "):((r=n[0])==null?void 0:r.question.replace(/\s+/g," ").slice(0,160))??""}function iN(n){if(typeof n!="object"||n===null)return null;const l=n.questions;if(!Array.isArray(l)||l.length===0)return null;const r=[];for(const c of l){if(typeof c!="object"||c===null)return null;const{question:o,header:u,options:h,multiSelect:p}=c;if(typeof o!="string"||!Array.isArray(h)||h.length===0)return null;const g=[];for(const x of h){if(typeof x!="object"||x===null)return null;const{label:v,description:j,preview:y}=x;if(typeof v!="string"||typeof j!="string")return null;g.push({label:v,description:j,...typeof y=="string"?{preview:y}:{}})}r.push({question:o,header:typeof u=="string"?u:"",options:g,multiSelect:p===!0})}return r}function rN({questions:n,answers:l}){return a.jsx("div",{className:"tool__questions",children:n.map((r,c)=>a.jsxs("div",{className:"tool__question",children:[a.jsxs("div",{className:"tool__question-head",children:[r.header&&a.jsx("span",{className:"chip chip--accent",children:r.header}),a.jsx("span",{className:"tool__question-text",children:r.question})]}),a.jsx("div",{className:"tool__question-answer",children:l!=null&&l[r.question]?a.jsx("span",{className:"tool__answer-value",children:l[r.question]}):a.jsx("span",{className:"tool__answer-empty",children:"не отвечено"})})]},c))})}function qb(n){return n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}function cN({connected:n,workspaceName:l,hasSession:r,onOpenWorkspace:c,onNewSession:o,onOpenFiles:u,onOpenSettings:h}){return a.jsxs("section",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsxs("div",{className:"welcome__eyebrow",children:[a.jsx("span",{})," МЕСТО, ГДЕ ИДЕИ ОБРЕТАЮТ ФОРМУ"]}),a.jsxs("div",{className:"eclipse","aria-hidden":"true",children:[a.jsx("div",{className:"eclipse__halo"}),a.jsx("div",{className:"eclipse__orbit eclipse__orbit--outer",children:a.jsx("i",{})}),a.jsx("div",{className:"eclipse__orbit eclipse__orbit--inner",children:a.jsx("i",{})}),a.jsx("div",{className:"eclipse__body"}),a.jsx("span",{className:"eclipse__star eclipse__star--one"}),a.jsx("span",{className:"eclipse__star eclipse__star--two"}),a.jsx("span",{className:"eclipse__coordinate",children:"СВЕТ / ТЬМА"})]}),a.jsxs("h1",{id:"welcome-title",children:["От мысли",a.jsx("br",{}),"к ",a.jsx("span",{children:"возможностям."})]}),a.jsx("p",{className:"welcome__description",children:"Одно пространство для больших идей и повседневных задач. Исследуйте, создавайте, меняйте — в своём ритме."}),a.jsxs("div",{className:"welcome__context",children:[a.jsx("span",{className:n?"dot dot--on":"dot"}),l?a.jsxs(a.Fragment,{children:["Рабочее пространство ",a.jsx("strong",{children:l})]}):"Начните с пространства для вашей работы"]}),a.jsxs("div",{className:"welcome__actions",children:[a.jsxs("button",{type:"button",className:"welcome-card",disabled:!n,onClick:r?()=>{var p;return(p=document.querySelector(".main .composer textarea"))==null?void 0:p.focus()}:l?o:c,children:[a.jsxs("span",{className:"welcome-card__top",children:[a.jsx("span",{className:"welcome-card__number",children:"01 / СОЗДАВАЙТЕ"}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),a.jsx("span",{className:"welcome-card__icon","aria-hidden":"true",children:"✧"}),a.jsx("strong",{children:r?"Начать с идеи":l?"Новый разговор":"Открыть пространство"}),a.jsx("span",{className:"welcome-card__description",children:r?"Опишите задачу своими словами. Ответы и действия появятся здесь.":l?"Создайте сессию с подключённым агентом и переходите к задаче.":"Выберите папку проекта: файлы, разговоры и результаты будут рядом."})]}),a.jsxs("button",{type:"button",className:"welcome-card",disabled:!n,onClick:l?u:c,children:[a.jsxs("span",{className:"welcome-card__top",children:[a.jsx("span",{className:"welcome-card__number",children:"02 / ИССЛЕДУЙТЕ"}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),a.jsx("span",{className:"welcome-card__icon","aria-hidden":"true",children:a.jsxs("svg",{viewBox:"0 0 24 24",width:"27",height:"27",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:[a.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),a.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),a.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),a.jsx("path",{d:"M14 17.5h7m-3.5-3.5v7"})]})}),a.jsx("strong",{children:"Ближе к деталям"}),a.jsx("span",{className:"welcome-card__description",children:"Откройте файлы, изучите структуру и соберите контекст для следующего шага."})]}),a.jsxs("button",{type:"button",className:"welcome-card",onClick:h,children:[a.jsxs("span",{className:"welcome-card__top",children:[a.jsx("span",{className:"welcome-card__number",children:"03 / НАСТРАИВАЙТЕ"}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),a.jsx("span",{className:"welcome-card__icon welcome-card__icon--circle","aria-hidden":"true",children:"◐"}),a.jsx("strong",{children:"На вашей стороне"}),a.jsx("span",{className:"welcome-card__description",children:"Выберите свет или тьму, подключите агентов и задайте правила работы."})]})]}),a.jsxs("p",{className:"welcome__footnote",children:[a.jsx("span",{"aria-hidden":"true",children:"↳"})," Ваши инструменты. Ваш подход. Единое пространство."]})]})}const an=n=>n.claudeSessionId??n.id;function ry(n,l,r,c){const o=new Set([...l,...r].flatMap(h=>[h.id,an(h)])),u=l.map(h=>{const p=n.find(g=>g.id===h.id||an(g)===an(h));return!p||p.lastSeq<=h.lastSeq&&p.updatedAt<=h.updatedAt?h:{...h,...p,pinned:h.pinned,pinnedAt:h.pinnedAt,folderId:h.folderId,pinnedFolderId:h.pinnedFolderId,archivedAt:h.archivedAt,archivedAuto:h.archivedAuto}});for(const h of n)h.workspaceId===c&&h.state!=="closed"&&!o.has(h.id)&&!o.has(an(h))&&u.push(h);return u}const Os=n=>{var l;return((l=n.title)==null?void 0:l.trim())||"Новый разговор"},ru=n=>["running","reconnecting"].includes(n.state)||n.backgroundWork;function hu(n){return n.state==="waiting_permission"?"Нужен ваш ответ":n.state==="error"||n.lastTurn==="failed"?"Ошибка":n.state==="running"?"В работе":n.state==="reconnecting"?"Восстанавливает связь":n.backgroundWork?"Работает в фоне":n.state==="closed"?"На диске":n.lastTurn==="completed"?"Завершено":n.lastTurn==="interrupted"||n.lastTurn==="stopped"?"Приостановлено":"Готов к работе"}function Gb(n,l){var o;const r=new Set;let c=n;for(;!r.has(c);){r.add(c);const u=(o=l.find(h=>h.sessionId===c))==null?void 0:o.parentId;if(!u)return c;c=u}return n}function oN(){try{const n=JSON.parse(localStorage.getItem("ether:inbox.seen")??"{}");if(n&&typeof n=="object"&&!Array.isArray(n))return Object.fromEntries(Object.entries(n).filter(([,l])=>typeof l=="number"&&Number.isFinite(l)))}catch{}return{}}function uN({connected:n,workspaces:l,send:r}){const[c,o]=b.useState(null),[u,h]=b.useState([]),p=b.useRef([]),[g,x]=b.useState({}),[v,j]=b.useState({}),[y,T]=b.useState({}),[N,E]=b.useState({}),[A,D]=b.useState({}),[q,Q]=b.useState(null),z=b.useRef(null),[U,O]=b.useState([]),[I,V]=b.useState(oN),[R,L]=b.useState({}),[G,se]=b.useState(null),[ve,je]=b.useState(!0),[we,F]=b.useState(!1),[$,ne]=b.useState(null),pe=b.useRef(null),Ne=b.useRef(new Map),S=b.useRef(new Set);S.current=new Set(l.map(ee=>ee.id));const Z=b.useRef(null),de=b.useRef(G);de.current=G;const be=b.useRef(g);be.current=g;const Me=b.useRef(N);Me.current=N;const Ie=b.useRef(y);Ie.current=y;const Ke=l.map(ee=>ee.id).sort().join("|");b.useEffect(()=>{if(!n){Ne.current.clear(),F(!1),pe.current=null;return}for(const ee of l)r({type:"session.list",workspaceId:ee.id});p.current.includes("session-links")&&r({type:"session.links.get"})},[n,Ke,r]);const ce=b.useCallback(ee=>{var tt,Fe;if(ee.type==="hello.ok"&&(p.current=ee.features??[],h(ee.features??[]),Z.current&&Z.current!==ee.hostId&&(T({}),E({}),L({}),Ne.current.clear()),Z.current=ee.hostId),ee.type==="session.list"){for(const $e of ee.sessions)$e.state!=="closed"&&!$e.parentSessionId&&!Ne.current.has($e.id)&&(Ne.current.set($e.id,0),r({type:"session.sync",sessionId:$e.id,sinceSeq:0}));j($e=>({...$e,[ee.workspaceId]:!0})),x($e=>{const Je=Object.fromEntries(Object.entries($e).filter(([,Qe])=>Qe.workspaceId!==ee.workspaceId));for(const Qe of[...ry(Object.values($e),ee.sessions,ee.archived,ee.workspaceId),...ee.archived])Qe.parentSessionId||(Je[Qe.id]=Qe);return Je})}if(ee.type==="session.summary"||ee.type==="session.live"){const $e=ee.type==="session.live"?ee.sessions:[ee.session],Je=de.current?be.current[de.current]:null;if(!p.current.includes("session-routing")&&pe.current&&ee.type==="session.summary"&&Je&&ee.session.state!=="closed"&&(ee.session.id===Je.id||ee.session.claudeSessionId===an(Je))&&(pe.current=null,F(!1),se(ee.session.id),r({type:"session.sync",sessionId:ee.session.id,sinceSeq:0}),r({type:"session.history",sessionId:ee.session.id})),x(Qe=>{const ft={...Qe};for(const De of $e)if(!(De.parentSessionId||!S.current.has(De.workspaceId))){for(const[wt,Nt]of Object.entries(ft))Nt.workspaceId===De.workspaceId&&wt!==De.id&&an(Nt)===an(De)&&delete ft[wt];ft[De.id]={...ft[De.id],...De,...De.state!=="closed"?{archivedAt:void 0}:{}}}return ft}),ee.type==="session.live")for(const Qe of $e)Qe.parentSessionId||!S.current.has(Qe.workspaceId)||Ne.current.has(Qe.id)||(Ne.current.set(Qe.id,0),r({type:"session.sync",sessionId:Qe.id,sinceSeq:0}))}if(ee.type==="session.events"){const $e=ee.entries.findLast(De=>De.event.kind==="result");$e&&L(De=>({...De,[ee.sessionId]:$e.ts}));const Je=ee.entries.findLast(De=>{var wt;return De.event.kind==="rewound"&&De.seq>(((wt=Ie.current[ee.sessionId])==null?void 0:wt.lastSeq)??0)}),Qe=(Je==null?void 0:Je.event.kind)==="rewound"?Je.event.toUserIndex:null,ft=Qe===null?null:k_(((tt=Me.current[ee.sessionId])==null?void 0:tt.entries)??[],Qe);ft&&E(De=>({...De,[ee.sessionId]:{...De[ee.sessionId]??qi,entries:ft}})),T(De=>{let wt=De[ee.sessionId]??Jn;if(Je&&Je.seq>wt.lastSeq&&Qe!==null){const Nt=(ft==null?void 0:ft.filter(Ht=>Ht.event.kind==="user.message").length)??0;wt={...wt,items:S_(wt.items,Qe,Nt)}}return{...De,[ee.sessionId]:iu(wt,ee.entries)}})}if(ee.type==="session.history"&&E($e=>({...$e,[ee.sessionId]:N_($e[ee.sessionId]??qi,ee)})),ee.type==="session.capabilities"&&D($e=>({...$e,[ee.sessionId]:ee.capabilities})),ee.type==="fs.search"&&ee.scope==="comparison"&&ee.workspaceId===((Fe=z.current)==null?void 0:Fe.workspaceId)&&ee.query===z.current.query&&Q({query:ee.query,entries:ee.entries}),ee.type==="fs.dir"&&z.current&&ee.workspaceId===z.current.workspaceId&&ee.path===z.current.path){const $e=z.current.query,Je=$e.slice($e.lastIndexOf("/")+1).toLocaleLowerCase();Q({query:$e,entries:ee.entries.filter(Qe=>Qe.name.toLocaleLowerCase().includes(Je))})}ee.type==="session.links"&&(O(ee.links),ne(null)),ee.type==="session.closed"&&x($e=>{const Je=$e[ee.sessionId];return Je?{...$e,[ee.sessionId]:{...Je,state:"closed",backgroundWork:!1}}:$e}),ee.type==="session.started"&&ee.requestId===pe.current&&(pe.current=null,F(!1),se(ee.session.id),x($e=>({...$e,[ee.session.id]:ee.session})),r({type:"session.sync",sessionId:ee.session.id,sinceSeq:0}),r({type:"session.history",sessionId:ee.session.id})),ee.type==="error"&&["session.start","session.link","session.history","session.sync","permission.respond","prompt.send"].includes(ee.context??"")&&(ne(ee.message),ee.context==="session.start"&&ee.requestId===pe.current&&(pe.current=null,F(!1)))},[r]),Ue=b.useMemo(()=>Object.values(g).filter(ee=>S.current.has(ee.workspaceId)).sort((ee,tt)=>tt.updatedAt-ee.updatedAt),[g,Ke]),ge=ee=>ee.state==="error"?ee.updatedAt:R[ee.id]??ee.updatedAt,Ze=Ue.filter(ee=>{var tt;return!ee.archivedAt&&(ee.state==="waiting_permission"||(((tt=y[ee.id])==null?void 0:tt.pending.length)??0)>0||!ru(ee)&&(ee.state==="error"||ee.lastTurn==="failed"||ee.lastTurn==="completed")&&ge(ee)>(I[an(ee)]??0))}),dt=Ze.filter(ee=>{var tt;return ee.state==="waiting_permission"||(((tt=y[ee.id])==null?void 0:tt.pending.length)??0)>0}),lt=b.useCallback(ee=>V(tt=>{const Fe=ee.state==="error"?ee.updatedAt:R[ee.id]??ee.updatedAt;if((tt[an(ee)]??0)>=Fe)return tt;const $e={...tt,[an(ee)]:Fe};try{localStorage.setItem("ether:inbox.seen",JSON.stringify($e))}catch{}return $e}),[R]),gt=b.useCallback(ee=>{z.current=null,Q(null),se(ee.id),je(!0),o(null),ne(null)},[]);b.useEffect(()=>{!G||!n||!g[G]||g[G].state==="closed"||(r({type:"session.sync",sessionId:G,sinceSeq:0}),E(ee=>({...ee,[G]:{...ee[G]??qi,loading:!0}})),r({type:"session.history",sessionId:G}))},[G,n,r]);const et=b.useCallback(()=>{const ee=de.current?be.current[de.current]:null;if(!ee||pe.current)return;const tt=crypto.randomUUID();pe.current=tt,F(!0),ne(null),r({type:"session.start",requestId:tt,workspaceId:ee.workspaceId,resume:an(ee),provider:ee.provider})},[r]),Tt=b.useCallback(()=>{if(n){ne(null);for(const ee of l)r({type:"session.list",workspaceId:ee.id});for(const ee of Object.values(be.current))ee.state!=="closed"&&!ee.archivedAt&&r({type:"session.sync",sessionId:ee.id,sinceSeq:0});p.current.includes("session-links")&&r({type:"session.links.get"})}},[n,l,r]);return{view:c,setView:o,sessions:g,allSessions:Ue,loaded:v,timelines:y,histories:N,links:U,attention:Ze,waiting:dt,markRead:lt,handleFrame:ce,capabilities:A,comparisonContext:q,supportsLinks:u.includes("session-links"),compareId:G,compareVisible:ve,setCompareVisible:je,compareLaunching:we,openComparison:gt,resumeComparison:et,closeComparison:()=>{se(null),je(!1)},send:r,error:$,clearError:()=>ne(null),refresh:Tt,searchComparison:ee=>{const tt=de.current?be.current[de.current]:null;if(Q(null),ee===null||!tt){z.current=null;return}const Fe=ee.lastIndexOf("/"),$e=Fe>=0?ee.slice(0,Fe):"";z.current={workspaceId:tt.workspaceId,query:ee,...Fe>=0||ee===""?{path:$e}:{}},Fe>=0||ee===""?r({type:"fs.list",workspaceId:tt.workspaceId,path:$e}):r({type:"fs.search",workspaceId:tt.workspaceId,query:ee,scope:"comparison"})},loadHistory:(ee,tt)=>{E(Fe=>({...Fe,[ee]:{...Fe[ee]??qi,loading:!0}})),r({type:"session.history",sessionId:ee,before:tt})}}}function Fp(n){const l=n.findLast(o=>o.kind==="user"),r=n.findLast(o=>o.kind==="assistant"),c=n.filter(o=>o.kind==="tool").slice(-3).map(o=>{if(o.kind!=="tool")return"";const u=o.input&&typeof o.input=="object"?o.input:{},h=[u.file_path,u.path,u.command,u.query].find(p=>typeof p=="string");return`${Zp(o.name).title}${h?` · ${String(h).slice(0,180)}`:` · ${o.name}`}${o.isError?" · ошибка":o.result===null?" · выполняется":" · готово"}`});return{prompt:(l==null?void 0:l.kind)==="user"?l.text:"",answer:(r==null?void 0:r.kind)==="assistant"?r.text:"",actions:c}}function cy({session:n,items:l,pendingCount:r}){const[c,o]=b.useState(()=>Date.now()-n.createdAt>3e5),u=Fp(l);return!u.prompt&&!u.answer&&u.actions.length===0?null:a.jsxs("section",{className:"session-recap"+(c?" is-open":""),"aria-label":"Контекст сессии",children:[a.jsxs("button",{type:"button",className:"session-recap__toggle","aria-expanded":c,onClick:()=>o(!c),children:[a.jsx("span",{"aria-hidden":"true",children:"↳"}),a.jsx("strong",{children:"Вернуться в контекст"}),a.jsx("span",{className:"session-recap__preview",children:u.prompt.slice(0,130)||"Последние действия и результат"}),a.jsx("span",{"aria-hidden":"true",children:c?"−":"+"})]}),c&&a.jsxs("div",{className:"session-recap__body",children:[u.prompt&&a.jsxs("div",{children:[a.jsx("span",{className:"hub-eyebrow",children:"ПОСЛЕДНЯЯ ЗАДАЧА"}),a.jsx("p",{children:u.prompt.slice(0,700)})]}),u.actions.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"hub-eyebrow",children:"ПОСЛЕДНИЕ ДЕЙСТВИЯ"}),a.jsx("ul",{children:u.actions.map((h,p)=>a.jsx("li",{children:h},p))})]}),u.answer&&a.jsxs("div",{children:[a.jsx("span",{className:"hub-eyebrow",children:"ПОСЛЕДНИЙ ОТВЕТ"}),a.jsxs("p",{children:[u.answer.slice(0,700),u.answer.length>700?"…":""]})]}),r>0&&a.jsxs("p",{className:"hub-warning",children:["Ожидают вашего решения: ",r,". Рассмотрите запрос в разговоре или во «Входящих»."]}),["interrupted","stopped","failed"].includes(n.lastTurn??"")&&a.jsx("p",{className:"hub-warning",children:"Предыдущий ход не завершён. Можно уточнить задачу и продолжить разговор."})]})]})}function rs({title:n,children:l,actions:r,className:c,sheet:o=!1,onClose:u}){const h=b.useRef(null);return b.useEffect(()=>{function p(g){if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),u();return}if(g.key!=="Tab")return;const x=h.current;if(!x)return;const v=x.querySelectorAll('button, input, textarea, select, a[href], [tabindex]:not([tabindex="-1"])'),j=v[0],y=v[v.length-1];!j||!y||(g.shiftKey&&document.activeElement===j?(g.preventDefault(),y.focus()):!g.shiftKey&&document.activeElement===y&&(g.preventDefault(),j.focus()))}return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[u]),a.jsx("div",{className:o?"modal-backdrop modal-backdrop--sheet":"modal-backdrop",onMouseDown:p=>{p.target===p.currentTarget&&u()},children:a.jsxs("div",{ref:h,className:c?`modal ${c}`:"modal",role:"dialog","aria-modal":"true","aria-label":n,children:[a.jsxs("div",{className:"modal__head",children:[a.jsx("h2",{className:"modal__title",children:n}),a.jsx("button",{className:"modal__close","aria-label":"Закрыть",onClick:u,children:"✕"})]}),a.jsx("div",{className:"modal__body",children:l}),r&&a.jsx("div",{className:"modal__actions",children:r})]})})}function oy(n,l){if(n!=="ExitPlanMode"||!l||typeof l!="object")return null;const r=l.plan;return typeof r=="string"?r:null}function uy({request:n,plan:l,queued:r,collapsed:c,onCollapse:o,onAccept:u,onDecline:h}){const[p,g]=b.useState(l),[x,v]=b.useState("preview");b.useEffect(()=>{g(l),v("preview")},[n.requestId,l]);const j=p.trim().length>0;function y(){j&&u(n.requestId,p)}return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:c,children:a.jsxs("div",{className:"plansheet",role:"dialog","aria-modal":"true","aria-label":"План агента",children:[a.jsxs("div",{className:"plansheet__head",children:[a.jsx("span",{className:"plansheet__head-icon","aria-hidden":"true",children:a.jsx(dy,{})}),a.jsxs("span",{className:"plansheet__head-text",children:["План на согласование",r>0&&` — ещё ${r} в очереди`]}),a.jsxs("div",{className:"plansheet__viewtoggle",role:"tablist","aria-label":"Режим просмотра",children:[a.jsx("button",{className:"btn btn--sm"+(x==="preview"?" is-on":""),role:"tab","aria-selected":x==="preview",onClick:()=>v("preview"),children:"Просмотр"}),a.jsx("button",{className:"btn btn--sm"+(x==="source"?" is-on":""),role:"tab","aria-selected":x==="source",onClick:()=>v("source"),children:"Код"})]}),a.jsx(Jp,{onClick:o})]}),a.jsxs("div",{className:"plansheet__body",children:[n.reason&&a.jsx("p",{className:"plansheet__reason",children:n.reason}),a.jsx("div",{className:"plansheet__content",children:x==="preview"?a.jsx(dN,{text:p}):a.jsx("textarea",{className:"plansheet__source",value:p,onChange:T=>g(T.target.value),spellCheck:!1,"aria-label":"Текст плана — можно отредактировать перед тем, как согласиться",autoFocus:!0})})]}),a.jsxs("div",{className:"plansheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>h(n.requestId),children:"Доработать"}),a.jsx("button",{className:"btn btn--ok",disabled:!j,autoFocus:!0,onClick:y,children:"Одобрить план"})]})]})})}function dN({text:n}){const[l,r]=b.useState("");return b.useEffect(()=>{let c=!1;return ff(n).then(o=>{c||r(o)}),()=>{c=!0}},[n]),a.jsx("div",{className:"markdown-preview plansheet__preview",dangerouslySetInnerHTML:{__html:l}})}function dy(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M4.4 2.5h5.6L13 5.5v7.4a.6.6 0 0 1-.6.6H4.4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z"}),a.jsx("path",{d:"M9.5 2.5v2.5a.5.5 0 0 0 .5.5h3"}),a.jsx("path",{d:"M5.6 8.6 7 10l3-3.2"})]})}function fN({kind:n,toolName:l,queued:r,onExpand:c}){const o=n==="question"?"Уточняющий вопрос":n==="plan"?"План на согласование":`Разрешить действие: ${l}`;return a.jsxs("button",{type:"button",className:`decision-bar decision-bar--${n}`,onClick:c,children:[a.jsx("span",{className:"decision-bar__icon","aria-hidden":"true",children:n==="question"?"?":n==="plan"?a.jsx(dy,{}):"!"}),a.jsxs("span",{className:"decision-bar__text",children:[a.jsx("span",{className:"decision-bar__title",children:o}),a.jsxs("span",{className:"decision-bar__sub",children:["ждёт вашего решения",r>0&&` — ещё ${r} в очереди`]})]}),a.jsxs("span",{className:"decision-bar__action",children:["Развернуть",a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 10 4-4 4 4"})})]})]})}function Jp({onClick:n}){return a.jsxs("button",{type:"button",className:"decision-collapse",onClick:n,title:"Свернуть — агент продолжит ждать","aria-label":"Свернуть",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4"})}),a.jsx("span",{className:"decision-collapse__label",children:"Свернуть"})]})}function fy({request:n,queued:l,collapsed:r,onCollapse:c,onDecide:o}){const u=iy(n.toolName,n.input);return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:r,children:a.jsxs("div",{className:"sheet",role:"dialog","aria-modal":"true","aria-label":"Запрос разрешения",children:[a.jsxs("div",{className:"sheet__head",children:[a.jsxs("span",{className:"sheet__head-text",children:["Разрешить действие?",l>0&&` (ещё ${l} в очереди)`]}),a.jsx(Jp,{onClick:c})]}),a.jsxs("div",{className:"sheet__body",children:[a.jsx("div",{className:"sheet__tool",children:n.toolName}),n.reason&&a.jsx("p",{className:"sheet__reason",children:n.reason}),u?a.jsx(Kp,{diff:u}):a.jsx("pre",{className:"code",children:JSON.stringify(n.input,null,2)})]}),a.jsxs("div",{className:"sheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>o(n.requestId,"deny"),children:"Отклонить"}),a.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>o(n.requestId,"allow"),children:"Разрешить"})]})]})})}function hy({request:n,queued:l,collapsed:r,onCollapse:c,onAnswer:o,onDecline:u}){const{questions:h}=n,[p,g]=b.useState(()=>h.map(()=>new Set)),[x,v]=b.useState(()=>h.map(()=>"")),[j,y]=b.useState(()=>$b(h));b.useEffect(()=>{g(h.map(()=>new Set)),v(h.map(()=>"")),y($b(h))},[n.requestId]);const T=b.useMemo(()=>pN(h,p,x),[h,p,x]),N=T!==null;function E(U,O){var I,V;(V=(I=h[U])==null?void 0:I.options[O])!=null&&V.preview&&y(R=>{const L=R.slice();return L[U]=O,L})}function A(U,O,I){g(V=>{const R=V.slice(),L=new Set(R[U]);return I?L.has(O)?L.delete(O):L.add(O):L.has(O)||(L.clear(),L.add(O)),R[U]=L,R}),O!=="other"&&E(U,O)}function D(U,O){v(I=>{const V=I.slice();return V[U]=O,V})}function q(){T&&o(n.requestId,T)}function Q(U){U.key==="Enter"&&(U.target.closest("button")||N&&(U.preventDefault(),q()))}function z(U){var R;if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(U.key))return;const O=Array.from(U.currentTarget.querySelectorAll("button.qsheet__option")),I=O.indexOf(document.activeElement);if(I===-1)return;U.preventDefault();const V=U.key==="ArrowDown"||U.key==="ArrowRight"?1:-1;(R=O[(I+V+O.length)%O.length])==null||R.focus()}return a.jsx("div",{className:"modal-backdrop modal-backdrop--sheet",hidden:r,children:a.jsxs("div",{className:"qsheet",role:"dialog","aria-modal":"true","aria-label":"Вопрос от агента",onKeyDown:Q,children:[a.jsxs("div",{className:"qsheet__head",children:[a.jsx("span",{className:"qsheet__head-icon","aria-hidden":"true",children:"?"}),a.jsxs("span",{className:"qsheet__head-text",children:[h.length===1?"Уточняющий вопрос":`Уточняющие вопросы (${h.length})`,l>0&&` — ещё ${l} в очереди`]}),a.jsx(Jp,{onClick:c})]}),a.jsxs("div",{className:"qsheet__body",children:[n.reason&&a.jsx("p",{className:"qsheet__reason",children:n.reason}),h.map((U,O)=>a.jsx(hN,{q:U,qi:O,selected:p[O]??new Set,otherText:x[O]??"",previewIndex:j[O]??null,onToggle:A,onFocusOption:E,onOtherText:D,onOptionsKeyDown:z},O))]}),a.jsxs("div",{className:"qsheet__actions",children:[a.jsx("button",{className:"btn",onClick:()=>u(n.requestId),children:"Не отвечать"}),a.jsx("button",{className:"btn btn--primary",disabled:!N,onClick:q,children:"Ответить"})]})]})})}function hN({q:n,qi:l,selected:r,otherText:c,previewIndex:o,onToggle:u,onFocusOption:h,onOtherText:p,onOptionsKeyDown:g}){var T;const x=n.options.some(N=>N.preview),v=o!==null?(T=n.options[o])==null?void 0:T.preview:void 0,j=r.has("other"),y=n.multiSelect?"checkbox":"radio";return a.jsxs("div",{className:"qsheet__question",children:[a.jsxs("div",{className:"qsheet__qhead",children:[a.jsx("span",{className:"chip chip--accent",children:n.header}),a.jsx("span",{className:"qsheet__qtext",children:n.question})]}),a.jsxs("div",{className:"qsheet__options"+(n.multiSelect?"":" qsheet__options--radio"),role:n.multiSelect?"group":"radiogroup","aria-label":n.question,onKeyDown:g,children:[n.options.map((N,E)=>{const A=r.has(E);return a.jsxs("button",{type:"button",role:y,"aria-checked":A,className:"qsheet__option"+(A?" is-selected":""),onClick:()=>u(l,E,n.multiSelect),onFocus:()=>h(l,E),onMouseEnter:()=>h(l,E),children:[a.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),a.jsxs("span",{className:"qsheet__opt-body",children:[a.jsx("span",{className:"qsheet__opt-label",children:N.label}),a.jsx("span",{className:"qsheet__opt-desc",children:N.description})]})]},E)}),a.jsxs("div",{className:"qsheet__other",children:[a.jsxs("button",{type:"button",role:y,"aria-checked":j,className:"qsheet__option qsheet__option--other"+(j?" is-selected":""),onClick:()=>u(l,"other",n.multiSelect),children:[a.jsx("span",{className:"qsheet__opt-mark","aria-hidden":"true"}),a.jsxs("span",{className:"qsheet__opt-body",children:[a.jsx("span",{className:"qsheet__opt-label",children:"Другое"}),a.jsx("span",{className:"qsheet__opt-desc",children:"Свой вариант ответа"})]})]}),j&&a.jsx("input",{type:"text",className:"qsheet__other-input",placeholder:"Впишите свой вариант…","aria-label":`Свой вариант ответа на вопрос «${n.question}»`,value:c,onChange:N=>p(l,N.target.value),autoFocus:!0})]})]}),x&&a.jsx("pre",{className:"qsheet__preview",children:v??""})]})}function $b(n){return n.map(l=>{const r=l.options.findIndex(c=>c.preview);return r===-1?null:r})}function pN(n,l,r){const c={};for(let o=0;o<n.length;o++){const u=n[o];if(!u)continue;const h=l[o]??new Set,p=[];for(let g=0;g<u.options.length;g++){const x=u.options[g];x&&h.has(g)&&p.push(x.label)}if(h.has("other")){const g=(r[o]??"").trim();g&&p.push(g)}if(p.length===0)return null;c[u.question]=p.join(", ")}return c}function py({hub:n,sessionId:l,onClose:r}){var v;const c=n.timelines[l],o=c==null?void 0:c.pending[0],u=b.useRef(null);if(b.useEffect(()=>{if(!o)return;const j=y=>{var A;if(y.key==="Escape"){y.preventDefault(),y.stopPropagation(),r();return}if(y.key!=="Tab")return;const T=(A=u.current)==null?void 0:A.querySelectorAll('button:not(:disabled), input:not(:disabled), textarea:not(:disabled), [tabindex="0"]'),N=T==null?void 0:T[0],E=T==null?void 0:T[T.length-1];y.shiftKey&&document.activeElement===N&&E?(y.preventDefault(),E.focus()):!y.shiftKey&&document.activeElement===E&&N&&(y.preventDefault(),N.focus())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[o==null?void 0:o.requestId,r]),!o)return null;const h=j=>n.send({type:"permission.respond",sessionId:l,requestId:j,decision:"deny"}),p={queued:((c==null?void 0:c.pending.length)??1)-1,collapsed:!1,onCollapse:r},g=oy(o.toolName,o.input),x=(v=o.questions)!=null&&v.length?a.jsx(hy,{...p,request:{...o,questions:o.questions},onDecline:h,onAnswer:(j,y)=>n.send({type:"permission.respond",sessionId:l,requestId:j,decision:"allow",answers:y})},o.requestId):g!==null?a.jsx(uy,{...p,request:o,plan:g,onDecline:h,onAccept:(j,y)=>n.send({type:"permission.respond",sessionId:l,requestId:j,decision:"allow",plan:y})},o.requestId):a.jsx(fy,{...p,request:o,onDecide:(j,y)=>n.send({type:"permission.respond",sessionId:l,requestId:j,decision:y})},o.requestId);return a.jsx("div",{ref:u,className:"hub-decision",children:x})}const qd=[{value:"research",label:"Исследование"},{value:"implementation",label:"Реализация"},{value:"review",label:"Проверка"},{value:"other",label:"Другой этап"}];function mN({hub:n}){return a.jsxs("nav",{className:"hub-navigation","aria-label":"Управление пространством",children:[a.jsxs("button",{className:n.view==="projects"?"is-active":"",onClick:()=>n.setView("projects"),children:[a.jsx("span",{"aria-hidden":"true",children:"▦"}),"Обзор проектов",a.jsx("span",{children:Object.keys(n.loaded).length})]}),a.jsxs("button",{className:n.view==="inbox"?"is-active":"",onClick:()=>n.setView("inbox"),children:[a.jsx("span",{"aria-hidden":"true",children:"◫"}),"Входящие",n.attention.length>0&&a.jsx("span",{className:n.waiting.length?"has-attention":"",children:n.attention.length})]}),a.jsxs("button",{onClick:()=>n.setView("command"),children:[a.jsx("span",{"aria-hidden":"true",children:"⌕"}),"Найти и перейти",a.jsx("kbd",{children:"Ctrl K"})]})]})}function gN({hub:n,hasSession:l}){return a.jsxs("nav",{className:"hub-strip","aria-label":"Проекты и разговоры",children:[a.jsx("button",{className:"hub-strip__global",onClick:()=>n.setView("projects"),children:"▦ Проекты"}),a.jsxs("button",{className:"hub-strip__global",onClick:()=>n.setView("inbox"),children:["Входящие",n.attention.length>0&&a.jsx("span",{className:"hub-count",children:n.attention.length})]}),a.jsx("button",{onClick:()=>n.setView("tasks"),disabled:!l,children:"↳ Ветки задачи"}),a.jsxs("button",{onClick:()=>n.compareId?n.setCompareVisible(!n.compareVisible):n.setView("compare"),"aria-pressed":!!n.compareId&&n.compareVisible,children:["◧ ",n.compareId?"Второй разговор":"Два разговора"]}),a.jsx("button",{className:"hub-strip__global",onClick:()=>n.setView("command"),children:"⌕ Поиск"})]})}function xN(n){var p,g,x;const{hub:l}=n,[r,c]=b.useState(null),o=r?((p=l.timelines[r])==null?void 0:p.pending.length)??0:0;b.useEffect(()=>{r&&!o&&c(null)},[r,o]),b.useEffect(()=>{const v=j=>{(j.ctrlKey||j.metaKey)&&j.key.toLowerCase()==="k"&&!j.altKey&&!j.isComposing&&(j.preventDefault(),j.stopPropagation(),l.setView(l.view==="command"?null:"command"))};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[l.view,l.setView]);const u={projects:"Обзор проектов",inbox:"Входящие",command:"Найти и перейти",tasks:"Ветки задачи",compare:"Второй разговор"},h=r?l.sessions[r]:null;return a.jsxs(a.Fragment,{children:[l.view&&!r&&a.jsxs(rs,{title:u[l.view],className:l.view==="command"?"modal--palette":"modal--hub",onClose:()=>l.setView(null),children:[!n.connected&&a.jsx("p",{className:"hub-warning",role:"status",children:"Связь с хостом прервана. Данные ниже — последнее полученное состояние."}),l.error&&a.jsxs("div",{className:"hub-error",role:"alert",children:[l.error,a.jsx("button",{onClick:l.clearError,"aria-label":"Закрыть ошибку",children:"×"})]}),l.view==="projects"&&a.jsx(bN,{...n}),l.view==="inbox"&&a.jsx(_N,{...n,onReview:c}),l.view==="command"&&a.jsx(yN,{...n}),l.view==="tasks"&&a.jsx(jN,{...n},(g=n.activeSession)==null?void 0:g.id),l.view==="compare"&&a.jsx(vN,{...n})]}),r&&h&&o>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hub-decision-context",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"hub-eyebrow",children:["ВХОДЯЩИЕ · ",(x=n.workspaces.find(v=>v.id===h.workspaceId))==null?void 0:x.name]}),a.jsx("strong",{children:Os(h)})]}),a.jsx("button",{className:"btn",onClick:()=>c(null),children:"← К входящим"})]}),a.jsx(py,{hub:l,sessionId:r,onClose:()=>c(null)})]})]})}function my({session:n,workspace:l,onOpen:r,onCompare:c,detail:o}){return a.jsxs("div",{className:"hub-session-row",children:[a.jsxs("button",{className:"hub-session-row__main",onClick:r,children:[a.jsx("span",{className:"hub-session-dot"+(n.state==="waiting_permission"?" is-waiting":ru(n)?" is-running":"")}),a.jsxs("span",{children:[a.jsx("strong",{children:Os(n)}),a.jsxs("small",{children:[l&&`${l} · `,n.provider," · ",o??hu(n)]})]})]}),c&&a.jsx("button",{className:"hub-icon-btn",onClick:c,"aria-label":`Открыть рядом: ${Os(n)}`,title:"Открыть вторым разговором",children:"◧"})]})}function bN({hub:n,workspaces:l,connected:r,onSelectWorkspace:c,onSelectSession:o,onOpenWorkspace:u,onNewSession:h}){const[p,g]=b.useState(""),[x,v]=b.useState("all"),j=l.filter(y=>{if(!`${y.name} ${y.path}`.toLocaleLowerCase().includes(p.toLocaleLowerCase()))return!1;const T=n.allSessions.filter(N=>N.workspaceId===y.id&&!N.archivedAt);return x==="all"||(x==="working"?T.some(ru):T.some(N=>N.state==="waiting_permission"))});return a.jsxs("div",{className:"projects-hub",children:[a.jsx("p",{className:"hub-description",children:"Все проекты в одном месте. Видно, где идёт работа, где нужен ваш ответ и к чему вы возвращались последним."}),a.jsxs("div",{className:"hub-stats",children:[a.jsxs("div",{children:[a.jsx("strong",{children:l.length}),a.jsx("span",{children:"проектов"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:n.allSessions.filter(y=>!y.archivedAt&&ru(y)).length}),a.jsx("span",{children:"сессий в работе"})]}),a.jsxs("div",{className:n.waiting.length?"has-attention":"",children:[a.jsx("strong",{children:n.waiting.length}),a.jsx("span",{children:"ждут решения"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:n.attention.filter(y=>y.lastTurn==="completed"&&y.state!=="running").length}),a.jsx("span",{children:"новых результатов"})]})]}),a.jsxs("div",{className:"hub-controls",children:[a.jsx("input",{className:"hub-input","aria-label":"Найти проект",placeholder:"Название или путь проекта…",value:p,onChange:y=>g(y.target.value)}),a.jsx("button",{className:"btn btn--primary",disabled:!r,onClick:u,children:"+ Проект"}),a.jsx("button",{className:"hub-icon-btn",disabled:!r,onClick:n.refresh,"aria-label":"Обновить обзор",title:"Обновить обзор",children:"↻"})]}),a.jsx("div",{className:"hub-filters","aria-label":"Фильтр проектов",children:[["all","Все"],["working","В работе"],["waiting","Нужен ответ"]].map(([y,T])=>a.jsx("button",{"aria-pressed":x===y,onClick:()=>v(y),children:T},y))}),a.jsx("div",{className:"hub-project-grid",children:j.map(y=>{const T=n.allSessions.filter(A=>A.workspaceId===y.id&&!A.archivedAt),N=T.filter(A=>A.state==="waiting_permission").length,E=T.filter(ru).length;return a.jsxs("article",{className:"hub-project"+(N?" hub-project--waiting":""),children:[a.jsxs("div",{className:"hub-project__head",children:[a.jsxs("button",{onClick:()=>c(y.id),children:[a.jsx("span",{className:"hub-eyebrow",children:"РАБОЧЕЕ ПРОСТРАНСТВО"}),a.jsx("h3",{children:y.name})]}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),a.jsx("p",{className:"hub-project__path",title:y.path,children:y.path}),a.jsx("div",{className:"hub-project__counts",children:n.loaded[y.id]?a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:[T.length," сессий"]}),a.jsxs("span",{children:[E," в работе"]}),N>0&&a.jsxs("span",{className:"hub-warning",children:[N," ждут ответа"]})]}):a.jsx("span",{children:"Загружаются сессии…"})}),a.jsxs("div",{className:"hub-project__recent",children:[T.slice(0,3).map(A=>a.jsx(my,{session:A,onOpen:()=>o(A),onCompare:()=>n.openComparison(A)},A.id)),n.loaded[y.id]&&!T.length&&a.jsx("p",{className:"hub-muted",children:"Здесь начнётся следующий разговор."})]}),a.jsxs("button",{className:"hub-project__new",disabled:!r,onClick:()=>h(y.id),children:["+ Новый разговор ",a.jsx("span",{"aria-hidden":"true",children:"→"})]})]},y.id)})}),!j.length&&a.jsxs("div",{className:"hub-empty",children:[a.jsx("strong",{children:l.length?"Проекты не найдены":"Начните с проекта"}),a.jsx("p",{children:l.length?"Измените запрос или фильтр.":"Откройте папку, чтобы собрать файлы и разговоры в одном пространстве."})]})]})}function _N({hub:n,workspaces:l,connected:r,onSelectSession:c,onReview:o}){const[u,h]=b.useState("all"),p=x=>{var v;return x.state==="waiting_permission"||(v=n.timelines[x.id])!=null&&v.pending.length?"waiting":x.state==="error"||x.lastTurn==="failed"?"error":"result"},g=n.attention.filter(x=>u==="all"||p(x)===u).sort((x,v)=>(p(x)==="waiting"?0:p(x)==="error"?1:2)-(p(v)==="waiting"?0:p(v)==="error"?1:2)||v.updatedAt-x.updatedAt);return a.jsxs("div",{children:[a.jsx("p",{className:"hub-description",children:"Вопросы, разрешения, ошибки и новые результаты из всех проектов. Нерешённые запросы остаются здесь до вашего ответа."}),a.jsxs("div",{className:"hub-filters",children:[[["all","Всё"],["waiting","Требует решения"],["error","Ошибки"],["result","Результаты"]].map(([x,v])=>a.jsx("button",{"aria-pressed":u===x,onClick:()=>h(x),children:v},x)),a.jsx("button",{className:"hub-mark-all",onClick:()=>n.attention.filter(x=>p(x)!=="waiting").forEach(n.markRead),children:"Прочитать результаты"})]}),a.jsx("div",{className:"hub-inbox",children:g.map(x=>{var E,A,D,q;const v=n.timelines[x.id],j=v==null?void 0:v.pending[0],y=p(x),T=Fp((v==null?void 0:v.items)??[]),N=(A=(E=j==null?void 0:j.questions)==null?void 0:E[0])==null?void 0:A.question;return a.jsxs("article",{className:"hub-inbox-item hub-inbox-item--"+y,children:[a.jsxs("div",{className:"hub-inbox-item__meta",children:[a.jsx("span",{className:"hub-pill",children:y==="waiting"?(D=j==null?void 0:j.questions)!=null&&D.length?"Вопрос":"Нужно разрешение":y==="error"?"Ошибка":"Задача завершена"}),a.jsxs("span",{children:[(q=l.find(Q=>Q.id===x.workspaceId))==null?void 0:q.name," · ",x.provider]})]}),a.jsx("h3",{children:Os(x)}),a.jsx("p",{children:N??(j?`${j.toolName}${j.reason?` · ${j.reason}`:""}`:T.answer.slice(0,220)||T.prompt.slice(0,220)||hu(x))}),a.jsxs("div",{className:"hub-inbox-item__actions",children:[y==="waiting"&&j&&a.jsxs("button",{className:"btn btn--primary",disabled:!r,onClick:()=>o(x.id),children:["Рассмотреть",v.pending.length>1?` · ${v.pending.length}`:""]}),a.jsx("button",{className:"btn",onClick:()=>c(x),children:"Открыть разговор"}),a.jsx("button",{className:"btn btn--ghost",onClick:()=>n.openComparison(x),children:"Открыть рядом"}),y!=="waiting"&&a.jsx("button",{className:"hub-read",onClick:()=>n.markRead(x),children:"Прочитано ✓"})]})]},x.id)})}),!g.length&&a.jsxs("div",{className:"hub-empty",children:[a.jsx("span",{className:"hub-empty__orbit","aria-hidden":"true",children:"✓"}),a.jsx("strong",{children:"Всё под контролем"}),a.jsx("p",{children:"Здесь появятся новые события, требующие внимания."})]})]})}function yN({hub:n,workspaces:l,activeWorkspaceId:r,connected:c,onSelectSession:o,onSelectWorkspace:u,onOpenWorkspace:h,onOpenFiles:p,onOpenSettings:g,onNewSession:x}){const[v,j]=b.useState(""),[y,T]=b.useState(0),N=b.useRef(null);b.useEffect(()=>{const D=setTimeout(()=>{var q;return(q=N.current)==null?void 0:q.focus()},0);return()=>clearTimeout(D)},[]);const E=b.useMemo(()=>{const D=[{id:"projects",title:"Обзор проектов",hint:"Действие · все рабочие пространства",run:()=>n.setView("projects")},{id:"inbox",title:"Входящие",hint:"Действие · вопросы и результаты",run:()=>n.setView("inbox")},{id:"open",title:"Открыть проект",hint:"Действие · выбрать папку",run:h,disabled:!c},{id:"new",title:"Создать сессию",hint:"Действие · новый разговор в текущем проекте",run:()=>r&&x(r),disabled:!r||!c},{id:"files",title:"Открыть файлы проекта",hint:"Действие · дерево файлов и редактор",run:p,disabled:!r},{id:"settings",title:"Настройки пространства",hint:"Действие · темы и агенты",run:g},{id:"compare",title:"Открыть второй разговор",hint:"Действие · две сессии рядом",run:()=>n.setView("compare")}],q=l.map(U=>({id:"p:"+U.id,title:U.name,hint:"Проект · "+U.path,run:()=>u(U.id),disabled:!1})),Q=n.allSessions.map(U=>{var O;return{id:"s:"+U.id,title:Os(U),hint:`${U.archivedAt?"Архив · ":"Сессия · "}${((O=l.find(I=>I.id===U.workspaceId))==null?void 0:O.name)??""} · ${U.provider} · ${hu(U)}`,run:()=>o(U),disabled:!c&&U.state==="closed"}}),z=v.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);return[...D,...q,...Q].filter(U=>z.every(O=>`${U.title} ${U.hint}`.toLocaleLowerCase().includes(O))).sort((U,O)=>Number(O.title.toLocaleLowerCase().startsWith(v.toLocaleLowerCase()))-Number(U.title.toLocaleLowerCase().startsWith(v.toLocaleLowerCase()))).slice(0,60)},[v,n.allSessions,l,c,r]),A=D=>{const q=E[D];q&&!q.disabled&&(n.setView(null),q.run())};return b.useEffect(()=>{var D;(D=document.getElementById(`hub-option-${y}`))==null||D.scrollIntoView({block:"nearest"})},[y]),a.jsxs("div",{className:"command-palette",children:[a.jsx("input",{ref:N,className:"hub-input command-palette__input",role:"combobox","aria-expanded":"true","aria-controls":"hub-command-results","aria-autocomplete":"list","aria-activedescendant":E[y]?`hub-option-${y}`:void 0,"aria-label":"Поиск проектов, сессий и действий",placeholder:"Проект, разговор или действие…",value:v,onChange:D=>{j(D.target.value),T(0)},onKeyDown:D=>{(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),T(q=>E.length?(q+(D.key==="ArrowDown"?1:-1)+E.length)%E.length:0)),D.key==="Enter"&&(D.preventDefault(),A(y))}}),a.jsx("div",{className:"command-palette__results",role:"listbox",id:"hub-command-results","aria-label":"Результаты поиска",children:E.map((D,q)=>a.jsxs("button",{role:"option","aria-selected":y===q,"aria-disabled":D.disabled,disabled:D.disabled,id:`hub-option-${q}`,className:y===q?"is-selected":"",onMouseMove:()=>T(q),onClick:()=>A(q),children:[a.jsx("span",{className:"command-palette__kind","aria-hidden":"true",children:D.id.startsWith("p:")?"▦":D.id.startsWith("s:")?"◌":"↗"}),a.jsxs("span",{children:[a.jsx("strong",{children:D.title}),a.jsx("small",{children:D.hint})]}),a.jsx("span",{"aria-hidden":"true",children:"↵"})]},D.id))}),!E.length&&a.jsx("p",{className:"hub-empty",children:"Совпадений нет. Попробуйте название проекта или слово из заголовка сессии."}),a.jsxs("div",{className:"command-palette__foot",children:[a.jsx("span",{children:"↑ ↓ выбрать · Enter перейти"}),a.jsx("span",{children:"Esc закрыть"})]})]})}function vN({hub:n,activeSession:l,workspaces:r,onSelectSession:c}){const[o,u]=b.useState(""),h=n.allSessions.filter(p=>{var g;return p.id!==(l==null?void 0:l.id)&&!p.archivedAt&&`${Os(p)} ${(g=r.find(x=>x.id===p.workspaceId))==null?void 0:g.name} ${p.provider}`.toLocaleLowerCase().includes(o.toLocaleLowerCase())});return a.jsxs("div",{children:[a.jsx("p",{className:"hub-description",children:"Оставьте основной разговор на месте и откройте другой рядом. У каждого свой контекст, ввод и черновик. На телефоне между ними можно переключаться."}),a.jsx("input",{className:"hub-input",value:o,onChange:p=>u(p.target.value),"aria-label":"Найти второй разговор",placeholder:"Найти разговор в любом проекте…"}),a.jsx("div",{className:"hub-session-list",children:h.map(p=>{var g;return a.jsx(my,{session:p,workspace:(g=r.find(x=>x.id===p.workspaceId))==null?void 0:g.name,onOpen:()=>n.openComparison(p)},p.id)})}),!h.length&&a.jsxs("div",{className:"hub-empty",children:[a.jsx("strong",{children:"Нужен ещё один разговор"}),a.jsx("p",{children:"Создайте вторую сессию в любом проекте, затем откройте её здесь."}),a.jsx("button",{className:"btn",onClick:()=>n.setView("projects"),children:"К проектам"})]}),!l&&n.compareId&&a.jsx("button",{className:"btn",onClick:()=>{const p=n.sessions[n.compareId];p&&c(p)},children:"Открыть выбранную сессию как основную"})]})}function jN({hub:n,activeSession:l,workspaces:r,providers:c,connected:o,onSelectSession:u,onStartStage:h}){var F;const p=l==null?void 0:l.workspaceId,g=n.allSessions.filter($=>$.workspaceId===p),[x,v]=b.useState(l?an(l):""),j=g.find($=>an($)===x)??l,y=n.links.find($=>$.sessionId===x),[T,N]=b.useState((y==null?void 0:y.parentId)??""),[E,A]=b.useState((y==null?void 0:y.stage)??"other"),[D,q]=b.useState("implementation"),[Q,z]=b.useState(c.includes((l==null?void 0:l.provider)??"claude")?l.provider:c[0]??"claude"),[U,O]=b.useState(!1),I=j?Gb(an(j),n.links):"",V=g.filter($=>Gb(an($),n.links)===I).sort(($,ne)=>$.createdAt-ne.createdAt),R=[],L=new Set,G=($,ne)=>{var Ne;const pe=an($);if(!L.has(pe)){L.add(pe),R.push({session:$,depth:ne});for(const S of V)((Ne=n.links.find(Z=>Z.sessionId===an(S)))==null?void 0:Ne.parentId)===pe&&G(S,ne+1)}},se=V.find($=>an($)===I);se&&G(se,0);for(const $ of V)L.has(an($))||G($,0);const ve=$=>{v($);const ne=n.links.find(pe=>pe.sessionId===$);N((ne==null?void 0:ne.parentId)??""),A((ne==null?void 0:ne.stage)??"other")};if(!l||!j)return a.jsxs("div",{className:"hub-empty",children:[a.jsx("strong",{children:"Сначала откройте сессию"}),a.jsx("p",{children:"Её можно связать с другими разговорами и продолжить отдельным этапом."})]});if(!n.supportsLinks)return a.jsxs("div",{className:"hub-empty",children:[a.jsx("strong",{children:"Обновите хост для веток задач"}),a.jsx("p",{children:"На этом компьютере работает предыдущая версия CLI. Обновите пакет командой ниже и перезапустите ccv. Проекты, поиск, входящие и разговоры доступны уже сейчас."}),a.jsx("code",{children:"npm install -g @i14ks/ccv@latest"})]});const je=j.provider===Q&&Q!=="antigravity",we=g.filter($=>{var Ne;let ne=an($);const pe=new Set;for(;ne&&!pe.has(ne);){if(ne===x)return!1;pe.add(ne),ne=((Ne=n.links.find(S=>S.sessionId===ne))==null?void 0:Ne.parentId)??null}return!0});return a.jsxs("div",{className:"task-hub",children:[a.jsx("p",{className:"hub-description",children:"Одна задача может пройти через несколько разговоров: исследование, реализацию и проверку. Связи сохраняются на хосте и доступны с других устройств."}),a.jsxs("p",{className:"hub-eyebrow",children:[(F=r.find($=>$.id===p))==null?void 0:F.name," · ЦЕПОЧКА ЗАДАЧИ"]}),a.jsx("div",{className:"task-chain",children:R.map(({session:$,depth:ne})=>{var S;const pe=n.links.find(Z=>Z.sessionId===an($)),Ne=g.find(Z=>an(Z)===(pe==null?void 0:pe.parentId));return a.jsxs("article",{className:"task-node"+($.id===j.id?" is-current":""),style:{marginLeft:Math.min(ne,4)*14},"data-depth":ne,children:[a.jsx("div",{className:"task-node__rail","aria-hidden":"true",children:(pe==null?void 0:pe.kind)==="fork"?"⑂":"○"}),a.jsxs("div",{children:[a.jsxs("span",{className:"hub-eyebrow",children:[((S=qd.find(Z=>Z.value===(pe==null?void 0:pe.stage)))==null?void 0:S.label)??"Начало задачи",$.archivedAt?" · архив":""]}),a.jsx("button",{className:"task-node__title",onClick:()=>u($),children:Os($)}),a.jsxs("p",{children:[Ne?`Из «${Os(Ne)}» · `:"",hu($)," · ",$.provider]})]}),a.jsx("button",{className:"hub-icon-btn",title:"Открыть рядом","aria-label":`Открыть рядом: ${Os($)}`,onClick:()=>n.openComparison($),children:"◧"})]},$.id)})}),a.jsxs("section",{className:"hub-form-section",children:[a.jsx("h3",{children:"Связать существующие разговоры"}),a.jsx("p",{className:"hub-muted",children:"Выберите разговор, его предыдущий этап и роль в задаче."}),a.jsxs("form",{className:"hub-link-form",onSubmit:$=>{$.preventDefault(),n.send({type:"session.link",workspaceId:p,sessionId:x,parentId:T||null,stage:E})},children:[a.jsxs("label",{children:["Разговор",a.jsx("select",{value:x,onChange:$=>ve($.target.value),children:g.map($=>a.jsx("option",{value:an($),children:Os($)},$.id))})]}),a.jsxs("label",{children:["Предыдущий этап",a.jsxs("select",{value:T,onChange:$=>N($.target.value),children:[a.jsx("option",{value:"",children:"Самостоятельная задача"}),we.map($=>a.jsx("option",{value:an($),children:Os($)},$.id))]})]}),a.jsxs("label",{children:["Этап",a.jsx("select",{value:E,onChange:$=>A($.target.value),children:qd.map($=>a.jsx("option",{value:$.value,children:$.label},$.value))})]}),a.jsx("button",{className:"btn",disabled:!o,children:"Сохранить связь"})]})]}),a.jsxs("section",{className:"hub-form-section",children:[a.jsx("h3",{children:"Продолжить новым этапом"}),a.jsxs("p",{className:"hub-muted",children:["Новый разговор будет связан с «",Os(j),"». Доступный контекст появится в черновике — его можно проверить перед отправкой.",j.state==="closed"&&!n.histories[j.id]&&" История не открыта: в черновике будут название и этап. Для переноса всей истории выберите ответвление разговора."]}),a.jsxs("form",{className:"hub-stage-form",onSubmit:$=>{var S,Z,de;$.preventDefault();const ne=Fp([...Mp(((S=n.histories[j.id])==null?void 0:S.entries)??[]),...((Z=n.timelines[j.id])==null?void 0:Z.items)??[]]),Ne=`Следующий этап: ${(de=qd.find(be=>be.value===D))==null?void 0:de.label}.
119
+ Продолжаем задачу «${Os(j)}».${ne.prompt?`
120
+
121
+ Последняя задача:
122
+ ${ne.prompt.slice(0,3e3)}`:""}${ne.answer?`
123
+
124
+ Последний ответ:
125
+ ${ne.answer.slice(0,5e3)}`:""}
126
+
127
+ `;h(j,Q,D,U&&je,Ne)},children:[a.jsxs("label",{children:["Следующий этап",a.jsx("select",{value:D,onChange:$=>q($.target.value),children:qd.map($=>a.jsx("option",{value:$.value,children:$.label},$.value))})]}),a.jsxs("label",{children:["Агент",a.jsx("select",{value:Q,onChange:$=>{z($.target.value),O(!1)},children:c.map($=>a.jsx("option",{value:$,children:$==="claude"?"Claude":$==="codex"?"Codex":"Antigravity"},$))})]}),a.jsxs("label",{className:"hub-checkbox",children:[a.jsx("input",{type:"checkbox",checked:U&&je,disabled:!je,onChange:$=>O($.target.checked)}),a.jsxs("span",{children:["Ответвить полный разговор",!je&&a.jsx("small",{children:"Доступно с тем же агентом, если он поддерживает форки."})]})]}),a.jsx("button",{className:"btn btn--primary",disabled:!o||!c.length,children:"Создать этап →"})]})]})]})}const wN="ccv.dictation.lang",Yb="ru-RU";function NN(n){try{return Function.prototype.toString.call(n).includes("[native code]")}catch{return!1}}function Vb(){const n=window,l=[n.SpeechRecognition,n.webkitSpeechRecognition].filter(c=>typeof c=="function"),r=l.find(NN);return!r&&l.length>0&&Hl("распознавание подменено: родной реализации в странице нет"),r??l[0]??null}function gy(){var n;try{return((n=localStorage.getItem(wN))==null?void 0:n.trim())||Yb}catch{return Yb}}function Hl(n,l){l===void 0?console.debug(`[dictation] ${n}`):console.debug(`[dictation] ${n}`,l)}const kN=3,SN=400,EN=5,TN=250,CN=2e3,AN=2e4;async function RN(){try{return(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch{return!1}}const MN={"not-allowed":"Браузер не дал доступ к микрофону","service-not-allowed":"Браузер не дал доступ к микрофону","audio-capture":"Микрофон не найден",network:"Сервис распознавания недоступен","language-not-supported":`Распознавание не знает языка ${gy()}`};function DN(n){const[l]=b.useState(()=>Vb()!==null),[r,c]=b.useState(!1),[o,u]=b.useState(null),h=b.useRef(null),p=b.useRef(!1),g=b.useRef(!1),x=b.useRef(n),v=b.useRef({openedAt:0,audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1}),j=b.useRef(null),y=b.useRef(!1),T=b.useRef(null),N=b.useCallback(()=>{T.current&&clearTimeout(T.current),T.current=null},[]),E=b.useCallback(()=>{N();const z=async U=>{if(T.current=null,!(!p.current||y.current)){if(!U&&!await RN()){if(Hl("ждём ответа на запрос доступа к микрофону"),!p.current||y.current)return;T.current=setTimeout(()=>void z(!0),AN);return}Hl("движок не ответил на start()"),p.current=!1,c(!1),u("Распознавание не отвечает — проверьте расширения браузера и доступ к микрофону")}};T.current=setTimeout(()=>void z(!1),CN)},[N]);b.useEffect(()=>{x.current=n}),b.useEffect(()=>{const z=Vb();if(!z)return;const U=new z;return U.lang=gy(),U.continuous=!0,U.interimResults=!0,U.onstart=()=>{Hl("сессия открыта"),y.current=!0,N(),c(!0)},U.onaudiostart=()=>{Hl("пошёл звук с микрофона"),v.current.audio=!0},U.onresult=O=>{var L;if(g.current)return;let I="",V="";for(let G=O.resultIndex;G<O.results.length;G++){const se=O.results[G];if(!se)continue;const ve=((L=se[0])==null?void 0:L.transcript)??"";se.isFinal?I+=ve:V+=ve}const R=v.current;R.heard=!0,R.everHeard=!0,Hl("распознано",{final:I,interim:V}),x.current(I,V)},U.onerror=O=>{v.current.lastError=O.error,Hl("ошибка движка",O.error),!(O.error==="no-speech"||O.error==="aborted")&&(p.current=!1,c(!1),u(MN[O.error]??`Распознавание не работает: ${O.error}`))},U.onend=()=>{g.current=!1,y.current=!1;const O=v.current,I=Date.now()-O.openedAt;if(Hl("сессия закрыта",{мс:I,звук:O.audio,слова:O.heard,ошибка:O.lastError||null}),!p.current){c(!1);return}if(O.dead=!O.audio&&I<SN?O.dead+1:0,O.dead>=EN){p.current=!1,c(!1),u(O.lastError?`Распознавание не работает: ${O.lastError}`:"Распознавание закрывается сразу после запуска — проверьте доступ к микрофону в настройках сайта");return}O.silent=O.heard?0:O.silent+1,!O.everHeard&&!O.warned&&O.silent>=kN&&(O.warned=!0,u(O.audio?"Микрофон слушает, но речь не распознаётся — проверьте язык диктовки и уровень звука":"С микрофона не идёт звук — проверьте устройство ввода в настройках сайта в браузере")),j.current=setTimeout(()=>{if(j.current=null,!!p.current){O.openedAt=Date.now(),O.audio=!1,O.heard=!1,O.lastError="",E();try{U.start()}catch{}}},TN)},h.current=U,()=>{p.current=!1,j.current&&clearTimeout(j.current),j.current=null,N(),U.onend=null,U.onresult=null,U.onerror=null,U.onstart=null,U.onaudiostart=null,U.abort(),h.current=null}},[]);const A=b.useCallback(()=>{var z;if(p.current){if(p.current=!1,Hl("выключение микрофона"),j.current&&clearTimeout(j.current),j.current=null,N(),!y.current){c(!1);return}(z=h.current)==null||z.stop()}},[]),D=b.useCallback(()=>{const z=h.current;if(z){if(!window.isSecureContext){u("Микрофон доступен только по https или с localhost");return}u(null),p.current=!0,g.current=!1,j.current&&clearTimeout(j.current),j.current=null,v.current={openedAt:Date.now(),audio:!1,heard:!1,everHeard:!1,silent:0,dead:0,lastError:"",warned:!1},c(!0),Hl("включение микрофона",{язык:z.lang}),E();try{z.start()}catch(U){Hl("start() не прошёл",U)}}},[E]),q=b.useCallback(()=>{p.current?A():D()},[D,A]),Q=b.useCallback(()=>{var z;p.current&&y.current&&(g.current=!0,(z=h.current)==null||z.abort())},[]);return{supported:l,listening:r,error:o,toggle:q,stop:A,drop:Q}}const ON="(max-width: 860px)",Xb=/^\/(\S*)$/,LN=new Set(["model","permissions"]);function zN(n){return LN.has(n.name)||n.name.startsWith("__")}const IN=new Set(["clear","rename"]),Qb=/(?:^|\s)@([^\s@]*)$/,UN=200,HN=100,BN=190,qN=5,GN=20*1024*1024,$N=1568,YN=.85;let Kb=0;async function VN(n){var j,y;if(!n.type.startsWith("image/")||n.size>GN)return null;const l=await XN(n);if(!l)return null;const{width:r,height:c}=l;if(r<=0||c<=0)return null;const o=Math.min(1,$N/Math.max(r,c)),u=document.createElement("canvas");u.width=Math.max(1,Math.round(r*o)),u.height=Math.max(1,Math.round(c*o));const h=u.getContext("2d");if(!h)return null;h.drawImage(l.image,0,0,u.width,u.height),(y=(j=l.image).close)==null||y.call(j);const p=n.type==="image/png",g=p?"image/png":"image/jpeg",x=u.toDataURL(g,p?void 0:YN),v=x.slice(x.indexOf(",")+1);return v?(Kb+=1,{id:`att${Kb}`,mediaType:g,data:v,previewUrl:x}):null}async function XN(n){if(typeof createImageBitmap=="function")try{const l=await createImageBitmap(n);return{image:l,width:l.width,height:l.height}}catch{}return new Promise(l=>{const r=URL.createObjectURL(n),c=new Image;c.onload=()=>{URL.revokeObjectURL(r),l({image:c,width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{URL.revokeObjectURL(r),l(null)},c.src=r})}function Pp({disabled:n,busy:l,commands:r,sessionTitle:c,contextResult:o,className:u,placeholder:h,draftKey:p,sendLabel:g="Отправить",autoFocus:x=!1,attachmentsEnabled:v=!0,sendBlocked:j=!1,onContextSearch:y,onCommand:T,onSend:N,onInterrupt:E,onEscape:A}){var Zt;const D=of(ON),[q,Q]=b.useState(()=>p?Kh(p):""),[z,U]=b.useState(!1),[O,I]=b.useState(0),V=b.useRef(null),R=b.useRef(null),L=b.useRef(!1),G=b.useRef(null),[se,ve]=b.useState(()=>p?Kh(p).length:0),[je,we]=b.useState([]),F=b.useRef(null),$=b.useCallback(K=>{!v||K.length===0||Promise.all(K.map(VN)).then(fe=>{const ke=fe.filter(Ve=>Ve!==null);ke.length!==0&&we(Ve=>[...Ve,...ke].slice(0,qN))})},[v]);function ne(K){we(fe=>fe.filter(ke=>ke.id!==K))}function pe(K){var Ve;if(!v)return;const fe=(Ve=K.clipboardData)==null?void 0:Ve.items;if(!fe)return;const ke=[];for(const Mt of fe){if(!Mt.type.startsWith("image/"))continue;const Cn=Mt.getAsFile();Cn&&ke.push(Cn)}ke.length!==0&&(K.preventDefault(),$(ke))}function Ne(K){const fe=K.target.files?Array.from(K.target.files):[];K.target.value="",$(fe)}b.useEffect(()=>{v||we([])},[v]);const[S,Z]=b.useState([]),[de,be]=b.useState(-1),Me=b.useRef(""),[Ie,Ke]=b.useState(""),ce=DN(b.useCallback((K,fe)=>{K&&Q(ke=>cp(ke,K)),Ke(fe.trim())},[])),Ue=Ie?cp(q,Ie):q;b.useEffect(()=>{ce.listening||Ie===""||(Q(K=>cp(K,Ie)),Ke(""))},[ce.listening,Ie]),b.useEffect(()=>{var K;x&&((K=V.current)==null||K.focus())},[x]);const ge=b.useRef(new Map),Ze=b.useRef(new Map),dt=b.useRef(p),lt=b.useRef({text:q,caret:se});lt.current={text:q,caret:se};const gt=b.useCallback((K,fe,ke)=>{fe===""?(ge.current.delete(K),Ze.current.delete(K)):(ge.current.set(K,fe),Ze.current.set(K,ke)),pp(K,fe)},[]),et=ce.drop;b.useLayoutEffect(()=>{const K=dt.current;if(K===p)return;dt.current=p,K&&gt(K,lt.current.text,lt.current.caret);const fe=p?ge.current.get(p)??Kh(p):"",ke=p?Ze.current.get(p):void 0,Ve=Math.min(ke??fe.length,fe.length);Q(fe),ve(Ve),G.current=[Ve,Ve],Ke(""),I(0),U(!1),be(-1),Me.current="",we([]),et()},[p,gt,et]),b.useEffect(()=>{p&&gt(p,q,se)},[p,q,se,gt]);const Tt=n?"Выберите сессию":j?"Нет VPN — отправка остановлена":h??"С чего начнём? Опишите задачу…",ee=b.useRef(0),tt=b.useCallback(K=>{const fe=parseFloat(getComputedStyle(K).maxHeight),ke=Number.isFinite(fe)&&fe>0?fe:BN;K.style.height="auto";const Ve=K.scrollHeight;K.style.height=`${Math.min(Ve,ke)}px`,K.style.overflowY=Ve>ke?"auto":"hidden"},[]);b.useEffect(()=>{const K=V.current;K&&tt(K)},[Ue,Tt,n,tt]),b.useLayoutEffect(()=>{const K=V.current,fe=G.current;!K||!fe||(G.current=null,K.setSelectionRange(fe[0],fe[1]))}),b.useEffect(()=>{const K=V.current;if(!K)return;const fe=new ResizeObserver(([ke])=>{const Ve=ke==null?void 0:ke.contentRect.width;Ve===void 0||Math.abs(Ve-ee.current)<1||(ee.current=Ve,tt(K))});return fe.observe(K),()=>fe.disconnect()},[tt]);const Fe=ce.stop;b.useEffect(()=>{n&&Fe()},[n,Fe]);const $e=b.useMemo(()=>ce.error?{ok:!1,message:ce.error}:null,[ce.error]),Je=b.useMemo(()=>{var ke;const K=(ke=Xb.exec(q))==null?void 0:ke[1];if(K===void 0)return[];const fe=K.toLowerCase();return r.filter(Ve=>!zN(Ve)&&op(Ve,fe)<xy).sort((Ve,Mt)=>op(Ve,fe)-op(Mt,fe))},[q,r]),Qe=!z&&Je.length>0,ft=Math.min(O,Je.length-1),De=z?null:((Zt=Qb.exec(Ue.slice(0,se)))==null?void 0:Zt[1])??null,wt=b.useRef(y);wt.current=y,b.useEffect(()=>{if(De===null||De===""||De.endsWith("/")){wt.current(De);return}const K=setTimeout(()=>wt.current(De),UN);return()=>clearTimeout(K)},[De]);const Nt=De!==null&&(o==null?void 0:o.query)===De,Ht=Nt?o.entries:[],Kt=De!==null,kt=Kt&&!Nt,ot=Math.min(O,Math.max(Ht.length-1,0));b.useEffect(()=>{var fe,ke;if(!Qe&&!Kt)return;const K=Qe?ft:ot;(ke=(fe=R.current)==null?void 0:fe.children[K])==null||ke.scrollIntoView({block:"nearest"})},[Qe,Kt,ft,ot]);function wn(K,fe){var ke;Q(K),ve(fe),G.current=[fe,fe],I(0),U(!1),Ie!==""&&(Ke(""),ce.drop()),(ke=V.current)==null||ke.focus()}function Dn(){Q(""),Ke(""),I(0),ve(0),U(!1),be(-1),Me.current="",we([]),ce.drop(),p&&gt(p,"",0)}function ln(K){const fe=K.trim();if(fe===""&&je.length===0||n||j||L.current)return;const ke=N(fe,je.length>0?je.map(Ve=>({mediaType:Ve.mediaType,data:Ve.data})):void 0);if(ke instanceof Promise){L.current=!0,ke.then(Ve=>{L.current=!1,Ve&&$t(fe)},()=>{L.current=!1});return}ke!==!1&&$t(fe)}function $t(K){K!==""&&Z(fe=>[K,...fe.filter(ke=>ke!==K)].slice(0,HN)),Dn()}function hn(K){if(K<-1||K>=S.length)return;de===-1&&(Me.current=q);const fe=K===-1?Me.current:S[K]??"";be(K),wn(fe,fe.length)}function yt(){var Ve;const K=((Ve=V.current)==null?void 0:Ve.selectionStart)??Ue.length,ke=`${K>0&&!/\s$/.test(Ue.slice(0,K))?" ":""}@`;wn(Ue.slice(0,K)+ke+Ue.slice(K),K+ke.length)}function Wn(K){var Mt;const fe=(Mt=Qb.exec(Ue.slice(0,se)))==null?void 0:Mt[1];if(fe===void 0)return;const ke=se-fe.length-1,Ve=K.kind==="dir"?`@${K.path}/`:`@${K.path} `;wn(Ue.slice(0,ke)+Ve+Ue.slice(se),ke+Ve.length)}function ae(){var fe;if(j)return;const K=(fe=Xb.exec(Ue.trim()))==null?void 0:fe[1];if(K&&T(K)){Dn();return}ln(Ue)}function _e(K,fe){Q(K),ve(fe),I(0),U(!1),be(-1),Ie!==""&&(Ke(""),ce.drop())}function qe(K){var Ve;const fe=IN.has(K.name)?c:null,ke=`/${K.name} `;Q(ke+(fe??"")),ve(ke.length+((fe==null?void 0:fe.length)??0)),fe&&(G.current=[ke.length,ke.length+fe.length]),I(0),(Ve=V.current)==null||Ve.focus()}function it(K){if(T(K.name)){Q(""),I(0),U(!1);return}K.argumentHint?qe(K):ln(`/${K.name}`)}function Pe(K){if(Qe){if(K.key==="ArrowDown")return K.preventDefault(),I(fe=>(Math.min(fe,Je.length-1)+1)%Je.length);if(K.key==="ArrowUp"){K.preventDefault();const fe=Je.length-1;return I(ke=>(Math.min(ke,fe)+fe)%Je.length)}if(K.key==="Enter"&&!K.shiftKey){K.preventDefault();const fe=Je[ft];fe&&it(fe);return}if(K.key==="Tab"){K.preventDefault();const fe=Je[ft];fe&&qe(fe);return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),U(!0);return}}if(Kt){if(K.key==="ArrowDown"&&Ht.length>0)return K.preventDefault(),I(fe=>(Math.min(fe,Ht.length-1)+1)%Ht.length);if(K.key==="ArrowUp"&&Ht.length>0){K.preventDefault();const fe=Ht.length-1;return I(ke=>(Math.min(ke,fe)+fe)%Ht.length)}if(K.key==="Enter"&&!K.shiftKey||K.key==="Tab"){const fe=Ht[ot];if(fe){K.preventDefault(),Wn(fe);return}if(K.key==="Tab")return}if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),U(!0);return}}if((K.key==="ArrowUp"||K.key==="ArrowDown")&&!K.shiftKey){const fe=K.currentTarget,ke=fe.selectionStart;if(fe.selectionEnd===ke){const Mt=K.key==="ArrowUp"?de+1:de-1;Mt>=-1&&Mt<S.length&&requestAnimationFrame(()=>{fe.selectionStart===ke&&fe.selectionEnd===ke&&hn(Mt)})}}if(K.key==="Escape"&&A){K.preventDefault(),K.stopPropagation(),A();return}K.key==="Enter"&&!K.shiftKey&&!D&&(K.preventDefault(),ae())}return a.jsx("div",{className:u?`composer ${u}`:"composer",children:a.jsxs("div",{className:"composer__inner",children:[a.jsx(Or,{result:$e}),Kt&&!Qe&&a.jsxs("div",{className:"cmdmenu",role:"listbox",ref:R,children:[Ht.map((K,fe)=>a.jsxs("button",{role:"option","aria-selected":fe===ot,className:fe===ot?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>I(fe),onMouseDown:ke=>{ke.preventDefault(),Wn(K)},children:[a.jsxs("span",{className:"cmdmenu__name",children:[K.name,K.kind==="dir"?"/":""]}),a.jsx("span",{className:"cmdmenu__desc",children:K.path}),K.ignored&&a.jsx("span",{className:"cmdmenu__tag",children:"git-ignore"})]},K.path)),Ht.length===0&&a.jsx("div",{className:"cmdmenu__empty",children:kt?"ищем…":De?"Ничего не нашлось":"Наберите имя файла или каталога"})]}),Qe&&a.jsx("div",{className:"cmdmenu",role:"listbox",ref:R,children:Je.map((K,fe)=>a.jsxs("button",{role:"option","aria-selected":fe===ft,className:fe===ft?"cmdmenu__row is-on":"cmdmenu__row",onMouseEnter:()=>I(fe),onMouseDown:ke=>{ke.preventDefault(),it(K)},children:[a.jsxs("span",{className:"cmdmenu__name",children:["/",K.name]}),K.argumentHint&&a.jsx("span",{className:"cmdmenu__hint",children:K.argumentHint}),a.jsx("span",{className:"cmdmenu__desc",children:K.description})]},K.name))}),je.length>0&&a.jsx("div",{className:"composer__attachments",children:je.map(K=>a.jsxs("div",{className:"composer__thumb",children:[a.jsx("img",{src:K.previewUrl,alt:"Вложение"}),a.jsx("button",{type:"button",className:"composer__thumb-remove","aria-label":"Удалить вложение",onClick:()=>ne(K.id),children:a.jsx(PN,{})})]},K.id))}),a.jsxs("div",{className:"composer__field",children:[a.jsx("button",{type:"button",className:"addbtn",title:"Добавить контекст — файл проекта («@»)","aria-label":"Добавить контекст",disabled:n,onClick:yt,children:a.jsx(ZN,{})}),v&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:F,type:"file",accept:"image/*",multiple:!0,className:"composer__fileinput",tabIndex:-1,"aria-hidden":"true",onChange:Ne}),a.jsx("button",{type:"button",className:"attachbtn",title:"Прикрепить изображение","aria-label":"Прикрепить изображение",disabled:n,onClick:()=>{var K;return(K=F.current)==null?void 0:K.click()},children:a.jsx(JN,{})})]}),a.jsx("textarea",{ref:V,value:Ue,"aria-label":"Сообщение агенту",disabled:n,placeholder:Tt,onChange:K=>_e(K.target.value,K.target.selectionStart),onSelect:K=>ve(K.currentTarget.selectionStart),onKeyDown:Pe,onPaste:pe}),ce.supported&&a.jsx("button",{type:"button",className:ce.listening?"micbtn is-on":"micbtn",title:ce.listening?"Остановить диктовку":"Продиктовать промпт","aria-label":ce.listening?"Остановить диктовку":"Продиктовать промпт","aria-pressed":ce.listening,disabled:n,onClick:ce.toggle,children:a.jsx(WN,{on:ce.listening})}),l?a.jsx("button",{className:"btn",onClick:E,title:"Прервать (Esc)",children:"Стоп"}):a.jsxs("button",{className:"btn btn--primary sendbtn",onClick:ae,disabled:n||j||Ue.trim()===""&&je.length===0,"aria-label":g,title:j?"Нет VPN — отправка остановлена":g,children:[a.jsx("span",{className:"sendbtn__label",children:g}),a.jsx(FN,{})]})]}),a.jsxs("div",{className:"composer__help",children:[a.jsxs("span",{children:[a.jsx("kbd",{children:"@"})," файлы проекта ",a.jsx("span",{"aria-hidden":"true",children:"·"})," ",a.jsx("kbd",{children:"/"})," команды"]}),a.jsxs("span",{className:"composer__keyboard",children:[a.jsx("kbd",{children:"Enter"})," отправить ",a.jsx("span",{"aria-hidden":"true",children:"·"})," ",a.jsx("kbd",{children:"Shift + Enter"})," новая строка"]})]})]})})}function cp(n,l){const r=l.trim();if(r==="")return n;const c=Tp(r).slice(QN(n,r)).join(" ");return c===""?n:n===""||/\s$/.test(n)?n+c:`${n} ${c}`}function QN(n,l){const r=Tp(n),c=Tp(l);for(let o=Math.min(r.length,c.length);o>0;o--)if(r.slice(r.length-o).every((u,h)=>KN(u,c[h]??"")))return o;return 0}function Tp(n){return n.split(/\s+/).filter(l=>l!=="")}function KN(n,l){const r=c=>c.toLowerCase().replace(/[.,!?;:…]+$/u,"");return r(n)===r(l)}function ZN(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2"})})}function FN(){return a.jsx("svg",{className:"sendbtn__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 12.5V3.5M4 7.5 8 3.5l4 4"})})}function JN(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M10.8 4.2 5.9 9.1a2 2 0 0 0 2.8 2.8l4.6-4.6a3.3 3.3 0 0 0-4.7-4.7L3.9 7.3a4.6 4.6 0 0 0 6.5 6.5l4.4-4.4"})})}function PN(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}function WN({on:n}){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5.9",y:"1.7",width:"4.2",height:"7.6",rx:"2.1",fill:n?"currentColor":"none"}),a.jsx("path",{d:"M3.3 7.3v.8a4.7 4.7 0 0 0 9.4 0v-.8"}),a.jsx("path",{d:"M8 12.8v1.5"})]})}const xy=4;function op(n,l){const r=n.name.toLowerCase();return r===l?0:r.startsWith(l)?1:n.aliases.some(c=>c.toLowerCase().startsWith(l))?2:r.includes(l)?3:xy}function ek({hub:n,workspaces:l,primary:r,connected:c,networkBlocked:o,onFocusPrimary:u,onPromote:h}){var q;const[p,g]=b.useState(!1);if(!n.compareId)return null;const x=n.sessions[n.compareId];if(!x)return null;const v=n.timelines[x.id]??Jn,j=n.histories[x.id]??qi,y=Mp(j.entries),T=["running","waiting_permission"].includes(x.state),N=v.pending.length>0,E=x.state==="closed",A=l.find(Q=>Q.id===x.workspaceId),D=(r==null?void 0:r.id)===x.id;return a.jsxs("aside",{className:"comparison"+(n.compareVisible?" comparison--visible":""),"aria-label":"Второй разговор",children:[a.jsxs("header",{className:"comparison__head",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"hub-eyebrow",children:["ВТОРОЙ РАЗГОВОР · ",(A==null?void 0:A.name)??"ПРОЕКТ"]}),a.jsx("strong",{title:Os(x),children:Os(x)})]}),a.jsx("button",{type:"button",className:"hub-icon-btn",title:"Выбрать другой разговор","aria-label":"Выбрать другой разговор",onClick:()=>n.setView("compare"),children:"⇄"}),a.jsx("button",{type:"button",className:"hub-icon-btn",title:"Открыть как основной","aria-label":"Открыть как основной",onClick:()=>h(x),children:"↗"}),a.jsx("button",{type:"button",className:"hub-icon-btn",title:"Закрыть второй разговор","aria-label":"Закрыть второй разговор",onClick:n.closeComparison,children:"×"})]}),a.jsxs("div",{className:"comparison__status",children:[a.jsx("span",{className:N?"hub-pill hub-pill--waiting":"hub-pill",children:hu(x)}),a.jsx("span",{children:x.provider}),a.jsx("button",{type:"button",className:"comparison__back",onClick:u,children:"← Основной разговор"})]}),a.jsx(cy,{session:x,items:[...y,...v.items],pendingCount:v.pending.length},x.id),n.error&&a.jsx("p",{className:"hub-error",role:"alert",children:n.error}),D?a.jsxs("div",{className:"hub-empty",children:[a.jsx("strong",{children:"Этот разговор уже открыт слева"}),a.jsx("p",{children:"Выберите другую сессию, чтобы работать с двумя разговорами."}),a.jsx("button",{className:"btn",onClick:()=>n.setView("compare"),children:"Выбрать сессию"})]}):a.jsxs(a.Fragment,{children:[a.jsx(hf,{items:v.items,busy:T,waiting:N,sessionId:x.id,history:y,historyHasMore:gp(j),historyLoading:j.loading,onLoadHistory:()=>n.loadHistory(x.id,Rp(j)),empty:E?"Сессия сохранена на диске. Продолжите её, чтобы загрузить историю и написать сообщение.":"Независимый разговор: сообщения и черновик относятся только к этой сессии."}),N&&a.jsxs("button",{className:"comparison__decision",onClick:()=>g(!0),children:["Нужен ваш ответ · запросов: ",v.pending.length," ",a.jsx("span",{children:"Рассмотреть →"})]}),E?a.jsxs("div",{className:"comparison__resume",children:[a.jsx("p",{children:"Разговор сохранён. Продолжение восстановит его контекст."}),a.jsx("button",{className:"btn btn--primary",disabled:!c||n.compareLaunching,onClick:n.resumeComparison,children:n.compareLaunching?"Восстанавливается…":"Продолжить разговор"})]}):a.jsx(Pp,{className:"composer--comparison",disabled:!c,busy:T,commands:((q=n.capabilities[x.id])==null?void 0:q.commands)??[],sessionTitle:x.title,contextResult:n.comparisonContext,draftKey:x.id,sendBlocked:o,placeholder:x.state==="reconnecting"?"Сообщение будет отправлено после восстановления связи":"Сообщение во второй разговор…",onContextSearch:n.searchComparison,onCommand:()=>!1,onEscape:()=>{T&&!N&&n.send({type:"control.interrupt",sessionId:x.id})},onSend:(Q,z)=>!c||o?!1:(n.send({type:"prompt.send",sessionId:x.id,text:Q,images:z}),!0),onInterrupt:()=>n.send({type:"control.interrupt",sessionId:x.id})})]}),p&&N&&a.jsx(py,{hub:n,sessionId:x.id,onClose:()=>g(!1)})]})}function by({path:n}){const[l,r]=b.useState(!1),[c,o]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{if(!l)return;function p(g){var x;(x=u.current)!=null&&x.contains(g.target)||r(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),b.useEffect(()=>{if(!c)return;const p=setTimeout(()=>o(!1),Qp);return()=>clearTimeout(p)},[c]),b.useEffect(()=>r(!1),[n]);async function h(){await ba(n)&&o(!0)}return a.jsxs("div",{ref:u,className:"cwd",children:[a.jsxs("button",{type:"button",className:"cwd__toggle","aria-expanded":l,title:l?"Свернуть путь":`Полный путь: ${n}`,onClick:()=>r(p=>!p),onKeyDown:p=>{p.key!=="Escape"||!l||(p.preventDefault(),p.stopPropagation(),r(!1))},children:[a.jsx(tk,{open:l}),a.jsx("span",{className:"cwd__short",children:n})]}),l&&a.jsxs("div",{className:"cwd__pop",children:[a.jsx("span",{className:"cwd__full",children:n}),a.jsx("button",{type:"button",className:"btn btn--ghost cwd__copy",onClick:()=>void h(),children:c?Uc:Rr})]})]})}function tk({open:n}){return a.jsx("svg",{className:n?"cwd__chev cwd__chev--open":"cwd__chev",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M6 3.5 10.5 8 6 12.5"})})}const nk=["low","medium","high"];function _y({models:n,value:l,effort:r,ultracode:c,thinking:o,switchOnFlag:u,showSwitchOnFlag:h=!0,showUltracode:p=!0,showThinking:g=!0,className:x,onModel:v,onEffort:j,onUltracode:y,onThinking:T,onSwitchOnFlag:N}){const[E,A]=b.useState(!1),[D,q]=b.useState(0),Q=b.useRef(null),z=b.useRef(null),U=n.find(L=>L.value===l)??null,O=U&&U.supportsEffort?U.effortLevels.length>0?U.effortLevels:nk:[],I=O.includes("xhigh");b.useEffect(()=>{if(!E)return;const L=n.findIndex(G=>G.value===l);q(L===-1?0:L)},[E]),b.useEffect(()=>{if(!E)return;function L(G){var se;(se=Q.current)!=null&&se.contains(G.target)||A(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[E]),b.useEffect(()=>{var L,G;E&&((G=(L=z.current)==null?void 0:L.querySelector(".is-cursor"))==null||G.scrollIntoView({block:"nearest"}))},[E,D]);function V(L){A(!1),L.value!==l&&v(L.value)}function R(L){if(L.key==="Escape"){if(!E)return;L.preventDefault(),L.stopPropagation(),A(!1);return}if(L.key==="ArrowDown"||L.key==="ArrowUp"){if(L.preventDefault(),!E)return A(!0);if(n.length===0)return;const G=L.key==="ArrowDown"?1:n.length-1;return q(se=>(se+G)%n.length)}if(L.key==="Enter"||L.key===" "){if(L.preventDefault(),!E)return A(!0);const G=n[D];G&&V(G)}}return a.jsxs("div",{ref:Q,className:"select"+(E?" select--open":"")+(x?` ${x}`:""),children:[a.jsxs("button",{type:"button",className:"select__trigger",title:"Модель, усилие и размышления","aria-label":"Модель, усилие и размышления","aria-haspopup":"menu","aria-expanded":E,onClick:()=>A(L=>!L),onKeyDown:R,children:[(U==null?void 0:U.displayName)??l?a.jsx("span",{className:"select__value",children:(U==null?void 0:U.displayName)??l}):a.jsx("span",{className:"select__value select__value--muted",children:"по умолчанию"}),c?a.jsx("span",{className:"select__suffix select__suffix--hot",children:"ultracode"}):O.length>0&&r&&a.jsx("span",{className:"select__suffix",children:r}),a.jsx(sk,{})]}),E&&a.jsxs("div",{ref:z,className:"select__menu modelmenu",role:"menu",children:[a.jsx("div",{className:"modelmenu__head",children:"Модель"}),n.map((L,G)=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":L.value===l,className:"select__option"+(G===D?" is-cursor":"")+(L.value===l?" is-on":""),onMouseEnter:()=>q(G),onClick:()=>V(L),children:[a.jsx("span",{className:"select__check","aria-hidden":"true",children:L.value===l?"✓":""}),a.jsx("span",{className:"select__label",children:L.displayName}),L.description&&a.jsx("span",{className:"select__hint",children:L.description})]},L.value)),O.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"modelmenu__sep",role:"separator"}),a.jsxs("div",{className:"modelmenu__row",children:[a.jsxs("span",{className:"modelmenu__label",children:["Усилие",a.jsx("span",{className:"modelmenu__desc",children:"насколько усердно модель думает"})]}),a.jsx("span",{className:"modelmenu__levels",children:O.map(L=>a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":L===r,className:L===r?"modelmenu__level is-on":"modelmenu__level",onClick:()=>j(L),children:L},L))})]}),I&&p&&a.jsx(up,{label:"Ultracode",desc:"xhigh и постоянная оркестрация подагентами",on:c,onToggle:()=>y(!c)})]}),a.jsx("div",{className:"modelmenu__sep",role:"separator"}),g&&(U==null?void 0:U.supportsThinking)!==!1&&a.jsx(up,{label:"Размышления",desc:"расширенное обдумывание перед ответом",on:o,onToggle:()=>T(!o)}),h&&a.jsx(up,{label:"Менять модель по флагу",desc:"иначе помеченный ход встаёт на паузу",on:u,onToggle:()=>N(!u)})]})]})}function up({label:n,desc:l,on:r,onToggle:c}){return a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":r,className:"modelmenu__row modelmenu__row--btn",onClick:c,children:[a.jsxs("span",{className:"modelmenu__label",children:[n,a.jsx("span",{className:"modelmenu__desc",children:l})]}),a.jsx("span",{className:r?"switch is-on":"switch","aria-hidden":"true",children:a.jsx("span",{className:"switch__knob"})})]})}function sk(){return a.jsx("svg",{className:"select__chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M3 4.5 6 7.5 9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function lk({candidates:n,searching:l,agentItems:r,agentBusy:c,error:o,roots:u,created:h,onSearch:p,onAskAgent:g,onInterrupt:x,onSubmit:v,onCreate:j,onClose:y}){const[T,N]=b.useState("open"),[E,A]=b.useState(""),[D,q]=b.useState(!1),[Q,z]=b.useState(""),[U,O]=b.useState(""),[I,V]=b.useState({git:!0,claudeMd:!0,agentsMd:!0,readme:!0}),R=E.trim(),L=R!=="",G=Q.trim(),se=U.trim(),ve=G!==""&&se!=="";b.useEffect(()=>{Q===""&&u.length>0&&z(u[0])},[u]);const je=b.useRef(p);je.current=p,b.useEffect(()=>{if(T!=="open")return;const ne=E.trim(),pe=setTimeout(()=>je.current(ne),200);return()=>clearTimeout(pe)},[E,T]);function we(){L&&v(R)}function F(){ve&&j(G,se,I)}function $(){L&&(q(!0),g(R))}return h?a.jsxs(rs,{title:"Новый проект",onClose:y,actions:a.jsx("button",{className:"btn btn--primary",onClick:y,autoFocus:!0,children:"Понятно"}),children:[a.jsx("p",{className:"modal__text",children:"Каталог создан и открыт как проект, но часть шагов не удалась."}),a.jsx("p",{className:"newproj__preview",children:h.path}),a.jsx("div",{className:"modal__error",children:a.jsx("ul",{className:"newproj__warnings",children:h.warnings.map(ne=>a.jsx("li",{children:ne},ne))})}),a.jsx("p",{className:"modal__text modal__text--dim",children:"Проект открыт и работает — недостающее можно добавить руками, в дереве файлов или из терминала."})]}):a.jsxs(rs,{title:"Новый проект",className:D&&T==="open"?"modal--wide":void 0,onClose:y,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:y,children:"Отмена"}),T==="open"?a.jsxs(a.Fragment,{children:[c?a.jsx("button",{className:"btn",onClick:x,children:"Остановить"}):a.jsx("button",{className:"btn",disabled:!L,onClick:$,title:"Найти по описанию",children:"Попросить агента"}),a.jsx("button",{className:"btn btn--primary",disabled:!L,onClick:we,children:"Открыть"})]}):a.jsx("button",{className:"btn btn--primary",disabled:!ve,onClick:F,children:"Создать"})]}),children:[a.jsxs("div",{className:"tabs",children:[a.jsx(Zb,{label:"Открыть",on:T==="open",onClick:()=>N("open")}),a.jsx(Zb,{label:"Создать",on:T==="create",onClick:()=>N("create")})]}),T==="open"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal__text",children:"Каталог, в котором будет работать агент. Введите путь или часть имени — подходящие каталоги появятся ниже."}),a.jsx("label",{className:"field",htmlFor:"workspace-path",children:"Путь или название"}),a.jsx("input",{id:"workspace-path",className:"input input--mono",value:E,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects\\my-app",onChange:ne=>A(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),we())}}),o&&a.jsx("p",{className:"modal__error",children:o}),n.length>0&&a.jsx("ul",{className:"finds",children:n.map(ne=>a.jsx("li",{children:a.jsxs("button",{className:"find",disabled:ne.open,title:ne.open?"Этот проект уже открыт":ne.path,onClick:()=>A(ne.path),onDoubleClick:()=>v(ne.path),children:[a.jsx("span",{className:"find__name",children:ne.name}),a.jsx("span",{className:"find__path",children:ne.path}),a.jsx("span",{className:"find__note",children:rk(ne)})]})},ne.path))}),n.length===0&&L&&!l&&!D&&a.jsx("p",{className:"modal__text modal__text--dim",children:"Ничего похожего среди каталогов, где вы работали. Если помните не имя, а суть проекта — опишите его и нажмите «Попросить агента». Проекта ещё нет вовсе — рядом вкладка «Создать»."}),D&&a.jsx("div",{className:"finds__agent",children:a.jsx(hf,{items:r,busy:c,waiting:!1,empty:"Агент ищет…"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"modal__text",children:"Пустой каталог для нового проекта. Дальше в нём работает агент — с первого промпта, без отдельной настройки."}),a.jsx("label",{className:"field",htmlFor:"workspace-parent",children:"Где создать"}),a.jsx("input",{id:"workspace-parent",className:"input input--mono",value:Q,spellCheck:!1,autoComplete:"off",placeholder:"C:\\Projects",onChange:ne=>z(ne.target.value)}),u.length>0&&a.jsx("div",{className:"newproj__roots",children:u.map(ne=>a.jsx("button",{type:"button",className:ne===G?"newproj__root is-on":"newproj__root",title:ne,onClick:()=>z(ne),children:ik(ne)},ne))}),a.jsx("label",{className:"field newproj__field",htmlFor:"workspace-name",children:"Имя проекта"}),a.jsx("input",{id:"workspace-name",className:"input input--mono",value:U,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"my-app",onChange:ne=>O(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&(ne.preventDefault(),F())}}),a.jsx("p",{className:"newproj__preview",children:ve?ak(G,se):"Каталог появится здесь"}),o&&a.jsx("p",{className:"modal__error",children:o}),a.jsxs("div",{className:"newproj__opts",children:[a.jsx(Gd,{label:"AGENTS.md",desc:"инструкции проекта для Codex",on:I.agentsMd??!1,onToggle:()=>V(ne=>({...ne,agentsMd:!ne.agentsMd}))}),a.jsx(Gd,{label:"git init",desc:"панель истории работает сразу",on:I.git,onToggle:()=>V(ne=>({...ne,git:!ne.git}))}),a.jsx(Gd,{label:"CLAUDE.md",desc:"заготовка инструкций для агента",on:I.claudeMd,onToggle:()=>V(ne=>({...ne,claudeMd:!ne.claudeMd}))}),a.jsx(Gd,{label:"README.md",desc:"по нему проект потом узнаёт поиск",on:I.readme,onToggle:()=>V(ne=>({...ne,readme:!ne.readme}))})]})]})]})}function Zb({label:n,on:l,onClick:r}){return a.jsx("button",{type:"button",className:l?"tabs__tab is-on":"tabs__tab","aria-pressed":l,onClick:r,children:n})}function Gd({label:n,desc:l,on:r,onToggle:c}){return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,className:"newproj__opt",onClick:c,children:[a.jsxs("span",{className:"newproj__optlabel",children:[n,a.jsx("span",{className:"newproj__optdesc",children:l})]}),a.jsx("span",{className:r?"switch is-on":"switch","aria-hidden":"true",children:a.jsx("span",{className:"switch__knob"})})]})}function ak(n,l){const r=n.includes("\\")?"\\":"/";return n.replace(/[\\/]+$/,"")+r+l}function ik(n){const l=n.includes("\\")?"\\":"/",r=n.split(/[\\/]/).filter(Boolean);return r.length<=2?n:`…${l}${r.slice(-2).join(l)}`}function rk(n){return n.open?"уже открыт":n.why?n.why:n.sessions===0?"рядом с вашими проектами":`${ck(n.sessions)}${ok(n.lastUsedAt)}`}function ck(n){const l=n%10,r=n%100;return r>=11&&r<=14?`${n} сессий`:l===1?`${n} сессия`:l>=2&&l<=4?`${n} сессии`:`${n} сессий`}function ok(n){if(!n)return"";const l=Math.floor((Date.now()-n)/864e5);return l<=0?" · сегодня":l===1?" · вчера":l<30?` · ${l} дн. назад`:` · ${new Date(n).toLocaleDateString("ru-RU")}`}const Wp=7;function uk(n){const l=[],r=[];let c=1;for(const o of n){const u=l.slice();let h=l.indexOf(o.hash);h===-1&&(h=Fb(l),l[h]=o.hash);const[p,...g]=o.parents;l[h]=p??null;const x=[];p!==void 0&&x.push({from:h,to:h});for(const y of g){let T=l.indexOf(y);T===-1&&(T=Fb(l),l[T]=y),x.push({from:h,to:T})}const v=[];for(let y=0;y<u.length;y++)u[y]===o.hash&&(v.push({from:y,to:h}),y!==h&&(l[y]=null));const j=[];for(let y=0;y<u.length;y++){const T=u[y];!T||T===o.hash||y===h||l[y]===T&&j.push(y)}dk(l),c=Math.max(c,l.length,h+1),r.push({commit:o,col:h,up:v,down:x,through:j})}return{rows:r,columns:Math.min(c,Wp)}}function Fb(n){const l=n.indexOf(null);return l!==-1?l:(n.push(null),n.length-1)}function dk(n){for(;n.length>0&&n[n.length-1]===null;)n.pop()}const yy=1500;function fk(n){const l=[];let r=!1;for(const c of n.patch.split(`
128
+ `)){if(l.length>=yy){r=!0;break}if(c.startsWith("@@"))l.push({type:"gap",text:hk(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:n.path||n.oldPath,rows:l,added:n.added,removed:n.removed,note:pk(n,r)}}function hk(n){const l=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(n);if(!l)return n;const r=Number(l[1]),c=l[2]===void 0?1:Number(l[2]),o=(l[3]??"").trim(),u=c>1?`строки ${r}–${r+c-1}`:`строка ${r}`;return o?`⋯ ${u} · ${o}`:`⋯ ${u}`}function pk(n,l){const r=[];return n.status==="added"&&r.push("новый файл"),n.status==="deleted"&&r.push("файл удалён"),n.status==="renamed"&&r.push(`переименован из ${n.oldPath}`),n.binary?r.push("двоичный файл"):n.patch===""&&r.push("содержимое не показано"),l&&r.push(`показаны первые ${yy} строк`),r.length>0?r.join(" · "):null}function mk({open:n,state:l,result:r,selected:c,busy:o,onRefresh:u,onShow:h,onCheckout:p,onPush:g,onPull:x,onPublish:v,onConnectRemote:j,onDismissResult:y,onClose:T,zoomed:N,onToggleZoom:E}){const A=uk((l==null?void 0:l.commits)??[]),D=[...l!=null&&l.detached?[{value:"",label:`отделён · ${l.head.slice(0,8)}`}]:[],...((l==null?void 0:l.branches)??[]).map(q=>({value:q.name,label:q.name,hint:q.hash.slice(0,8)}))];return a.jsxs("aside",{className:(n?"sidepane sidepane--git sidepane--open":"sidepane sidepane--git")+(N?" sidepane--zoomed":""),"aria-label":"История git",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:q=>{E&&(q.target.closest("button")||E())},children:[a.jsx(vk,{}),a.jsx("span",{className:"sidepane__title",children:"История"}),a.jsx("button",{className:"sidepane__btn",title:"Обновить","aria-label":"Обновить историю",onClick:u,children:"↻"}),E&&a.jsx("button",{className:"sidepane__btn",title:N?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":N?"Свернуть панель истории":"Развернуть панель истории на весь экран","aria-pressed":N,onClick:E,children:a.jsx(Fc,{active:N})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель истории",onClick:T,children:"✕"})]}),l===null?a.jsx("p",{className:"sidepane__empty",children:"Читаем репозиторий…"}):l.available?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"gitbar",children:[a.jsx(_l,{className:"gitbar__branch",title:"Ветка — выбрать значит переключиться",value:l.detached?"":l.branch,options:D,onChange:q=>{q&&p(q,`ветку ${q}`)}}),a.jsx(Kc,{text:l.detached?l.head:l.branch,hint:l.detached?"хеш HEAD":"имя ветки"})]}),l.detached&&a.jsx("p",{className:"gitbar__note",children:"HEAD отделён от ветки. Выберите ветку в списке, чтобы вернуться."}),a.jsx("div",{className:"gitbar__actions",children:o?a.jsxs("p",{className:"gitbar__busy",children:[a.jsx(kk,{}),o]}):l.hasRemote?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm",title:"Отправить текущую ветку в origin",onClick:g,children:[a.jsx(jk,{}),"Отправить",l.ahead>0&&a.jsx("span",{className:"gitbar__count",children:l.ahead})]}),a.jsxs("div",{className:"gitbar__group",children:[a.jsxs("button",{type:"button",className:"btn btn--sm",title:"Забрать с origin и перемотать вперёд (git pull --ff-only)",onClick:()=>x(!0),children:[a.jsx(wk,{}),"Забрать",l.behind>0&&a.jsx("span",{className:"gitbar__count",children:l.behind})]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost gitbar__check",title:"Только проверить — git fetch, рабочее дерево не меняется","aria-label":"Проверить, что нового на origin, без изменений на диске",onClick:()=>x(!1),children:a.jsx(Nk,{})})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",title:"Создать репозиторий на GitHub и отправить в него ветку",onClick:v,children:[a.jsx(Pb,{}),"Опубликовать на GitHub"]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",title:"Прописать origin на уже существующий репозиторий",onClick:j,children:"уже есть репозиторий"})]})}),a.jsxs("div",{className:"sidepane__scroll",children:[a.jsx("button",{className:"gitrow gitrow--work"+(c===""?" is-on":""),onClick:()=>h(""),children:a.jsxs("span",{className:"gitrow__body",children:[a.jsx("span",{className:"gitrow__subject",children:l.changed.length>0?`Рабочее дерево · ${l.changed.length} ${Ck(l.changed.length)}`:"Рабочее дерево чистое"}),a.jsx("span",{className:"gitrow__meta",children:l.changed.length>0?l.changed.slice(0,4).map(q=>Tk(q.path)).join(", "):"незакоммиченных изменений нет"})]})}),A.rows.map(q=>a.jsx(xk,{row:q,columns:A.columns,head:q.commit.hash===l.head,local:l.hasRemote&&!q.commit.pushed,active:c===q.commit.hash,onOpen:()=>h(q.commit.hash)},q.commit.hash)),A.rows.length===0&&a.jsx("p",{className:"sidepane__empty",children:"В репозитории ещё нет коммитов"})]})]}):a.jsxs("div",{className:"gitempty",children:[a.jsx("p",{className:"gitempty__text",children:l.message||"Это не git-репозиторий"}),l.noRepo&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"btn btn--sm btn--primary gitempty__btn",onClick:v,children:[a.jsx(Pb,{}),"Опубликовать на GitHub"]}),a.jsx("p",{className:"gitempty__hint",children:"Заведёт репозиторий, сделает первый коммит и отправит его на GitHub."})]})]}),a.jsx(Or,{result:r,onDismiss:y})]})}const eu=50,Jb=13,gk=500;function xk({row:n,columns:l,head:r,local:c,active:o,onOpen:u}){const{commit:h}=n,p=h.refs.map(Sk).filter(Boolean),[g,x]=b.useState(null),v=b.useRef(null);function j(E){const A=E.touches[0];if(!A)return;const D={timer:0,x:A.clientX,y:A.clientY,fired:!1};D.timer=window.setTimeout(()=>{D.fired=!0,x({x:D.x,y:D.y})},gk),v.current=D}function y(E){const A=v.current,D=E.touches[0];!A||!D||Math.hypot(D.clientX-A.x,D.clientY-A.y)>10&&(window.clearTimeout(A.timer),v.current=null)}function T(E){const A=v.current;A&&(window.clearTimeout(A.timer),A.fired&&E.preventDefault())}function N(){const E=[{id:"hash",label:"Копировать хеш",hint:h.shortHash,onSelect:()=>void ba(h.hash)},{id:"short",label:"Копировать короткий хеш",onSelect:()=>void ba(h.shortHash)},{id:"subject",label:"Копировать сообщение",onSelect:()=>void ba(h.subject)}],A=new Set;for(const D of h.refs){const q=D.startsWith("tag: "),Q=Ek(D);!Q||A.has(Q)||(A.add(Q),E.push({id:`ref:${Q}`,label:q?"Копировать тег":"Копировать ветку",hint:Q,onSelect:()=>void ba(Q)}))}return E}return a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"gitrow"+(o?" is-on":""),title:c?"Коммит ещё не отправлен на удалённый репозиторий":void 0,onClick:()=>{var E;if((E=v.current)!=null&&E.fired){v.current=null;return}u()},onContextMenu:E=>{E.preventDefault(),x({x:E.clientX,y:E.clientY})},onTouchStart:j,onTouchMove:y,onTouchEnd:T,onTouchCancel:T,children:[a.jsx(bk,{row:n,columns:l,head:r,local:c}),a.jsxs("span",{className:"gitrow__body",children:[a.jsxs("span",{className:"gitrow__subject",children:[p.map(E=>a.jsx("span",{className:"gitrow__ref",children:E},E)),h.subject]}),a.jsxs("span",{className:"gitrow__meta",children:[h.shortHash," · ",h.author," · ",Ak(h.date),c&&a.jsx("span",{className:"gitrow__local",children:"· не отправлен"})]})]})]}),g&&a.jsx(Ui,{x:g.x,y:g.y,items:N(),onClose:()=>x(null)})]})}function bk({row:n,columns:l,head:r,local:c}){const o=l*Jb+6,u=eu/2,h=x=>8+Math.min(x,Wp-1)*Jb,p=c?"3.5 2.5":void 0,g=$d(n.col);return a.jsxs("svg",{className:"gitgraph",width:o,height:eu,viewBox:`0 0 ${o} ${eu}`,"aria-hidden":"true",children:[n.through.map(x=>a.jsx("line",{x1:h(x),y1:0,x2:h(x),y2:eu,style:{stroke:$d(x)}},`t${x}`)),n.up.map((x,v)=>a.jsx("path",{d:`M${h(x.from)} 0 L${h(x.from)} ${u-12} L${h(x.to)} ${u}`,fill:"none",style:{stroke:$d(x.from),strokeDasharray:p}},`u${v}`)),n.down.map((x,v)=>a.jsx("path",{d:`M${h(x.from)} ${u} L${h(x.to)} ${u+12} L${h(x.to)} ${eu}`,fill:"none",style:{stroke:$d(x.to),strokeDasharray:p}},`d${v}`)),r&&a.jsx("circle",{className:"gitgraph__head",cx:h(n.col),cy:u,r:n.commit.parents.length>1?7.4:6.6}),a.jsx("circle",{className:"gitgraph__dot",cx:h(n.col),cy:u,r:n.commit.parents.length>1?4.6:3.6,style:{stroke:g,fill:c?void 0:g}})]})}function $d(n){return`var(--lane-${n%Wp})`}function _k({detail:n,local:l,onCheckout:r,onClose:c}){const o=n.hash==="";return a.jsxs(rs,{className:"modal--wide",title:o?"Незакоммиченные изменения":`Коммит ${n.shortHash}`,onClose:c,actions:a.jsxs(a.Fragment,{children:[!o&&a.jsx("button",{className:"btn",onClick:()=>r(n.hash,`коммит ${n.shortHash} (HEAD отделится от ветки)`),children:"Переключиться сюда"}),a.jsx("button",{className:"btn btn--primary",onClick:c,children:"Закрыть"})]}),children:[!o&&a.jsxs("div",{className:"commit__head",children:[a.jsxs("div",{className:"commit__line",children:[a.jsx("p",{className:"commit__subject",children:n.subject}),a.jsx(Kc,{text:n.subject,hint:"сообщение коммита"})]}),a.jsxs("p",{className:"commit__meta",children:[n.author,n.email&&` <${n.email}>`," · ",Rk(n.date)]}),a.jsxs("div",{className:"commit__line commit__line--hash",children:[a.jsx("span",{className:"commit__hash",children:n.hash}),a.jsx(Kc,{text:n.hash,hint:"хеш коммита"})]}),l&&a.jsx("p",{className:"commit__meta commit__meta--local",children:"Не отправлен: этого коммита нет ни в одной удалённой ветке."}),n.parents.length>0&&a.jsxs("p",{className:"commit__meta",children:[n.parents.length>1?"слияние: ":"родитель: ",n.parents.map(u=>u.slice(0,8)).join(", ")]}),n.body&&a.jsx("pre",{className:"commit__body",children:n.body})]}),n.truncated&&a.jsx("p",{className:"modal__text",children:"Изменения слишком велики — часть патча не показана."}),n.files.length===0?a.jsx("p",{className:"modal__text",children:"Изменений нет."}):n.files.map(u=>a.jsx(yk,{file:u,defaultOpen:n.files.length<=3},u.path+u.oldPath))]})}function yk({file:n,defaultOpen:l}){const[r,c]=b.useState(l);return a.jsxs("div",{className:"commit__file",children:[a.jsxs("button",{className:"commit__filehead",onClick:()=>c(o=>!o),children:[a.jsx("span",{className:"commit__filepath",children:n.path||n.oldPath}),a.jsxs("span",{className:"diff__stat",children:[n.added>0&&a.jsxs("span",{className:"diff__stat--add",children:["+",n.added]}),n.removed>0&&a.jsxs("span",{className:"diff__stat--del",children:["−",n.removed]})]}),a.jsx("span",{className:"tool__status",children:r?"▴":"▾"})]}),r&&a.jsx(Kp,{diff:fk(n)})]})}function vk(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),a.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),a.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),a.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function jk(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 13V3M4.5 6.5 8 3l3.5 3.5"})})}function wk(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M4.5 9.5 8 13l3.5-3.5"})})}function Nk(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"m13 13-2.6-2.6"})]})}function Pb(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function kk(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),a.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function Sk(n){return n.replace(/^HEAD -> /,"").replace(/^tag: /,"⌂ ").trim()}function Ek(n){const l=n.replace(/^HEAD -> /,"").replace(/^tag: /,"").trim();return l==="HEAD"?"":l}function Tk(n){const l=n.split("/");return l[l.length-1]??n}function Ck(n){const l=n%100;if(l>=11&&l<=14)return"файлов";switch(n%10){case 1:return"файл";case 2:case 3:case 4:return"файла";default:return"файлов"}}function Ak(n){const l=Date.parse(n);if(Number.isNaN(l))return n;const r=Math.round((Date.now()-l)/6e4);if(r<1)return"только что";if(r<60)return`${r} мин назад`;const c=Math.round(r/60);if(c<24)return`${c} ч назад`;const o=Math.round(c/24);return o<30?`${o} дн назад`:new Date(l).toLocaleDateString()}function Rk(n){const l=Date.parse(n);return Number.isNaN(l)?n:new Date(l).toLocaleString()}function Wb(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")}function Mk({status:n,owners:l,files:r,defaultName:c,hasCommits:o,busy:u,result:h,onRefreshStatus:p,onSaveToken:g,onPublish:x,onDismissResult:v,onClose:j}){var ne;const[y,T]=b.useState(()=>Wb(c)),[N,E]=b.useState(""),[A,D]=b.useState(""),[q,Q]=b.useState(!0),[z,U]=b.useState("Первый коммит"),[O,I]=b.useState(null),[V,R]=b.useState("");b.useEffect(()=>{!N&&l.length>0&&E(l[0].login)},[N,l]),b.useEffect(()=>{r&&O===null&&I(new Set(r.files))},[r,O]);const L=(n==null?void 0:n.connected)===!0,G=l.map(pe=>({value:pe.login,label:pe.login,hint:pe.kind==="org"?"организация":void 0})),se=b.useMemo(()=>{if(!r)return[];const pe=V.trim().toLowerCase();return pe?r.files.filter(Ne=>Ne.toLowerCase().includes(pe)):r.files},[r,V]),ve=(O==null?void 0:O.size)??0,je=L&&y.trim()!==""&&N!==""&&u===""&&(o||ve>0);function we(pe){I(Ne=>{const S=new Set(Ne??[]);return S.has(pe)?S.delete(pe):S.add(pe),S})}function F(pe){I(Ne=>{const S=new Set(Ne??[]);for(const Z of se)pe?S.add(Z):S.delete(Z);return S})}function $(){if(!je)return;const pe=(r==null?void 0:r.files)??[];x({owner:N,name:y.trim(),description:A.trim(),private:q,include:o?[]:pe.filter(Ne=>O==null?void 0:O.has(Ne)),ignore:o?[]:pe.filter(Ne=>!(O!=null&&O.has(Ne))),message:o?"":z.trim()||"Первый коммит"})}return a.jsxs(rs,{className:"modal--wide",title:"Опубликовать на GitHub",onClose:j,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"btn",onClick:j,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--primary",disabled:!je,onClick:$,children:u||"Опубликовать"})]}),children:[a.jsx(Dk,{status:n,onRefreshStatus:p,onSaveToken:g}),a.jsxs("div",{className:"publish__section",children:[a.jsx("h3",{className:"publish__heading",children:"Репозиторий"}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Имя"}),a.jsx("input",{className:"input input--mono",value:y,spellCheck:!1,autoComplete:"off",onChange:pe=>T(Wb(pe.target.value))})]}),y.trim()===""&&a.jsx("p",{className:"modal__error",children:"Имя репозитория не может быть пустым."}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Владелец"}),l.length>1?a.jsx(_l,{className:"settings__select",value:N,options:G,onChange:E,placeholder:"выберите владельца",ariaLabel:"Владелец репозитория"}):a.jsx("p",{className:"publish__static",children:((ne=l[0])==null?void 0:ne.login)??"—"})]}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Описание (необязательно)"}),a.jsx("input",{className:"input",value:A,placeholder:"о чём проект — одной строкой",onChange:pe=>D(pe.target.value)})]}),a.jsxs("div",{className:"field publish__field",children:[a.jsx("span",{children:"Видимость"}),a.jsxs("div",{className:"access",role:"radiogroup","aria-label":"Видимость репозитория",children:[a.jsx(e_,{title:"Приватный",desc:"Виден только вам и тем, кого вы пригласите. Стоит по умолчанию: репозиторий с чужим кодом, случайно ставший публичным, потом не отозвать.",on:q,onClick:()=>Q(!0)}),a.jsx(e_,{title:"Публичный",desc:"Виден всем в интернете — код, история коммитов, всё содержимое.",risky:!0,on:!q,onClick:()=>Q(!1)})]})]})]}),!o&&a.jsxs("div",{className:"publish__section",children:[a.jsx("h3",{className:"publish__heading",children:"Файлы первого коммита"}),r===null?a.jsx("p",{className:"modal__text",children:"Читаем файлы…"}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"publish__filehead",children:[a.jsxs("span",{className:"publish__filecount",children:[ve," из ",r.files.length," файлов"]}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>F(!0),children:"Отметить все"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>F(!1),children:"Снять все"})]}),r.files.length>8&&a.jsx("input",{className:"input publish__filter",value:V,placeholder:"Фильтр по пути…",spellCheck:!1,onChange:pe=>R(pe.target.value)}),a.jsx("div",{className:"publish__filelist",children:se.length===0?a.jsx("p",{className:"modal__text publish__filesempty",children:"Ничего не найдено по фильтру."}):se.map(pe=>a.jsxs("button",{type:"button",role:"checkbox","aria-checked":(O==null?void 0:O.has(pe))===!0,className:"publish__file",onClick:()=>we(pe),children:[a.jsx("span",{className:"publish__box"+(O!=null&&O.has(pe)?" is-on":""),"aria-hidden":"true",children:(O==null?void 0:O.has(pe))&&"✓"}),a.jsx("span",{className:"publish__filepath",children:pe})]},pe))}),r.truncated&&a.jsx("p",{className:"publish__truncated",children:"Каталог больше, чем показано здесь, — часть файлов в список не попала. Их всё равно можно закоммитить потом обычным образом."}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Сообщение коммита"}),a.jsx("input",{className:"input",value:z,onChange:pe=>U(pe.target.value)})]})]})]}),a.jsx(Or,{result:h,onDismiss:v})]})}function e_({title:n,desc:l,on:r,risky:c,onClick:o}){return a.jsxs("button",{type:"button",role:"radio","aria-checked":r,className:"access__card"+(r?" is-on":"")+(c?" access__card--risky":""),onClick:o,children:[a.jsx("span",{className:"access__radio","aria-hidden":"true"}),a.jsxs("span",{className:"access__body",children:[a.jsxs("span",{className:"access__title",children:[n,c&&a.jsx("span",{className:"access__risk",children:"видно всем"})]}),a.jsx("span",{className:"access__desc",children:l})]})]})}function Dk({status:n,onRefreshStatus:l,onSaveToken:r}){const[c,o]=b.useState(""),[u,h]=b.useState(!1);return a.jsxs("div",{className:"publish__section publish__section--first",children:[a.jsx("h3",{className:"publish__heading",children:"Учётная запись GitHub"}),n===null?a.jsx("p",{className:"modal__text",children:"Проверяем подключение…"}):n.connected?a.jsxs("div",{className:"publish__account",children:[a.jsx("span",{className:"chip chip--ok",children:n.login}),a.jsx("span",{className:"publish__accountvia",children:n.source==="gh"?"через GitHub CLI":"по личному токену"}),n.source==="token"&&a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>r(""),children:"Отключить токен"})]}):a.jsxs("div",{className:"publish__connect",children:[n.ghInstalled&&a.jsxs("p",{className:"modal__text",children:["В системе установлен ",a.jsx("code",{children:"gh"}),", но вход в нём не выполнен. Можно вместо токена выполнить ",a.jsx("code",{children:"gh auth login"})," в панели терминала и нажать «Проверить снова» — либо ввести личный токен ниже."]}),a.jsxs("label",{className:"field publish__field",children:[a.jsx("span",{children:"Личный токен GitHub"}),a.jsx(Ok,{value:c,onChange:o,visible:u,onToggleVisible:()=>h(p=>!p),placeholder:"ghp_…"})]}),a.jsxs("p",{className:"publish__tokenhint",children:["Нужен токен с доступом ",a.jsx("code",{children:"repo"})," — им приложение создаст репозиторий и отправит в него код."," ",a.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=Claude%20Code%20Visual",target:"_blank",rel:"noreferrer",children:"Создать токен на GitHub ↗"})]}),n.message&&a.jsx("p",{className:"modal__error",children:n.message}),a.jsxs("div",{className:"extbar",children:[a.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:l,children:"Проверить снова"}),a.jsx("button",{type:"button",className:"btn btn--sm btn--primary",disabled:c.trim()==="",onClick:()=>r(c.trim()),children:"Сохранить токен"})]})]})]})}function Ok({value:n,onChange:l,visible:r,onToggleVisible:c,placeholder:o,autoFocus:u}){return a.jsxs("div",{className:"pwfield",children:[a.jsx("input",{className:"input input--mono pwfield__input",type:r?"text":"password",value:n,placeholder:o,spellCheck:!1,autoComplete:"off",autoFocus:u,onChange:h=>l(h.target.value)}),a.jsx("button",{type:"button",className:"pwfield__toggle","aria-label":r?"Скрыть токен":"Показать токен","aria-pressed":r,onClick:c,children:r?a.jsx(zk,{}):a.jsx(Lk,{})})]})}function Lk(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),a.jsx("circle",{cx:"8",cy:"8",r:"2.1"})]})}function zk(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M1 8s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5Z"}),a.jsx("circle",{cx:"8",cy:"8",r:"2.1"}),a.jsx("path",{d:"M2 14 14 2"})]})}function Ik({busy:n,result:l,onSubmit:r,onDismissResult:c,onClose:o}){const[u,h]=b.useState(""),p=/^(https?|ssh|git):\/\/\S+/i.test(u.trim())||/^[\w.-]+@[\w.-]+:.+/.test(u.trim());return a.jsxs(rs,{title:"Подключить существующий репозиторий",onClose:o,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"btn",onClick:o,children:"Отмена"}),a.jsx("button",{type:"button",className:"btn btn--primary",disabled:!p||n!=="",onClick:()=>r(u.trim()),children:n||"Подключить"})]}),children:[a.jsxs("p",{className:"modal__text",children:["Пропишет этот адрес как ",a.jsx("code",{children:"origin"})," текущего репозитория. Ничего не отправляется само — после этого в панели появятся обычные «Отправить» и «Забрать»."]}),a.jsxs("label",{className:"field",children:[a.jsx("span",{children:"Адрес репозитория"}),a.jsx("input",{className:"input input--mono",value:u,placeholder:"https://github.com/owner/name.git",spellCheck:!1,autoComplete:"off",autoFocus:!0,onChange:g=>h(g.target.value),onKeyDown:g=>{g.key==="Enter"&&p&&n===""&&r(u.trim())}})]}),a.jsxs("p",{className:"modal__text modal__text--dim",children:["Подходят адреса вида ",a.jsx("code",{children:"https://…"}),", ",a.jsx("code",{children:"ssh://…"}),", ",a.jsx("code",{children:"git://…"})," и"," ",a.jsx("code",{children:"git@host:path"}),"."]}),a.jsx(Or,{result:l,onDismiss:c})]})}function Uk({open:n,items:l,busy:r,ready:c,sendBlocked:o,commands:u,contextResult:h,draftKey:p,models:g,model:x,effort:v,ultracode:j,thinking:y,switchOnFlag:T,onContextSearch:N,onCommand:E,onModel:A,onEffort:D,onUltracode:q,onThinking:Q,onSwitchOnFlag:z,onAsk:U,onInterrupt:O,onReset:I,onClose:V,zoomed:R,onToggleZoom:L}){return a.jsxs("aside",{className:(n?"sidepane sidepane--ask sidepane--open":"sidepane sidepane--ask")+(R?" sidepane--zoomed":""),"aria-label":"Вопрос на полях",children:[a.jsxs("div",{className:"sidepane__head",onDoubleClick:G=>{L&&(G.target.closest("button")||L())},children:[a.jsx(Hk,{}),a.jsx("span",{className:"sidepane__title",children:"Вопрос на полях"}),a.jsx("button",{className:"sidepane__btn",title:"Начать заново — следующий вопрос возьмёт свежий контекст","aria-label":"Начать боковой разговор заново",disabled:l.length===0,onClick:I,children:"↻"}),L&&a.jsx("button",{className:"sidepane__btn",title:R?"Свернуть панель — то же самое, что двойной клик по шапке":"Развернуть панель на весь экран — то же самое, что двойной клик по шапке","aria-label":R?"Свернуть панель вопроса":"Развернуть панель вопроса на весь экран","aria-pressed":R,onClick:L,children:a.jsx(Fc,{active:R})}),a.jsx("button",{className:"sidepane__btn",title:"Закрыть панель","aria-label":"Закрыть панель вопроса",onClick:V,children:"✕"})]}),g.length>0&&a.jsxs("div",{className:"sidepane__tools",children:[a.jsx(_y,{className:"select--compact",models:g,value:x,effort:v,ultracode:j,thinking:y,switchOnFlag:T,onModel:A,onEffort:D,onUltracode:q,onThinking:Q,onSwitchOnFlag:z}),a.jsx("span",{className:"sidepane__note",title:"Боковой вопрос работает только на чтение",children:"только чтение"})]}),a.jsx(hf,{items:l,busy:r,waiting:!1,empty:c?"Спросите о том, что происходит: вопрос уйдёт в сторону от основного разговора и не попадёт в его контекст. Отвечающий видит сессию и проект, но ничего не меняет.":"Откройте сессию — вопрос задаётся о ней."}),a.jsx(Pp,{className:"composer--side",disabled:!c,busy:r,commands:u,sessionTitle:null,contextResult:h,draftKey:p?`side:${p}`:null,placeholder:"Спросить, не мешая работе…",sendLabel:"Спросить",autoFocus:n,attachmentsEnabled:!1,sendBlocked:o,onContextSearch:N,onCommand:E,onSend:U,onInterrupt:O,onEscape:r?O:V})]})}function Hk(){return a.jsxs("svg",{className:"sidepane__icon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),a.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}const Bk=75,qk=90;function vy({usage:n}){if(!(n!=null&&n.available))return null;const l=n.buckets??[],r=l.length>0?l.map(o=>({key:o.id,label:o.label,window:o.window})):[...n.fiveHour?[{key:"five",label:"5 ч",window:n.fiveHour}]:[],...n.sevenDay?[{key:"week",label:"нед",window:n.sevenDay}]:[]];if(r.length===0)return null;const c=l.length>0?"Квота Antigravity":`Расход лимитов плана${n.plan?` ${n.plan}`:""}`;return a.jsx("div",{className:"usage",title:Yk(n,l),"aria-label":c,children:r.map(o=>a.jsx(Gk,{label:o.label,window:o.window},o.key))})}function Gk({label:n,window:l}){const r=Math.round(l.utilization),c=Xk(l.resetsAt);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"usage__label",children:n}),a.jsx("span",{className:"usage__track",role:"progressbar","aria-label":n,"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx("span",{className:`usage__fill${$k(r)}`,style:{width:`${r}%`}})}),a.jsxs("span",{className:"usage__pct",children:[r,"%"]}),a.jsx("span",{className:"usage__reset",title:em(l.resetsAt)||void 0,children:c&&`↻ ${c}`})]})}function $k(n){return n>=qk?" usage__fill--over":n>=Bk?" usage__fill--warn":""}function Yk(n,l){if(l.length>0)return Vk(l);const r=[n.plan?`Лимиты плана ${n.plan}`:"Лимиты плана"],c=(o,u)=>{if(!u)return;const h=em(u.resetsAt);r.push(`${o}: ${Math.round(u.utilization)}%${h?`, ${h}`:""}`)};return c("5 часов",n.fiveHour),c("Неделя",n.sevenDay),c("Неделя, Opus",n.sevenDayOpus),r.join(`
129
+ `)}function Vk(n){const l=["Квота Antigravity"];for(const r of n){const c=em(r.window.resetsAt),o=Math.round(r.window.utilization);l.push(`${r.title}: ${o}%${c?`, ${c}`:""}`),r.description&&l.push(r.description)}return l.join(`
130
+ `)}function jy(n){if(!n)return null;const l=new Date(n);return Number.isNaN(l.getTime())?null:l}function wy(n){return n.getTime()-Date.now()<1440*60*1e3}function Xk(n){const l=jy(n);return l?wy(l)?l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):l.toLocaleDateString(void 0,{day:"numeric",month:"short"}):""}function em(n){const l=jy(n);return l?`обнулится ${wy(l)?`в ${l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:l.toLocaleDateString(void 0,{day:"numeric",month:"long"})}`:""}function Ny(){const[n,l]=b.useState(()=>new Date);return b.useEffect(()=>{let r=0;const c=()=>{const u=new Date;l(u),r=window.setTimeout(c,6e4-(u.getSeconds()*1e3+u.getMilliseconds()))};c();const o=()=>{document.hidden||(window.clearTimeout(r),c())};return document.addEventListener("visibilitychange",o),()=>{window.clearTimeout(r),document.removeEventListener("visibilitychange",o)}},[]),a.jsxs("time",{className:"clock",dateTime:n.toISOString(),title:Qk(n),children:[a.jsx("span",{className:"clock__time",children:n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),a.jsx("span",{className:"clock__date",children:n.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})})]})}function Qk(n){return n.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function Kk({onClose:n,permission:l,model:r,usage:c,cwd:o,costLabel:u,onRefresh:h,refreshing:p,metersFetchedAt:g,onRename:x,onHandoff:v,onFreshSession:j,handoffWriting:y,onStop:T}){const N=R_({onLongPress:()=>j==null?void 0:j(),onClick:()=>v==null?void 0:v(),disabled:y});return a.jsx(rs,{title:"Настройки сессии",className:"modal--sheet",sheet:!0,onClose:n,children:a.jsxs("div",{className:"sessionmenu",children:[l&&a.jsx(Mc,{label:"Режим прав",children:l}),a.jsx(Mc,{label:"Модель",children:r}),(c==null?void 0:c.available)&&(c.fiveHour||c.sevenDay||c.buckets&&c.buckets.length>0)&&a.jsx(Mc,{label:"Лимиты плана",children:a.jsx(vy,{usage:c})}),a.jsxs("button",{type:"button",className:p?"sessionmenu__refresh is-busy":"sessionmenu__refresh","aria-busy":p,disabled:p,onClick:h,children:[a.jsx(Zk,{}),a.jsxs("span",{className:"sessionmenu__refresh-text",children:["Обновить показания",g&&a.jsxs("span",{className:"sessionmenu__refresh-time",children:["обновлено в"," ",new Date(g).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})]})]})]}),a.jsx(Mc,{label:"Время",children:a.jsx(Ny,{})}),u&&a.jsx(Mc,{label:"Стоимость хода",children:a.jsx("span",{className:"badge badge--cost",children:u})}),o&&a.jsx(Mc,{label:"Каталог проекта",children:a.jsx(by,{path:o})}),x&&a.jsx("button",{type:"button",className:"sessionmenu__rename",onClick:x,children:"Переименовать сессию"}),v&&a.jsxs("button",{type:"button",className:y?"sessionmenu__handoff is-busy":N.holding?"sessionmenu__handoff is-holding":"sessionmenu__handoff",style:{"--hold-ms":`${N.thresholdMs}ms`},"aria-busy":y,disabled:y,...N.handlers,children:[a.jsx("span",{className:"sessionmenu__handoff-hold","aria-hidden":"true"}),a.jsxs("span",{className:"sessionmenu__handoff-text",children:[y?"Пишется хэндофф…":"Хэндофф и новая сессия",!y&&a.jsx("span",{className:"sessionmenu__handoff-hint",children:"Зажмите — новая сессия без хэндоффа"})]})]}),T&&a.jsx("button",{type:"button",className:"sessionmenu__stop",onClick:T,children:"Остановить сессию"})]})})}function Mc({label:n,children:l}){return a.jsxs("div",{className:"sessionmenu__row",children:[a.jsx("span",{className:"sessionmenu__label",children:n}),l]})}function Zk(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),a.jsx("path",{d:"M14 2v3.33h-3.33"})]})}function Fk({tab:n,servers:l,plugins:r,marketplaces:c,catalog:o,result:u,auth:h,remote:p,actions:g,onTab:x,onClose:v}){const j=[{id:"mcp",label:"MCP-серверы",count:l.length},{id:"plugins",label:"Плагины",count:r.length},{id:"catalog",label:"Каталог",count:o.length}];return a.jsxs(rs,{title:"Расширения",className:"modal--wide",onClose:v,children:[a.jsx("div",{className:"tabs",role:"tablist",children:j.map(y=>a.jsxs("button",{role:"tab","aria-selected":n===y.id,className:n===y.id?"tabs__tab is-on":"tabs__tab",onClick:()=>x(y.id),children:[y.label,a.jsx("span",{className:"tabs__count",children:y.count})]},y.id))}),n==="mcp"&&a.jsx(Jk,{servers:l,auth:h,remote:p,actions:g}),n==="plugins"&&a.jsx(sS,{plugins:r,marketplaces:c,actions:g}),n==="catalog"&&a.jsx(lS,{catalog:o,hasMarketplaces:c.length>0,actions:g,onMarketplaces:()=>x("plugins")}),a.jsx(Or,{result:u})]})}function Jk({servers:n,auth:l,remote:r,actions:c}){const[o,u]=b.useState(!1);return a.jsxs(a.Fragment,{children:[n.length===0&&!o&&a.jsxs("p",{className:"modal__text",children:["Ни одного MCP-сервера. Добавленный здесь попадёт в ",a.jsx("code",{children:".mcp.json"})," ","проекта — его увидит и консольный ",a.jsx("code",{children:"claude mcp list"}),"."]}),a.jsx("ul",{className:"extlist",children:n.map(h=>{const p=(l==null?void 0:l.name)===h.name?l:null,g=p!==null&&p.active&&p.url==="",x=p!==null&&p.active&&p.url!=="";return a.jsxs("li",{className:"extlist__row",children:[a.jsxs("div",{className:"extlist__head",children:[a.jsx("span",{className:"extlist__name",children:h.name}),a.jsx("span",{className:`chip chip--${eS(h.status)}`,children:Wk[h.status]}),h.scope&&a.jsx("span",{className:"chip",children:h.scope}),h.transport&&a.jsx("span",{className:"chip",children:h.transport})]}),h.target&&a.jsx("div",{className:"extlist__meta",title:h.target,children:h.target}),h.error&&a.jsx("div",{className:"extlist__error",children:h.error}),h.tools.length>0&&a.jsxs("div",{className:"extlist__meta",children:["Инструментов: ",h.tools.length," · ",h.tools.slice(0,6).join(", "),h.tools.length>6&&"…"]}),a.jsxs("div",{className:"extlist__actions",children:[h.status==="needs-auth"&&a.jsx("button",{className:x?"btn btn--ghost btn--sm":"btn btn--primary btn--sm",disabled:g,onClick:()=>c.mcpAuth(h.name),children:g?"Запускаем вход…":x?"Начать заново":"Авторизовать"}),a.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>c.mcpAction(h.name,"reconnect"),children:"Переподключить"}),h.status==="disabled"?a.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>c.mcpAction(h.name,"enable"),children:"Включить"}):a.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>c.mcpAction(h.name,"disable"),children:"Выключить"}),h.editable&&a.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>c.mcpRemove(h.name),children:"Удалить"})]}),p&&a.jsx(Pk,{auth:p,remote:r,actions:c})]},h.name)})}),o?a.jsx(tS,{onCancel:()=>u(!1),onSubmit:(h,p)=>{c.mcpAdd(h,p),u(!1)}}):a.jsx("div",{className:"extbar",children:a.jsx("button",{className:"btn btn--primary",onClick:()=>u(!0),children:"+ Сервер"})})]})}function Pk({auth:n,remote:l,actions:r}){const[c,o]=b.useState("");function u(){const g=c.trim();g!==""&&(r.mcpAuthCallback(n.name,g),o(""))}if(!n.active)return n.error?a.jsx("div",{className:"extlist__error",children:n.error}):n.done?a.jsxs("div",{className:"extauth extauth--done",role:"status",children:[a.jsx("span",{className:"extauth__tick","aria-hidden":"true",children:"✓"}),"Вход выполнен, сервер подключён."]}):null;const h=a.jsxs("div",{className:"extauth__paste",children:[l&&a.jsx("label",{className:"extauth__label",htmlFor:`mcp-cb-${n.name}`,children:"Адрес из строки браузера после входа"}),a.jsxs("div",{className:"extform__row",children:[a.jsx("input",{id:`mcp-cb-${n.name}`,"aria-label":"Адрес из строки браузера после входа",className:"input input--mono",value:c,spellCheck:!1,autoComplete:"off",placeholder:"http://localhost:…/callback?code=…",onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),u())}}),a.jsx("button",{className:c.trim()===""?"btn btn--ghost btn--sm":"btn btn--primary btn--sm",disabled:c.trim()==="",onClick:u,children:"Отправить"})]}),a.jsx("p",{className:"extauth__hint",children:l?"Браузер покажет ошибку на localhost — это нормально. Скопируйте адрес из его строки и вставьте сюда.":"Скопируйте адрес из строки браузера и вставьте сюда."})]}),p=n.callbackExpected&&(l?h:a.jsxs("details",{className:"extauth__more",children:[a.jsx("summary",{children:"Браузер показал ошибку на localhost?"}),h]}));return a.jsxs("div",{className:"extauth",role:"status",children:[n.url&&a.jsxs(a.Fragment,{children:[a.jsx("a",{className:"btn btn--primary extauth__go",href:n.url,target:"_blank",rel:"noopener noreferrer",children:"Открыть страницу входа"}),!l&&a.jsx("p",{className:"extauth__hint",children:"На этом компьютере окно обновится само, как только вы войдёте."})]}),p,n.error&&a.jsx("div",{className:"extlist__error",children:n.error}),a.jsxs("div",{className:"extauth__wait",children:[a.jsx("span",{className:"extauth__dot","aria-hidden":"true"}),"Ждём завершения входа…"]})]})}const Wk={connected:"подключён",failed:"ошибка","needs-auth":"нужна авторизация",pending:"подключается",disabled:"выключен",unknown:"неизвестно"};function eS(n){return n==="connected"?"ok":n==="failed"?"bad":n==="needs-auth"?"warn":"mute"}function tS({onSubmit:n,onCancel:l}){const[r,c]=b.useState(""),[o,u]=b.useState("stdio"),[h,p]=b.useState(""),[g,x]=b.useState(""),[v,j]=b.useState(""),y=o==="stdio",T=r.trim()!==""&&(y?h.trim()!=="":g.trim()!=="");function N(){if(T)if(y){const[E,...A]=nS(h);n(r.trim(),{transport:"stdio",command:E??"",args:A,env:t_(v)})}else n(r.trim(),{transport:o,url:g.trim(),headers:t_(v)})}return a.jsxs("div",{className:"extform extform--card",children:[a.jsx("label",{className:"field",htmlFor:"mcp-name",children:"Имя сервера"}),a.jsx("input",{id:"mcp-name",className:"input input--mono",value:r,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"context7",onChange:E=>c(E.target.value)}),a.jsx("label",{className:"field",children:"Транспорт"}),a.jsx(_l,{title:"Транспорт",value:o,options:[{value:"stdio",label:"stdio",hint:"локальный процесс"},{value:"http",label:"http",hint:"удалённый сервер"},{value:"sse",label:"sse",hint:"удалённый, поток событий"}],onChange:E=>u(E)}),y?a.jsxs(a.Fragment,{children:[a.jsx("label",{className:"field",htmlFor:"mcp-command",children:"Команда с аргументами"}),a.jsx("input",{id:"mcp-command",className:"input input--mono",value:h,spellCheck:!1,autoComplete:"off",placeholder:"npx -y @upstash/context7-mcp",onChange:E=>p(E.target.value)})]}):a.jsxs(a.Fragment,{children:[a.jsx("label",{className:"field",htmlFor:"mcp-url",children:"URL"}),a.jsx("input",{id:"mcp-url",className:"input input--mono",value:g,spellCheck:!1,autoComplete:"off",placeholder:"https://mcp.example.dev/mcp",onChange:E=>x(E.target.value)})]}),a.jsxs("label",{className:"field",htmlFor:"mcp-pairs",children:[y?"Переменные окружения":"Заголовки"," — по одной на строку, необязательно"]}),a.jsx("textarea",{id:"mcp-pairs",className:"input input--mono input--area",value:v,spellCheck:!1,placeholder:y?"API_KEY=xxx":"Authorization: Bearer xxx",onChange:E=>j(E.target.value)}),a.jsxs("div",{className:"extbar",children:[a.jsx("button",{className:"btn",onClick:l,children:"Отмена"}),a.jsx("button",{className:"btn btn--primary",disabled:!T,onClick:N,children:"Подключить"})]})]})}function t_(n){const l={};for(const r of n.split(`
131
+ `)){const c=r.trim();if(!c)continue;const o=c.indexOf("="),u=c.indexOf(":"),h=o===-1?u:u===-1?o:Math.min(o,u);h<=0||(l[c.slice(0,h).trim()]=c.slice(h+1).trim())}return l}function nS(n){return(n.trim().match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(l=>l.replace(/^["']|["']$/g,""))}function sS({plugins:n,marketplaces:l,actions:r}){const[c,o]=b.useState("");return a.jsxs(a.Fragment,{children:[n.length===0&&a.jsx("p",{className:"modal__text",children:"Ни одного установленного плагина. Что можно поставить — на вкладке «Каталог»."}),a.jsx("ul",{className:"extlist",children:n.map(u=>a.jsxs("li",{className:"extlist__row",children:[a.jsxs("div",{className:"extlist__head",children:[a.jsx("span",{className:"extlist__name",children:u.name}),a.jsx("span",{className:u.enabled?"chip chip--ok":"chip chip--mute",children:u.enabled?"включён":"выключен"}),u.version&&u.version!=="unknown"&&a.jsx("span",{className:"chip",children:u.version}),u.scope&&a.jsx("span",{className:"chip",children:u.scope})]}),u.marketplace&&a.jsx("div",{className:"extlist__meta",children:u.marketplace}),u.mcpServers.length>0&&a.jsxs("div",{className:"extlist__meta",children:["MCP-серверы: ",u.mcpServers.join(", ")]}),a.jsxs("div",{className:"extlist__actions",children:[a.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>r.pluginToggle(u.id,!u.enabled),children:u.enabled?"Выключить":"Включить"}),a.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.pluginUninstall(u.id),children:"Удалить"})]})]},u.id))}),a.jsx("div",{className:"sidebar__section",children:"Маркетплейсы"}),a.jsx("ul",{className:"extlist",children:l.map(u=>a.jsxs("li",{className:"extlist__row",children:[a.jsx("div",{className:"extlist__head",children:a.jsx("span",{className:"extlist__name",children:u.name})}),u.source&&a.jsx("div",{className:"extlist__meta",children:u.source}),a.jsx("div",{className:"extlist__actions",children:a.jsx("button",{className:"btn btn--ghost btn--sm btn--danger",onClick:()=>r.marketplaceRemove(u.name),children:"Отключить"})})]},u.name))}),a.jsxs("div",{className:"extform__row",children:[a.jsx("input",{className:"input input--mono",value:c,spellCheck:!1,autoComplete:"off","aria-label":"Источник маркетплейса",placeholder:"owner/repo, URL или путь",onChange:u=>o(u.target.value),onKeyDown:u=>{u.key!=="Enter"||c.trim()===""||(u.preventDefault(),r.marketplaceAdd(c.trim()),o(""))}}),a.jsx("button",{className:"btn",disabled:c.trim()==="",onClick:()=>{r.marketplaceAdd(c.trim()),o("")},children:"Добавить"})]})]})}const tu=30;function lS({catalog:n,hasMarketplaces:l,actions:r,onMarketplaces:c}){const[o,u]=b.useState(""),[h,p]=b.useState(""),[g,x]=b.useState(tu),[v,j]=b.useState(""),y=b.useMemo(()=>[...new Set(n.map(E=>E.category).filter(Boolean))].sort(),[n]),T=b.useMemo(()=>{const N=o.trim().toLowerCase();return n.filter(E=>h&&E.category!==h?!1:N?`${E.name} ${E.displayName} ${E.description} ${E.author}`.toLowerCase().includes(N):!0)},[n,o,h]);return n.length===0?a.jsxs("p",{className:"modal__text",children:[l?"Маркетплейсы подключены, но их каталог ещё не выкачан. Попробуйте открыть окно ещё раз через минуту.":"Ни одного маркетплейса — ставить нечего."," ",a.jsx("button",{className:"linkish",onClick:c,children:"Подключить маркетплейс"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"catalog__filters",children:[a.jsx("input",{className:"input",value:o,spellCheck:!1,autoComplete:"off","aria-label":"Поиск по каталогу",placeholder:"Поиск: имя, описание, автор",onChange:N=>{u(N.target.value),x(tu)}}),a.jsx(_l,{title:"Категория",value:h,options:[{value:"",label:"все категории"},...y.map(N=>({value:N,label:N}))],onChange:N=>{p(N),x(tu)}})]}),T.length===0?a.jsx("p",{className:"modal__text",children:"Ничего не нашлось."}):a.jsx("ul",{className:"extlist",children:T.slice(0,g).map(N=>a.jsxs("li",{className:"extlist__row",children:[a.jsxs("div",{className:"extlist__head",children:[a.jsx("span",{className:"extlist__name",children:N.name}),N.installed&&a.jsx("span",{className:"chip chip--ok",children:"установлен"}),N.version&&a.jsx("span",{className:"chip",children:N.version}),N.category&&a.jsx("span",{className:"chip",children:N.category})]}),N.description&&a.jsx("div",{className:"catalog__desc",children:N.description}),a.jsxs("div",{className:"extlist__meta",children:[N.author&&`${N.author} · `,N.marketplace]}),a.jsxs("div",{className:"extlist__actions",children:[a.jsx("button",{className:"btn btn--ghost btn--sm",disabled:N.installed,onClick:()=>r.pluginInstall(N.id),children:N.installed?"Уже стоит":"Установить"}),N.homepage&&a.jsx("a",{className:"btn btn--ghost btn--sm",href:N.homepage,target:"_blank",rel:"noreferrer",children:"Страница"})]})]},N.id))}),T.length>g&&a.jsx("div",{className:"extbar",children:a.jsxs("button",{className:"btn",onClick:()=>x(N=>N+tu),children:["Ещё ",Math.min(tu,T.length-g)," из ",T.length-g]})}),a.jsxs("div",{className:"extform",children:[a.jsx("label",{className:"field",htmlFor:"plugin-spec",children:"Или установить по имени — если нужного в каталоге нет"}),a.jsxs("div",{className:"extform__row",children:[a.jsx("input",{id:"plugin-spec",className:"input input--mono",value:v,spellCheck:!1,autoComplete:"off",placeholder:"имя или имя@маркетплейс",onChange:N=>j(N.target.value),onKeyDown:N=>{N.key!=="Enter"||v.trim()===""||(N.preventDefault(),r.pluginInstall(v.trim()),j(""))}}),a.jsx("button",{className:"btn",disabled:v.trim()==="",onClick:()=>{r.pluginInstall(v.trim()),j("")},children:"Установить"})]})]})]})}function aS({status:n,login:l,actions:r,remote:c,runningSessions:o,onReconnect:u,reconnectBlocked:h,reconnectHint:p,onClose:g}){const[x,v]=b.useState(""),[j,y]=b.useState(!1),[T,N]=b.useState(!1),E=u!==null&&(n==null?void 0:n.loggedIn)===!0&&!T&&!j,A=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 D(Q=x){const z=Q.trim();z!==""&&(r.submitCode(z),v(""))}function q(){if(o>0){y(!1),N(!0);return}r.login("claudeai",!0)}return a.jsxs(rs,{title:"Аккаунт",onClose:g,children:[n===null?a.jsx("p",{className:"modal__text",children:"Спрашиваем у хоста…"}):n.loggedIn?a.jsxs("div",{className:"account",children:[a.jsx("div",{className:"account__id",children:n.email||"Вход выполнен"}),a.jsxs("div",{className:"account__chips",children:[a.jsx("span",{className:"chip chip--ok",children:cS[n.method]??n.method}),n.plan&&a.jsx("span",{className:"chip",children:n.plan})]}),n.organization&&a.jsx("div",{className:"extlist__meta",children:n.organization})]}):a.jsxs("p",{className:"modal__text",children:["Вход не выполнен. Сессии не запустятся, пока аккаунт не подключён — или пока в окружении хоста нет ",a.jsx("code",{children:"ANTHROPIC_API_KEY"}),"."]}),l.active?a.jsx(oS,{login:l,remote:c,code:x,onCode:v,onSubmit:D,onCancel:r.cancel}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{result:A}),T&&a.jsx("p",{className:"account__warn",role:"alert",children:iS(o)}),E&&h&&a.jsx("p",{className:"account__note",children:p}),a.jsx("div",{className:`extbar${n!=null&&n.loggedIn?" account__bar":""}`,children:n!=null&&n.loggedIn?a.jsxs(a.Fragment,{children:[E&&a.jsxs("button",{type:"button",className:"btn account__relink",title:`Переподключить сессию
132
+ ${p}`,"aria-label":"Переподключить сессию",disabled:h,onClick:u,children:[a.jsx(rS,{}),"Переподключить"]}),T?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>N(!1),children:"Отмена"}),a.jsx("button",{className:"btn btn--warn",autoFocus:!0,onClick:()=>{N(!1),r.login("claudeai",!0)},children:"Всё равно сменить"})]}):a.jsx("button",{className:"btn",onClick:q,children:"Сменить аккаунт"}),j?a.jsx("button",{className:"btn btn--danger",autoFocus:!0,onClick:()=>{y(!1),r.logout()},children:"Точно выйти?"}):a.jsx("button",{className:"btn",onClick:()=>{N(!1),y(!0)},children:"Выйти"})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>r.login("console",!1),children:"Через Console"}),a.jsx("button",{className:"btn btn--primary",onClick:()=>r.login("claudeai",!1),children:"Войти"})]})})]})]})}function iS(n){const l=n%10,r=n%100,c=l===1&&r!==11,o=c?"сессия":l>=2&&l<=4&&(r<12||r>14)?"сессии":"сессий";return`${n} ${o} сейчас ${c?"работает":"работают"} — смена аккаунта может ${c?"её":"их"} прервать.`}function rS(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),a.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const cS={"claude.ai":"подписка Claude",console:"Anthropic Console",apiKey:"API-ключ",none:"нет"};function oS({login:n,remote:l,code:r,onCode:c,onSubmit:o,onCancel:u}){var N;const[h,p]=b.useState(null),g=b.useRef(""),x=b.useRef({code:r,onCode:c,onSubmit:o});x.current={code:r,onCode:c,onSubmit:o};const v=b.useCallback(async E=>{const{code:A,onCode:D,onSubmit:q}=x.current;if(E&&A.trim()!=="")return;const Q=await Sp();if(Q===null){E||p("Не получилось прочитать буфер — вставьте код в поле руками.");return}const z=Q.trim();if(!n_(z)){E||p("В буфере не похоже на код: нужен он целиком, вместе с частью после «#». Подойдёт и адрес страницы, на которую увёл браузер, — его тоже разберём.");return}if(E){if(g.current===z)return;g.current=z}p(null),D(z),q(z)},[]);b.useEffect(()=>{if(!n.awaitingCode)return;const E=()=>{document.visibilityState==="visible"&&v(!0)};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[n.awaitingCode,v]);const j=typeof((N=navigator.clipboard)==null?void 0:N.readText)=="function",y=r.trim()!==""&&!n_(r),T=h??(y?"Похоже, скопирована только часть кода — нужен он целиком, вместе с частью после «#».":null);return a.jsxs("div",{className:"account__flow",children:[n.url?l?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"field",children:"Подтвердите вход на странице Anthropic"}),a.jsx("a",{className:"btn btn--primary account__go",href:n.url,target:"_blank",rel:"noreferrer",children:"Открыть страницу входа"}),a.jsx("p",{className:"account__step",children:"После кнопки «Authorize» там появится код — скопируйте его и вернитесь сюда."}),a.jsxs("div",{className:"account__raw",children:[a.jsx("span",{className:"account__rawurl",children:n.url}),a.jsx(Kc,{text:n.url,hint:"ссылку входа"})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"field",children:"Подтвердите вход в открывшемся браузере"}),a.jsx("p",{className:"account__step",children:"Хост открыл страницу входа на этом же компьютере — там достаточно нажать «Authorize», остальное произойдёт само."}),a.jsxs("details",{className:"account__fallback",children:[a.jsx("summary",{children:"Браузер не открылся"}),a.jsx("p",{className:"account__step",children:"Тогда откройте ссылку сами: страница покажет код, и его нужно будет вставить ниже."}),a.jsx("a",{className:"account__link",href:n.url,target:"_blank",rel:"noreferrer",children:n.url})]})]}):a.jsx("p",{className:"modal__text",children:"Запускаем вход…"}),n.awaitingCode&&a.jsxs(a.Fragment,{children:[a.jsx("label",{className:"field",htmlFor:"auth-code",children:"Код со страницы авторизации"}),a.jsxs("div",{className:"extform__row account__coderow",children:[a.jsx("input",{id:"auth-code",className:"input input--mono",value:r,autoFocus:!l,spellCheck:!1,autoComplete:"off",placeholder:"код#state",onChange:E=>{p(null),c(E.target.value)},onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),o())}}),j&&a.jsx("button",{type:"button",className:"btn",onClick:()=>void v(!1),children:"Вставить код"}),a.jsx("button",{type:"button",className:"btn btn--primary",disabled:r.trim()==="",onClick:()=>o(),children:"Готово"})]}),T&&a.jsx("p",{className:"account__note account__note--code",children:T})]}),n.output.trim()!==""&&a.jsx("pre",{className:"account__log",children:n.output.trim()}),a.jsx("div",{className:"extbar",children:a.jsx("button",{className:"btn",onClick:u,children:"Отменить вход"})})]})}function n_(n){const l=n.trim();if(/^https?:\/\//i.test(l))return/[?#&]code=/.test(l);const[r,c]=l.split("#");return!!r&&!!c&&!/\s/.test(l)}function uS({state:n,onPair:l,onUnpair:r,onClose:c}){const[o,u]=b.useState(""),[h,p]=b.useState(""),[g,x]=b.useState(!1),v=b.useRef(null),j=(n==null?void 0:n.paired)===!0;b.useEffect(()=>{var T;j||(T=v.current)==null||T.focus()},[j]),b.useEffect(()=>{x(!1),j&&u("")},[j,n==null?void 0:n.error]);const y=(n==null?void 0:n.url)??"https://claudevisual.com";return a.jsx(rs,{title:"Удалённый доступ",onClose:c,children:j?a.jsxs("div",{className:"relay",children:[a.jsxs("p",{className:"relay__lede",children:["Компьютер связан с аккаунтом на ",a.jsx("b",{children:s_(y)}),". Открывайте его оттуда с любого устройства — с телефона в том числе."]}),a.jsxs("dl",{className:"relay__facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"Имя"}),a.jsx("dd",{children:(n==null?void 0:n.name)??"—"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Связь"}),a.jsxs("dd",{children:[a.jsx("span",{className:n!=null&&n.connected?"dot dot--on":"dot"})," ",n!=null&&n.connected?"на связи":"нет связи, пробуем переподключиться"]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Подключено"}),a.jsxs("dd",{children:[(n==null?void 0:n.clients)??0," вкладок"]})]})]}),(n==null?void 0:n.error)&&a.jsx("p",{className:"relay__error",children:n.error}),a.jsx("p",{className:"relay__note",children:"Терминал с удалённых устройств настраивается в настройках приложения, раздел «Терминал»."}),a.jsx("p",{className:"relay__note",children:"Отвязка гасит токен этой машины: чтобы вернуть доступ, понадобится новый код. Сессии Claude Code это не трогает."}),a.jsx("button",{className:"btn btn--danger",onClick:r,children:"Отвязать компьютер"})]}):a.jsxs("div",{className:"relay",children:[a.jsx("p",{className:"relay__lede",children:"Чтобы работать с этим компьютером из браузера и с телефона, свяжите его с аккаунтом."}),a.jsxs("ol",{className:"relay__steps",children:[a.jsxs("li",{children:["Откройте ",a.jsx("b",{children:s_(y)})," и войдите (или зарегистрируйтесь)."]}),a.jsxs("li",{children:["Нажмите ",a.jsx("b",{children:"«Подключить ПК»"})," — появится код из восьми знаков."]}),a.jsx("li",{children:"Введите его сюда."})]}),a.jsxs("form",{className:"relay__form",onSubmit:T=>{T.preventDefault(),o.trim()&&(x(!0),l(o.trim(),h.trim()))},children:[a.jsxs("label",{className:"field",children:[a.jsx("span",{children:"Код сопряжения"}),a.jsx("input",{ref:v,className:"input relay__code",value:o,onChange:T=>u(T.target.value.toUpperCase()),placeholder:"XXXX-XXXX",autoComplete:"off",spellCheck:!1,maxLength:12})]}),a.jsxs("label",{className:"field",children:[a.jsx("span",{children:"Как назвать этот компьютер"}),a.jsx("input",{className:"input",value:h,onChange:T=>p(T.target.value),placeholder:"имя машины",autoComplete:"off",maxLength:64})]}),(n==null?void 0:n.error)&&a.jsx("p",{className:"relay__error",children:n.error}),a.jsx("button",{className:"btn btn--primary",type:"submit",disabled:!o.trim()||g,children:g?"Связываем…":"Связать"})]})]})})}function s_(n){try{return new URL(n).host}catch{return n}}const l_=[{id:"codex",label:"Codex",hint:"OpenAI Codex CLI · вход через /login или codex login"},{id:"claude",label:"Claude",hint:"Claude Code"},{id:"antigravity",label:"Antigravity",hint:"Google agy"}],dp="",dS=[{value:"opus",label:"Opus",hint:"полный список моделей виден, когда открыта сессия"},{value:"sonnet",label:"Sonnet",hint:"полный список моделей виден, когда открыта сессия"},{value:"haiku",label:"Haiku",hint:"полный список моделей виден, когда открыта сессия"}],fS=E_.map(n=>({value:n.value,label:n.value,hint:n.hint})),Yd=3600*1e3,hS=[{value:"6h",label:"6 часов"},{value:"24h",label:"Сутки"},{value:"48h",label:"Двое суток"},{value:"168h",label:"Неделя"},{value:"never",label:"Никогда"}],Oc={"6h":6*Yd,"24h":24*Yd,"48h":48*Yd,"168h":168*Yd,never:0};function pS(n){return Oc[n]??Oc["48h"]}const mS=[{value:"5m",label:"5 минут"},{value:"10m",label:"10 минут"},{value:"30m",label:"30 минут"},{value:"60m",label:"Час"},{value:"never",label:"Никогда"}],Vd=60*1e3,Lc={"5m":5*Vd,"10m":10*Vd,"30m":30*Vd,"60m":60*Vd,never:0};function gS(n){return Lc[n]??Lc["10m"]}function xS(n){const l=Object.entries(Lc).find(([,r])=>r===n);return l?l[0]:Object.keys(Lc).reduce((r,c)=>Math.abs(Lc[c]-n)<Math.abs(Lc[r]-n)?c:r)}function bS(n){const l=Object.entries(Oc).find(([,r])=>r===n);return l?l[0]:Object.keys(Oc).reduce((r,c)=>Math.abs(Oc[c]-n)<Math.abs(Oc[r]-n)?c:r)}const _S=[{value:"off",label:"Выключено"},{value:"500",label:"0.5 с"},{value:"1500",label:"1.5 с"},{value:"3000",label:"3 с"},{value:"10000",label:"10 с"}],zc={off:0,500:500,1500:1500,3e3:3e3,1e4:1e4};function yS(n){return zc[n]??zc.off}function a_(n){return Number.isFinite(n)?Math.min(100,Math.max(0,Math.round(n))):0}function vS(n){const l=Object.entries(zc).find(([,r])=>r===n);return l?l[0]:Object.keys(zc).reduce((r,c)=>Math.abs(zc[c]-n)<Math.abs(zc[r]-n)?c:r)}const jS=[{value:"project",title:"Только текущий проект",description:"Агент молча пишет файлы в открытом проекте и в ~/.claude — настройках самого Claude Code. Чужой проект и любая новая папка — только с явного разрешения."},{value:"projects",title:"Папка с проектами",description:"То же плюс каталог, где лежат открытые проекты, — то есть и соседний проект тоже. Всё остальное — с разрешения."},{value:"all",title:"Все папки на компьютере",description:"Агент пишет файлы куда угодно на диске — вопросов про место записи не будет.",risky:!0}];function wS({themeMode:n,onThemeChange:l,settings:r,models:c,relayState:o,networkState:u,local:h,onChange:p,onEnableShell:g,onDisableShell:x,onOpenRelay:v,onClose:j}){const y=r===null,[T,N]=b.useState(""),[E,A]=b.useState(null),D=!y&&r.networkGuardEnabled,q=(r==null?void 0:r.networkGuardBlockedCountries)??[];function Q(){const R=T.trim().toUpperCase();if(R!==""){if(!/^[A-Z]{2}$/.test(R)){A("Нужен код из двух латинских букв, например RU или CN.");return}if(q.includes(R)){A(`Код ${R} уже в списке.`);return}A(null),N(""),p({networkGuardBlockedCountries:[...q,R]})}}const z=!y&&r.terminalEnabled===!0,U=!y&&r.liveSessionsFirst===!0,O=!z,I=b.useMemo(()=>{const R=[{value:dp,label:"Как в Claude Code",hint:"модель определят настройки самого Claude Code"},...c.length>0?c.map(L=>({value:L.value,label:L.displayName,hint:L.description})):dS];return r&&r.startModel!==null&&!R.some(L=>L.value===r.startModel)&&R.push({value:r.startModel,label:r.startModel}),R},[c,r]);function V(){var R,L;return(o==null?void 0:o.paired)!==!0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"settings__hint",children:"Компьютер не связан с аккаунтом — включать удалённый доступ пока не к чему: без пары ни телефон, ни другое устройство этот компьютер вообще не видят."}),a.jsx("button",{type:"button",className:"btn",disabled:O,onClick:v,children:"Связать компьютер"})]}):(R=o.shell)!=null&&R.enabled?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"settings__hint",children:["Разрешён: с телефона и любого другого устройства этого аккаунта можно открыть терминал и выполнить на этом компьютере что угодно — как если бы сидели за ним.",o.shell.confirmedAt&&` Включено ${new Date(o.shell.confirmedAt).toLocaleString()}.`]}),a.jsx("button",{type:"button",className:"btn btn--danger",disabled:O,onClick:x,children:"Запретить"})]}):(L=o.shell)!=null&&L.pending?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"settings__hint",children:["Письмо ушло на ",a.jsx("b",{children:o.shell.email}),". Перейдите по ссылке из него — терминал заработает удалённо."]}),a.jsx("p",{className:"settings__hint",children:"Повторная отправка ограничена раз в минуту — если жали кнопку только что, письмо не придёт и от повторного нажатия тоже. Если сейчас доберётесь до самого компьютера, там разрешение включится сразу, без письма."}),a.jsx("button",{type:"button",className:"btn",disabled:O,onClick:g,children:"Отправить письмо ещё раз"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"settings__hint",children:"Сейчас с телефона можно смотреть разговоры и файлы, но не запускать команды. Разрешение даёт полный доступ к терминалу этого компьютера: с телефона станет можно выполнить любую команду, как в обычной консоли за этой машиной."}),h?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"settings__hint",children:"Включится сразу — вы уже за этим компьютером, подтверждать доступ к нему нечем и незачем."}),a.jsx("button",{type:"button",className:"btn",disabled:O,onClick:g,children:"Разрешить с телефона"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"settings__hint",children:"Отсюда мгновенно не включится: на почту аккаунта уйдёт письмо, и терминал заработает только после перехода по ссылке из него."}),a.jsx("button",{type:"button",className:"btn",disabled:O,onClick:g,children:"Прислать письмо"})]})]})}return a.jsx(rs,{title:"Настройки",onClose:j,children:a.jsxs("div",{className:"settings",children:[a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Тема оформления"}),a.jsx("p",{className:"settings__hint",children:"Свет и тьма — два состояния одного пространства. Оформление одинаково для всех подключённых агентов."}),a.jsx(_l,{title:"Тема оформления",value:n,options:[{value:"system",label:"Ритм системы",hint:"следовать настройке вашего устройства"},{value:"light",label:"Свет",hint:"молочные поверхности и мягкие тени"},{value:"dark",label:"Тьма",hint:"графит, светящиеся орбиты и глубокие тени"}],onChange:R=>l(R)})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Архивация молчащих сессий"}),a.jsx("p",{className:"settings__hint",children:"Сессия, к которой долго не возвращались, сама уезжает в архив — на диске ничего не удаляется, транскрипт остаётся, и её можно вернуть обратно в любой момент."}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsx(_l,{className:"settings__select",value:bS(r.autoArchiveAfterMs),options:hS,onChange:R=>p({autoArchiveAfterMs:pS(R)}),ariaLabel:"Через сколько молчащая сессия уезжает в архив"})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Останавливать простаивающие сессии через"}),a.jsx("p",{className:"settings__hint",children:"Простаивающая живая сессия сама отпускает процесс CLI — освобождает память компьютера, на котором стоит хост. Простой — это когда сессия ничего не делает (не работает, не ждёт разрешения, фоновых задач нет), в ней ничего не происходит и ни в одном открытом окне не висит недописанный черновик для неё. Разговор при этом никуда не девается: открытая заново сессия, как и отправленное в неё сообщение, продолжают с того же места."}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsx(_l,{className:"settings__select",value:xS(r.autoStopAfterMs),options:mS,onChange:R=>p({autoStopAfterMs:gS(R)}),ariaLabel:"Останавливать простаивающие сессии через"})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Остановка у лимита плана"}),a.jsx("p",{className:"settings__hint",children:"Когда расход окна лимита доходит до этого порога, хост прерывает все живые сессии Claude, сохраняет хэндофф у занятых и останавливает их — разговор остаётся на диске, а хэндофф показывается баннером в открытой сессии. Antigravity эта настройка не касается."}),a.jsxs("div",{className:"settings__field",children:[a.jsx("span",{className:"settings__field-label",children:"Остановка у 5-часового лимита, %"}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsxs("div",{className:"settings__pct",children:[a.jsx("input",{type:"number",className:"input settings__pct-input",min:0,max:100,step:1,value:r.limitStopFiveHourPct,onChange:R=>p({limitStopFiveHourPct:a_(R.target.valueAsNumber)}),"aria-label":"Остановка у 5-часового лимита, %"}),a.jsx("span",{className:"settings__pct-suffix",children:"%"})]}),a.jsx("p",{className:"settings__hint",children:"0 — не останавливать."})]}),a.jsxs("div",{className:"settings__field",children:[a.jsx("span",{className:"settings__field-label",children:"Остановка у недельного лимита, %"}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsxs("div",{className:"settings__pct",children:[a.jsx("input",{type:"number",className:"input settings__pct-input",min:0,max:100,step:1,value:r.limitStopSevenDayPct,onChange:R=>p({limitStopSevenDayPct:a_(R.target.valueAsNumber)}),"aria-label":"Остановка у недельного лимита, %"}),a.jsx("span",{className:"settings__pct-suffix",children:"%"})]}),a.jsx("p",{className:"settings__hint",children:"0 — не останавливать."})]})]}),a.jsxs("section",{className:"settings__section",children:[a.jsxs("div",{className:"settings__switch-row",children:[a.jsxs("div",{className:"settings__switch-copy",children:[a.jsx("h3",{className:"settings__heading",children:"Kill switch: останавливать агентов, если упал VPN"}),a.jsx("p",{className:"settings__hint",children:"Если VPN отключился, ccv сразу останавливает всех агентов и не даёт отправлять сообщения, пока VPN не вернётся. Как определяем: смотрим, из какой страны Anthropic видит запросы — страна из списка ниже или неудачная проверка считаются падением VPN. Сессии остаются открытыми и продолжатся после возврата VPN. Kill switch самого VPN-клиента это не заменяет — его тоже стоит включить."})]}),y?a.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):a.jsx("button",{type:"button",role:"switch","aria-checked":D,"aria-label":"Kill switch: останавливать агентов, если упал VPN",className:D?"switch is-on":"switch",onClick:()=>p({networkGuardEnabled:!D}),children:a.jsx("span",{className:"switch__knob"})})]}),D&&u&&a.jsx("p",{className:u.status==="blocked"?"settings__hint settings__netstatus is-bad":"settings__hint settings__netstatus",children:u.status==="blocked"?u.reason??"Маршрут не прошёл проверку.":u.country?`Сейчас: ${u.country} — всё в порядке.`:"Сейчас всё в порядке."}),a.jsxs("div",{className:D?"settings__field":"settings__field settings__nested is-disabled",children:[a.jsx("span",{className:"settings__field-label",children:"Запрещённые страны"}),a.jsxs("ul",{className:"countries","aria-label":"Запрещённые страны",children:[q.map(R=>a.jsxs("li",{className:"countries__chip",children:[a.jsx("span",{children:R}),a.jsx("button",{type:"button",className:"countries__remove","aria-label":`Убрать ${R} из списка`,disabled:!D,onClick:()=>p({networkGuardBlockedCountries:q.filter(L=>L!==R)}),children:"×"})]},R)),q.length===0&&a.jsx("li",{className:"settings__hint",children:"Список пуст: блокировать будет только сбой проверки."})]}),a.jsxs("form",{className:"countries__add",onSubmit:R=>{R.preventDefault(),Q()},children:[a.jsx("input",{type:"text",className:"input countries__input",value:T,maxLength:2,placeholder:"RU",autoCapitalize:"characters",spellCheck:!1,disabled:!D,"aria-label":"Код страны, две буквы","aria-invalid":E!==null,onChange:R=>{N(R.target.value.toUpperCase()),A(null)}}),a.jsx("button",{type:"submit",className:"btn",disabled:!D||T.trim()==="",children:"Добавить"})]}),E&&a.jsx("p",{className:"settings__hint countries__error",role:"alert",children:E})]})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Автосохранение"}),a.jsx("p",{className:"settings__hint",children:"Открытый файл сам уезжает на диск, если немного постоять без ввода — ручное сохранение, кнопкой или Ctrl+S, при этом всегда работает как обычно, независимо от этой настройки."}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsx(_l,{className:"settings__select",value:vS(r.autoSaveAfterPauseMs),options:_S,onChange:R=>p({autoSaveAfterPauseMs:yS(R)}),ariaLabel:"Пауза перед автосохранением открытого файла"})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Агенты"}),a.jsx("p",{className:"settings__hint",children:"Выключенный агент не предлагается при создании новой сессии. Уже открытые сессии с ним продолжают работать."}),l_.map(R=>{const L=(r==null?void 0:r.enabledProviders)??["claude","antigravity","codex"],G=!y&&L.includes(R.id),se=G&&L.length<=1;return a.jsxs("div",{className:"settings__switch-row settings__agent",children:[a.jsx("span",{className:`newsession__mark newsession__mark--${R.id}`,"aria-hidden":"true",children:R.id==="codex"?a.jsx("span",{className:"codex-mark",children:"C"}):R.id==="antigravity"?a.jsx(Xp,{className:"newsession__mark-logo"}):a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"var(--accent)"})})}),a.jsxs("div",{className:"settings__switch-copy settings__agent-copy",children:[a.jsx("span",{className:"settings__field-label",children:R.label}),a.jsx("span",{className:"settings__hint",children:se?"Хотя бы один агент должен остаться включённым":R.hint})]}),y?a.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):a.jsx("button",{type:"button",role:"switch","aria-checked":G,"aria-label":R.label,disabled:se,title:se?"Хотя бы один агент должен остаться включённым":void 0,className:G?"switch is-on":"switch",onClick:()=>{const ve=l_.map(je=>je.id).filter(je=>je===R.id?!G:L.includes(je));p({enabledProviders:ve})},children:a.jsx("span",{className:"switch__knob"})})]},R.id)})]}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Старт новой сессии"}),a.jsx("p",{className:"settings__hint",children:"Модель и режим прав, с которыми поднимается новая сессия. Уже открытую это не меняет — у неё свои переключатели в шапке."}),a.jsxs("div",{className:"settings__field",children:[a.jsx("span",{className:"settings__field-label",children:"Модель"}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsx(_l,{className:"settings__select",value:r.startModel??dp,options:I,onChange:R=>p({startModel:R===dp?null:R}),ariaLabel:"Модель, с которой поднимается новая сессия"})]}),a.jsxs("div",{className:"settings__field",children:[a.jsx("span",{className:"settings__field-label",children:"Режим прав при старте"}),y?a.jsx("div",{className:"settings__select-skeleton","aria-hidden":"true",children:"Загрузка…"}):a.jsx(_l,{className:"settings__select",value:r.startPermissionMode,options:fS,onChange:R=>p({startPermissionMode:R}),ariaLabel:"Режим прав, с которым поднимается новая сессия"})]})]}),a.jsx("section",{className:"settings__section",children:a.jsxs("div",{className:"settings__switch-row",children:[a.jsxs("div",{className:"settings__switch-copy",children:[a.jsx("h3",{className:"settings__heading",children:"Запущенные сессии сверху"}),a.jsx("p",{className:"settings__hint",children:"Сессии, поднятые в хосте прямо сейчас — работают, готовы, ждут разрешения, работают в фоне, переподключаются, — показываются выше остальных в списке сессий проекта и в панели закреплённых. Порядок внутри каждой из двух частей остаётся тем, что задан руками."})]}),y?a.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):a.jsx("button",{type:"button",role:"switch","aria-checked":U,"aria-label":"Запущенные сессии сверху",className:U?"switch is-on":"switch",onClick:()=>p({liveSessionsFirst:!U}),children:a.jsx("span",{className:"switch__knob"})})]})}),a.jsxs("section",{className:"settings__section",children:[a.jsx("h3",{className:"settings__heading",children:"Доступ к папкам"}),a.jsx("p",{className:"settings__hint",children:"Это про то, где агент пишет файлы (Write, Edit, NotebookEdit), не спрашивая разрешения, — не про чтение: читает он в любом случае. Ничего не запрещается наглухо — выход за выбранную границу просто превращается в обычный запрос прав, который остаётся подтвердить или отклонить."}),a.jsx("div",{className:"access",role:"radiogroup","aria-label":"Доступ к папкам",children:jS.map(R=>{const L=!y&&r.folderAccess===R.value;return a.jsxs("button",{type:"button",role:"radio","aria-checked":L,disabled:y,className:"access__card"+(L?" is-on":"")+(R.risky?" access__card--risky":""),onClick:()=>p({folderAccess:R.value}),children:[a.jsx("span",{className:"access__radio","aria-hidden":"true"}),a.jsxs("span",{className:"access__body",children:[a.jsxs("span",{className:"access__title",children:[R.title,R.risky&&a.jsx("span",{className:"access__risk",children:"самое широкое"})]}),a.jsx("span",{className:"access__desc",children:R.description})]})]},R.value)})})]}),a.jsxs("section",{className:"settings__section",children:[a.jsxs("div",{className:"settings__switch-row",children:[a.jsxs("div",{className:"settings__switch-copy",children:[a.jsx("h3",{className:"settings__heading",children:"Терминал"}),a.jsx("p",{className:"settings__hint",children:"Панель терминала под лентой разговора: команда, которую там набрали, выполняется прямо на этом компьютере с правами вашего пользователя — не в песочнице агента, как Bash-инструмент в разговоре. Выключите — и все открытые вкладки терминала закроются, а процессы в них не переживут закрытия."})]}),y?a.jsx("div",{className:"settings__switch-skeleton","aria-hidden":"true"}):a.jsx("button",{type:"button",role:"switch","aria-checked":z,"aria-label":"Терминал",className:z?"switch is-on":"switch",onClick:()=>p({terminalEnabled:!z}),children:a.jsx("span",{className:"switch__knob"})})]}),a.jsxs("div",{className:"settings__nested"+(O?" is-disabled":""),children:[a.jsx("h4",{className:"settings__nested-heading",children:"Удалённый доступ к терминалу"}),y?a.jsx("p",{className:"settings__hint",children:"Загрузка…"}):a.jsxs(a.Fragment,{children:[O&&a.jsx("p",{className:"settings__hint",children:"Сначала включите терминал выше — удалённый доступ выдаётся к тому, что на этой машине уже разрешено, а не поверх выключенного рубильника."}),V()]})]})]})]})})}const i_={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"};function NS(n){if(!n)return"срок неизвестен";const l=new Date(n);return Number.isNaN(l.getTime())?"срок неизвестен":l.toLocaleString()}function kS({handoff:n,onContinue:l,onShow:r,onDismiss:c}){if(n.continuedAt!==void 0){const o=n.limit===null?`Хэндофф записан вручную ${new Date(n.stoppedAt).toLocaleString()}`:`${i_[n.limit]} (${Math.round(n.utilization)} %) — работа прервана ${new Date(n.stoppedAt).toLocaleString()}`;return a.jsxs("div",{className:"handoff handoff--continued",role:"status",children:[a.jsxs("div",{className:"handoff__msg",children:[a.jsx("span",{className:"handoff__dot","aria-hidden":"true"}),a.jsxs("span",{children:[a.jsxs("span",{className:"handoff__continued",children:["Новая сессия из этого хэндоффа уже начата ",new Date(n.continuedAt).toLocaleString(),"."]})," ",o,".",n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),a.jsxs("div",{className:"handoff__actions",children:[a.jsx("button",{type:"button",className:"btn btn--sm",onClick:r,children:"Показать хэндофф"}),a.jsx("button",{type:"button",className:"btn btn--sm",onClick:c,children:"Скрыть"}),a.jsx("button",{type:"button",className:"btn btn--sm",onClick:l,children:"Продолжить ещё раз"})]})]})}return a.jsxs("div",{className:"handoff",role:"status",children:[a.jsxs("div",{className:"handoff__msg",children:[a.jsx("span",{className:"handoff__dot","aria-hidden":"true"}),a.jsxs("span",{children:[n.limit===null?a.jsxs(a.Fragment,{children:["Хэндофф записан вручную ",new Date(n.stoppedAt).toLocaleString()," — сессия остановлена."]}):a.jsxs(a.Fragment,{children:[i_[n.limit]," (",Math.round(n.utilization)," %) — работа прервана"," ",new Date(n.stoppedAt).toLocaleString(),". Окно сбросится: ",NS(n.resetsAt),"."]}),n.source==="journal"&&" Хэндофф собран автоматически из журнала."]})]}),a.jsxs("div",{className:"handoff__actions",children:[a.jsx("button",{type:"button",className:"btn btn--sm btn--primary",onClick:l,children:"Продолжить в новой сессии"}),a.jsx("button",{type:"button",className:"btn btn--sm",onClick:r,children:"Показать хэндофф"}),a.jsx("button",{type:"button",className:"btn btn--sm",onClick:c,children:"Скрыть"})]})]})}function SS({handoff:n,onClose:l}){const[r,c]=b.useState("");return b.useEffect(()=>{let o=!1;return ff(n.text).then(u=>{o||c(u)}),()=>{o=!0}},[n.text]),a.jsx(rs,{title:"Хэндофф",className:"modal--wide",onClose:l,children:a.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:r}})})}function ES({state:n}){return a.jsxs("div",{className:"netguard",role:"alert",children:[a.jsxs("svg",{className:"netguard__icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M8 1.8 14.2 13H1.8L8 1.8Z",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round"}),a.jsx("path",{d:"M8 6.4v3",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"11.2",r:"0.8",fill:"currentColor"})]}),a.jsxs("div",{className:"netguard__copy",children:[a.jsx("strong",{className:"netguard__reason",children:n.reason??"Не удалось убедиться, что запросы идут через VPN"}),a.jsx("span",{className:"netguard__note",children:"Запросы агента остановлены, отправка отключена. Когда VPN вернётся, сессии можно продолжить: следующее сообщение возобновит разговор."})]})]})}const rf={fiveHour:"5-часовой лимит",sevenDay:"недельный лимит"},TS=12e3;function CS(n){const l=n%10,r=n%100;return l===1&&r!==11?"сессии":"сессиях"}function AS({notices:n,onDismiss:l}){return n.length===0?null:a.jsx("div",{className:"limittoasts",children:n.map(r=>a.jsx(RS,{notice:r,onDismiss:()=>l(r.id)},r.id))})}function RS({notice:n,onDismiss:l}){return b.useEffect(()=>{const r=window.setTimeout(l,TS);return()=>window.clearTimeout(r)},[l]),a.jsxs("div",{className:"limittoast",role:"status",children:[a.jsx("span",{className:"limittoast__dot","aria-hidden":"true"}),a.jsx("span",{className:"limittoast__body",children:n.stopped>0?a.jsxs(a.Fragment,{children:["Достигнут ",rf[n.limit]," (",Math.round(n.utilization)," %): работа прервана в ",n.stopped," ",CS(n.stopped),", хэндоффов —"," ",n.handoffs,". Сессии остаются запущенными."]}):a.jsxs(a.Fragment,{children:["Достигнут ",rf[n.limit]," (",Math.round(n.utilization)," %): занятых сессий не было — ничего не прервано."]})}),a.jsx("button",{type:"button",className:"limittoast__dismiss","aria-label":"Закрыть уведомление",onClick:l,children:"✕"})]})}function MS(n,l,r=Date.now()){if(!n||!n.available||!l)return null;const c=[["fiveHour",n.fiveHour,l.limitStopFiveHourPct],["sevenDay",n.sevenDay,l.limitStopSevenDayPct]];for(const[o,u,h]of c){if(!u||h<=0||u.utilization<h)continue;const p=Date.parse(u.resetsAt);if(!(!Number.isFinite(p)||p<=r))return{limit:o,utilization:u.utilization,resetsAt:p}}return null}function DS(n,l=Date.now()){const r=new Date(n),c=r.toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"});return r.toDateString()===new Date(l).toDateString()?c:`${r.toLocaleDateString("ru-RU",{day:"numeric",month:"short"})}, ${c}`}const OS=16;function LS({pane:n,width:l,onResize:r,onReset:c}){const o=Cr[n],u=b.useRef(null);function h(v){if(v.button!==0)return;const j=document.querySelector(".main"),y=j?Math.max(0,j.getBoundingClientRect().width-xv):0;u.current={x:v.clientX,width:l,max:Math.min(o.max,l+y)},v.currentTarget.setPointerCapture(v.pointerId),document.body.classList.add("is-resizing"),v.preventDefault()}function p(v){const j=u.current;if(!j)return;const y=o.side==="left"?v.clientX-j.x:j.x-v.clientX;r(Math.min(j.max,j.width+y))}function g(v){u.current&&(u.current=null,v.currentTarget.hasPointerCapture(v.pointerId)&&v.currentTarget.releasePointerCapture(v.pointerId),document.body.classList.remove("is-resizing"))}function x(v){const j=v.key==="ArrowRight"?1:v.key==="ArrowLeft"?-1:0;j!==0&&(v.preventDefault(),r(l+j*OS*(o.side==="left"?1:-1)))}return a.jsx("div",{className:`pane-resizer pane-resizer--${n} pane-resizer--${o.side}`,role:"separator","aria-orientation":"vertical","aria-label":`Ширина панели ${o.label}`,"aria-valuenow":l,"aria-valuemin":o.min,"aria-valuemax":o.max,tabIndex:0,title:"Потяните, чтобы изменить ширину; двойной щелчок — ширина по умолчанию",onPointerDown:h,onPointerMove:p,onPointerUp:g,onPointerCancel:g,onDoubleClick:c,onKeyDown:x,children:a.jsx("span",{className:"pane-resizer__line","aria-hidden":"true"})})}const zS=16;function IS({height:n,onResize:l,onReset:r}){const c=b.useRef(null);function o(){const x=document.querySelector(".main .transcript, .main .editor");if(!x)return 1/0;const v=x.getBoundingClientRect().height-vv;return Math.round(n+Math.max(0,v))}function u(x){x.button===0&&(c.current={y:x.clientY,height:n,max:o()},x.currentTarget.setPointerCapture(x.pointerId),document.body.classList.add("is-resizing-row"),x.preventDefault())}function h(x){const v=c.current;if(!v)return;const j=v.y-x.clientY;l(v.height+j,v.max)}function p(x){c.current&&(c.current=null,x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId),document.body.classList.remove("is-resizing-row"))}function g(x){const v=x.key==="ArrowUp"?1:x.key==="ArrowDown"?-1:0;v!==0&&(x.preventDefault(),l(n+v*zS,o()))}return a.jsx("div",{className:"term-resizer",role:"separator","aria-orientation":"horizontal","aria-label":"Высота панели терминала","aria-valuenow":n,"aria-valuemin":A_,tabIndex:0,title:"Потяните, чтобы изменить высоту; двойной щелчок — высота по умолчанию",onPointerDown:u,onPointerMove:h,onPointerUp:p,onPointerCancel:p,onDoubleClick:r,onKeyDown:g,children:a.jsx("span",{className:"term-resizer__line","aria-hidden":"true"})})}function r_(){const n=document.documentElement,l=getComputedStyle(n),r=q=>l.getPropertyValue(q).trim(),c=r("--surface"),o=r("--text"),u=r("--text-2"),h=r("--muted"),p=r("--accent"),g=r("--accent-fg"),x=r("--select"),v=r("--danger"),j=r("--ok"),y=r("--warn"),T=r("--cm-fn"),N=r("--cm-key"),E=r("--cm-type"),A=c_(o,c,55),D=q=>c_(q,"#ffffff",25);return{background:c,foreground:o,cursor:p,cursorAccent:g,selectionBackground:x,black:A,brightBlack:h,red:v,brightRed:D(v),green:j,brightGreen:D(j),yellow:y,brightYellow:D(y),blue:T,brightBlue:D(T),magenta:N,brightMagenta:D(N),cyan:E,brightCyan:D(E),white:u,brightWhite:o}}function US(){return getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()}let ua=null;function HS(n){return ua||(ua=document.createElement("span"),ua.style.position="fixed",ua.style.width="0",ua.style.height="0",ua.style.opacity="0",ua.style.pointerEvents="none",document.body.appendChild(ua)),ua.style.color=n,getComputedStyle(ua).color}function c_(n,l,r){return HS(`color-mix(in srgb, ${n} ${100-r}%, ${l} ${r}%)`)}let Xd=null;function BS(){return Xd||(Xd=Promise.all([ct(()=>import("./xterm-D6Mng-DB.js").then(n=>n.x),__vite__mapDeps([22,23]),import.meta.url),ct(()=>import("./addon-fit-CevVMrUA.js").then(n=>n.a),__vite__mapDeps([24,23]),import.meta.url),ct(()=>import("./addon-web-links-CnB65OV_.js").then(n=>n.a),__vite__mapDeps([25,23]),import.meta.url),ct(()=>Promise.resolve({}),__vite__mapDeps([26]),import.meta.url)]).then(([n,l,r])=>({Terminal:n.Terminal,FitAddon:l.FitAddon,WebLinksAddon:r.WebLinksAddon})).catch(n=>{throw Xd=null,n})),Xd}function qS({terminals:n,activeId:l,blocked:r,error:c,onDismissError:o,height:u,offset:h,mobile:p=!1,zoomed:g,onToggleZoom:x,onSelect:v,onOpen:j,onClose:y,onInput:T,onResize:N,onAttach:E,onHide:A,registerSink:D}){const[q,Q]=b.useState(()=>r_());return b.useEffect(()=>{const z=new MutationObserver(()=>Q(r_()));return z.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>z.disconnect()},[]),a.jsxs("div",{className:"termpanel"+(p?" termpanel--mobile":"")+(!p&&g?" termpanel--zoomed":""),style:p?{height:u,top:(h==null?void 0:h.top)??0,left:(h==null?void 0:h.left)??0}:g?void 0:{height:u},children:[a.jsxs("div",{className:"termpanel__tabbar",onDoubleClick:z=>{x&&(z.target.closest("button")||x())},children:[a.jsx("div",{className:"termpanel__tabs",role:"tablist","aria-label":"Открытые терминалы",children:n.map(z=>a.jsxs("div",{role:"tab","aria-selected":z.id===l,className:"termtab"+(z.id===l?" is-on":"")+(z.exitCode!==null?" termtab--exited":""),onDoubleClick:U=>{x&&(U.target.closest(".termtab__close")||x())},children:[a.jsx("button",{className:"termtab__name",title:z.cwd,onClick:()=>v(z.id),children:z.title}),z.exitCode!==null&&a.jsx("span",{className:"termtab__code",title:`Оболочка завершилась с кодом ${z.exitCode}`,children:z.exitCode}),a.jsx("button",{className:"termtab__close",title:"Закрыть терминал","aria-label":`Закрыть терминал «${z.title}»`,onClick:()=>y(z.id),children:"✕"})]},z.id))}),a.jsx("button",{className:"termpanel__add",title:"Новый терминал","aria-label":"Новый терминал",disabled:r,onClick:j,children:"+"}),a.jsx("div",{className:"termpanel__spacer"}),x&&a.jsx("button",{className:"termpanel__zoom",title:g?"Свернуть терминал — то же самое, что двойной клик по вкладке":"Развернуть терминал на весь экран — то же самое, что двойной клик по вкладке","aria-label":g?"Свернуть терминал":"Развернуть терминал на весь экран","aria-pressed":g,onClick:x,children:a.jsx(Fc,{active:g})}),a.jsx("button",{className:"termpanel__hide",title:"Скрыть панель","aria-label":"Скрыть панель терминала",onClick:A,children:"✕"})]}),c&&n.length>0&&a.jsx(o_,{message:c,strip:!0,onRetry:null,onDismiss:o}),a.jsxs("div",{className:"termpanel__body",children:[c&&n.length===0?a.jsx(o_,{message:c,onRetry:r?null:j,onDismiss:o}):r?a.jsxs("div",{className:"termpanel__empty",children:[a.jsx("p",{children:"Терминал с удалённых устройств выключен"}),a.jsx("p",{className:"termpanel__hint",children:"Откройте «Удалённый доступ» → «Прислать письмо»: на почту аккаунта придёт ссылка, и после перехода по ней терминал заработает прямо здесь. Если сейчас доберётесь до самого компьютера — там разрешение включается сразу, без письма."})]}):n.length===0&&a.jsxs("div",{className:"termpanel__empty",children:[a.jsx("p",{children:"Терминалов не открыто"}),a.jsx("button",{className:"btn btn--primary",onClick:j,children:"Открыть терминал"})]}),n.map(z=>a.jsx($S,{id:z.id,exitCode:z.exitCode,active:z.id===l,theme:q,mobile:p,onInput:T,onResize:N,onAttach:E,registerSink:D},z.id))]})]})}function o_({message:n,strip:l=!1,onRetry:r,onDismiss:c}){const{lede:o,hint:u,details:h}=GS(n);return a.jsxs("div",{className:l?"termfail termfail--strip":"termfail",role:"alert",children:[a.jsxs("div",{className:"termfail__text",children:[a.jsx("p",{className:"termfail__lede",children:o}),u&&a.jsx("p",{className:"termfail__hint",children:u}),h&&a.jsxs("details",{className:"termfail__details",children:[a.jsx("summary",{children:"Подробности"}),a.jsx("pre",{children:h})]})]}),a.jsxs("div",{className:"termfail__bar",children:[r&&a.jsx("button",{className:"btn btn--primary",onClick:r,children:"Открыть терминал"}),a.jsx("button",{className:"btn",onClick:c,children:"Понятно"})]})]})}function GS(n){const[l="",...r]=n.trim().split(`
133
+
134
+ `),c=l.split(`
135
+ `).map(o=>o.trim()).filter(o=>o!=="");return{lede:c[0]??n.trim(),hint:c.slice(1).join(" "),details:r.join(`
136
+
137
+ `).trim()}}function $S({id:n,exitCode:l,active:r,theme:c,mobile:o,onInput:u,onResize:h,onAttach:p,registerSink:g}){const x=b.useRef(null),v=b.useRef(null),j=b.useRef(!1),y=b.useRef(o);y.current=o;const T=b.useRef(c),N=b.useRef(l),[E,A]=b.useState("loading"),[D,q]=b.useState(!1);return b.useEffect(()=>{if(!x.current)return;let z=!1,U=null;A("loading"),q(!1);const O=window.setTimeout(()=>{z||q(!0)},200);return(async()=>{var Ne;let I;try{I=await BS()}catch{window.clearTimeout(O),z||A("error");return}if(z||!x.current)return;window.clearTimeout(O);const{Terminal:V,FitAddon:R,WebLinksAddon:L}=I,G=new V({fontFamily:US()||"monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,theme:T.current}),se=new R;G.loadAddon(se),G.loadAddon(new L),G.open(x.current),v.current=G,G.attachCustomKeyEventHandler(S=>{if(S.type!=="keydown"||!(S.ctrlKey||S.metaKey))return!0;if(S.key==="`")return S.preventDefault(),!1;if(S.key==="c"||S.key==="C"){const de=G.getSelection();return de?(S.preventDefault(),ba(de),!1):!S.shiftKey}return S.key==="v"||S.key==="V"?(S.preventDefault(),Sp().then(de=>{de&&G.paste(de)}),!1):!0});const ve=S=>{S.preventDefault();const Z=G.getSelection();if(Z){ba(Z),G.clearSelection();return}Sp().then(de=>{de&&G.paste(de)})};(Ne=G.element)==null||Ne.addEventListener("contextmenu",ve);const je=G.onData(S=>u(n,S));let we={cols:G.cols,rows:G.rows},F=null;const $=G.onResize(({cols:S,rows:Z})=>{F!==null&&window.clearTimeout(F),F=window.setTimeout(()=>{F=null,!(S===we.cols&&Z===we.rows)&&(we={cols:S,rows:Z},h(n,S,Z))},100)}),ne=new ResizeObserver(()=>{try{se.fit()}catch{return}y.current&&G.scrollToBottom()});ne.observe(x.current);const pe=g(n,S=>{S.kind==="buffer"&&G.reset(),G.write(S.data)});p(n),N.current!==null&&!j.current&&(j.current=!0,G.write(`\r
138
+ \x1B[2m— Процесс завершён (код ${N.current}) —\x1B[0m\r
139
+ `)),r&&G.focus(),U=()=>{var S;F!==null&&window.clearTimeout(F),ne.disconnect(),(S=G.element)==null||S.removeEventListener("contextmenu",ve),je.dispose(),$.dispose(),pe(),G.dispose(),v.current=null},A("ready")})(),()=>{z=!0,window.clearTimeout(O),U==null||U(),U=null}},[n]),b.useEffect(()=>{if(!o)return;const Q=x.current;if(!Q)return;let z=null,U=0,O=!1;const I=G=>{G.pointerType==="mouse"||z!==null||(z=G.pointerId,U=G.clientY,O=!1)},V=G=>{if(G.pointerId!==z)return;const se=U-G.clientY;if(!O){if(Math.abs(se)<4)return;O=!0,Q.setPointerCapture(G.pointerId)}U=G.clientY;const ve=Q.querySelector(".xterm-viewport");ve&&(ve.scrollTop+=se)},R=G=>{G.pointerId===z&&(Q.hasPointerCapture(G.pointerId)&&Q.releasePointerCapture(G.pointerId),z=null,O=!1)},L=G=>G.stopPropagation();return Q.addEventListener("pointerdown",I),Q.addEventListener("pointermove",V),Q.addEventListener("pointerup",R),Q.addEventListener("pointercancel",R),Q.addEventListener("touchmove",L,{capture:!0}),()=>{Q.removeEventListener("pointerdown",I),Q.removeEventListener("pointermove",V),Q.removeEventListener("pointerup",R),Q.removeEventListener("pointercancel",R),Q.removeEventListener("touchmove",L,{capture:!0}),z!==null&&Q.hasPointerCapture(z)&&Q.releasePointerCapture(z)}},[o]),b.useEffect(()=>{T.current=c,v.current&&(v.current.options.theme=c)},[c]),b.useEffect(()=>{var Q;r&&((Q=v.current)==null||Q.focus())},[r]),b.useEffect(()=>{if(N.current=l,l===null){j.current=!1;return}if(j.current)return;const Q=v.current;Q&&(j.current=!0,Q.write(`\r
140
+ \x1B[2m— Процесс завершён (код ${l}) —\x1B[0m\r
141
+ `))},[l]),a.jsxs("div",{className:"termview"+(r?" is-active":""),children:[a.jsx("div",{ref:x,className:"termview__surface"+(E==="ready"?"":" is-hidden")}),E==="loading"&&D&&a.jsxs("div",{className:"termview__state work",role:"status",children:[a.jsxs("div",{className:"work__dots",children:[a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"}),a.jsx("span",{className:"work__dot"})]}),a.jsx("span",{className:"work__label",children:"Загружается терминал…"})]}),E==="error"&&a.jsxs("div",{className:"termview__state termview__state--error",role:"alert",children:[a.jsx("p",{children:"Не удалось загрузить терминал"}),a.jsx("p",{className:"termpanel__hint",children:"Соединение оборвалось раньше, чем приехал нужный модуль — на мобильном relay это обычное дело на слабой сети. Ниже — перезагрузка страницы, а не тихий повтор: открытые терминалы и их содержимое приедут обратно с хоста, а вот черновик в поле ввода внизу — нет."}),a.jsx("button",{className:"btn btn--primary",onClick:()=>window.location.reload(),children:"Перезагрузить страницу"})]})]})}const YS=2e5,VS=75,XS=90;function QS({tokens:n,maxTokens:l,fetchedAt:r}){if(n===null)return null;const c=l??YS,o=Math.min(100,Math.round(n/c*100)),u=`${n.toLocaleString()} из ${c.toLocaleString()} токенов${r?`
142
+ обновлено в ${new Date(r).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:""}`;return a.jsxs("div",{className:"contextbar","aria-label":`Занято контекста: ${o}%`,title:u,children:[a.jsx("span",{className:"contextbar__label",children:"контекст"}),a.jsx("span",{className:"contextbar__track",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:a.jsx("span",{className:`contextbar__fill${KS(o)}`,style:{width:`${o}%`}})}),a.jsxs("span",{className:"contextbar__pct",children:[o,"%"]})]})}function KS(n){return n>=XS?" contextbar__fill--over":n>=VS?" contextbar__fill--warn":""}const ky="ccv:last-session",ZS=300*1e3,FS=1e4;function JS(){try{const n=localStorage.getItem(ky);if(!n)return null;const l=JSON.parse(n);if(typeof l!="object"||l===null)return null;const{workspaceId:r,sessionId:c,claudeSessionId:o}=l;return typeof r!="string"||typeof c!="string"?null:{workspaceId:r,sessionId:c,claudeSessionId:typeof o=="string"?o:null}}catch{return null}}function PS(n,l){const r=n.find(o=>o.id===l);if(r)return r;const c=n.filter(o=>J0(o.path).includes(l));return c.length===1?c[0]:void 0}function WS(n,l){return n.id===l.sessionId?!0:l.claudeSessionId?n.id===l.claudeSessionId||n.claudeSessionId===l.claudeSessionId:!1}const eE={mcp:"mcp",plugins:"plugins",plugin:"plugins"},u_=[{name:"login",description:"Войти в аккаунт Claude — окно приложения",argumentHint:"",aliases:["signin","вход"]},{name:"switch-account",description:"Сменить аккаунт: выйти и войти заново",argumentHint:"",aliases:["account","аккаунт"]},{name:"logout",description:"Выйти из аккаунта Claude",argumentHint:"",aliases:["signout","выход"]}],tE={active:!1,url:"",awaitingCode:!1,output:"",error:null};function d_(n,l,r){if(n===null)return null;const c=n.lastIndexOf("/");if(c===-1&&n!=="")return l;const o=r[c===-1?"":n.slice(0,c)];if(!o)return null;const u=n.slice(c+1).toLowerCase();return u===""?{query:n,entries:o}:{query:n,entries:o.filter(h=>h.name.toLowerCase().includes(u)).sort((h,p)=>f_(h.name,u)-f_(p.name,u))}}function f_(n,l){return n.toLowerCase().startsWith(l)?0:1}function h_(n,l){const r=n.find(o=>o.value===l)??n.find(o=>o.resolvedModel===l),c=l&&!r?l:null;return{rows:[...c?[{value:c,resolvedModel:c,displayName:c,description:"задана в настройках",supportsEffort:!1,effortLevels:[],supportsThinking:!0,supportsAutoMode:!1}]:[],...n],selected:(r==null?void 0:r.value)??c??(n.some(o=>o.value==="default")?"default":"")}}function nE(){var cc,xi;const n=b.useRef(null),l=b.useRef(null),r=b.useRef(!1),c=b.useRef(new Set),o=b.useCallback(m=>{var H;return(H=n.current)==null?void 0:H.send(m)},[]),u=b.useCallback(m=>{var H,re,Ce;if(m.type==="session.start"){const jt=crypto.randomUUID();l.current={requestId:jt,workspaceId:m.workspaceId,provider:m.provider,resume:m.resume,known:new Set(c.current),draft:(H=l.current)==null?void 0:H.draft},(re=n.current)==null||re.send({...m,requestId:jt})}else(Ce=n.current)==null||Ce.send(m)},[]),[h,p]=b.useState(!1),[g,x]=b.useState("Нет связи с хостом"),[v,j]=b.useState(null),[y,T]=b.useState(null),N=(y==null?void 0:y.status)==="blocked",[E,A]=b.useState(!1),D=b.useMemo(()=>Zd()==="relay",[]),[q,Q]=b.useState([]),z=uN({connected:h,workspaces:q,send:o}),U=b.useRef(z.handleFrame);U.current=z.handleFrame;const[O,I]=b.useState([]),[V,R]=b.useState([]),[L,G]=b.useState([]),[se,ve]=b.useState([]),[je,we]=b.useState([]),[F,$]=b.useState([]),[ne,pe]=b.useState([]),[Ne,S]=b.useState([]),[Z,de]=b.useState(null),[be,Me]=b.useState(null),[Ie,Ke]=b.useState(null),[ce,Ue]=b.useState(null),[ge,Ze]=b.useState(null),[dt,lt]=b.useState(null),[gt,et]=b.useState(Jn),[Tt,ee]=b.useState(qi),[tt,Fe]=b.useState(!1),[$e,Je]=b.useState(!1),Qe=of("(max-width: 860px)"),[ft,De]=b.useState(!1);b.useEffect(()=>{Qe||De(!1)},[Qe]);const[wt,Nt]=b.useState(!1),[Ht,Kt]=b.useState([]),[kt,ot]=b.useState(!1),[wn,Dn]=b.useState(Jn),[ln,$t]=b.useState(null),[hn,yt]=b.useState(null),[Wn,ae]=b.useState([]),[_e,qe]=b.useState(null),[it,Pe]=b.useState(null),[Zt,K]=b.useState([]),[fe,ke]=b.useState([]),[Ve,Mt]=b.useState([]),[Cn,il]=b.useState([]),[Vs,vs]=b.useState(null),[js,Xs]=b.useState(null),[Qs,Wa]=b.useState({}),[us,ds]=b.useState(null),[Ft,at]=b.useState({}),[Nn,Ks]=b.useState(null),[Zs,ws]=b.useState([]),[Ns,Dt]=b.useState(!1),[rl,rn]=b.useState(null),[Jt,Ct]=b.useState(null),pn=(Jt==null?void 0:Jt.enabledProviders)??["claude","antigravity","codex"],[xt,Kn]=b.useState(!1),[es,ts]=b.useState(tE),[Pt,cl]=b.useState(null),[Wt,An]=b.useState(null),[On,fs]=b.useState(!1),[hs,Gn,en]=hv(),vl=yv(),[ks,ns]=b.useState(!1),[xn,jl]=b.useState(null),[$l,kn]=b.useState(null),[wl,ol]=b.useState(null),[Ls,tn]=b.useState(null),[ye,C]=b.useState(null),[J,xe]=b.useState(""),[Oe,Ye]=b.useState(null),[Le,Yt]=b.useState([]),[vt,bn]=b.useState(!1),[Bt,Sn]=b.useState(null),[mn,zs]=b.useState(!1),[_n,Fs]=b.useState(!1),[ss,Nl]=b.useState({}),[k,ie]=b.useState([""]),[Re,nt]=b.useState([]),[yn,kl]=b.useState(null),[Lr,Sl]=b.useState(null),[Yl,_a]=b.useState(null),[ei,$n]=b.useState(null),[ya,ti]=b.useState(null),[Vl,pu]=b.useState({}),[ni,zr]=b.useState({}),[Js,Ps]=b.useState(!1),[mu,Jc]=b.useState(null),[Ir,Pc]=b.useState(null),Ur=b.useRef(0),Hr=b.useRef(null),[si,Wc]=b.useState(!1),[Br,$i]=b.useState([]),[gu,qr]=b.useState(null),[pf,Gr]=b.useState(null),$r=jv(),Yi=Sv(Qe&&si),Vi=b.useRef(new Map),va=(Jt==null?void 0:Jt.terminalEnabled)===!0,Yr=Zd()==="relay"&&((cc=v==null?void 0:v.shell)==null?void 0:cc.enabled)!==!0,Vr=b.useRef(!1),mf=b.useCallback((m,H)=>(Vi.current.set(m,H),()=>{Vi.current.get(m)===H&&Vi.current.delete(m)}),[]),[ja,Xi]=b.useState(!1),[xu,Xr]=b.useState(null),[bu,Qr]=b.useState(Jn),[El,Kr]=b.useState(null),[wa,Ws]=b.useState({}),Qi=b.useRef([]),[cn,Zr]=b.useState(null);function _u(m){Zr(H=>H===m?null:m)}b.useEffect(()=>{(Qe||cn==="terminal"&&!si||cn==="files"&&!_n||cn==="search"&&!Js||cn==="git"&&!ks||cn==="ask"&&!ja||cn==="main"&&Re.length===0)&&Zr(null)},[cn,Qe,si,_n,Js,ks,ja,Re.length]);const[yu]=b.useState(JS),Fr=b.useRef(yu),Tl=b.useRef(!1),Ln=b.useRef(null),Ki=b.useRef(null),Jr=b.useRef(null),eo=b.useRef(0),Rn=b.useRef(null),li=b.useRef(0);Ln.current=ge,Rn.current=ce,li.current=gt.lastSeq;const ai=b.useRef(Tt);ai.current=Tt;const Cl=b.useRef(null),Zi=b.useRef(0);Zi.current=bu.lastSeq;const Fi=b.useRef(null),Ji=b.useRef(""),Na=b.useRef(null),Al=b.useRef([]),to=b.useRef([""]);Al.current=Re,to.current=k;const ii=b.useRef(new Map),Pi=b.useRef(new Set),Wi=b.useRef(null),er=b.useRef(null),vu=b.useRef(0),tr=b.useRef(new Set);b.useEffect(()=>{const m=av();if(!m)return;n.current=m;const H=()=>{p(m.connected),x(m.statusText)};m.onStatus(H),m.onReconnect(()=>{H(),at({});const jt=Ln.current;jt&&m.send({type:"session.sync",sessionId:jt,sinceSeq:li.current});const In=Cl.current;In&&m.send({type:"session.sync",sessionId:In,sinceSeq:Zi.current})});const re=m.on(jt=>{U.current(jt),gf(jt)});m.connect();const Ce=window.setInterval(()=>{H(),m.connected&&m.send({type:"ping",nonce:Date.now()})},15e3);return()=>{re(),window.clearInterval(Ce),m.close()}},[]);const gf=b.useCallback(m=>{var re,Ce,jt,In,As,Ha,gs,Rs,Ll,oc,jo,zl,xs;const H=ue=>{var Ge,Te,Be;const Se=(Ge=l.current)==null?void 0:Ge.draft;l.current=null,Se&&pp(ue.id,Se),((Te=Jr.current)==null?void 0:Te.workspaceId)===ue.workspaceId&&(pp(ue.id,Jr.current.text),Jr.current=null),Ln.current=ue.id,Ue(ue.workspaceId),Ze(ue.id),(Be=n.current)==null||Be.send({type:"session.sync",sessionId:ue.id,sinceSeq:0})};switch(m.type){case"hello.ok":r.current=((re=m.features)==null?void 0:re.includes("session-routing"))??!1,p(!0);break;case"workspace.list":{Q(m.workspaces),I(m.archived),Ue(Ge=>{var It;if(Ge)return Ge;const Te=Fr.current,Be=Te&&PS(m.workspaces,Te.workspaceId);return Te&&Be&&Be.id!==Te.workspaceId&&(Fr.current={...Te,workspaceId:Be.id}),(Be==null?void 0:Be.id)??((It=m.workspaces[0])==null?void 0:It.id)??null});const ue=Na.current;if(!ue)break;const Se=m.workspaces.find(Ge=>cE(Ge.path,ue));if(!Se)break;Na.current=null,Nt(!1),Ue(Se.id);break}case"workspace.candidates":if(m.query.trim()!==Ji.current)break;Kt(m.candidates),m.source==="host"&&ot(!1);break;case"finder.opened":Fi.current=m.sessionId;break;case"workspace.roots":ae(m.roots);break;case"workspace.created":if(Ue(m.workspace.id),m.warnings.length===0){Nt(!1),yt(null);break}qe({path:m.workspace.path,warnings:m.warnings});break;case"session.list":if(m.workspaceId!==Rn.current)break;we(ue=>ry(ue,m.sessions,m.archived,m.workspaceId)),$(m.archived);break;case"folder.list":R(m.workspaceFolders),G(m.sessionFolders),ve(m.pinnedFolders??[]);break;case"session.pinned":pe(m.sessions);break;case"session.live":for(const ue of m.sessions)c.current.add(ue.id);S(m.sessions);break;case"order.state":Ke(m.order);break;case"session.summary":if(!r.current&&l.current){const ue=l.current,Se=m.session;!Se.parentSessionId&&Se.workspaceId===ue.workspaceId&&Se.state!=="closed"&&(!ue.provider||ue.provider===Se.provider)&&(!((Ce=ue.known)!=null&&Ce.has(Se.id))||ue.resume===Se.id||ue.resume===Se.claudeSessionId)&&H(Se)}if(c.current.add(m.session.id),m.session.id===Fi.current){$t(m.session);break}if(m.session.parentSessionId){m.session.id===Cl.current&&Kr(m.session);break}if(S(ue=>{const Se=ue.findIndex(Te=>Te.id===m.session.id);if(m.session.state==="closed")return Se===-1?ue:ue.filter(Te=>Te.id!==m.session.id);if(Se===-1)return[...ue,m.session];const Ge=ue.slice();return Ge[Se]=m.session,Ge}),we(ue=>{const Se=ue.findIndex(Te=>Te.id===m.session.id);if(Se===-1)return[m.session,...ue];const Ge=ue.slice();return Ge[Se]=m.session,Ge}),pe(ue=>{const Se=ue.findIndex(Te=>Te.id===m.session.id);if(Se===-1)return ue;const Ge=ue.slice();return Ge[Se]={...m.session,pinned:!0,...ue[Se].pinnedAt?{pinnedAt:ue[Se].pinnedAt}:{}},Ge}),((jt=Ki.current)==null?void 0:jt.sessionId)===m.session.id){const ue=Ki.current;m.session.state==="error"?Ki.current=null:m.session.state!=="closed"&&(Ki.current=null,(In=n.current)==null||In.send({type:"prompt.send",sessionId:ue.sessionId,text:ue.text,images:ue.images}))}break;case"session.started":{if(m.requestId!==((As=l.current)==null?void 0:As.requestId))break;H(m.session);break}case"usage.state":m.sessionId===Ln.current&&(cl(m.usage),fs(!1));break;case"context.state":m.sessionId===Ln.current&&(An(m.context),fs(!1));break;case"session.capabilities":m.sessionId===Ln.current&&lt(m.capabilities);break;case"session.events":if(m.sessionId===Cl.current){Qr(ue=>iu(ue,m.entries));break}if(m.sessionId===Fi.current){Dn(ue=>iu(ue,m.entries));break}if(m.sessionId!==Ln.current)break;for(const ue of m.entries){if(ue.event.kind!=="rewound")continue;const Se=ue.event.toUserIndex,Ge=k_(ai.current.entries,Se),Te=Ge.reduce((Be,It)=>It.event.kind==="user.message"?Be+1:Be,0);ee(Be=>({...Be,entries:Ge})),et(Be=>({...Be,items:S_(Be.items,Se,Te)}))}et(ue=>iu(ue,m.entries));break;case"session.history":if(m.sessionId!==Ln.current)break;ee(ue=>N_(ue,m));break;case"side.opened":{if(m.parentSessionId!==Ln.current)break;Cl.current=m.sessionId,Xr(m.sessionId);const ue=Qi.current;Qi.current=[];for(const Se of ue)Se(m.sessionId);break}case"side.closed":if(m.parentSessionId!==Ln.current)break;Cl.current=null,Xr(null),Qr(Jn),Kr(null);break;case"git.state":if(m.workspaceId!==Rn.current)break;jl(m.state);break;case"git.commit":if(m.workspaceId!==Rn.current)break;kn(m.detail);break;case"git.result":if(m.workspaceId!==Rn.current)break;tn({ok:m.ok,message:m.message,url:m.url}),m.ok&&(kn(null),ol(null),bn(!1),zs(!1));break;case"git.busy":if(m.workspaceId!==Rn.current)break;xe(m.label);break;case"git.files":if(m.workspaceId!==Rn.current)break;Sn({files:m.files,truncated:m.truncated});break;case"github.status":Ye(m.status);break;case"github.owners":Yt(m.owners);break;case"fs.dir":if(m.workspaceId!==Rn.current)break;Nl(ue=>({...ue,[m.path]:m.entries}));break;case"fs.search":if(m.workspaceId!==Rn.current)break;if(m.scope!=="tree"){const ue=m.scope;zr(Se=>({...Se,[ue]:{query:m.query,entries:m.entries}}));break}ti({query:m.query,entries:m.entries,truncated:m.truncated});break;case"fs.grep":if(m.workspaceId!==Rn.current)break;Jc({query:m.query,matches:m.matches,truncated:m.truncated});break;case"fs.file":{if(m.workspaceId!==Rn.current)break;const ue=Pi.current.delete(m.file.path);nt(Ge=>{const Te=Ge.findIndex(uc=>uc.path===m.file.path);if(Te===-1)return[...Ge,Ab(m.file,++vu.current)];const Be=Ge[Te],It=Ge.slice();return It[Te]=Be.saved===m.file.content&&!Fa(Be)?{...Be,mtime:m.file.mtime,size:m.file.size,stale:!1}:Ab(m.file,++vu.current),It}),ue&&kl(m.file.path);const Se=Hr.current;Se&&Se.path===m.file.path&&(Hr.current=null,Pc({...Se,token:++Ur.current}));break}case"fs.media":{if(m.workspaceId!==Rn.current)break;tr.current.delete(m.path),nt(ue=>ue.map(Se=>Se.path===m.path?{...Se,mediaBase64:m.base64,mediaError:void 0}:Se));break}case"fs.mediaFailed":{if(m.workspaceId!==Rn.current)break;tr.current.delete(m.path),nt(ue=>ue.map(Se=>Se.path===m.path?{...Se,mediaError:m.message}:Se));break}case"fs.saved":{if(m.workspaceId!==Rn.current)break;const ue=ii.current.get(m.path);ii.current.delete(m.path);const Se=ue!==void 0;nt(Te=>Te.map(Be=>Be.path!==m.path?Be:Se?{...Be,saved:ue,mtime:m.mtime,size:m.size,stale:!1}:{...Be,stale:!0}));const Ge=Al.current.find(Te=>Te.path===m.path);!Se&&Ge&&!Fa(Ge)&&((Ha=n.current)==null||Ha.send({type:"fs.read",workspaceId:m.workspaceId,path:m.path})),(gs=n.current)==null||gs.send({type:"git.state",workspaceId:m.workspaceId});break}case"fs.result":{if(m.workspaceId!==Rn.current)break;if(Sl({ok:m.ok,message:m.message}),m.ok||ii.current.delete(m.path),m.conflict&&nt(Se=>Se.map(Ge=>Ge.path===m.path?{...Ge,stale:!0}:Ge)),er.current===m.path){const Se=er.current;er.current=null,m.ok&&(Pi.current.add(Se),(Rs=n.current)==null||Rs.send({type:"fs.read",workspaceId:m.workspaceId,path:Se}))}const ue=Wi.current;if(m.ok&&ue&&ue.to===m.path){Wi.current=null;const Se=Ge=>Ge===ue.from?ue.to:Ge.startsWith(`${ue.from}/`)?ue.to+Ge.slice(ue.from.length):Ge;nt(Ge=>Ge.map(Te=>({...Te,path:Se(Te.path)}))),kl(Ge=>Ge===null?null:Se(Ge)),ie(Ge=>Ge.map(Se)),Nl(Ge=>{const Te={};for(const[Be,It]of Object.entries(Ge))Be===ue.from||Be.startsWith(`${ue.from}/`)||(Te[Be]=It);return Te})}m.ok&&((Ll=n.current)==null||Ll.send({type:"git.state",workspaceId:m.workspaceId}));break}case"term.list":if(m.workspaceId!==Rn.current)break;$i(m.terminals);break;case"term.opened":if(m.terminal.workspaceId!==Rn.current)break;Gr(null),$i(ue=>{const Se=ue.findIndex(Te=>Te.id===m.terminal.id);if(Se===-1)return[...ue,m.terminal];const Ge=ue.slice();return Ge[Se]=m.terminal,Ge}),Vr.current&&(Vr.current=!1,qr(m.terminal.id));break;case"term.buffer":(oc=Vi.current.get(m.id))==null||oc({kind:"buffer",data:m.data});break;case"term.data":(jo=Vi.current.get(m.id))==null||jo({kind:"data",data:m.data});break;case"term.exit":$i(ue=>ue.map(Se=>Se.id===m.id?{...Se,exitCode:m.exitCode}:Se));break;case"term.closed":$i(ue=>ue.filter(Se=>Se.id!==m.id));break;case"mcp.list":m.sessionId===Ln.current&&K(m.servers);break;case"mcp.auth":m.sessionId===Ln.current&&Xs(m.state);break;case"plugin.list":if(m.sessionId!==Ln.current)break;ke(m.plugins),Mt(m.marketplaces),il(m.catalog);break;case"operation.result":m.sessionId===Ln.current&&vs(m.result);break;case"auth.status":rn(m.status);break;case"relay.state":j(m.state);break;case"network.state":T(m.state);break;case"settings.state":Ct(m.settings);break;case"handoff.state":Wa(ue=>{if(!m.handoff){if(!(m.sessionId in ue))return ue;const Se={...ue};return delete Se[m.sessionId],Se}return{...ue,[m.sessionId]:m.handoff}});break;case"handoff.written":at(ue=>{if(!(m.sessionId in ue))return ue;const Se={...ue};return delete Se[m.sessionId],Se}),m.handoff&&Ln.current===m.sessionId?Ks(m.handoff):m.handoff||console.warn("[handoff] хост не смог записать хэндофф",m.sessionId);break;case"limit.stopped":eo.current+=1,ws(ue=>[...ue,{id:eo.current,limit:m.limit,utilization:m.utilization,stopped:m.stopped,handoffs:m.handoffs}]);break;case"auth.login":ts(m.state),m.state.active&&Dt(!0);break;case"session.closed":S(ue=>ue.filter(Se=>Se.id!==m.sessionId)),we(ue=>ue.map(Se=>Se.id===m.sessionId?{...Se,state:"closed"}:Se));break;case"error":m.context==="session.start"&&m.requestId===((zl=l.current)==null?void 0:zl.requestId)&&(l.current=null,et(ue=>({...ue,items:[...ue.items,{id:crypto.randomUUID(),kind:"notice",tone:"error",text:m.message}]}))),console.error("[host]",m.message,m.context??""),(m.context==="workspace.open"||m.context==="workspace.create")&&(Na.current=null,yt(m.message)),(xs=m.context)!=null&&xs.startsWith("term.")&&Gr(m.message);break}},[]);b.useEffect(()=>{!z.compareId||!z.compareVisible||(Fs(!1),Ps(!1),ns(!1),Xi(!1),Fe(!1))},[z.compareId,z.compareVisible]),b.useEffect(()=>{ce&&u({type:"session.list",workspaceId:ce})},[ce,u]),b.useEffect(()=>{h&&u({type:"session.pins"})},[h,u]),b.useEffect(()=>{h&&u({type:"settings.get"})},[h,u]),b.useEffect(()=>{if(h)return u({type:"session.drafts",sessionIds:j_()}),ov(m=>u({type:"session.drafts",sessionIds:m}))},[h,u]),b.useEffect(()=>{if(Tl.current)return;const m=Fr.current;if(!m||!ce)return;if(ce!==m.workspaceId){Tl.current=!0;return}if(ge){Tl.current=!0;return}if(je.length===0)return;const H=je.find(re=>WS(re,m));Tl.current=!0,H&&H.state!=="closed"&&ul(H)},[je,ce,ge]),b.useEffect(()=>{!ce||Yr||!va||u({type:"term.list",workspaceId:ce})},[ce,Yr,va,u]),b.useEffect(()=>{qr(m=>{var H;return m&&Br.some(re=>re.id===m)?m:((H=Br[0])==null?void 0:H.id)??null})},[Br]),b.useEffect(()=>{wt&&u({type:"workspace.roots"})},[wt,u]);const zn=b.useCallback(()=>{const m=Ln.current;m&&(fs(!0),u({type:"usage.get",sessionId:m}),u({type:"context.get",sessionId:m}))},[u]);b.useEffect(()=>{if(!On)return;const m=window.setTimeout(()=>fs(!1),FS);return()=>window.clearTimeout(m)},[On]);const ka=b.useMemo(()=>{const m=Math.max((Pt==null?void 0:Pt.fetchedAt)??0,(Wt==null?void 0:Wt.fetchedAt)??0);return m>0?m:null},[Pt==null?void 0:Pt.fetchedAt,Wt==null?void 0:Wt.fetchedAt]);b.useEffect(()=>{if(An(null),!ge)return;zn();const m=()=>{document.hidden||zn()},H=window.setInterval(m,ZS),re=()=>{document.hidden||zn()};return document.addEventListener("visibilitychange",re),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",re)}},[ge,zn]),b.useEffect(()=>{if(!ge){ee(qi);return}ee({...qi,loading:!0}),u({type:"session.history",sessionId:ge})},[ge,u]);const ju=b.useCallback(()=>{!ge||Tt.loading||!gp(Tt)||(ee(m=>({...m,loading:!0})),u({type:"session.history",sessionId:ge,before:Rp(Tt)}))},[ge,Tt,u]),no=b.useMemo(()=>Mp(Tt.entries),[Tt.entries]),Y=b.useMemo(()=>je.find(m=>m.id===ge)??null,[je,ge]),ri=ge?(Y==null?void 0:Y.claudeSessionId)??ge:null,Sa=ri?Qs[ri]??null:null;b.useEffect(()=>{ri&&u({type:"handoff.get",sessionId:ri})},[ri,u]),b.useEffect(()=>{us&&!(us.sessionId in Qs)&&ds(null)},[Qs,us]);const wu=b.useMemo(()=>{var re;if(!Pt)return null;const m=(((re=Pt.buckets)==null?void 0:re.length)??0)>0,H=(Y==null?void 0:Y.provider)!=="claude";return m===H?Pt:null},[Pt,Y==null?void 0:Y.provider]),Ea="Обновить лимиты и контекст",so=Ea+(ka?`
143
+ обновлено в ${new Date(ka).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:"");b.useEffect(()=>{document.documentElement.dataset.provider=(Y==null?void 0:Y.provider)??"claude"},[Y==null?void 0:Y.provider]),b.useEffect(()=>{(Y==null?void 0:Y.provider)!=="claude"&&Xi(!1)},[Y==null?void 0:Y.provider]);const Ss=q.find(m=>m.id===ce)??O.find(m=>m.id===ce)??null;b.useEffect(()=>{if(!ce||!ge)return;const m={workspaceId:ce,sessionId:ge,claudeSessionId:(Y==null?void 0:Y.claudeSessionId)??null};try{localStorage.setItem(ky,JSON.stringify(m))}catch{}},[ce,ge,Y==null?void 0:Y.claudeSessionId]);function lo(m){Na.current=m,yt(null),u({type:"workspace.open",path:m})}function Nu(m,H,re){yt(null),u({type:"workspace.create",parent:m,name:H,init:re})}function Ta(m){if(Ji.current=m,!m){Kt([]),ot(!1);return}ot(!0),u({type:"workspace.find",query:m})}function ci(m){Ji.current=m,Dn(Jn),u({type:"workspace.find.agent",query:m})}function ao(){Nt(!1),yt(null),qe(null),Kt([]),Dn(Jn),$t(null),Ji.current="",Na.current=null}function Ca(){const m=Ln.current;m&&Cl.current&&u({type:"side.reset",sessionId:m}),Cl.current=null,Xr(null),Qr(Jn),Kr(null),Ws({}),Qi.current=[]}function Aa(m){u({type:"workspace.close",workspaceIds:m}),!(!ce||!m.includes(ce))&&(Ca(),Ue(null),Ze(null),we([]),$([]),et(Jn),lt(null),Je(!1))}function ku(m,H){u({type:"session.archive",workspaceId:m,sessionIds:H}),ge&&(H.includes(ge)||Y!=null&&Y.claudeSessionId&&H.includes(Y.claudeSessionId))&&(Ca(),Ze(null),et(Jn),lt(null),Je(!1))}function Su(m){u({type:"workspace.restore",workspaceIds:m})}function Eu(m,H,re){u({type:"folder.create",scope:m,name:H,workspaceId:re})}function xf(m,H){u({type:"folder.rename",folderId:m,name:H})}function bf(m,H){u({type:"folder.setColor",folderId:m,color:H})}function _f(m){u({type:"folder.delete",folderId:m})}function Tu(m,H,re,Ce){u({type:"folder.assign",scope:m,itemId:H,folderId:re,workspaceId:Ce})}function io(m=pn[0]??"claude"){ce&&(Ca(),Ze(null),lt(null),et(Jn),Je(!1),u({type:"session.start",workspaceId:ce,provider:m}),Fe(!1))}function ro(m){z.setView(null),z.markRead(m),nr(m),z.setCompareVisible(!1)}function el(m,H=pn[0]??"claude"){z.setView(null),Yn(m),l.current=null,u({type:"session.start",workspaceId:m,provider:H}),Fe(!1)}function Pr(m,H,re,Ce,jt){z.setView(null),Yn(m.workspaceId),l.current={requestId:"",draft:jt},u({type:"session.start",workspaceId:m.workspaceId,provider:H,taskParent:an(m),taskStage:re,...Ce?{resume:an(m),fork:!0}:{}}),Fe(!1)}function Yn(m){Ca(),nc(),Ue(m),Ze(null),et(Jn),lt(null),Je(!1),jl(null),kn(null),ol(null),tn(null),xe(""),bn(!1),Sn(null),zs(!1),$i([]),qr(null)}function oi(m,H,re){u({type:"session.pin",workspaceId:m,sessionIds:H,pinned:re})}function co(m){return m.state==="running"||m.state==="waiting_permission"||m.state==="reconnecting"||m.backgroundWork}function ui(m){if(co(m)){de(m);return}u({type:"session.close",sessionId:m.id})}function Wr(m,H,re){Ke(Ce=>{const jt=Ce??{workspaces:[],sessions:{},pinned:[],live:[]};if(m==="sessions"){if(!re)return Ce;const In={...jt.sessions};return H&&H.length>0?In[re]=H:delete In[re],{...jt,sessions:In}}return{...jt,[m]:H??[]}}),u({type:"order.set",scope:m,ids:H,...re?{workspaceId:re}:{}})}function nr(m){m.workspaceId!==ce&&Yn(m.workspaceId),ul(m)}function ul(m){if(Fe(!1),Ca(),et(Jn),lt(null),Je(!1),m.state==="closed"){Ze(null),u({type:"session.start",workspaceId:m.workspaceId,resume:m.id,provider:m.provider});return}Ze(m.id),u({type:"session.sync",sessionId:m.id,sinceSeq:0})}function Cu(m,H){if(!ge||N)return!1;const re=ge,Ce=Y;return sr(()=>{if((Ce==null?void 0:Ce.state)==="closed"){Ki.current={sessionId:Ce.id,text:m,images:H},ul(Ce);return}u({type:"prompt.send",sessionId:re,text:m,images:H})})}function sr(m){const H=(Y==null?void 0:Y.provider)!=="claude"?null:MS(Pt,Jt);return H?new Promise(re=>{Me(Ce=>(Ce==null||Ce.resolve(!1),{warning:H,resolve:re}))}).then(re=>(re&&m(),re)):(m(),!0)}function Xl(m){be&&(be.resolve(m),Me(null))}function Au(m){const H=Ne.find(re=>(re.claudeSessionId??re.id)===m.sessionId&&re.state!=="closed");ec(m.workspaceId,m.sessionId,m.text),H&&u({type:"session.close",sessionId:H.id})}function ps(m){ec(m.workspaceId,m.claudeSessionId??m.id,null)}function ec(m,H,re){Jr.current=re===null?null:{workspaceId:m,text:re},m!==ce?Yn(m):(Ca(),Ze(null),lt(null),et(Jn),Je(!1)),u({type:"session.start",workspaceId:m,provider:"claude",continuesFrom:H,...re===null?{}:{fromHandoff:!0}}),Fe(!1)}b.useEffect(()=>{Nn&&(Ks(null),Au(Nn))},[Nn]);function dl(m){Ft[m.id]||(at(H=>({...H,[m.id]:!0})),u({type:"session.handoff",sessionId:m.id}))}function Ru(m){u({type:"handoff.dismiss",sessionId:m})}function lr(m,H){u({type:"session.rename",sessionId:m.id,title:H,workspaceId:m.workspaceId}),we(re=>re.map(Ce=>Ce.id===m.id?{...Ce,title:H}:Ce))}function Ql(m){ge&&(Fe(!1),vs(null),Xs(null),Pe(m),u({type:"mcp.list",sessionId:ge}),u({type:"plugin.list",sessionId:ge}))}const oo={mcpAction:(m,H)=>{ge&&(vs(null),u({type:"mcp.action",sessionId:ge,name:m,action:H}))},mcpAuth:m=>{ge&&(vs(null),Xs({name:m,active:!0,url:"",callbackExpected:!1,done:!1,error:null}),u({type:"mcp.auth",sessionId:ge,name:m}))},mcpAuthCallback:(m,H)=>{ge&&u({type:"mcp.auth_callback",sessionId:ge,name:m,callbackUrl:H})},mcpAdd:(m,H)=>{ge&&u({type:"mcp.add",sessionId:ge,name:m,draft:H})},mcpRemove:m=>{ge&&u({type:"mcp.remove",sessionId:ge,name:m})},pluginInstall:m=>{ge&&u({type:"plugin.install",sessionId:ge,spec:m})},pluginUninstall:m=>{ge&&u({type:"plugin.uninstall",sessionId:ge,id:m})},pluginToggle:(m,H)=>{ge&&u({type:"plugin.toggle",sessionId:ge,id:m,enabled:H})},marketplaceAdd:m=>{ge&&u({type:"marketplace.add",sessionId:ge,source:m})},marketplaceRemove:m=>{ge&&u({type:"marketplace.remove",sessionId:ge,name:m})}};function uo(){Fe(!1),Dt(!0),u({type:"auth.status"})}const ar={login:(m,H)=>u({type:"auth.login",mode:m,switchAccount:H}),submitCode:m=>u({type:"auth.code",code:m}),cancel:()=>u({type:"auth.cancel"}),logout:()=>u({type:"auth.logout"})};function tc(){Fe(!1),Kn(!0),u({type:"settings.get"})}function Is(m){Ct(H=>H&&{...H,...m}),u({type:"settings.update",settings:m})}function di(m){!ge||N||u({type:"side.ask",sessionId:ge,text:m})}function fi(){ge&&(u({type:"side.reset",sessionId:ge}),Cl.current=null,Xr(null),Qr(Jn),Kr(null),Ws({}),Qi.current=[])}function Kl(m){const H=Cl.current;if(H){m(H);return}const re=Ln.current;re&&(Qi.current.push(m),u({type:"side.open",sessionId:re}))}function hi(){ce&&u({type:"git.state",workspaceId:ce})}function Us(m){ce&&(ol(m),u({type:"git.show",workspaceId:ce,ref:m}))}function Es(m,H){tn(null),C({target:m,label:H})}function Zl(){!ce||!ye||(u({type:"git.checkout",workspaceId:ce,target:ye.target}),C(null))}function fl(){ce&&(tn(null),u({type:"git.push",workspaceId:ce}))}function hl(m){ce&&(tn(null),u({type:"git.pull",workspaceId:ce,merge:m}))}function Rl(){ce&&(tn(null),Sn(null),bn(!0),u({type:"github.status"}),u({type:"github.owners"}),u({type:"git.files",workspaceId:ce}))}function Mu(m){ce&&(tn(null),u({type:"git.publish",workspaceId:ce,...m}))}function fo(m){ce&&(tn(null),u({type:"git.remote",workspaceId:ce,url:m}))}function ho(){tn(null),zs(!0)}function Du(m){u({type:"github.token",token:m}),u({type:"github.owners"})}function Vn(){u({type:"github.status"}),u({type:"github.owners"})}b.useEffect(()=>{if(!(!_n||!ce))for(const m of k)m in ss||u({type:"fs.list",workspaceId:ce,path:m})},[_n,k,ss,ce,u]);function nn(m){ie(H=>H.includes(m)?H.filter(re=>re!==m):[...H,m])}function ht(m){if(!m){ti(null);return}ce&&u({type:"fs.search",workspaceId:ce,query:m})}function Fl(m){if(!m){Jc(null);return}ce&&u({type:"fs.grep",workspaceId:ce,query:m})}const Ts=b.useCallback((m,H)=>{pu(jt=>({...jt,[m]:H}));const re=Rn.current;if(H===null||!re)return;const Ce=H.lastIndexOf("/");if(Ce!==-1){u({type:"fs.list",workspaceId:re,path:H.slice(0,Ce)});return}if(H===""){u({type:"fs.list",workspaceId:re,path:""});return}u({type:"fs.search",workspaceId:re,query:H,scope:m})},[u]),po=b.useMemo(()=>d_(Vl.mention??null,ni.mention??null,ss),[Vl.mention,ni.mention,ss]),Jl=b.useMemo(()=>d_(Vl.side??null,ni.side??null,ss),[Vl.side,ni.side,ss]);function Ou(m){Pl(m.path,{line:m.line,column:m.column})}function Lu(m){const H=[];let re=Ar(m.path);for(;H.push(re),!!re;)re=Ar(re);ie(Ce=>{const jt=new Set(Ce);for(const In of H)jt.add(In);return m.kind==="dir"&&jt.add(m.path),[...jt]}),m.kind==="file"&&Pl(m.path)}function Pl(m,H){if(Al.current.find(Ce=>Ce.path===m)){kl(m),H&&Pc({path:m,...H,token:++Ur.current});return}ce&&(H&&(Hr.current={path:m,...H}),Pi.current.add(m),u({type:"fs.read",workspaceId:ce,path:m}))}function Ml(m,H=!1){const re=Al.current,Ce=re.find(As=>As.path===m);if(Ce&&Fa(Ce)&&!H){$n(m);return}$n(null);const jt=re.findIndex(As=>As.path===m),In=re.filter(As=>As.path!==m);nt(In),kl(As=>{var Ha;return As===m?((Ha=In[Math.min(jt,In.length-1)])==null?void 0:Ha.path)??null:As})}function pi(m,H=!1){const re=Al.current.find(Ce=>Ce.path===m);!re||!ce||!H&&!Fa(re)||(ii.current.set(m,re.text),u({type:"fs.write",workspaceId:ce,path:m,content:re.text,eol:re.eol,encoding:re.encoding,baseMtime:re.mtime,...H?{force:!0}:{}}))}function ir(m){ce&&u({type:"fs.read",workspaceId:ce,path:m})}function mo(m){ce&&(tr.current.has(m)||(tr.current.add(m),u({type:"fs.readMedia",workspaceId:ce,path:m})))}const Ra=b.useRef(new Map);function Dl(m){const H=Ra.current,re=H.get(m);re&&clearTimeout(re);const Ce=(Jt==null?void 0:Jt.autoSaveAfterPauseMs)??0;Ce<=0||H.set(m,setTimeout(()=>{H.delete(m);const jt=Al.current.find(In=>In.path===m);jt&&Fa(jt)&&!jt.stale&&pi(m)},Ce))}function Wl(m,H,re){if(!ce)return;const Ce=m?`${m}/${re}`:re;Sl(null),H==="file"&&(er.current=Ce),u({type:"fs.create",workspaceId:ce,path:Ce,kind:H})}function Ol(m,H){if(!ce)return;const re=Ar(m),Ce=re?`${re}/${H}`:H;Sl(null),Wi.current={from:m,to:Ce},u({type:"fs.rename",workspaceId:ce,path:m,to:Ce})}function go(m,H){if(!ce)return;const re=m.slice(m.lastIndexOf("/")+1),Ce=H?`${H}/${re}`:re;Ce!==m&&(Sl(null),Wi.current={from:m,to:Ce},u({type:"fs.rename",workspaceId:ce,path:m,to:Ce}))}function xo(m,H){ce&&(Sl(null),u({type:"fs.copy",workspaceId:ce,path:m,toDir:H}))}function mi(m){ce&&(Sl(null),_a(null),u({type:"fs.delete",workspaceId:ce,path:m.path}),nt(H=>H.filter(re=>re.path!==m.path&&!re.path.startsWith(`${m.path}/`))),kl(H=>H&&(H===m.path||H.startsWith(`${m.path}/`))?null:H))}function nc(){Nl({}),ie([""]),nt([]),kl(null),Sl(null),ti(null),Jc(null),pu({}),zr({}),Pc(null),Pi.current.clear(),ii.current.clear(),tr.current.clear(),Hr.current=null,Wi.current=null,er.current=null}function Ma(){!ce||Yr||!va||(Gr(null),Vr.current=!0,u({type:"term.open",workspaceId:ce,cols:80,rows:24}))}function Xn(m){u({type:"term.close",id:m})}function sc(m,H){ge&&u({type:"permission.respond",sessionId:ge,requestId:m,decision:H})}function zu(m,H){ge&&u({type:"permission.respond",sessionId:ge,requestId:m,decision:"allow",answers:H})}function yf(m){ge&&u({type:"permission.respond",sessionId:ge,requestId:m,decision:"deny",reason:"Пользователь не стал отвечать на вопросы"})}function vf(m,H){ge&&u({type:"permission.respond",sessionId:ge,requestId:m,decision:"allow",plan:H})}function jf(m){ge&&u({type:"permission.respond",sessionId:ge,requestId:m,decision:"deny",reason:"Пользователь просит продолжить планирование"})}b.useEffect(()=>{function m(H){if(H.key!=="Escape")return;if(cn!==null){const Ce=H.target;if(!(Ce instanceof HTMLElement&&Ce.closest(".termview, .editor, .sidepane"))){Zr(null);return}}if(!ge||gt.pending.length>0)return;const re=H.target;re instanceof HTMLElement&&re.closest('.sidepane, .editor, .comparison, [role="dialog"]')||u({type:"control.interrupt",sessionId:ge})}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[ge,gt.pending.length,u,cn]),b.useEffect(()=>{function m(H){H.key!=="`"||!(H.ctrlKey||H.metaKey)||va&&(H.preventDefault(),Wc(re=>!re))}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[va]);const vn=b.useMemo(()=>{const m=(dt==null?void 0:dt.commands)??[];return m.length===0||(Y==null?void 0:Y.provider)!=="claude"?m:[...m,{name:"plugins",description:"Плагины и маркетплейсы — окно приложения",argumentHint:"",aliases:["plugin"]},...u_]},[dt,Y==null?void 0:Y.provider]);function lc(m){if(m==="fork"&&(Y==null?void 0:Y.provider)==="codex"&&ge&&!ms){const re=Y;return Ze(null),lt(null),et(Jn),u({type:"session.start",workspaceId:re.workspaceId,provider:"codex",resume:re.id,fork:!0}),!0}const H=eE[m];return H&&(Y==null?void 0:Y.provider)==="claude"?(Ql(H),!0):(Y==null?void 0:Y.provider)!=="claude"||!u_.some(re=>re.name===m)?!1:(uo(),m==="logout"&&ar.logout(),m==="switch-account"&&ar.login("claudeai",!0),!0)}const ea=(Y==null?void 0:Y.state)==="waiting_permission",ls=(Y==null?void 0:Y.state)==="reconnecting",ms=(Y==null?void 0:Y.state)==="running"||ls||ea,Ot=gt.pending[0]??null,ta=Ot?oy(Ot.toolName,Ot.input):null,[wf,Iu]=b.useState(()=>new Set),ac=Ot?wf.has(Ot.requestId):!1,bo=Ot?Ot.questions&&Ot.questions.length>0?"question":ta!==null?"plan":"permission":null;function pl(m,H){Iu(re=>{if(re.has(m)===H)return re;const Ce=new Set(re);return H?Ce.add(m):Ce.delete(m),Ce})}b.useEffect(()=>{!ks&&!_n||!ce||ms||u({type:"git.state",workspaceId:ce})},[ks,_n,ce,ms,u]),b.useEffect(()=>{if(!(ms||!ce)){_n&&Nl(m=>{const H={};for(const[re,Ce]of Object.entries(m))to.current.includes(re)||(H[re]=Ce);return H});for(const m of Al.current)Fa(m)||u({type:"fs.read",workspaceId:ce,path:m.path})}},[ms,ce,_n,u]);const rr=(Y==null?void 0:Y.cwd)??(dt==null?void 0:dt.cwd)??null,cr=(dt==null?void 0:dt.models)??[],or=(Y==null?void 0:Y.model)??(dt==null?void 0:dt.model)??null,{rows:Da,selected:_o}=h_(cr,or),na=El?{model:El.model,effort:El.effort,ultracode:El.ultracode,thinking:El.thinking,switchOnFlag:El.switchModelsOnFlag}:{model:wa.model??or,effort:wa.effort??(Y==null?void 0:Y.effort)??null,ultracode:wa.ultracode??(Y==null?void 0:Y.ultracode)??!1,thinking:wa.thinking??(Y==null?void 0:Y.thinking)??!0,switchOnFlag:wa.switchOnFlag??(Y==null?void 0:Y.switchModelsOnFlag)??!0},ur=h_(cr,na.model),Uu=(El==null?void 0:El.state)==="running",dr=yn?Re.find(m=>m.path===yn)??null:null,Oa=new Set(Re.filter(Fa).map(m=>m.path)),tl=m=>a.jsx(LS,{pane:m,width:vl.widths[m],onResize:H=>vl.setWidth(m,H),onReset:()=>vl.reset(m)}),La=m=>Qe?null:()=>_u(m),Hu=(Y==null?void 0:Y.provider)==="codex"?mv:(Y==null?void 0:Y.provider)==="antigravity"?gv:E_,za=dt&&a.jsx(_l,{title:"Режим прав",value:(Y==null?void 0:Y.permissionMode)??"default",options:Hu.map(m=>({value:m.value,label:m.value,hint:m.hint})),onChange:m=>{ge&&u({type:"control.set_mode",sessionId:ge,mode:m})}}),gi=Da.length>0?a.jsx(_y,{models:Da,value:_o,effort:(Y==null?void 0:Y.effort)??null,ultracode:(Y==null?void 0:Y.ultracode)??!1,thinking:(Y==null?void 0:Y.thinking)??!0,switchOnFlag:(Y==null?void 0:Y.switchModelsOnFlag)??!0,showSwitchOnFlag:(Y==null?void 0:Y.provider)==="claude",showUltracode:(Y==null?void 0:Y.provider)==="claude",showThinking:(Y==null?void 0:Y.provider)==="claude",onModel:m=>{!ge||!m||u({type:"control.set_model",sessionId:ge,model:m})},onEffort:m=>{ge&&u({type:"control.set_effort",sessionId:ge,effort:m})},onUltracode:m=>{ge&&u({type:"control.set_ultracode",sessionId:ge,enabled:m})},onThinking:m=>{ge&&u({type:"control.set_thinking",sessionId:ge,enabled:m})},onSwitchOnFlag:m=>{ge&&u({type:"control.set_flag_switch",sessionId:ge,enabled:m})}}):or&&a.jsx("span",{className:"badge",children:or}),ic=ms&&a.jsx("span",{className:ea?"badge badge--wait":"badge badge--live",children:ea?"ждёт":ls?"переподключается":"работает"}),fr=(Y==null?void 0:Y.state)==="closed"&&a.jsx("span",{className:"badge",title:"Разговор сохранён — сессия поднимется заново, как только вы отправите сообщение",children:"остановлена"}),hr=ic||fr,yo=()=>{ge&&u({type:"session.reconnect",sessionId:ge})},Ia=ls?"Сессия уже поднимает новый процесс":ms?"Недоступно, пока идёт ход":"Поднять сессии новый процесс — разговор сохранён",Bu=ge&&(ls||(Y==null?void 0:Y.state)==="error")?a.jsxs("div",{className:ls?"relink":"relink relink--error",role:"status",children:[a.jsxs("span",{className:"relink__msg",children:[a.jsx("span",{className:"relink__dot","aria-hidden":"true"}),ls?"Связь оборвалась. Сессия поднимает новый процесс — разговор сохранён.":"Переподключиться не удалось. Разговор сохранён — сессия продолжит с этого места."]}),a.jsx("button",{className:"btn btn--sm",title:ls?"Не ждать паузы между попытками — попробовать сейчас":"Поднять сессии новый процесс и продолжить разговор",onClick:yo,children:ls?"Переподключить сейчас":"Переподключить"})]}):null,sa=Sa?a.jsx(kS,{handoff:Sa,onContinue:()=>Au(Sa),onShow:()=>ds(Sa),onDismiss:()=>Ru(Sa.sessionId)}):null,pr=Y&&Y.totalCostUsd>0?`$${Y.totalCostUsd.toFixed(3)}`:null,rc=(Y==null?void 0:Y.provider)==="claude"&&a.jsx("button",{className:ja?"pane-btn is-on":"pane-btn",title:"Вопрос на полях — спросить, не мешая работе","aria-label":"Вопрос на полях","aria-pressed":ja,onClick:()=>Xi(m=>!m),children:a.jsx(uE,{})}),la=Y&&Y.state!=="closed"&&a.jsx("button",{type:"button",className:"pane-btn pane-btn--stop",title:"Остановить сессию — освобождает память хоста, разговор остаётся на диске","aria-label":"Остановить сессию",onClick:()=>ui(Y),children:a.jsx(iE,{})}),Cs=Y?Ft[Y.id]===!0:!1,Ua=R_({onLongPress:()=>{Y&&ps(Y)},onClick:()=>{Y&&dl(Y)},disabled:Cs}),vo=Y&&Y.state!=="closed"&&Y.provider==="claude"&&a.jsxs("button",{type:"button",className:Cs?"pane-btn pane-btn--handoff is-busy":Ua.holding?"pane-btn pane-btn--handoff is-holding":"pane-btn pane-btn--handoff",style:{"--hold-ms":`${Ua.thresholdMs}ms`},title:Cs?"Пишется хэндофф…":"Клик — хэндофф и новая сессия: агент запишет сводку, сессия остановится, работа продолжится в новой. Зажать (или Shift+клик) — новая пустая сессия без хэндоффа: закрепление переходит, старая сессия продолжает работать.","aria-label":"Хэндофф и новая сессия","aria-busy":Cs,disabled:Cs,...Ua.handlers,children:[a.jsx("span",{className:"pane-btn__hold","aria-hidden":"true"}),a.jsx(rE,{})]});return a.jsxs("div",{className:"app",style:vl.style,children:[a.jsx(yw,{open:tt,connected:h,status:g,workspaces:q,archivedWorkspaces:O,workspaceFolders:V,sessionFolders:L.filter(m=>m.workspaceId===ce),pinnedFolders:se,sessions:je.filter(m=>m.workspaceId===ce),archived:F.filter(m=>m.workspaceId===ce),pinned:ne,live:Ne,listOrder:Ie,liveSessionsFirst:(Jt==null?void 0:Jt.liveSessionsFirst)===!0,onReorder:Wr,activeWorkspaceId:ce,activeSessionId:ge,onPinSessions:oi,onSelectPinned:nr,onCloseWorkspaces:Aa,onRestoreWorkspaces:Su,onArchiveSessions:ku,onUnarchiveSessions:m=>{ce&&u({type:"session.unarchive",workspaceId:ce,sessionIds:m})},onCreateFolder:Eu,onRenameFolder:xf,onSetFolderColor:bf,onDeleteFolder:_f,onAssignToFolder:Tu,onSelectWorkspace:Yn,onSelectSession:ul,onRenameSession:lr,onStopSession:ui,onOpenWorkspace:()=>Nt(!0),onNewSession:io,enabledProviders:pn,onOpenExtensions:ge&&(Y==null?void 0:Y.provider)==="claude"?()=>Ql("mcp"):null,account:rl,onOpenAccount:uo,relay:v,onOpenRelay:D?null:()=>A(!0),onOpenSettings:tc,themeMode:hs,onCycleTheme:en,navigation:a.jsx(mN,{hub:z})}),tl("sidebar"),tt&&a.jsx("div",{className:"scrim",onClick:()=>Fe(!1)}),a.jsx(R1,{open:_n,tree:ss,expanded:new Set(k),activePath:yn,dirty:Oa,gitChanges:(xn==null?void 0:xn.changed)??[],result:Lr,searchResult:ya,onSearch:ht,onReveal:Lu,onToggle:nn,onOpen:Pl,onCreate:Wl,onRename:Ol,onMove:go,onCopy:xo,onDelete:_a,onRefresh:()=>{Sl(null),Nl({}),hi()},onClose:()=>Fs(!1),zoomed:cn==="files",onToggleZoom:La("files")}),_n&&cn!=="files"&&tl("files"),a.jsx(q1,{open:Js,result:mu,onSearch:Fl,onOpenMatch:Ou,onClose:()=>Ps(!1),zoomed:cn==="search",onToggleZoom:La("search")}),Js&&cn!=="search"&&tl("search"),a.jsx(mk,{open:ks,state:xn,result:Ls,selected:wl,busy:J,onRefresh:hi,onShow:Us,onCheckout:Es,onPush:fl,onPull:hl,onPublish:Rl,onConnectRemote:ho,onDismissResult:()=>tn(null),onClose:()=>ns(!1),zoomed:cn==="git",onToggleZoom:La("git")}),ks&&cn!=="git"&&tl("git"),a.jsxs("main",{className:cn==="main"||cn==="terminal"?"main main--zoomed":"main",children:[y&&N&&a.jsx(ES,{state:y}),a.jsxs("header",{className:"topbar",children:[a.jsx("button",{className:"btn btn--ghost menu-btn",onClick:()=>Fe(!0),children:"☰"}),a.jsx("button",{className:_n?"pane-btn is-on":"pane-btn",title:"Файлы проекта","data-label":"Файлы","aria-label":"Файлы проекта","aria-pressed":_n,onClick:()=>{Fs(m=>!m),ns(!1),Ps(!1)},children:a.jsx(sE,{})}),a.jsx("button",{className:Js?"pane-btn is-on":"pane-btn",title:"Поиск по тексту в проекте","data-label":"Поиск","aria-label":"Поиск по тексту в проекте","aria-pressed":Js,onClick:()=>{Ps(m=>!m),Fs(!1),ns(!1)},children:a.jsx(lE,{})}),a.jsx("button",{className:ks?"pane-btn is-on":"pane-btn",title:"История git","data-label":"История","aria-label":"История git","aria-pressed":ks,onClick:()=>{ns(m=>!m),Fs(!1),Ps(!1)},children:a.jsx(aE,{})}),va&&a.jsx("button",{className:si?"pane-btn is-on":"pane-btn",title:"Терминал (Ctrl+`)","aria-label":"Терминал","aria-pressed":si,onClick:()=>Wc(m=>!m),children:a.jsx(oE,{})}),Qe&&rc,Qe&&a.jsx("button",{className:ft?"pane-btn is-on":"pane-btn",title:"Ещё","aria-label":"Ещё","aria-haspopup":"menu","aria-pressed":ft,onClick:()=>De(!0),children:a.jsx(dE,{})}),a.jsxs("div",{className:"topbar__id",children:[$e&&Y?a.jsx(ga,{className:"rename--title",value:Y.title??"",onCommit:m=>{lr(Y,m),Je(!1)},onCancel:()=>Je(!1)}):a.jsxs("div",{className:"topbar__head",children:[a.jsx("button",{className:"topbar__title",disabled:!Y||Qe,title:Y&&!Qe?"Переименовать сессию":void 0,onClick:()=>Je(!0),children:(Y==null?void 0:Y.title)??"Ваше пространство"}),Ss&&a.jsx("span",{className:"topbar__project",title:Ss.path,children:Ss.name})]}),Qe?hr:rr&&a.jsx(by,{path:rr})]}),!Qe&&a.jsxs("div",{className:"topbar__tools",children:[a.jsx("button",{type:"button",className:On?"meters-refresh is-busy":"meters-refresh",title:so,"aria-label":Ea,"aria-busy":On,disabled:!ge||On,onClick:zn,children:a.jsx(fE,{})}),a.jsx(vy,{usage:wu}),a.jsx(Ny,{}),za,gi,hr,pr&&a.jsx("span",{className:"badge badge--cost",children:pr}),vo,la,rc]})]}),a.jsx(gN,{hub:z,hasSession:!!ge}),!dr&&Y&&a.jsx(cy,{session:Y,items:[...no,...gt.items],pendingCount:gt.pending.length},Y.id),a.jsx(QS,{tokens:(Wt==null?void 0:Wt.tokens)??gt.contextTokens,maxTokens:(Wt==null?void 0:Wt.maxTokens)??null,fetchedAt:(Wt==null?void 0:Wt.fetchedAt)??null}),Qe&&ft&&a.jsx(Kk,{onClose:()=>De(!1),permission:za,model:gi,usage:wu,cwd:rr,costLabel:pr,onRefresh:zn,refreshing:On,metersFetchedAt:ka,onRename:Y?()=>{Je(!0),De(!1)}:null,onHandoff:Y&&Y.state!=="closed"&&Y.provider==="claude"?()=>{dl(Y),De(!1)}:null,onFreshSession:Y&&Y.state!=="closed"&&Y.provider==="claude"?()=>{ps(Y),De(!1)}:null,handoffWriting:Cs,onStop:Y&&Y.state!=="closed"?()=>{ui(Y),De(!1)}:null}),Re.length>0&&a.jsx(iw,{files:Re,activePath:yn,busy:ms,onSelect:kl,onClose:m=>Ml(m),zoomed:cn==="main",onToggleZoom:La("main")}),dr?a.jsx(lw,{file:dr,goto:(Ir==null?void 0:Ir.path)===dr.path?Ir:null,onChange:(m,H)=>{nt(re=>re.map(Ce=>Ce.path===m?{...Ce,text:H}:Ce)),Dl(m)},onSave:m=>pi(m),onReload:ir,onOverwrite:m=>pi(m,!0),onRequestMedia:mo,onTogglePreview:m=>nt(H=>H.map(re=>re.path===m?{...re,previewMode:!re.previewMode}:re))}):a.jsxs(a.Fragment,{children:[a.jsx(hf,{items:gt.items,welcome:a.jsx(cN,{connected:h,workspaceName:Ss==null?void 0:Ss.name,hasSession:!!ge,onOpenWorkspace:()=>Nt(!0),onNewSession:()=>io(),onOpenFiles:()=>{Fs(!0),Ps(!1),ns(!1)},onOpenSettings:tc}),busy:ms&&!ls,waiting:ea,history:no,historyHasMore:gp(Tt),historyLoading:Tt.loading,onLoadHistory:ju,sessionId:ge??void 0,onEditMessage:(Y==null?void 0:Y.provider)==="antigravity"?void 0:(m,H,re)=>{if(!ge||N)return!1;const Ce=ge;return sr(()=>u({type:"prompt.edit",sessionId:Ce,userIndex:m,text:H,images:re}))}}),Bu,sa,ge&&((xi=Y==null?void 0:Y.tasks)!=null&&xi.length)?a.jsx(dw,{tasks:Y.tasks,onStop:m=>u({type:"task.stop",sessionId:ge,taskId:m})}):null,Ot&&bo&&ac&&a.jsx(fN,{kind:bo,toolName:Ot.toolName,queued:gt.pending.length-1,onExpand:()=>pl(Ot.requestId,!1)}),a.jsx(Pp,{disabled:!ge,busy:ms&&!ls,sendBlocked:N,placeholder:ls?"Промпт уйдёт, как только связь вернётся":(Y==null?void 0:Y.state)==="closed"?"Остановлена — отправьте сообщение, чтобы продолжить":void 0,commands:vn,sessionTitle:(Y==null?void 0:Y.title)??null,contextResult:po,draftKey:ge,onContextSearch:m=>Ts("mention",m),onCommand:lc,onSend:Cu,onInterrupt:()=>{ge&&u({type:"control.interrupt",sessionId:ge})}})]}),si&&va&&a.jsxs(a.Fragment,{children:[!Qe&&cn!=="terminal"&&a.jsx(IS,{height:$r.height,onResize:$r.setHeight,onReset:$r.reset}),a.jsx(qS,{mobile:Qe,zoomed:cn==="terminal",onToggleZoom:La("terminal"),terminals:Br,activeId:gu,blocked:Yr,error:pf,onDismissError:()=>Gr(null),height:Qe?Yi.height:$r.height,offset:Qe?{top:Yi.offsetTop,left:Yi.offsetLeft}:void 0,onSelect:qr,onOpen:Ma,onClose:Xn,onInput:(m,H)=>u({type:"term.input",id:m,data:H}),onResize:(m,H,re)=>u({type:"term.resize",id:m,cols:H,rows:re}),onAttach:m=>u({type:"term.attach",id:m}),onHide:()=>Wc(!1),registerSink:mf})]})]}),a.jsx(Uk,{open:ja,items:bu.items,busy:Uu,ready:ge!==null,sendBlocked:N,commands:vn,contextResult:Jl,draftKey:ge,models:ur.rows,model:ur.selected,effort:na.effort,ultracode:na.ultracode,thinking:na.thinking,switchOnFlag:na.switchOnFlag,onContextSearch:m=>Ts("side",m),onCommand:lc,onModel:m=>{m&&(Ws(H=>({...H,model:m})),Kl(H=>u({type:"control.set_model",sessionId:H,model:m})))},onEffort:m=>{Ws(H=>({...H,effort:m,ultracode:!1})),Kl(H=>u({type:"control.set_effort",sessionId:H,effort:m}))},onUltracode:m=>{Ws(H=>({...H,ultracode:m,...m?{effort:"xhigh"}:{}})),Kl(H=>u({type:"control.set_ultracode",sessionId:H,enabled:m}))},onThinking:m=>{Ws(H=>({...H,thinking:m})),Kl(H=>u({type:"control.set_thinking",sessionId:H,enabled:m}))},onSwitchOnFlag:m=>{Ws(H=>({...H,switchOnFlag:m})),Kl(H=>u({type:"control.set_flag_switch",sessionId:H,enabled:m}))},onAsk:di,onInterrupt:()=>{xu&&u({type:"control.interrupt",sessionId:xu})},onReset:fi,onClose:()=>Xi(!1),zoomed:cn==="ask",onToggleZoom:La("ask")}),ja&&cn!=="ask"&&tl("ask"),(ks||ja||_n||Js)&&a.jsx("div",{className:"scrim scrim--pane",onClick:()=>{ns(!1),Xi(!1),Fs(!1),Ps(!1)}}),$l&&a.jsx(_k,{detail:$l,local:((xn==null?void 0:xn.hasRemote)??!1)&&(xn==null?void 0:xn.commits.some(m=>m.hash===$l.hash&&!m.pushed))===!0,onCheckout:Es,onClose:()=>{kn(null),ol(null)}}),be&&a.jsxs(rs,{title:"Лимит плана почти исчерпан",onClose:()=>Xl(!1),actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",autoFocus:!0,onClick:()=>Xl(!1),children:"Отмена"}),a.jsx("button",{className:"btn btn--primary",onClick:()=>Xl(!0),children:"Отправить всё равно"})]}),children:[a.jsxs("p",{className:"modal__text",children:[rf[be.warning.limit][0].toUpperCase(),rf[be.warning.limit].slice(1)," использован на"," ",Math.round(be.warning.utilization)," %, сброс в"," ",DS(be.warning.resetsAt),". Сообщение может оборваться на полуслове, когда лимит дойдёт до 100 %."]}),a.jsx("p",{className:"modal__text modal__text--dim",children:"До сброса сессию повторно останавливать не будем."})]}),Z&&a.jsx(rs,{title:"Остановить сессию?",onClose:()=>de(null),actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>de(null),children:"Отмена"}),a.jsx("button",{className:"btn btn--warn",onClick:()=>{u({type:"session.close",sessionId:Z.id}),de(null)},children:"Остановить"})]}),children:a.jsx("p",{className:"modal__text",children:"Сессия сейчас работает — остановка прервёт текущий ход. Разговор останется на диске: открыть сессию заново или просто написать в неё снова можно в любой момент."})}),ye&&a.jsxs(rs,{title:"Переключить рабочее дерево?",onClose:()=>C(null),actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>C(null),children:"Отмена"}),a.jsx("button",{className:"btn btn--warn",onClick:Zl,children:"Переключиться"})]}),children:[a.jsxs("p",{className:"modal__text",children:["git переключится на ",ye.label,". Файлы в каталоге проекта изменятся — это тот же каталог, в котором работает агент."]}),ms&&a.jsx("p",{className:"modal__text",children:"Сейчас идёт ход агента: он читает и правит файлы прямо сейчас."}),xn&&xn.changed.length>0&&a.jsxs("p",{className:"modal__text",children:["Незакоммиченных изменений: ",xn.changed.length,". Git откажется переключаться, если они будут затёрты."]})]}),vt&&a.jsx(Mk,{status:Oe,owners:Le,files:Bt,defaultName:(Ss==null?void 0:Ss.name)??"",hasCommits:xn===null||xn.head!=="",busy:J,result:Ls,onRefreshStatus:Vn,onSaveToken:Du,onPublish:Mu,onDismissResult:()=>tn(null),onClose:()=>bn(!1)}),mn&&a.jsx(Ik,{busy:J,result:Ls,onSubmit:fo,onDismissResult:()=>tn(null),onClose:()=>zs(!1)}),Yl&&a.jsx(rs,{title:Yl.kind==="dir"?"Удалить каталог?":"Удалить файл?",onClose:()=>_a(null),actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>_a(null),children:"Отмена"}),a.jsx("button",{className:"btn btn--warn",onClick:()=>mi(Yl),children:"Удалить"})]}),children:a.jsxs("p",{className:"modal__text",children:[Yl.path," будет удалён с диска",Yl.kind==="dir"?" вместе со всем содержимым":"",". Корзины здесь нет: это тот же каталог, в котором работает агент."]})}),ei&&a.jsx(rs,{title:"Закрыть без сохранения?",onClose:()=>$n(null),actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn",onClick:()=>$n(null),children:"Отмена"}),a.jsx("button",{className:"btn btn--warn",onClick:()=>Ml(ei,!0),children:"Закрыть"}),a.jsx("button",{className:"btn btn--primary",onClick:()=>{pi(ei),Ml(ei,!0)},children:"Сохранить и закрыть"})]}),children:a.jsxs("p",{className:"modal__text",children:["В ",ei," есть несохранённые правки."]})}),it&&a.jsx(Fk,{tab:it,servers:Zt,plugins:fe,marketplaces:Ve,catalog:Cn,result:Vs,auth:js,remote:D,actions:oo,onTab:Pe,onClose:()=>Pe(null)}),Ns&&a.jsx(aS,{status:rl,login:es,actions:ar,remote:D,runningSessions:je.filter(m=>m.state==="running"||m.state==="waiting_permission").length,onReconnect:ge?()=>{yo(),Dt(!1)}:null,reconnectBlocked:ms,reconnectHint:Ia,onClose:()=>Dt(!1)}),E&&a.jsx(uS,{state:v,onPair:(m,H)=>u({type:"relay.pair",code:m,...H?{name:H}:{}}),onUnpair:()=>u({type:"relay.unpair"}),onClose:()=>A(!1)}),xt&&a.jsx(wS,{themeMode:hs,onThemeChange:Gn,settings:Jt,models:(Y==null?void 0:Y.provider)==="claude"?(dt==null?void 0:dt.models)??[]:[],relayState:v,networkState:y,local:Zd()==="local",onChange:Is,onEnableShell:()=>u({type:"relay.shell.enable"}),onDisableShell:()=>u({type:"relay.shell.disable"}),onOpenRelay:()=>{Kn(!1),A(!0)},onClose:()=>Kn(!1)}),wt&&a.jsx(lk,{candidates:Ht,searching:kt,agentItems:wn.items,agentBusy:(ln==null?void 0:ln.state)==="running",error:hn,roots:Wn,created:_e,onSearch:Ta,onAskAgent:ci,onInterrupt:()=>{const m=Fi.current;m&&u({type:"control.interrupt",sessionId:m})},onSubmit:lo,onCreate:Nu,onClose:ao}),Ot!=null&&Ot.questions&&Ot.questions.length>0?a.jsx(hy,{request:{...Ot,questions:Ot.questions},queued:gt.pending.length-1,collapsed:ac||z.view!==null,onCollapse:()=>pl(Ot.requestId,!0),onAnswer:zu,onDecline:yf}):Ot&&ta!==null?a.jsx(uy,{request:Ot,plan:ta,queued:gt.pending.length-1,collapsed:ac||z.view!==null,onCollapse:()=>pl(Ot.requestId,!0),onAccept:vf,onDecline:jf}):Ot&&a.jsx(fy,{request:Ot,queued:gt.pending.length-1,collapsed:ac||z.view!==null,onCollapse:()=>pl(Ot.requestId,!0),onDecide:sc}),us&&a.jsx(SS,{handoff:us,onClose:()=>ds(null)}),a.jsx(ek,{hub:z,workspaces:q,primary:Y,connected:h,networkBlocked:N,onFocusPrimary:()=>z.setCompareVisible(!1),onPromote:m=>{const H=Y;nr(m),H&&H.id!==m.id?z.openComparison(H):z.closeComparison()}}),a.jsx(xN,{hub:z,connected:h,workspaces:q,activeWorkspaceId:ce,activeSession:Y,providers:pn,onSelectSession:ro,onSelectWorkspace:m=>{z.setView(null),Yn(m),Fe(!1),z.setCompareVisible(!1)},onOpenWorkspace:()=>{z.setView(null),Nt(!0)},onOpenSettings:()=>{z.setView(null),tc()},onOpenFiles:()=>{z.setView(null),Fs(!0),Ps(!1),ns(!1),z.setCompareVisible(!1)},onNewSession:el,onStartStage:Pr}),a.jsx(AS,{notices:Zs,onDismiss:m=>ws(H=>H.filter(re=>re.id!==m))})]})}function sE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 4.1V3a.6.6 0 0 1 .6-.6h2.6l1.2 1.4h5a.6.6 0 0 1 .6.6v1.1"}),a.jsx("path",{d:"M2 12.6V5.7h11.4a.6.6 0 0 1 .58.75l-1.5 6.2a.6.6 0 0 1-.58.45H2.6a.6.6 0 0 1-.6-.5Z"})]})}function lE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.3"}),a.jsx("path",{d:"M13.2 13.2 10.1 10.1",strokeLinecap:"round"})]})}function aE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.9"}),a.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.9"}),a.jsx("circle",{cx:"11.5",cy:"8",r:"1.9"}),a.jsx("path",{d:"M4.5 5.4v5.2M6.4 3.9h2.2a1.6 1.6 0 0 1 1.6 1.6v.8"})]})}function iE(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,"aria-hidden":"true",children:a.jsx("rect",{x:"3.6",y:"3.6",width:"8.8",height:"8.8",rx:"1.8"})})}function rE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"1.8",y:"2.4",width:"7",height:"11.2",rx:"1.5"}),a.jsx("path",{d:"M4.1 5.7h2.4M4.1 10.3h2.4"}),a.jsx("path",{d:"M8.8 8h5.4M11.9 5.6 14.2 8l-2.3 2.4"})]})}function cE(n,l){return p_(n)===p_(l)}function p_(n){return n.replace(/[\\/]+/g,"/").replace(/\/+$/,"").toLowerCase()}function oE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"1.6",y:"2.6",width:"12.8",height:"10.8",rx:"1.7"}),a.jsx("path",{d:"M4.3 6 6.6 8l-2.3 2"}),a.jsx("path",{d:"M8.2 10h3.1"})]})}function uE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13.6 9.4a1.6 1.6 0 0 1-1.6 1.6H6.2L3.2 13.4V4.2a1.6 1.6 0 0 1 1.6-1.6h7.2a1.6 1.6 0 0 1 1.6 1.6Z"}),a.jsx("path",{d:"M8.4 8.5v-.3c0-.7.9-.9.9-1.7a1 1 0 0 0-1.9-.4"})]})}function dE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("circle",{cx:"3.2",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"12.8",cy:"8",r:"1.5"})]})}function fE(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M14 8a6 6 0 1 1-6-6c1.68 0 3.29.67 4.49 1.83L14 5.33"}),a.jsx("path",{d:"M14 2v3.33h-3.33"})]})}const Sy=document.getElementById("root");if(!Sy)throw new Error("#root not found");Z0.createRoot(Sy).render(a.jsx(b.StrictMode,{children:a.jsx(nE,{})}));export{Zj as D,un as I,fn as N,mE as P,bl as T,Gl as a,V_ as b,Ys as c,pE as d,F_ as e,ou as f,p1 as h,gE as p,xE as s,Ae as t};