(function(){const h=document.createElement("link").relList;if(h&&h.supports&&h.supports("modulepreload"))return;for(const E of document.querySelectorAll('link[rel="modulepreload"]'))T(E);new MutationObserver(E=>{for(const I of E)if(I.type==="childList")for(const B of I.addedNodes)B.tagName==="LINK"&&B.rel==="modulepreload"&&T(B)}).observe(document,{childList:!0,subtree:!0});function p(E){const I={};return E.integrity&&(I.integrity=E.integrity),E.referrerPolicy&&(I.referrerPolicy=E.referrerPolicy),E.crossOrigin==="use-credentials"?I.credentials="include":E.crossOrigin==="anonymous"?I.credentials="omit":I.credentials="same-origin",I}function T(E){if(E.ep)return;E.ep=!0;const I=p(E);fetch(E.href,I)}})();function vd(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ta={exports:{}},Do={},Ma={exports:{}},pe={};var Wc;function wf(){if(Wc)return pe;Wc=1;var a=Symbol.for("react.element"),h=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),B=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),z=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),ee=Symbol.iterator;function ne(y){return y===null||typeof y!="object"?null:(y=ee&&y[ee]||y["@@iterator"],typeof y=="function"?y:null)}var Te={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},de=Object.assign,fe={};function he(y,k,oe){this.props=y,this.context=k,this.refs=fe,this.updater=oe||Te}he.prototype.isReactComponent={},he.prototype.setState=function(y,k){if(typeof y!="object"&&typeof y!="function"&&y!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,y,k,"setState")},he.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function Qe(){}Qe.prototype=he.prototype;function Ke(y,k,oe){this.props=y,this.context=k,this.refs=fe,this.updater=oe||Te}var He=Ke.prototype=new Qe;He.constructor=Ke,de(He,he.prototype),He.isPureReactComponent=!0;var Me=Array.isArray,$=Object.prototype.hasOwnProperty,ie={current:null},je={key:!0,ref:!0,__self:!0,__source:!0};function Ue(y,k,oe){var ue,ce={},ge=null,ye=null;if(k!=null)for(ue in k.ref!==void 0&&(ye=k.ref),k.key!==void 0&&(ge=""+k.key),k)$.call(k,ue)&&!je.hasOwnProperty(ue)&&(ce[ue]=k[ue]);var xe=arguments.length-2;if(xe===1)ce.children=oe;else if(1>>1,k=R[y];if(0>>1;yE(ce,A))geE(ye,ce)?(R[y]=ye,R[ge]=A,y=ge):(R[y]=ce,R[ue]=A,y=ue);else if(geE(ye,A))R[y]=ye,R[ge]=A,y=ge;else break e}}return F}function E(R,F){var A=R.sortIndex-F.sortIndex;return A!==0?A:R.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var I=performance;a.unstable_now=function(){return I.now()}}else{var B=Date,ae=B.now();a.unstable_now=function(){return B.now()-ae}}var re=[],z=[],Z=1,ee=null,ne=3,Te=!1,de=!1,fe=!1,he=typeof setTimeout=="function"?setTimeout:null,Qe=typeof clearTimeout=="function"?clearTimeout:null,Ke=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function He(R){for(var F=p(z);F!==null;){if(F.callback===null)T(z);else if(F.startTime<=R)T(z),F.sortIndex=F.expirationTime,h(re,F);else break;F=p(z)}}function Me(R){if(fe=!1,He(R),!de)if(p(re)!==null)de=!0,se($);else{var F=p(z);F!==null&&te(Me,F.startTime-R)}}function $(R,F){de=!1,fe&&(fe=!1,Qe(Ue),Ue=-1),Te=!0;var A=ne;try{for(He(F),ee=p(re);ee!==null&&(!(ee.expirationTime>F)||R&&!Bt());){var y=ee.callback;if(typeof y=="function"){ee.callback=null,ne=ee.priorityLevel;var k=y(ee.expirationTime<=F);F=a.unstable_now(),typeof k=="function"?ee.callback=k:ee===p(re)&&T(re),He(F)}else T(re);ee=p(re)}if(ee!==null)var oe=!0;else{var ue=p(z);ue!==null&&te(Me,ue.startTime-F),oe=!1}return oe}finally{ee=null,ne=A,Te=!1}}var ie=!1,je=null,Ue=-1,ht=5,ut=-1;function Bt(){return!(a.unstable_now()-utR||125y?(R.sortIndex=A,h(z,R),p(re)===null&&R===p(z)&&(fe?(Qe(Ue),Ue=-1):fe=!0,te(Me,A-y))):(R.sortIndex=k,h(re,R),de||Te||(de=!0,se($))),R},a.unstable_shouldYield=Bt,a.unstable_wrapCallback=function(R){var F=ne;return function(){var A=ne;ne=F;try{return R.apply(this,arguments)}finally{ne=A}}}})(La)),La}var Yc;function Ef(){return Yc||(Yc=1,Aa.exports=Nf()),Aa.exports}var Xc;function Pf(){if(Xc)return bt;Xc=1;var a=Qa(),h=Ef();function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),re=Object.prototype.hasOwnProperty,z=/^[: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]*$/,Z={},ee={};function ne(e){return re.call(ee,e)?!0:re.call(Z,e)?!1:z.test(e)?ee[e]=!0:(Z[e]=!0,!1)}function Te(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function de(e,t,n,r){if(t===null||typeof t>"u"||Te(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function fe(e,t,n,r,s,l,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=u}var he={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){he[e]=new fe(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];he[t]=new fe(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){he[e]=new fe(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){he[e]=new fe(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){he[e]=new fe(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){he[e]=new fe(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){he[e]=new fe(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){he[e]=new fe(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){he[e]=new fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Qe=/[\-:]([a-z])/g;function Ke(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Qe,Ke);he[t]=new fe(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Qe,Ke);he[t]=new fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Qe,Ke);he[t]=new fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){he[e]=new fe(e,1,!1,e.toLowerCase(),null,!1,!1)}),he.xlinkHref=new fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){he[e]=new fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function He(e,t,n,r){var s=he.hasOwnProperty(t)?he[t]:null;(s!==null?s.type!==0:r||!(2f||s[u]!==l[f]){var m=` `+s[u].replace(" at new "," at ");return e.displayName&&m.includes("")&&(m=m.replace("",e.displayName)),m}while(1<=u&&0<=f);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?k(e):""}function ce(e){switch(e.tag){case 5:return k(e.type);case 16:return k("Lazy");case 13:return k("Suspense");case 19:return k("SuspenseList");case 0:case 2:case 15:return e=ue(e.type,!1),e;case 11:return e=ue(e.type.render,!1),e;case 1:return e=ue(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case je:return"Fragment";case ie:return"Portal";case ht:return"Profiler";case Ue:return"StrictMode";case b:return"Suspense";case Re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bt:return(e.displayName||"Context")+".Consumer";case ut:return(e._context.displayName||"Context")+".Provider";case ct:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ge:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case se:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function ye(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(t);case 8:return t===Ue?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dt(e){var t=Se(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(u){r=""+u,l.call(this,u)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function sn(e){e._valueTracker||(e._valueTracker=dt(e))}function gr(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Se(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ln(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}}function xn(e,t){var n=t.checked;return A({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ee(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=xe(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Qt(e,t){t=t.checked,t!=null&&He(e,"checked",t,!1)}function st(e,t){Qt(e,t);var n=xe(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?jt(e,t.type,n):t.hasOwnProperty("defaultValue")&&jt(e,t.type,xe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gt(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function jt(e,t,n){(t!=="number"||Ln(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _n=Array.isArray;function G(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Dn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Je={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},vs=["Webkit","ms","Moz","O"];Object.keys(Je).forEach(function(e){vs.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Je[t]=Je[e]})});function Ze(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Je.hasOwnProperty(e)&&Je[e]?(""+t).trim():t+"px"}function Zn(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Ze(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var yr=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function on(e,t){if(t){if(yr[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(p(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(p(61))}if(t.style!=null&&typeof t.style!="object")throw Error(p(62))}}function On(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Rt=null;function Sn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ht=null,Y=null,ln=null;function er(e){if(e=_o(e)){if(typeof Ht!="function")throw Error(p(280));var t=e.stateNode;t&&(t=ol(t),Ht(e.stateNode,e.type,t))}}function Hr(e){Y?ln?ln.push(e):ln=[e]:Y=e}function Vr(){if(Y){var e=Y,t=ln;if(ln=Y=null,er(e),t)for(e=0;e>>=0,e===0?32:31-(tr(e)/ti|0)|0}var Ss=64,kn=4194304;function nr(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Zr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,u=n&268435455;if(u!==0){var f=u&~s;f!==0?r=nr(f):(l&=u,l!==0&&(r=nr(l)))}else u=n&~s,u!==0?r=nr(u):l!==0&&(r=nr(l));if(r===0)return 0;if(t!==0&&t!==r&&(t&s)===0&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function kr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Wt(t),e[t]=n}function jr(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Pr),fo=" ",i=!1;function c(e,t){switch(e){case"keyup":return Yo.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function d(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var w=!1;function L(e,t){switch(e){case"compositionend":return d(t);case"keypress":return t.which!==32?null:(i=!0,fo);case"textInput":return e=t.data,e===fo&&i?null:e;default:return null}}function Ne(e,t){if(w)return e==="compositionend"||!uo&&c(e,t)?(e=bo(),Cs=oo=Zt=null,w=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ka(n)}}function Ya(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ya(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Xa(){for(var e=window,t=Ln();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ln(e.document)}return t}function fi(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")}function Pd(e){var t=Xa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ya(n.ownerDocument.documentElement,n)){if(r!==null&&fi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=Ja(n,l);var u=Ja(n,r);s&&u&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ls=null,pi=null,ho=null,mi=!1;function Za(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;mi||Ls==null||Ls!==Ln(r)||(r=Ls,"selectionStart"in r&&fi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ho&&mo(ho,r)||(ho=r,r=nl(pi,"onSelect"),0$s||(e.current=Ni[$s],Ni[$s]=null,$s--)}function Ie(e,t){$s++,Ni[$s]=e.current,e.current=t}var Lr={},xt=Ar(Lr),Ot=Ar(!1),ls=Lr;function Fs(e,t){var n=e.type.contextTypes;if(!n)return Lr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function zt(e){return e=e.childContextTypes,e!=null}function ll(){$e(Ot),$e(xt)}function mu(e,t,n){if(xt.current!==Lr)throw Error(p(168));Ie(xt,t),Ie(Ot,n)}function hu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(p(108,ye(e)||"Unknown",s));return A({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Lr,ls=xt.current,Ie(xt,e),Ie(Ot,Ot.current),!0}function gu(e,t,n){var r=e.stateNode;if(!r)throw Error(p(169));n?(e=hu(e,t,ls),r.__reactInternalMemoizedMergedChildContext=e,$e(Ot),$e(xt),Ie(xt,e)):$e(Ot),Ie(Ot,n)}var ur=null,al=!1,Ei=!1;function vu(e){ur===null?ur=[e]:ur.push(e)}function Ud(e){al=!0,vu(e)}function Ir(){if(!Ei&&ur!==null){Ei=!0;var e=0,t=Q;try{var n=ur;for(Q=1;e>=u,s-=u,cr=1<<32-Wt(t)+s|n<le?(at=J,J=null):at=J.sibling;var ke=j(x,J,_[le],M);if(ke===null){J===null&&(J=at);break}e&&J&&ke.alternate===null&&t(x,J),v=l(ke,v,le),K===null?W=ke:K.sibling=ke,K=ke,J=at}if(le===_.length)return n(x,J),Fe&&as(x,le),W;if(J===null){for(;le<_.length;le++)J=P(x,_[le],M),J!==null&&(v=l(J,v,le),K===null?W=J:K.sibling=J,K=J);return Fe&&as(x,le),W}for(J=r(x,J);le<_.length;le++)at=D(J,x,le,_[le],M),at!==null&&(e&&at.alternate!==null&&J.delete(at.key===null?le:at.key),v=l(at,v,le),K===null?W=at:K.sibling=at,K=at);return e&&J.forEach(function(Qr){return t(x,Qr)}),Fe&&as(x,le),W}function H(x,v,_,M){var W=F(_);if(typeof W!="function")throw Error(p(150));if(_=W.call(_),_==null)throw Error(p(151));for(var K=W=null,J=v,le=v=0,at=null,ke=_.next();J!==null&&!ke.done;le++,ke=_.next()){J.index>le?(at=J,J=null):at=J.sibling;var Qr=j(x,J,ke.value,M);if(Qr===null){J===null&&(J=at);break}e&&J&&Qr.alternate===null&&t(x,J),v=l(Qr,v,le),K===null?W=Qr:K.sibling=Qr,K=Qr,J=at}if(ke.done)return n(x,J),Fe&&as(x,le),W;if(J===null){for(;!ke.done;le++,ke=_.next())ke=P(x,ke.value,M),ke!==null&&(v=l(ke,v,le),K===null?W=ke:K.sibling=ke,K=ke);return Fe&&as(x,le),W}for(J=r(x,J);!ke.done;le++,ke=_.next())ke=D(J,x,le,ke.value,M),ke!==null&&(e&&ke.alternate!==null&&J.delete(ke.key===null?le:ke.key),v=l(ke,v,le),K===null?W=ke:K.sibling=ke,K=ke);return e&&J.forEach(function(Sf){return t(x,Sf)}),Fe&&as(x,le),W}function qe(x,v,_,M){if(typeof _=="object"&&_!==null&&_.type===je&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case $:e:{for(var W=_.key,K=v;K!==null;){if(K.key===W){if(W=_.type,W===je){if(K.tag===7){n(x,K.sibling),v=s(K,_.props.children),v.return=x,x=v;break e}}else if(K.elementType===W||typeof W=="object"&&W!==null&&W.$$typeof===se&&ku(W)===K.type){n(x,K.sibling),v=s(K,_.props),v.ref=So(x,K,_),v.return=x,x=v;break e}n(x,K);break}else t(x,K);K=K.sibling}_.type===je?(v=gs(_.props.children,x.mode,M,_.key),v.return=x,x=v):(M=Ol(_.type,_.key,_.props,null,x.mode,M),M.ref=So(x,v,_),M.return=x,x=M)}return u(x);case ie:e:{for(K=_.key;v!==null;){if(v.key===K)if(v.tag===4&&v.stateNode.containerInfo===_.containerInfo&&v.stateNode.implementation===_.implementation){n(x,v.sibling),v=s(v,_.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=ja(_,x.mode,M),v.return=x,x=v}return u(x);case se:return K=_._init,qe(x,v,K(_._payload),M)}if(_n(_))return U(x,v,_,M);if(F(_))return H(x,v,_,M);fl(x,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,_),v.return=x,x=v):(n(x,v),v=ka(_,x.mode,M),v.return=x,x=v),u(x)):n(x,v)}return qe}var Qs=ju(!0),Cu=ju(!1),pl=Ar(null),ml=null,Hs=null,Li=null;function Ii(){Li=Hs=ml=null}function Di(e){var t=pl.current;$e(pl),e._currentValue=t}function Oi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Vs(e,t){ml=e,Li=Hs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&($t=!0),e.firstContext=null)}function mn(e){var t=e._currentValue;if(Li!==e)if(e={context:e,memoizedValue:t,next:null},Hs===null){if(ml===null)throw Error(p(308));Hs=e,ml.dependencies={lanes:0,firstContext:e}}else Hs=Hs.next=e;return t}var us=null;function zi(e){us===null?us=[e]:us.push(e)}function Nu(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,zi(t)):(n.next=s.next,s.next=n),t.interleaved=n,fr(e,r)}function fr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Dr=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Eu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Or(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(_e&2)!==0){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,fr(e,n)}return s=r.interleaved,s===null?(t.next=t,zi(r)):(t.next=s.next,s.next=t),r.interleaved=t,fr(e,n)}function hl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ws(e,n)}}function Pu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var u={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=u:l=l.next=u,n=n.next}while(n!==null);l===null?s=l=t:l=l.next=t}else s=l=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function gl(e,t,n,r){var s=e.updateQueue;Dr=!1;var l=s.firstBaseUpdate,u=s.lastBaseUpdate,f=s.shared.pending;if(f!==null){s.shared.pending=null;var m=f,S=m.next;m.next=null,u===null?l=S:u.next=S,u=m;var N=e.alternate;N!==null&&(N=N.updateQueue,f=N.lastBaseUpdate,f!==u&&(f===null?N.firstBaseUpdate=S:f.next=S,N.lastBaseUpdate=m))}if(l!==null){var P=s.baseState;u=0,N=S=m=null,f=l;do{var j=f.lane,D=f.eventTime;if((r&j)===j){N!==null&&(N=N.next={eventTime:D,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var U=e,H=f;switch(j=t,D=n,H.tag){case 1:if(U=H.payload,typeof U=="function"){P=U.call(D,P,j);break e}P=U;break e;case 3:U.flags=U.flags&-65537|128;case 0:if(U=H.payload,j=typeof U=="function"?U.call(D,P,j):U,j==null)break e;P=A({},P,j);break e;case 2:Dr=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,j=s.effects,j===null?s.effects=[f]:j.push(f))}else D={eventTime:D,lane:j,tag:f.tag,payload:f.payload,callback:f.callback,next:null},N===null?(S=N=D,m=P):N=N.next=D,u|=j;if(f=f.next,f===null){if(f=s.shared.pending,f===null)break;j=f,f=j.next,j.next=null,s.lastBaseUpdate=j,s.shared.pending=null}}while(!0);if(N===null&&(m=P),s.baseState=m,s.firstBaseUpdate=S,s.lastBaseUpdate=N,t=s.shared.interleaved,t!==null){s=t;do u|=s.lane,s=s.next;while(s!==t)}else l===null&&(s.shared.lanes=0);fs|=u,e.lanes=u,e.memoizedState=P}}function Tu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Qi.transition;Qi.transition={};try{e(!1),t()}finally{Q=n,Qi.transition=r}}function qu(){return hn().memoizedState}function Hd(e,t,n){var r=Ur(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ku(e))Ju(t,n);else if(n=Nu(e,t,n,r),n!==null){var s=Tt();An(n,e,r,s),Yu(n,t,r)}}function Vd(e,t,n){var r=Ur(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ku(e))Ju(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var u=t.lastRenderedState,f=l(u,n);if(s.hasEagerState=!0,s.eagerState=f,En(f,u)){var m=t.interleaved;m===null?(s.next=s,zi(t)):(s.next=m.next,m.next=s),t.interleaved=s;return}}catch{}n=Nu(e,t,s,r),n!==null&&(s=Tt(),An(n,e,r,s),Yu(n,t,r))}}function Ku(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function Ju(e,t){Co=xl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Yu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ws(e,n)}}var wl={readContext:mn,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},Wd={readContext:mn,useCallback:function(e,t){return Yn().memoizedState=[e,t===void 0?null:t],e},useContext:mn,useEffect:Uu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_l(4194308,4,Qu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _l(4194308,4,e,t)},useInsertionEffect:function(e,t){return _l(4,2,e,t)},useMemo:function(e,t){var n=Yn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Yn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Hd.bind(null,Be,e),[r.memoizedState,e]},useRef:function(e){var t=Yn();return e={current:e},t.memoizedState=e},useState:$u,useDebugValue:Ji,useDeferredValue:function(e){return Yn().memoizedState=e},useTransition:function(){var e=$u(!1),t=e[0];return e=Qd.bind(null,e[1]),Yn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Be,s=Yn();if(Fe){if(n===void 0)throw Error(p(407));n=n()}else{if(n=t(),it===null)throw Error(p(349));(ds&30)!==0||Lu(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,Uu(Du.bind(null,r,l,e),[e]),r.flags|=2048,Po(9,Iu.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Yn(),t=it.identifierPrefix;if(Fe){var n=dr,r=cr;n=(r&~(1<<32-Wt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=No++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=u.createElement(n,{is:r.is}):(e=u.createElement(n),n==="select"&&(u=e,r.multiple?u.multiple=!0:r.size&&(u.size=r.size))):e=u.createElementNS(e,n),e[Kn]=t,e[xo]=r,vc(e,t,!1,!1),t.stateNode=e;e:{switch(u=On(n,r),n){case"dialog":ze("cancel",e),ze("close",e),s=r;break;case"iframe":case"object":case"embed":ze("load",e),s=r;break;case"video":case"audio":for(s=0;sJs&&(t.flags|=128,r=!0,To(l,!1),t.lanes=4194304)}else{if(!r)if(e=vl(u),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),To(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Fe)return St(t),null}else 2*De()-l.renderingStartTime>Js&&n!==1073741824&&(t.flags|=128,r=!0,To(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(n=l.last,n!==null?n.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=De(),t.sibling=null,n=be.current,Ie(be,r?n&1|2:n&1),t):(St(t),null);case 22:case 23:return _a(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(rn&1073741824)!==0&&(St(t),t.subtreeFlags&6&&(t.flags|=8192)):St(t),null;case 24:return null;case 25:return null}throw Error(p(156,t.tag))}function ef(e,t){switch(Ti(t),t.tag){case 1:return zt(t.type)&&ll(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ws(),$e(Ot),$e(xt),Bi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ui(t),null;case 13:if($e(be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(p(340));Bs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(be),null;case 4:return Ws(),null;case 10:return Di(t.type._context),null;case 22:case 23:return _a(),null;case 24:return null;default:return null}}var Nl=!1,wt=!1,tf=typeof WeakSet=="function"?WeakSet:Set,O=null;function qs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){We(e,t,r)}else n.current=null}function aa(e,t,n){try{n()}catch(r){We(e,t,r)}}var _c=!1;function nf(e,t){if(_i=Nr,e=Xa(),fi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var u=0,f=-1,m=-1,S=0,N=0,P=e,j=null;t:for(;;){for(var D;P!==n||s!==0&&P.nodeType!==3||(f=u+s),P!==l||r!==0&&P.nodeType!==3||(m=u+r),P.nodeType===3&&(u+=P.nodeValue.length),(D=P.firstChild)!==null;)j=P,P=D;for(;;){if(P===e)break t;if(j===n&&++S===s&&(f=u),j===l&&++N===r&&(m=u),(D=P.nextSibling)!==null)break;P=j,j=P.parentNode}P=D}n=f===-1||m===-1?null:{start:f,end:m}}else n=null}n=n||{start:0,end:0}}else n=null;for(Si={focusedElem:e,selectionRange:n},Nr=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var U=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(U!==null){var H=U.memoizedProps,qe=U.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?H:Tn(t.type,H),qe);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(M){We(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return U=_c,_c=!1,U}function Mo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&aa(t,n,l)}s=s.next}while(s!==r)}}function El(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ua(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function Sc(e){var t=e.alternate;t!==null&&(e.alternate=null,Sc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kn],delete t[xo],delete t[Ci],delete t[$d],delete t[Fd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wc(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.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 ca(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(e=e.child,e!==null))for(ca(e,t,n),e=e.sibling;e!==null;)ca(e,t,n),e=e.sibling}function da(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(da(e,t,n),e=e.sibling;e!==null;)da(e,t,n),e=e.sibling}var pt=null,Mn=!1;function zr(e,t,n){for(n=n.child;n!==null;)jc(e,t,n),n=n.sibling}function jc(e,t,n){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(Yr,n)}catch{}switch(n.tag){case 5:wt||qs(n,t);case 6:var r=pt,s=Mn;pt=null,zr(e,t,n),pt=r,Mn=s,pt!==null&&(Mn?(e=pt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pt.removeChild(n.stateNode));break;case 18:pt!==null&&(Mn?(e=pt,n=n.stateNode,e.nodeType===8?ji(e.parentNode,n):e.nodeType===1&&ji(e,n),Et(e)):ji(pt,n.stateNode));break;case 4:r=pt,s=Mn,pt=n.stateNode.containerInfo,Mn=!0,zr(e,t,n),pt=r,Mn=s;break;case 0:case 11:case 14:case 15:if(!wt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,u=l.destroy;l=l.tag,u!==void 0&&((l&2)!==0||(l&4)!==0)&&aa(n,t,u),s=s.next}while(s!==r)}zr(e,t,n);break;case 1:if(!wt&&(qs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){We(n,t,f)}zr(e,t,n);break;case 21:zr(e,t,n);break;case 22:n.mode&1?(wt=(r=wt)||n.memoizedState!==null,zr(e,t,n),wt=r):zr(e,t,n);break;default:zr(e,t,n)}}function Cc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new tf),t.forEach(function(r){var s=ff.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Rn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=u),r&=~l}if(r=s,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sf(r/1960))-r,10e?16:e,Fr===null)var r=!1;else{if(e=Fr,Fr=null,Al=0,(_e&6)!==0)throw Error(p(331));var s=_e;for(_e|=4,O=e.current;O!==null;){var l=O,u=l.child;if((O.flags&16)!==0){var f=l.deletions;if(f!==null){for(var m=0;mDe()-ma?ms(e,0):pa|=n),Ut(e,t)}function $c(e,t){t===0&&((e.mode&1)===0?t=1:(t=kn,kn<<=1,(kn&130023424)===0&&(kn=4194304)));var n=Tt();e=fr(e,t),e!==null&&(kr(e,t,n),Ut(e,n))}function df(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$c(e,n)}function ff(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(p(314))}r!==null&&r.delete(t),$c(e,n)}var Fc;Fc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ot.current)$t=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return $t=!1,Xd(e,t,n);$t=(e.flags&131072)!==0}else $t=!1,Fe&&(t.flags&1048576)!==0&&yu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Cl(e,t),e=t.pendingProps;var s=Fs(t,xt.current);Vs(t,n),s=Vi(null,t,r,e,s,n);var l=Wi();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,zt(r)?(l=!0,il(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,$i(t),s.updater=kl,t.stateNode=s,s._reactInternals=t,Xi(t,r,e,n),t=na(null,t,r,!0,l,n)):(t.tag=0,Fe&&l&&Pi(t),Pt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Cl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=mf(r),e=Tn(r,e),s){case 0:t=ta(null,t,r,e,n);break e;case 1:t=dc(null,t,r,e,n);break e;case 11:t=lc(null,t,r,e,n);break e;case 14:t=ic(null,t,r,Tn(r.type,e),n);break e}throw Error(p(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),ta(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),dc(e,t,r,s,n);case 3:e:{if(fc(t),e===null)throw Error(p(387));r=t.pendingProps,l=t.memoizedState,s=l.element,Eu(e,t),gl(t,r,null,n);var u=t.memoizedState;if(r=u.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=Gs(Error(p(423)),t),t=pc(e,t,r,n,s);break e}else if(r!==s){s=Gs(Error(p(424)),t),t=pc(e,t,r,n,s);break e}else for(nn=Rr(t.stateNode.containerInfo.firstChild),tn=t,Fe=!0,Pn=null,n=Cu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Bs(),r===s){t=mr(e,t,n);break e}Pt(e,t,r,n)}t=t.child}return t;case 5:return Mu(t),e===null&&Ri(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,u=s.children,wi(r,s)?u=null:l!==null&&wi(r,l)&&(t.flags|=32),cc(e,t),Pt(e,t,u,n),t.child;case 6:return e===null&&Ri(t),null;case 13:return mc(e,t,n);case 4:return Fi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qs(t,null,r,n):Pt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),lc(e,t,r,s,n);case 7:return Pt(e,t,t.pendingProps,n),t.child;case 8:return Pt(e,t,t.pendingProps.children,n),t.child;case 12:return Pt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,u=s.value,Ie(pl,r._currentValue),r._currentValue=u,l!==null)if(En(l.value,u)){if(l.children===s.children&&!Ot.current){t=mr(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var f=l.dependencies;if(f!==null){u=l.child;for(var m=f.firstContext;m!==null;){if(m.context===r){if(l.tag===1){m=pr(-1,n&-n),m.tag=2;var S=l.updateQueue;if(S!==null){S=S.shared;var N=S.pending;N===null?m.next=m:(m.next=N.next,N.next=m),S.pending=m}}l.lanes|=n,m=l.alternate,m!==null&&(m.lanes|=n),Oi(l.return,n,t),f.lanes|=n;break}m=m.next}}else if(l.tag===10)u=l.type===t.type?null:l.child;else if(l.tag===18){if(u=l.return,u===null)throw Error(p(341));u.lanes|=n,f=u.alternate,f!==null&&(f.lanes|=n),Oi(u,n,t),u=l.sibling}else u=l.child;if(u!==null)u.return=l;else for(u=l;u!==null;){if(u===t){u=null;break}if(l=u.sibling,l!==null){l.return=u.return,u=l;break}u=u.return}l=u}Pt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Vs(t,n),s=mn(s),r=r(s),t.flags|=1,Pt(e,t,r,n),t.child;case 14:return r=t.type,s=Tn(r,t.pendingProps),s=Tn(r.type,s),ic(e,t,r,s,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tn(r,s),Cl(e,t),t.tag=1,zt(r)?(e=!0,il(t)):e=!1,Vs(t,n),Zu(t,r,s),Xi(t,r,s,n),na(null,t,r,!0,e,n);case 19:return gc(e,t,n);case 22:return uc(e,t,n)}throw Error(p(156,t.tag))};function Uc(e,t){return Vt(e,t)}function pf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vn(e,t,n,r){return new pf(e,t,n,r)}function wa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mf(e){if(typeof e=="function")return wa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ct)return 11;if(e===Ge)return 14}return 2}function Br(e,t){var n=e.alternate;return n===null?(n=vn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ol(e,t,n,r,s,l){var u=2;if(r=e,typeof e=="function")wa(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case je:return gs(n.children,s,l,t);case Ue:u=8,s|=8;break;case ht:return e=vn(12,n,t,s|2),e.elementType=ht,e.lanes=l,e;case b:return e=vn(13,n,t,s),e.elementType=b,e.lanes=l,e;case Re:return e=vn(19,n,t,s),e.elementType=Re,e.lanes=l,e;case te:return zl(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ut:u=10;break e;case Bt:u=9;break e;case ct:u=11;break e;case Ge:u=14;break e;case se:u=16,r=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return t=vn(u,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function gs(e,t,n,r){return e=vn(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=vn(22,e,r,t),e.elementType=te,e.lanes=n,e.stateNode={isHidden:!1},e}function ka(e,t,n){return e=vn(6,e,null,t),e.lanes=n,e}function ja(e,t,n){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hf(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qn(0),this.expirationTimes=Qn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qn(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ca(e,t,n,r,s,l,u,f,m){return e=new hf(e,t,n,f,m),t===1?(t=1,l===!0&&(t|=8)):t=0,l=vn(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(l),e}function gf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(h){console.error(h)}}return a(),Ra.exports=Pf(),Ra.exports}var ed;function Mf(){if(ed)return Hl;ed=1;var a=Tf();return Hl.createRoot=a.createRoot,Hl.hydrateRoot=a.hydrateRoot,Hl}var Rf=Mf();const Af=vd(Rf),Lf="/api";async function ve(a,h){const p=await fetch(`${Lf}${a}`,{...h,headers:{"Content-Type":"application/json",...h?.headers??{}}}),T=await p.json();if(!p.ok){const E=T.error?.message??"Ошибка запроса";throw new Error(E)}return T}const Pe={async loadSharedConnectionConfig(){return ve("/llm/shared-connection")},async saveSharedConnectionConfig(a){return ve("/llm/shared-connection",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,model:a.model,baseUrl:a.baseUrl,temperature:a.temperature,maxOutputTokens:a.maxOutputTokens})})},async listModels(a){return ve("/llm/models",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async testConnection(a){return ve("/llm/test-connection",{method:"POST",body:JSON.stringify({llmProvider:a.llmProvider,apiKey:a.apiKey,model:a.model,baseUrl:a.baseUrl})})},async normalize(a){return ve("/normalize",{method:"POST",body:JSON.stringify({llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,userQuestion:a.query.userQuestion,context:{period_hint:a.query.periodHint??"",business_context:a.query.businessContext??"",expected_route:a.query.expectedRoute??""},saveAsTestCase:!!a.saveAsTestCase,useMock:!!a.useMock})})},async loadHistory(){return ve("/history")},async loadTrace(a){return ve(`/history/${a}`)},async loadPresets(){return ve("/presets")},async savePreset(a){return ve("/presets/save",{method:"POST",body:JSON.stringify(a)})},async runEval(a){return ve("/eval/run",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples},caseIds:a.caseIds,useMock:!!a.useMock,mode:a.mode??"standard",caseSetFile:a.caseSetFile,rawQuestions:a.rawQuestions,eval_target:a.evalTarget,compare_with_report_file:a.compareWithReportFile,analysis_date:a.analysisDate})})},async startEvalRunAsync(a){return ve("/eval/run-async/start",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion,systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples},caseIds:a.caseIds,useMock:!!a.useMock,mode:a.mode??"standard",caseSetFile:a.caseSetFile,rawQuestions:a.rawQuestions,eval_target:a.evalTarget,compare_with_report_file:a.compareWithReportFile,questions:a.questions,scenarioQuestions:a.scenarioQuestions,scenarioTitle:a.scenarioTitle,analysis_date:a.analysisDate})})},async loadEvalRunAsyncStatus(a){return ve(`/eval/run-async/${encodeURIComponent(a)}`)},async startRun(){return ve("/accounting-agent/v1/runs/start",{method:"POST",body:JSON.stringify({initiator:"ndc_operator",source:"gui"})})},async finishRun(a){return ve("/accounting-agent/v1/runs/finish",{method:"POST",body:JSON.stringify({runId:a,status:"DONE",source:"gui",reason:"Остановлено оператором из GUI"})})},async listRuns(){return ve("/accounting-agent/v1/runs")},async listResults(){return ve("/accounting-agent/v1/results")},async runTrace(a){return ve(`/accounting-agent/v1/trace/run/${a}`)},async sendAssistantMessage(a){return ve("/assistant/message",{method:"POST",body:JSON.stringify({session_id:a.sessionId??"",mode:"assistant",message:a.userMessage,user_message:a.userMessage,llmProvider:a.connection.llmProvider,apiKey:a.connection.apiKey,model:a.connection.model,baseUrl:a.connection.baseUrl,temperature:a.connection.temperature,maxOutputTokens:a.connection.maxOutputTokens,promptVersion:a.promptVersion??"address_query_runtime_v1",systemPrompt:a.prompts.systemPrompt,developerPrompt:a.prompts.developerPrompt,domainPrompt:a.prompts.domainPrompt,fewShotExamples:a.prompts.fewShotExamples,context:{period_hint:a.context?.periodHint??"",business_context:a.context?.businessContext??""},useMock:!!a.useMock})})},async loadAssistantSession(a){return ve(`/assistant/session/${a}`)},async saveAutoRunAssistantSession(a){return ve("/autoruns/autogen/save-assistant-session",{method:"POST",body:JSON.stringify(a)})},async loadAssistantAnnotations(a){const h=new URLSearchParams;a?.session_id&&h.set("session_id",a.session_id),typeof a?.limit=="number"&&h.set("limit",String(a.limit));const p=h.toString();return ve(`/assistant/annotations${p?`?${p}`:""}`)},async saveAssistantAnnotation(a){return ve("/assistant/annotations",{method:"POST",body:JSON.stringify(a)})},async loadAutoRunsHistory(a){const h=new URLSearchParams;a?.from&&h.set("from",a.from),a?.to&&h.set("to",a.to),a?.target&&h.set("target",a.target),a?.mode&&h.set("mode",a.mode),a?.use_mock&&h.set("use_mock",a.use_mock),a?.prompt_contains&&h.set("prompt_contains",a.prompt_contains),typeof a?.limit=="number"&&h.set("limit",String(a.limit)),typeof a?.scan_limit=="number"&&h.set("scan_limit",String(a.scan_limit));const p=h.toString();return ve(`/autoruns/history${p?`?${p}`:""}`)},async loadAutoRunDetail(a){return ve(`/autoruns/history/${encodeURIComponent(a)}`)},async loadAutoRunCaseDialog(a,h){return ve(`/autoruns/history/${encodeURIComponent(a)}/case/${encodeURIComponent(h)}/dialog`)},async loadAutoRunAnnotations(a){const h=new URLSearchParams;a?.run_id&&h.set("run_id",a.run_id),a?.case_id&&h.set("case_id",a.case_id),typeof a?.min_rating=="number"&&h.set("min_rating",String(a.min_rating)),a?.manual_case_decision&&h.set("manual_case_decision",a.manual_case_decision),typeof a?.limit=="number"&&h.set("limit",String(a.limit));const p=h.toString();return ve(`/autoruns/annotations${p?`?${p}`:""}`)},async saveAutoRunAnnotation(a){return ve("/autoruns/annotations",{method:"POST",body:JSON.stringify(a)})},async updateAutoRunAnnotation(a){return ve(`/autoruns/annotations/${encodeURIComponent(a.annotation_id)}`,{method:"PATCH",body:JSON.stringify({resolved:a.resolved,resolved_by:a.resolved_by})})},async loadAutoRunPostAnalysis(a){const h=new URLSearchParams;a?.run_id&&h.set("run_id",a.run_id),typeof a?.limit_per_queue=="number"&&h.set("limit_per_queue",String(a.limit_per_queue)),typeof a?.annotation_limit=="number"&&h.set("annotation_limit",String(a.annotation_limit)),typeof a?.scan_limit=="number"&&h.set("scan_limit",String(a.scan_limit)),a?.from&&h.set("from",a.from),a?.to&&h.set("to",a.to),a?.target&&h.set("target",a.target),a?.mode&&h.set("mode",a.mode),a?.use_mock&&h.set("use_mock",a.use_mock),a?.prompt_contains&&h.set("prompt_contains",a.prompt_contains);const p=h.toString();return ve(`/autoruns/post-analysis${p?`?${p}`:""}`)},async loadAutoRunAutogenHistory(a){const h=new URLSearchParams;a?.mode&&h.set("mode",a.mode),typeof a?.limit=="number"&&h.set("limit",String(a.limit));const p=h.toString();return ve(`/autoruns/autogen/history${p?`?${p}`:""}`)},async loadAutoRunAutogenPersonalityCatalog(){return ve("/autoruns/autogen/personality-catalog")},async updateAutoRunAutogenQuestions(a){return ve(`/autoruns/autogen/history/${encodeURIComponent(a.generation_id)}/questions`,{method:"PATCH",body:JSON.stringify({questions:a.questions})})},async deleteAutoRunAutogenHistoryRecord(a){return ve(`/autoruns/autogen/history/${encodeURIComponent(a)}`,{method:"DELETE"})},async generateAutoRunQuestions(a){return ve("/autoruns/autogen/generate",{method:"POST",body:JSON.stringify(a)})}},If=/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json|debug_payload|technical_breakdown)\b/i,Df=[/\b(?:debug_payload_json|technical_breakdown_json)\b/i,/\b(?:route_summary|semantic_profile|domain_scope|relation_patterns|account_scope)\b/i,/\b(?:coverage_report|retrieval_status|problem_unit_state|candidate_evidence)\b/i,/\b(?:graph_domain_scope|graph_runtime|selection_reason|why_included)\b/i];function Of(a){try{return JSON.stringify(a,null,2)}catch{return String(a)}}function zf(a){const h=String(a??""),p=h.match(If);return(p?h.slice(0,p.index):h).replace(/###\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)[\s\S]*?(?:```[\s\S]*?```|$)/gi,"").replace(/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)\b[\s\S]*$/gi,"").split(/\r?\n/g).map(B=>B.trimEnd()).filter(B=>B.trim().length>0).filter(B=>!Df.some(ae=>ae.test(B))).join(` `).trim()}function $f(a,h,p="default"){const T=p==="technical",E=[];E.push("# Assistant conversation export"),E.push(`session_id: ${a||"n/a"}`),E.push(`export_mode: ${p}`),E.push(`exported_at: ${new Date().toISOString()}`),E.push("");for(let I=0;I{E.length!==0&&(T.push(E.join(` `)),E=[])};for(const B of p){const ae=B.trimEnd(),re=ae.trim();if(!re){I();continue}const z=/^Блок\s+\d+\./i.test(re),Z=/^\d+\.\s/.test(re);(z||Z)&&E.length>0&&I(),E.push(ae)}return I(),T.length>0?T:[a]}function Vf(a,h){const p=[],T=/\*\*(.+?)\*\*/g;let E=0,I=0,B;for(;(B=T.exec(a))!==null;)B.index>E&&(p.push(o.jsx("span",{children:a.slice(E,B.index)},`${h}-t-${I}`)),I+=1),p.push(o.jsx("strong",{children:B[1]},`${h}-b-${I}`)),I+=1,E=T.lastIndex;return E0?p:[o.jsx("span",{children:a},`${h}-raw`)]}function Wf(a){const h=a.trimStart();return/^Блок\s+\d+\./i.test(h)?"assistant-msg-line heading":/^\d+\.\s/.test(h)?"assistant-msg-line numbered":/^-\s/.test(h)?"assistant-msg-line bullet":"assistant-msg-line"}function Gf(a,h=40){const p=a.replace(/\s+/g," ").trim();if(p.length<=h)return p;const T=p.split(" ").slice(0,3).join(" ").trim();return T.length>=10&&T.length<=h?`${T}…`:`${p.slice(0,h-1).trimEnd()}…`}function xd(a){return a.replace(/\*\*(.+?)\*\*/g,"$1").replace(/^\d+\.\s*/,"").trim()}function qf(a){const h=a.replace(/\r\n?/g,` `).split(` `).map(E=>E.trim()).find(Boolean),p=xd(h??"");return(p.split("|")[0]?.trim()??p).replace(/\s+/g," ").trim()}function Kf(a){const h=a.replace(/\r\n?/g,` `).split(` `).map(T=>T.trim()).find(Boolean);return!h||!/^\d+\.\s/.test(h)?!1:xd(h).includes("|")}function Jf(a,h){const p=h.replace(/\r\n?/g,` `).replace(/\*\*(.+?)\*\*/g,"$1").split(` `).map((E,I)=>{const B=E.trim();return I===0?B.replace(/^\d+\.\s*/,""):B}).filter(Boolean).join(" ").replace(/\s+/g," ").trim();if(!p)return null;const T=qf(h)||p;return{message_id:a.message_id,source_text:p,anchor_text:T,preview_text:Gf(T)}}function Yf(a,h,p,T){return Hf(a.text).map((I,B)=>{const ae=I.split(` `),re=a.role==="assistant"&&Kf(I),z=re?Jf(a,I):null,Z=!!z&&h?.message_id===z?.message_id&&h?.source_text===z?.source_text,ee=ae.map((ne,Te)=>o.jsx("p",{className:Wf(ne),children:Vf(ne,`line-${B}-${Te}`)},`line-${B}-${Te}`));return!re||!z?o.jsx("div",{className:"assistant-msg-block",children:ee},`block-${B}`):o.jsx("div",{className:Z?"assistant-msg-block selectable active":"assistant-msg-block selectable",role:"button",tabIndex:0,onClick:()=>{if(Z){T();return}p(z)},onKeyDown:ne=>{if(!(ne.key!=="Enter"&&ne.key!==" ")){if(ne.preventDefault(),Z){T();return}p(z)}},children:ee},`block-${B}`)})}function Xf({sessionId:a,conversation:h,inputValue:p,onInputChange:T,selectedContextChip:E,onSelectContextChip:I,onClearContextChip:B,useMock:ae,onUseMockChange:re,onSend:z,onClear:Z,onSaveSession:ee,busy:ne,saveBusy:Te=!1,saveDisabled:de=!1,statusText:fe,errorMessage:he,showSaveAction:Qe=!1,showCommentAction:Ke=!1,onCommentAssistantMessage:He,isAssistantMessageCommented:Me,canCommentAssistantMessage:$}){const ie=g.useRef(null),je=g.useRef(!0),Ue=g.useRef(null),[ht,ut]=g.useState("idle"),[Bt,ct]=g.useState("чат");function b(se=!1){ie.current&&(se&&(je.current=!0),ie.current.scrollTop=ie.current.scrollHeight)}g.useEffect(()=>{je.current&&b()},[h]),g.useEffect(()=>()=>{Ue.current!==null&&window.clearTimeout(Ue.current)},[]);async function Re(se){if(h.length===0)return;const te=$f(a,h,se),R=await bf(te);ct(se==="technical"?"тех":"чат"),ut(R?"success":"error"),Ue.current!==null&&window.clearTimeout(Ue.current),Ue.current=window.setTimeout(()=>{ut("idle")},2200)}function Ge(){if(!ie.current)return;const se=ie.current,te=se.scrollHeight-se.scrollTop-se.clientHeight;je.current=te<16}return o.jsx(Zl,{className:"assistant-panel-frame",title:"Режим ассистента",children:o.jsxs("div",{className:"assistant-live-shell",children:[o.jsxs("div",{className:"assistant-toolbar",children:[o.jsxs("div",{className:"assistant-toolbar-actions",children:[o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{Re("default")},disabled:h.length===0,title:"Экспорт только user-facing чата",children:"Скопировать чат"}),o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{Re("technical")},disabled:h.length===0,title:"Технический экспорт с debug payload",children:"Скопировать техчат"}),Qe?o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>ee?.(),disabled:Te||de,children:Te?"Сохраняю...":"Сохранить"}):null,o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>Z(),disabled:ne&&h.length===0,children:"Сбросить сессию"})]}),o.jsxs("div",{className:"assistant-toolbar-meta",children:[a?o.jsx("span",{className:"status-chip",children:`session: ${a}`}):null,o.jsxs("div",{className:"assistant-toolbar-meta-right",children:[fe?o.jsx("span",{className:"assistant-live-status",children:fe}):null,ht==="success"?o.jsxs("span",{className:"assistant-copy-feedback success",children:["Скопировано (",Bt,")"]}):null,ht==="error"?o.jsx("span",{className:"assistant-copy-feedback error",children:"Ошибка копирования"}):null]})]}),he?o.jsx("p",{className:"error-text assistant-toolbar-error",children:he}):null]}),o.jsx("div",{ref:ie,className:"assistant-chat-list",onScroll:Ge,children:h.map((se,te)=>{const R=se.role==="assistant"&&Ke&&typeof He=="function"&&(typeof $=="function"?$(se,te):!0),F=se.role==="assistant"&&typeof Me=="function"?Me(se,te):!1;return o.jsxs("article",{className:`assistant-msg ${se.role}`,children:[o.jsxs("header",{className:"assistant-msg-head",children:[o.jsxs("div",{className:"assistant-msg-head-main",children:[o.jsx("strong",{children:Ff(se.role)}),o.jsx("span",{children:Uf(se.created_at)})]}),se.role==="assistant"&&Ke?o.jsx("div",{className:"assistant-msg-head-actions",children:o.jsx("button",{type:"button",className:F?"autoruns-comment-icon assistant-comment-btn commented":"autoruns-comment-icon assistant-comment-btn",onClick:()=>He?.(se,te),disabled:!R,title:R?"Комментировать ответ ассистента":"Комментарий недоступен для этого сообщения","aria-label":R?"Комментировать ответ ассистента":"Комментарий недоступен для этого сообщения",children:o.jsx(Bf,{commented:F})})}):null]}),o.jsx("div",{className:"assistant-msg-body",children:Yf(se,E,I,B)}),se.role==="assistant"&&se.debug?o.jsxs("details",{className:"assistant-debug",children:[o.jsx("summary",{children:"Показать технический разбор"}),o.jsx(yd,{value:se.debug})]}):null]},se.message_id)})}),o.jsxs("div",{className:"assistant-compose",children:[E?o.jsxs("div",{className:"assistant-compose-context",children:[o.jsx("span",{className:"assistant-compose-context-label",children:"Выбранный объект"}),o.jsxs("div",{className:"assistant-compose-context-pill",title:E.source_text,children:[o.jsx("span",{className:"assistant-compose-context-pill-text",children:E.preview_text}),o.jsx("button",{type:"button",className:"assistant-compose-context-clear",onClick:B,"aria-label":"Убрать выбранный объект",title:"Убрать выбранный объект",children:"×"})]})]}):null,o.jsxs("label",{className:"full-width",children:["Сообщение",o.jsx("textarea",{className:"assistant-input-textarea",value:p,onChange:se=>T(se.target.value),rows:4,placeholder:E?"Продолжите вопрос по выбранному объекту...":"Введите вопрос к данным компании..."})]}),o.jsxs("div",{className:"button-row assistant-send-row",children:[o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:ae,onChange:se=>re(se.target.checked)}),"Mock-режим"]}),o.jsx("button",{type:"button",className:"assistant-send-btn",onClick:()=>{b(!0),z()},disabled:ne||!p.trim(),children:ne?"Выполняю...":"Отправить"})]})]})]})})}const Vl="http://127.0.0.1:1234/v1",td="https://api.openai.com/v1",Yl="qwen2.5-14b-instruct-1m",Ha="unsloth/qwen3-30b-a3b-instruct-2507",Zf=[{value:Yl,label:"Qwen2.5 14B Instruct 1M"},{value:Ha,label:"Qwen3 30B A3B Instruct 2507"}];function ep(a){return a.llmProvider!=="local"?"openai":a.model===Ha?"local_qwen3":a.model===Yl?"local_qwen25":"local_custom"}function tp(a,h){const p=new Map;if(h)for(const T of Zf)p.set(T.value,T);for(const T of a)p.has(T)||p.set(T,{value:T,label:T});return Array.from(p.values())}function np({value:a,modelOptions:h,modelsBusy:p,onChange:T,onReloadModels:E,onTestConnection:I,onSaveLocalConfig:B,lastStatus:ae,busy:re,embedded:z=!1}){const Z=a.llmProvider==="local",ee=ep(a),ne=tp(h,Z),Te=ne.some($=>$.value===a.model),[de,fe]=g.useState(String(a.temperature)),[he,Qe]=g.useState(String(a.maxOutputTokens));g.useEffect(()=>{fe(String(a.temperature))},[a.temperature]),g.useEffect(()=>{Qe(String(a.maxOutputTokens))},[a.maxOutputTokens]);const Ke=$=>{const ie=$.replace(",",".").trim();if(!ie){fe(String(a.temperature));return}const je=Number(ie);if(!Number.isFinite(je)){fe(String(a.temperature));return}T({...a,temperature:je}),fe(String(je))},He=$=>{const ie=$.trim();if(!ie){Qe(String(a.maxOutputTokens));return}const je=Number.parseInt(ie,10);if(!Number.isFinite(je)||je<=0){Qe(String(a.maxOutputTokens));return}T({...a,maxOutputTokens:je}),Qe(String(je))},Me=o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{children:["Provider",o.jsxs("select",{value:ee,onChange:$=>{const ie=$.target.value;if(ie==="openai"){T({...a,llmProvider:"openai",baseUrl:td});return}if(ie==="local_qwen25"){T({...a,llmProvider:"local",model:Yl,baseUrl:Vl});return}if(ie==="local_qwen3"){T({...a,llmProvider:"local",model:Ha,baseUrl:Vl});return}T({...a,llmProvider:"local",model:a.llmProvider==="local"?a.model:Yl,baseUrl:Vl})},children:[o.jsx("option",{value:"openai",children:"OpenAI (token)"}),o.jsx("option",{value:"local_qwen25",children:"Qwen2.5 14B Instruct 1M (Local LM Studio)"}),o.jsx("option",{value:"local_qwen3",children:"Qwen3 30B A3B Instruct 2507 (Local LM Studio)"}),o.jsx("option",{value:"local_custom",children:"Local custom (LM Studio / OpenAI-compatible)"})]})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:Te?a.model:"__manual__",onChange:$=>{const ie=$.target.value;ie!=="__manual__"&&T({...a,model:ie})},children:[o.jsx("option",{value:"__manual__",children:"Manual input"}),ne.map($=>o.jsx("option",{value:$.value,children:$.label},$.value))]})]}),o.jsxs("label",{children:["Model ID (manual / current)",o.jsx("input",{value:a.model,onChange:$=>T({...a,model:$.target.value}),placeholder:"qwen2.5-14b-instruct-1m or unsloth/qwen3-30b-a3b-instruct-2507"})]}),Z?null:o.jsxs("label",{className:"full-width",children:["OpenAI API Key",o.jsx("input",{type:"password",value:a.apiKey,onChange:$=>T({...a,apiKey:$.target.value}),placeholder:"sk-..."})]}),o.jsxs("label",{className:Z?"full-width":void 0,children:[Z?"Local server base URL":"Base URL",o.jsx("input",{value:a.baseUrl,onChange:$=>T({...a,baseUrl:$.target.value}),placeholder:Z?Vl:td})]}),o.jsxs("label",{children:["Temperature",o.jsx("input",{type:"number",step:"0.1",value:de,onChange:$=>fe($.target.value),onBlur:$=>Ke($.target.value),onKeyDown:$=>{$.key==="Enter"&&Ke($.target.value)}})]}),o.jsxs("label",{children:["Max output tokens",o.jsx("input",{type:"number",value:he,onChange:$=>Qe($.target.value),onBlur:$=>He($.target.value),onKeyDown:$=>{$.key==="Enter"&&He($.target.value)}})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>B(),children:"Save local config"}),o.jsx("button",{type:"button",onClick:()=>E(),disabled:re||p,children:p?"Loading models...":"Load model list"}),o.jsx("button",{type:"button",onClick:()=>I(),disabled:re,children:re?"Checking...":"Test connection"})]})]});return z?o.jsxs("section",{className:"embedded-panel-section",children:[o.jsxs("div",{className:"embedded-panel-section-header",children:[o.jsxs("div",{children:[o.jsx("h4",{children:"LLM Connector"}),o.jsx("p",{children:"Switch between OpenAI cloud and local OpenAI-compatible server."})]}),o.jsx("span",{className:"status-chip",children:ae||"Status: not checked"})]}),Me]}):o.jsx(Zl,{title:"LLM Connector",subtitle:"Switch between OpenAI cloud and local OpenAI-compatible server.",actions:o.jsx("span",{className:"status-chip",children:ae||"Status: not checked"}),children:Me})}function rp({value:a,onChange:h,presets:p,selectedPresetId:T,onSelectPreset:E,onLoadPreset:I,onSavePreset:B,onResetDefaults:ae,onDiffPrevious:re,presetName:z,onPresetNameChange:Z,diffSummary:ee,embedded:ne=!1}){const Te=o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"prompt-manager-grid",children:[o.jsxs("label",{children:["Системный prompt",o.jsx("textarea",{value:a.systemPrompt,onChange:de=>h({...a,systemPrompt:de.target.value}),rows:6})]}),o.jsxs("label",{children:["Developer / Instruction prompt",o.jsx("textarea",{value:a.developerPrompt,onChange:de=>h({...a,developerPrompt:de.target.value}),rows:6})]}),o.jsxs("label",{children:["Domain prompt",o.jsx("textarea",{value:a.domainPrompt,onChange:de=>h({...a,domainPrompt:de.target.value}),rows:6})]}),o.jsxs("label",{children:["Schema notes",o.jsx("textarea",{value:a.schemaNotes,onChange:de=>h({...a,schemaNotes:de.target.value}),rows:6})]}),o.jsxs("label",{className:"full-width",children:["Few-shot examples",o.jsx("textarea",{value:a.fewShotExamples,onChange:de=>h({...a,fewShotExamples:de.target.value}),rows:8})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("select",{value:T,onChange:de=>E(de.target.value),children:[o.jsx("option",{value:"",children:"Выберите preset..."}),p.map(de=>o.jsx("option",{value:de.id,children:de.name},de.id))]}),o.jsx("button",{type:"button",onClick:()=>I(),children:"Загрузить preset"}),o.jsx("input",{value:z,onChange:de=>Z(de.target.value),placeholder:"Имя для сохранения"}),o.jsx("button",{type:"button",onClick:()=>B(),children:"Сохранить preset"}),o.jsx("button",{type:"button",onClick:()=>re(),children:"Diff с предыдущим"}),o.jsx("button",{type:"button",onClick:()=>ae(),children:"Сбросить к default"})]}),ee?o.jsx("p",{className:"diff-summary",children:ee}):null]});return ne?o.jsxs("section",{className:"embedded-panel-section",children:[o.jsx("div",{className:"embedded-panel-section-header",children:o.jsxs("div",{children:[o.jsx("h4",{children:"Prompt Manager"}),o.jsx("p",{children:"Системный, developer и domain уровни управляются отдельно."})]})}),Te]}):o.jsx(Zl,{title:"Prompt Manager",subtitle:"Системный, developer и domain уровни управляются отдельно.",children:Te})}const Ia={fromLocal:"",toLocal:"",target:"all",mode:"all",useMock:"any",promptContains:"",limit:120},Wl="needs_dialog_policy_fix",kt="__all__",Xl="__live__:",nd="ndc_autoruns_ui_config_v1",rd="ndc-autoruns-save",Da=["Анализ запроса","Получение данных","Подготовка ответа"];function sp(a,h){const p=a.trim();if(!p)return"";if(!h)return p;const T=p.toLowerCase(),E=h.anchor_text.trim(),I=E.toLowerCase();return I&&T.includes(I)?p:`По выбранному объекту "${E}": ${p}`}const Ba=[{id:"general",label:"Общий контур",domain:"",defaultPrompt:"Генерируй реалистичные живые вопросы бухгалтера по 1С. Добавляй разговорные формулировки и опечатки, но сохраняй бизнес-смысл."}];function op(a=Ba){return a.reduce((h,p)=>(h[p.id]=p.defaultPrompt,h),{})}const sd={mode:"codex_creative",count:24,personalityId:"general",personalityPrompts:op(),persistToEvalCases:!0,generatedBy:"manual_reviewer"};function Oa(a){const h=String(a??"").trim();return/^\d{4}-\d{2}-\d{2}$/.test(h)?h:""}function od(a){const h=typeof a=="number"&&Number.isFinite(a)?Math.trunc(a):160;return Math.max(110,Math.min(520,h))}function lp(a){const h=a.getFullYear(),p=String(a.getMonth()+1).padStart(2,"0"),T=String(a.getDate()).padStart(2,"0"),E=String(a.getHours()).padStart(2,"0"),I=String(a.getMinutes()).padStart(2,"0");return`${h}-${p}-${T}T${E}:${I}`}function ld(){const a=new Date;return a.setDate(a.getDate()-14),lp(a)}function Gl(a){if(!a.trim())return;const h=Date.parse(a);if(Number.isFinite(h))return new Date(h).toISOString()}function yn(a){if(!a)return"нет данных";const h=Date.parse(a);return Number.isFinite(h)?new Date(h).toLocaleString("ru-RU"):a}function id(a){const h=typeof a.case_message_index=="number"?a.case_message_index:typeof a.message_index=="number"?a.message_index:null;if(h===null||h<0)return null;const p=Math.floor(h/2)+1,T=String(p).padStart(3,"0"),E=a.role==="assistant"?"ответ":"вопрос";return`${T} ${E}`}function za(a){return a==="saved_user_sessions"?"Пользовательские сессии":a}function _d(a){return a?a.context?.agent_run===!0||a.context?.saved_case_set_kind==="agent_semantic_scenario"?!0:typeof a.title=="string"&&a.title.trim().toUpperCase().startsWith("AGENT"):!1}function $a(a){const h=a.title??yn(a.created_at);return _d(a)&&!h.trim().toUpperCase().startsWith("AGENT")?`AGENT | ${h}`:h}function ip(a){const h=a[a.length-1];return`Ручная сессия ${yn(h?.created_at??new Date().toISOString())}`}function ap(a,h){return h<=0?0:Math.max(0,Math.min(100,Number((a/h*100).toFixed(1))))}function ql(a){return typeof a!="number"?"нет данных":`${a.toFixed(1)}%`}function up(a){return a==="assistant_stage1"?"assistant/s1":a==="assistant_stage2"?"assistant/s2":a==="assistant_p0"?"assistant/p0":a}function ad(a){return a==="up"?"Рост":a==="down"?"Регресс":"Без изменений"}function Fa(a){const h=Math.max(1,Math.min(5,Math.round(a)));return`${"●".repeat(h)}${"○".repeat(5-h)}`}function ud(a){return a.length===0?o.jsx("p",{className:"muted",children:"Покрытие доменов пока не сформировано."}):o.jsx("div",{className:"autoruns-coverage-list",children:a.map(h=>{const p=ap(h.closed_cases,h.total_cases);return o.jsxs("div",{className:"autoruns-coverage-item",children:[o.jsxs("div",{className:"autoruns-coverage-head",children:[o.jsx("strong",{children:h.domain}),o.jsxs("span",{children:[h.closed_cases,"/",h.total_cases," (",p,"%)"]})]}),o.jsx("div",{className:"autoruns-coverage-bar",children:o.jsx("div",{style:{width:`${p}%`}})})]},h.domain)})})}function Jl(a){return`${Xl}${a}`}function Xs(a){return a.startsWith(Xl)}function cd(a){return a.startsWith(Xl)?a.slice(Xl.length):""}function Sd(a){const h=a.report_summary?.run_timestamp??a.created_at,p=Math.max(0,a.total_cases-a.completed_cases);return{run_id:Jl(a.job_id),eval_target:a.eval_target,run_timestamp:h,mode:"single-pass-strict",llm_provider:null,model:null,use_mock:null,analysis_date:a.report_summary?.analysis_date??a.analysis_date??null,prompt_version:null,schema_version:null,suite_id:a.case_set_file,cases_total:a.total_cases,requests_total:null,report_path:`async_job:${a.job_id}`,score_index:a.report_summary?.score_index??null,blocking_failures:0,quality_failures:0,closed_cases:a.completed_cases,open_cases:p,domain_coverage:[{domain:"runtime",total_cases:a.total_cases,closed_cases:a.completed_cases}]}}function Oo(a,h){const p=Sd(a),T=a.cases.map(Z=>({case_id:Z.case_id,domain:null,query_class:null,status:Z.status==="completed"?"closed":Z.status==="failed"?"open":"unknown",score_index:null,trace_id:null,reply_type:null,session_id:`${a.run_id}-${Z.case_id}`,dialog_available:Z.messages.length>0,commented_count:0,latest_annotation_at:null,avg_rating:null,checks:null,metric_subscores:null})),I=h!==kt&&T.some(Z=>Z.case_id===h)?h:T.length>0?kt:"",B={ok:!0,run:p,coverage:{closed_cases:a.completed_cases,open_cases:Math.max(0,a.total_cases-a.completed_cases),domain_coverage:[{domain:"runtime",total_cases:a.total_cases,closed_cases:a.completed_cases}]},cases:T,annotations_summary:{total:0},report:a.report_summary?{run_id:a.report_summary.run_id,run_timestamp:a.report_summary.run_timestamp,score_index:a.report_summary.score_index,cases_total:a.report_summary.cases_total,analysis_date:a.report_summary.analysis_date??a.analysis_date??null}:{}},ae=[];let re=0;if(I===kt)for(const Z of a.cases)for(let ee=0;eeee.case_id===I)??null;for(let ee=0;ee<(Z?.messages.length??0);ee+=1){const ne=Z?.messages[ee];ne&&ae.push({...ne,message_index:ee,case_id:I,case_message_index:ee,commented:!1,annotation:null})}}const z={ok:!0,run_id:p.run_id,case_id:I,source:"assistant_session",session_id:I===kt?`${a.run_id}::__all__`:`${a.run_id}-${I}`,messages:ae,decomposition:[],assistant_mode:{status:a.status,completed_cases:a.completed_cases,total_cases:a.total_cases},annotations:[]};return{detail:B,dialog:z,caseId:I}}function cp({commented:a}){const h=a?"comment-icon-svg commented":"comment-icon-svg";return o.jsx("svg",{className:h,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M5 6.5h14v9H11.5l-4.5 3v-3H5z"})})}function dd({resolved:a}){return o.jsxs("svg",{className:a?"resolve-icon-svg resolved":"resolve-icon-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[o.jsx("circle",{cx:"8",cy:"8",r:"6.2"}),a?o.jsx("path",{d:"M5.1 8.2 7.2 10.3 11 6.5"}):null]})}function fd(){return o.jsxs("svg",{className:"autoruns-copy-icon-svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2.2"}),o.jsx("path",{d:"M15 7V5.8a1.8 1.8 0 0 0-1.8-1.8H5.8A1.8 1.8 0 0 0 4 5.8v7.4A1.8 1.8 0 0 0 5.8 15H7"})]})}function pd(){return o.jsxs("svg",{className:"autoruns-question-grip-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[o.jsx("circle",{cx:"4",cy:"4",r:"1"}),o.jsx("circle",{cx:"8",cy:"4",r:"1"}),o.jsx("circle",{cx:"12",cy:"4",r:"1"}),o.jsx("circle",{cx:"4",cy:"8",r:"1"}),o.jsx("circle",{cx:"8",cy:"8",r:"1"}),o.jsx("circle",{cx:"12",cy:"8",r:"1"}),o.jsx("circle",{cx:"4",cy:"12",r:"1"}),o.jsx("circle",{cx:"8",cy:"12",r:"1"}),o.jsx("circle",{cx:"12",cy:"12",r:"1"})]})}function dp({expanded:a}){return o.jsx("svg",{className:a?"autoruns-card-chevron-svg expanded":"autoruns-card-chevron-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M3.5 6.2 8 10.4l4.5-4.2"})})}function fp(){return o.jsx("svg",{className:"autoruns-card-launch-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M5 3.8 12 8l-7 4.2Z"})})}function Kl({expanded:a}){return o.jsx("svg",{className:a?"autoruns-group-chevron-svg expanded":"autoruns-group-chevron-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M3.5 6.2 8 10.4l4.5-4.2"})})}function pp({connection:a,modelOptions:h,modelsBusy:p,connectionStatus:T,connectionBusy:E,onConnectionChange:I,onReloadModels:B,onSaveLocalConfig:ae,onTestConnection:re,prompts:z,onPromptsChange:Z,promptPresets:ee,selectedPresetId:ne,onSelectPreset:Te,onLoadPreset:de,onSavePreset:fe,onResetDefaults:he,onDiffPrevious:Qe,presetName:Ke,onPresetNameChange:He,diffSummary:Me,assistantPromptVersion:$,decompositionPromptVersion:ie,showSettingsMode:je,showAutoRunsMode:Ue,showAssistantMode:ht,showProgressMode:ut,showCommentsMode:Bt,onLog:ct}){const[b,Re]=g.useState({...Ia,fromLocal:ld()}),[Ge,se]=g.useState(""),[te,R]=g.useState(null),[F,A]=g.useState(null),[y,k]=g.useState(null),[oe,ue]=g.useState([]),[ce,ge]=g.useState("all"),[ye,xe]=g.useState(!1),[Se,dt]=g.useState(null),[sn,gr]=g.useState([]),[Ln,xn]=g.useState(""),[Ee,Qt]=g.useState(""),[st,gt]=g.useState(""),[jt,_n]=g.useState(Ba),[G,ft]=g.useState(sd),[vr,In]=g.useState([]),[Ve,Ct]=g.useState(""),[Mt,Dn]=g.useState(""),[me,Nt]=g.useState([]),[Je,vs]=g.useState(!1),[Ze,Zn]=g.useState(null),[yr,on]=g.useState(""),[On,Rt]=g.useState(null),[Sn,Ht]=g.useState(null),[Y,ln]=g.useState(null),[er,Hr]=g.useState(null),[Vr,Wr]=g.useState(!1),[xr,wn]=g.useState(!1),[zn,$n]=g.useState(!1),[Fn,Un]=g.useState(!1),[C,X]=g.useState(!1),[V,Ce]=g.useState(!1),[ot,zo]=g.useState(!1),[Gr,$o]=g.useState(!1),[bn,Zs]=g.useState(""),[eo,Ye]=g.useState(""),[et,ys]=g.useState(""),[Vt,xs]=g.useState([]),[qr,Kr]=g.useState([]),[De,to]=g.useState(""),[Jr,_s]=g.useState(null),[_r,ei]=g.useState(!1),[no,Yr]=g.useState(!1),[an,Xr]=g.useState(""),[Wt,tr]=g.useState(""),[ti,Sr]=g.useState(String(Ia.limit)),[Ss,kn]=g.useState(String(sd.count)),[nr,Zr]=g.useState(160),[wr,Fo]=g.useState(!0),[Bn,ro]=g.useState(!0),[Qn,kr]=g.useState(!0),[jr,ws]=g.useState(!0),[Q,Gt]=g.useState({open:!1,caseId:"",caseMessageIndex:-1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:Wl,annotationAuthor:"manual_reviewer",saving:!1,error:""}),[we,qt]=g.useState({open:!1,messageIndex:-1,rating:3,comment:"",annotationAuthor:"manual_reviewer",saving:!1,error:""}),[At,Hn]=g.useState({open:!1,title:"",saving:!1,error:""}),[Lt,rr]=g.useState({open:!1,generationId:"",questionIndex:-1,questionText:"",saving:!1,error:""}),[It,Kt]=g.useState({open:!1,generationId:"",title:"",saving:!1,error:""}),un=g.useRef(!1),Jt=g.useRef(null),Vn=g.useRef(null),Ae=G.mode==="saved_user_sessions",Yt=g.useMemo(()=>jt.find(i=>i.id===G.personalityId)??jt[0]??Ba[0],[G.personalityId,jt]),vt=g.useMemo(()=>vr.filter(i=>i.mode===G.mode),[vr,G.mode]),Oe=g.useMemo(()=>vt.find(i=>i.generation_id===Ve)??vt[0]??null,[Ve,vt]),Xt=g.useMemo(()=>ye?oe.filter(i=>!i.resolved):oe,[oe,ye]),Le=Xt.find(i=>i.annotation_id===Ln)??null,so=y?.messages.find(i=>i.message_index===Q.messageIndex)??null,ks=g.useMemo(()=>{if(!y||Q.messageIndex<0)return null;for(let i=Q.messageIndex-1;i>=0;i-=1){const c=y.messages[i];if(c?.role==="user")return c}return null},[Q.messageIndex,y]),es=g.useMemo(()=>{const i=new Map;for(const c of qr)c.message_id&&i.set(c.message_id,c);return i},[qr]),Uo=we.messageIndex>=0?Vt[we.messageIndex]??null:null,Cr=g.useMemo(()=>{if(we.messageIndex<0)return null;for(let i=we.messageIndex-1;i>=0;i-=1){const c=Vt[i];if(c?.role==="user")return c}return null},[we.messageIndex,Vt]),Et=g.useMemo(()=>{const i=Xt.map(d=>({source:"autorun",key:`autorun:${d.annotation_id}`,updated_at:d.updated_at,rating:d.rating,autorun:d,assistant:null})),c=qr.map(d=>({source:"assistant_live",key:`assistant:${d.annotation_id}`,updated_at:d.updated_at,rating:d.rating,autorun:null,assistant:d}));return[...i,...c].sort((d,w)=>Date.parse(w.updated_at)-Date.parse(d.updated_at))},[qr,Xt]),sr=g.useMemo(()=>{if(Et.length===0)return null;const i=Et.reduce((c,d)=>c+d.rating,0)/Et.length;return Number(i.toFixed(2))},[Et]),Nr=g.useMemo(()=>{const i=[...te?.items??[]];return Y&&i.unshift(Sd(Y)),Ee&&!i.some(c=>c.run_id===Ee)&&F?.run&&i.unshift(F.run),i},[Y,te?.items,F?.run,Ee]),q=g.useCallback(i=>{ct?.(`[autoruns] ${i}`)},[ct]),js=g.useCallback(async i=>{const c=String(i??"").trim();if(!c){Kr([]);return}try{const d=await Pe.loadAssistantAnnotations({session_id:c,limit:400});Kr(d.items??[])}catch(d){const w=d instanceof Error?d.message:String(d);q(`Assistant live annotations load error: ${w}`)}},[q]),Wn=g.useCallback(i=>{qt(c=>c.saving&&!i?.force?c:{open:!1,messageIndex:-1,rating:3,comment:"",annotationAuthor:"manual_reviewer",saving:!1,error:""})},[]),or=g.useCallback(i=>{Hn(c=>c.saving&&!i?.force?c:{open:!1,title:"",saving:!1,error:""})},[]),Er=g.useCallback(i=>{rr(c=>c.saving&&!i?.force?c:{open:!1,generationId:"",questionIndex:-1,questionText:"",saving:!1,error:""})},[]),ts=g.useCallback(i=>{Kt(c=>c.saving&&!i?.force?c:{open:!1,generationId:"",title:"",saving:!1,error:""})},[]),Zt=g.useCallback(async(i,c,d)=>{i.stopPropagation(),i.preventDefault();const w=String(c??"").trim();if(w)try{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(w);else{const L=document.createElement("textarea");L.value=w,L.setAttribute("readonly","true"),L.style.position="fixed",L.style.opacity="0",document.body.appendChild(L),L.select(),document.execCommand("copy"),document.body.removeChild(L)}q(`${d} copied: ${w}`)}catch(L){const Ne=L instanceof Error?L.message:String(L);Ye(`Копирование ${d}: ${Ne}`),q(`copy ${d} error: ${Ne}`)}},[q]);function oo(){let i=0;Xr(Da[0]);const c=window.setInterval(()=>{i=Math.min(i+1,Da.length-1),Xr(Da[i])},650);return()=>window.clearInterval(c)}const Cs=g.useCallback(()=>{ys(""),xs([]),Kr([]),to(""),_s(null),Xr(""),tr(""),Wn({force:!0}),q("Live-чат ассистента в истории автопрогонов сброшен.")},[Wn,q]),bo=g.useCallback(async()=>{const i=sp(De,Jr);if(!i)return;Yr(!0),tr(""),to(""),xs(d=>[...d,{message_id:`autoruns-live-${Date.now()}`,session_id:et||"pending",role:"user",text:i,reply_type:null,created_at:new Date().toISOString(),trace_id:null,debug:null}]);const c=oo();try{const d=await Pe.sendAssistantMessage({connection:a,prompts:z,userMessage:i,sessionId:et||void 0,promptVersion:$,useMock:_r});ys(d.session_id),xs(d.conversation),await js(d.session_id),Xr("Ответ готов"),q(`Live-ответ ассистента получен: trace=${d.debug.trace_id}`)}catch(d){const w=d instanceof Error?d.message:String(d);tr(w),Xr("Ошибка ассистента"),q(`Live-чат ассистента: ошибка отправки сообщения: ${w}`)}finally{c(),Yr(!1)}},[De,Jr,et,_r,$,a,js,q,z]),Ns=g.useCallback(()=>{if(!et.trim()||Vt.length===0){tr("Сначала получите хотя бы один ответ в живой сессии ассистента.");return}tr(""),Hn({open:!0,title:ip(Vt),saving:!1,error:""})},[Vt,et]),Es=g.useCallback(async()=>{const i=et.trim(),c=At.title.trim();if(!i){Hn(d=>({...d,error:"Активная сессия ассистента не найдена."}));return}if(!c){Hn(d=>({...d,error:"Укажите название сессии."}));return}Hn(d=>({...d,saving:!0,error:""}));try{const d=[z.systemPrompt,z.developerPrompt,z.domainPrompt,z.schemaNotes,z.fewShotExamples].join("||"),w=await Pe.saveAutoRunAssistantSession({session_id:i,title:c,generated_by:G.generatedBy.trim()||void 0,context:{llm_provider:a.llmProvider,model:a.model,assistant_prompt_version:$,decomposition_prompt_version:ie,prompt_fingerprint:d}});In(L=>[w.generation,...L.filter(Ne=>Ne.generation_id!==w.generation.generation_id)]),ft(L=>({...L,mode:"saved_user_sessions"})),Ct(w.generation.generation_id),or({force:!0}),q(`Живая сессия сохранена в автопрогоны: ${w.generation.generation_id}`)}catch(d){const w=d instanceof Error?d.message:String(d);Hn(L=>({...L,saving:!1,error:w})),q(`Assistant live save error: ${w}`)}},[At.title,et,$,G.generatedBy,or,a.llmProvider,a.model,ie,q,z.developerPrompt,z.domainPrompt,z.fewShotExamples,z.schemaNotes,z.systemPrompt]),lo=g.useCallback(i=>{const c=i.trim();if(!c){Sr(String(b.limit));return}if(!/^\d+$/.test(c)){Sr(String(b.limit));return}const d=Number.parseInt(c,10);if(!Number.isFinite(d)){Sr(String(b.limit));return}const w=Math.max(1,Math.min(500,d));w!==b.limit&&Re(L=>({...L,limit:w})),Sr(String(w))},[b.limit]),yt=g.useCallback(i=>{const c=i.trim();if(!c){kn(String(G.count));return}if(!/^\d+$/.test(c)){kn(String(G.count));return}const d=Number.parseInt(c,10);if(!Number.isFinite(d)){kn(String(G.count));return}const w=Math.max(1,Math.min(200,d));w!==G.count&&ft(L=>({...L,count:w})),kn(String(w))},[G.count]),lr=g.useCallback(i=>{Zr(od(i))},[]),Ps=g.useCallback(i=>{const c=i.currentTarget.offsetHeight;Number.isFinite(c)&&c>0&&lr(c)},[lr]),jn=g.useCallback(async()=>{$o(!0);try{const i=await Pe.loadAutoRunAnnotations({limit:800,manual_case_decision:ce});ue(i.items),dt(i.manual_case_decision_schema??null),gr(i.available_manual_case_decisions??[]),xn(c=>i.items.length===0?"":i.items.some(d=>d.annotation_id===c)?c:i.items[0].annotation_id)}catch(i){q(`Annotations load error: ${i instanceof Error?i.message:String(i)}`)}finally{$o(!1)}},[ce,q]),ir=g.useCallback(async()=>{Un(!0);try{const i=await Pe.loadAutoRunAutogenHistory({limit:180});In(i.items)}catch(i){q(`Autogen history load error: ${i instanceof Error?i.message:String(i)}`)}finally{Un(!1)}},[q]),Ts=g.useCallback(async()=>{try{const c=(await Pe.loadAutoRunAutogenPersonalityCatalog()).items.map(d=>({id:String(d.id??"").trim(),label:String(d.label??"").trim(),domain:typeof d.domain=="string"?d.domain.trim():"",defaultPrompt:String(d.default_prompt??"").trim()})).filter(d=>d.id.length>0&&d.label.length>0);if(c.length===0)return;_n(c.map(d=>({id:d.id,label:d.label,domain:d.domain||"",defaultPrompt:d.defaultPrompt||"Генерируй реалистичные вопросы бухгалтера по выбранному профилю. Не выдумывай непокрытые возможности."})))}catch(i){q(`Autogen personality catalog load error: ${i instanceof Error?i.message:String(i)}`)}},[q]),en=g.useCallback(async()=>{$n(!0);try{const i=await Pe.loadAutoRunPostAnalysis({run_id:Ee&&!Xs(Ee)?Ee:void 0,limit_per_queue:30,annotation_limit:1500,from:Gl(b.fromLocal),to:Gl(b.toLocal),target:b.target,mode:b.mode,use_mock:b.useMock,prompt_contains:b.promptContains.trim()||void 0});Hr(i)}catch(i){q(`Post-analysis load error: ${i instanceof Error?i.message:String(i)}`),Hr(null)}finally{$n(!1)}},[b.fromLocal,b.mode,b.promptContains,b.target,b.toLocal,b.useMock,q,Ee]),ns=g.useCallback(async()=>{Wr(!0),Ye("");try{if(G.mode==="saved_user_sessions")throw new Error("Пользовательские сессии сохраняются из живого чата, а не генерируются автоматически.");const i=G.personalityPrompts[G.personalityId]??"",c=[z.systemPrompt,z.developerPrompt,z.domainPrompt,z.schemaNotes,z.fewShotExamples].join(` `).slice(0,900),d=await Pe.generateAutoRunQuestions({mode:G.mode,count:G.count,domain:Yt.domain||void 0,persist_to_eval_cases:G.persistToEvalCases,generated_by:G.generatedBy.trim()||void 0,llm:{llm_provider:a.llmProvider,api_key:a.apiKey,model:a.model,base_url:a.baseUrl,temperature:a.temperature,max_output_tokens:a.maxOutputTokens},context:{llm_provider:a.llmProvider,model:a.model,assistant_prompt_version:$,decomposition_prompt_version:ie,prompt_fingerprint:c,autogen_personality_id:Yt.id,autogen_personality_prompt:i.trim()||void 0}});q(`Generated ${d.generation.count} questions (${d.generation.mode}) id=${d.generation.generation_id}`+(d.generation.saved_case_set_file?` saved=${d.generation.saved_case_set_file}`:"")),Ct(d.generation.generation_id),Nt([...d.generation.questions??[]]),await ir()}catch(i){const c=i instanceof Error?i.message:String(i);Ye(`Автогенерация: ${c}`),q(`Autogen generate error: ${c}`)}finally{Wr(!1)}},[$,G.count,G.generatedBy,G.mode,G.personalityId,G.personalityPrompts,G.persistToEvalCases,a.apiKey,a.baseUrl,a.llmProvider,a.maxOutputTokens,a.model,a.temperature,ie,ir,q,z.developerPrompt,z.domainPrompt,z.fewShotExamples,z.schemaNotes,z.systemPrompt,Yt.domain,Yt.id]),Gn=g.useCallback(async(i,c)=>{if(Xs(i)){const d=cd(i);if(Y&&Y.job_id===d){const w=Oo(Y,c);Qt(i),gt(w.caseId),k(w.dialog);return}k(null);return}zo(!0);try{const d=await Pe.loadAutoRunCaseDialog(i,c);k(d)}catch(d){const w=d instanceof Error?d.message:String(d);Ye(`Диалог кейса: ${w}`),k(null),q(`Dialog load error for ${i}/${c}: ${w}`)}finally{zo(!1)}},[Y,q]),Cn=g.useCallback(async(i,c)=>{if(Xs(i)){const d=cd(i);if(Y&&Y.job_id===d){const w=Oo(Y,c??kt);Qt(i),gt(w.caseId),A(w.detail),k(w.dialog);return}Qt(i),gt(""),A(null),k(null);return}Ce(!0);try{const d=await Pe.loadAutoRunDetail(i);A(d);const w=(c&&(c===kt||d.cases.some(L=>L.case_id===c))?c:"")||(d.cases.length>0?kt:"")||"";Qt(i),gt(w),w?await Gn(i,w):k(null)}catch(d){const w=d instanceof Error?d.message:String(d);Ye(`Детализация прогона: ${w}`),A(null),k(null),q(`Run detail load error for ${i}: ${w}`)}finally{Ce(!1)}},[Y,Gn,q]),rs=g.useCallback(async i=>{X(!0),Ye("");try{const c=await Pe.loadAutoRunsHistory({from:Gl(b.fromLocal),to:Gl(b.toLocal),target:b.target,mode:b.mode,use_mock:b.useMock,prompt_contains:b.promptContains.trim()||void 0,limit:b.limit});if(R(c),c.items.length===0){Qt(""),gt(""),A(null),k(null);return}const d=i?.keepSelection??!0,w=i?.preferredRunId??"",L=i?.preferredCaseId??"",Ne=d&&w&&c.items.some(tt=>tt.run_id===w)?w:c.items[0].run_id;await Cn(Ne,d?L:void 0),en()}catch(c){const d=c instanceof Error?c.message:String(c);Ye(`История прогонов: ${d}`),q(`History load error: ${d}`)}finally{X(!1)}},[b.fromLocal,b.limit,b.mode,b.promptContains,b.target,b.toLocal,b.useMock,en,Cn,q]),Nn=g.useCallback(()=>{Jt.current!==null&&(window.clearTimeout(Jt.current),Jt.current=null)},[]),io=g.useCallback(async i=>{try{const c=await Pe.loadEvalRunAsyncStatus(i);ln(c.job);const d=Jl(i);if(Ee===d){const w=Oo(c.job,st||kt);A(w.detail),k(w.dialog),gt(w.caseId)}if(c.job.status==="completed"){Nn(),wn(!1);const w=c.job.report_summary?.run_id??c.job.run_id;await rs({keepSelection:!0,preferredRunId:w||Ee,preferredCaseId:kt}),await ir(),ln(null);return}if(c.job.status==="failed"){Nn(),wn(!1),Ye(`Запуск прогонов: ${c.job.error??"неизвестная ошибка"}`),q(`Autogen async run failed: ${c.job.error??"unknown error"}`);return}Nn(),Jt.current=window.setTimeout(()=>{io(i)},500)}catch(c){Nn(),wn(!1);const d=c instanceof Error?c.message:String(c);Ye(`Запуск прогонов: ${d}`),q(`Autogen async status error: ${d}`)}},[ir,rs,q,st,Ee,Nn]),Ms=g.useCallback(async(i,c)=>{Nn(),wn(!0),Ye("");try{const d=i??Oe;if(!d)throw new Error("История автогенерации пуста. Сначала сгенерируйте пачку вопросов.");const L=(c??(Oe?.generation_id===d.generation_id?me:d.questions)).map(Tr=>Tr.trim()).filter(Tr=>Tr.length>0);if(L.length===0)throw new Error("Нет вопросов для запуска: список пустой после ручного редактирования.");const Ne=b.useMock==="true",tt=Oa(Ge),Dt=d.mode==="saved_user_sessions",dn=(await Pe.startEvalRunAsync({connection:a,prompts:z,promptVersion:$,mode:"single-pass-strict",caseSetFile:Dt?void 0:d.saved_case_set_file??void 0,useMock:Ne,evalTarget:"assistant_stage1",questions:Dt?void 0:L,scenarioQuestions:Dt?L:void 0,scenarioTitle:Dt?d.title??void 0:void 0,analysisDate:Dt?void 0:tt||void 0})).job;ln(dn);const ss=Jl(dn.job_id),po=Oo(dn,kt);Qt(ss),gt(po.caseId),A(po.detail),k(po.dialog),q(`Запущен async-прогон job=${dn.job_id}, run_id=${dn.run_id}, вопросов=${L.length}`+(d.saved_case_set_file?`, base_case_set=${d.saved_case_set_file}`:"")+(Dt?", replay_mode=saved_user_session_scenario":tt?`, analysis_date=${tt}`:", analysis_date=current_state")),io(dn.job_id)}catch(d){const w=d instanceof Error?d.message:String(d);Ye(`Запуск прогонов: ${w}`),q(`Autogen run error: ${w}`),wn(!1)}},[Ge,$,a,me,b.useMock,q,io,z,Oe,Nn]),ni=g.useCallback(i=>{if(i.role!=="assistant")return;const c=i.case_id??st,d=i.case_message_index??i.message_index;Gt({open:!0,caseId:c,caseMessageIndex:d,messageIndex:i.message_index,rating:i.annotation?.rating??3,comment:i.annotation?.comment??"",manualCaseDecision:i.annotation?.manual_case_decision??Wl,annotationAuthor:i.annotation?.annotation_author??G.generatedBy,saving:!1,error:""})},[G.generatedBy,st]),Rs=g.useCallback(i=>{Gt(c=>c.saving&&!i?.force?c:{open:!1,caseId:"",caseMessageIndex:-1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:Wl,annotationAuthor:G.generatedBy,saving:!1,error:""})},[G.generatedBy]),ri=g.useCallback(async()=>{const i=Ee,c=Q.caseId,d=Q.caseMessageIndex;if(!(!i||!c||d<0)){if(Xs(i)){Gt(w=>({...w,error:"Комментарий можно сохранить после завершения прогона."}));return}if(!Q.comment.trim()){Gt(w=>({...w,error:"Добавьте комментарий."}));return}Gt(w=>({...w,saving:!0,error:""}));try{await Pe.saveAutoRunAnnotation({run_id:i,case_id:c,message_index:d,rating:Q.rating,comment:Q.comment.trim(),manual_case_decision:Q.manualCaseDecision,annotation_author:Q.annotationAuthor.trim()||void 0}),Rs({force:!0}),Promise.all([Cn(i,st),jn(),en()]).catch(w=>{const L=w instanceof Error?w.message:String(w);Ye(`Обновление после комментария: ${L}`),q(`Comment refresh error: ${L}`)})}catch(w){Gt(L=>({...L,saving:!1,error:w instanceof Error?w.message:String(w)}))}}},[Rs,Q.annotationAuthor,Q.caseId,Q.caseMessageIndex,Q.comment,Q.manualCaseDecision,Q.rating,jn,en,Cn,q,st,Ee]),si=g.useCallback(i=>i.role==="assistant",[]),oi=g.useCallback(i=>i.role==="assistant"&&es.has(i.message_id),[es]),Bo=g.useCallback((i,c)=>{if(i.role!=="assistant")return;const d=et.trim(),w=String(i.session_id??"").trim();if(!(d||w)){tr("Сначала получите ответ ассистента в активной сессии.");return}!d&&w&&ys(w);const Ne=es.get(i.message_id)??null;tr(""),qt({open:!0,messageIndex:c,rating:Ne?.rating??3,comment:Ne?.comment??"",annotationAuthor:Ne?.annotation_author??"manual_reviewer",saving:!1,error:""})},[es,et]),li=g.useCallback(async()=>{if(we.messageIndex<0)return;if(!we.comment.trim()){qt(d=>({...d,error:"Добавьте комментарий."}));return}const i=Vt[we.messageIndex]??null,c=et.trim()||(i?.role==="assistant"?String(i.session_id??"").trim():"");if(!c){qt(d=>({...d,error:"Сессия ассистента не найдена."}));return}qt(d=>({...d,saving:!0,error:""}));try{const d=await Pe.saveAssistantAnnotation({session_id:c,message_index:we.messageIndex,rating:we.rating,comment:we.comment.trim(),annotation_author:we.annotationAuthor.trim()||void 0});Kr(w=>{const L=[...w],Ne=L.findIndex(tt=>tt.annotation_id===d.annotation.annotation_id);return Ne>=0?L[Ne]=d.annotation:L.unshift(d.annotation),L.sort((tt,Dt)=>Date.parse(Dt.updated_at)-Date.parse(tt.updated_at))}),Wn({force:!0})}catch(d){const w=d instanceof Error?d.message:String(d);qt(L=>({...L,saving:!1,error:w}))}},[we.annotationAuthor,we.comment,we.messageIndex,we.rating,Vt,et,Wn]);g.useCallback(i=>{if(!Oe||Oe.mode!=="saved_user_sessions")return;const c=me[i]??"";rr({open:!0,generationId:Oe.generation_id,questionIndex:i,questionText:c,saving:!1,error:""})},[me,Oe]);const ii=g.useCallback(async()=>{const i=Lt.generationId,c=Lt.questionIndex;if(!i||c<0)return;const d=me.filter((w,L)=>L!==c);if(d.length===0){rr(w=>({...w,error:"Нельзя удалить последний вопрос из сохраненной сессии."}));return}rr(w=>({...w,saving:!0,error:""}));try{const w=await Pe.updateAutoRunAutogenQuestions({generation_id:i,questions:d});In(L=>L.map(Ne=>Ne.generation_id===i?w.generation:Ne)),Nt(w.generation.questions),Er({force:!0}),q(`Обновлена сохраненная сессия: ${i}`)}catch(w){const L=w instanceof Error?w.message:String(w);rr(Ne=>({...Ne,saving:!1,error:L})),q(`Saved session question delete error: ${L}`)}},[Er,me,q,Lt.generationId,Lt.questionIndex]),qn=g.useCallback(async(i,c)=>{const d=Oe?.generation_id??"",w=c?.revertQuestions??me;if(Nt(i),!d)return!0;vs(!0);try{const L=await Pe.updateAutoRunAutogenQuestions({generation_id:d,questions:i});return In(Ne=>Ne.map(tt=>tt.generation_id===d?L.generation:tt)),Nt([...L.generation.questions??[]]),c?.successLog&&q(c.successLog),!0}catch(L){const Ne=L instanceof Error?L.message:String(L);return Nt(w),Ye(`Вопросы к запуску: ${Ne}`),q(`Autogen questions update error: ${Ne}`),!1}finally{vs(!1)}},[me,q,Oe]),Qo=g.useCallback(i=>{Zn(i),on(me[i]??"")},[me]),cn=g.useCallback(()=>{Zn(null),on("")},[]),As=g.useCallback(async i=>{if(i===null)return;const c=me[i]??"",d=yr.trim();if(!d||d===c){cn();return}const w=me.map((Ne,tt)=>tt===i?d:Ne);await qn(w,{successLog:`Список вопросов обновлен: ${Oe?.generation_id??"local"}`,revertQuestions:me})&&cn()},[me,yr,Oe,cn,qn]),Ho=g.useCallback(()=>{As(Ze)},[As,Ze]),Vo=g.useCallback(i=>{if(i.key==="Enter"){i.preventDefault(),As(Ze);return}i.key==="Escape"&&(i.preventDefault(),cn())},[As,Ze,cn]),ao=g.useCallback(async()=>{const i=[...me,"Новый вопрос"],c=i.length-1;await qn(i,{successLog:`В список добавлен вопрос: ${Oe?.generation_id??"local"}`,revertQuestions:me})&&(Zn(c),on(i[c]))},[me,Oe,qn]),Wo=g.useCallback(async i=>{if(me.length<=1){Ye("В списке должен остаться хотя бы один вопрос.");return}const c=me.filter((w,L)=>L!==i);await qn(c,{successLog:`Из списка удален вопрос: ${Oe?.generation_id??"local"}`,revertQuestions:me})&&(Zn(w=>w===null?w:w===i?null:w>i?w-1:w),on(""))},[me,Oe,qn]),Go=g.useCallback((i,c)=>{if(Je){i.preventDefault();return}Rt(c),Ht(c),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",String(c))},[Je]),qo=g.useCallback((i,c)=>{i.preventDefault(),Sn!==c&&Ht(c),i.dataTransfer.dropEffect="move"},[Sn]),Ko=g.useCallback(async(i,c)=>{i.preventDefault();const d=On;if(Ht(null),Rt(null),d===null||d===c)return;const w=[...me],[L]=w.splice(d,1);w.splice(c,0,L),await qn(w,{successLog:`Порядок вопросов обновлен: ${Oe?.generation_id??"local"}`,revertQuestions:me})},[On,me,Oe,qn]),Jo=g.useCallback(()=>{Rt(null),Ht(null)},[]),ai=g.useCallback(i=>{Ct(i),Dn(c=>c===i?"":i)},[]),Yo=g.useCallback(i=>{Kt({open:!0,generationId:i.generation_id,title:i.title??`${za(i.mode)} ${yn(i.created_at)}`,saving:!1,error:""})},[]),uo=g.useCallback(async()=>{const i=It.generationId.trim();if(i){Kt(c=>({...c,saving:!0,error:""}));try{const c=await Pe.deleteAutoRunAutogenHistoryRecord(i);In(d=>d.filter(w=>w.generation_id!==c.generation_id)),ts({force:!0}),q(`Удален набор автопрогона: ${c.generation_id}`+(c.deleted_files.length>0?`, files=${c.deleted_files.length}`:""))}catch(c){const d=c instanceof Error?c.message:String(c);Kt(w=>({...w,saving:!1,error:d})),q(`Autogen record delete error: ${d}`)}}},[It.generationId,ts,q]),Pr=g.useCallback(i=>{ue(c=>c.map(d=>d.annotation_id===i.annotation_id?{...d,...i}:d)),k(c=>c&&{...c,annotations:c.annotations.map(d=>d.annotation_id===i.annotation_id?i:d),messages:c.messages.map(d=>!d.annotation||d.annotation.annotation_id!==i.annotation_id?d:{...d,commented:!0,annotation:i})})},[]),Xo=g.useCallback(async(i,c)=>{if(i.annotation_id){if(Xs(i.run_id)){Ye("Статус выполнения можно менять только для завершённых прогонов.");return}Zs(i.annotation_id);try{const d=await Pe.updateAutoRunAnnotation({annotation_id:i.annotation_id,resolved:c,resolved_by:G.generatedBy||void 0});Pr(d.annotation),en()}catch(d){const w=d instanceof Error?d.message:String(d);Ye(`Смена статуса кейса: ${w}`),q(`Annotation resolve toggle error: ${w}`)}finally{Zs("")}}},[Pr,G.generatedBy,en,q]),co=g.useCallback(async i=>{xn(i.annotation_id),await Cn(i.run_id,i.case_id),te?.items.some(c=>c.run_id===i.run_id)||Ye("Комментарий относится к прогону вне текущего фильтра. Детали загружены напрямую.")},[te?.items,Cn]);g.useEffect(()=>{un.current||(un.current=!0,rs({keepSelection:!1}),ir(),Ts(),en())},[ir,Ts,rs,en]),g.useEffect(()=>{un.current&&jn()},[ce,jn]),g.useEffect(()=>{xn(i=>Xt.length===0?"":Xt.some(c=>c.annotation_id===i)?i:Xt[0].annotation_id)},[Xt]),g.useEffect(()=>{Ct(i=>vt.length===0?"":i&&vt.some(c=>c.generation_id===i)?i:vt[0].generation_id)},[vt]),g.useEffect(()=>{if(!Oe){Nt([]),cn(),Rt(null),Ht(null);return}Nt([...Oe.questions]),cn(),Rt(null),Ht(null)},[Oe,cn]),g.useEffect(()=>{if(Ze===null)return;const i=window.setTimeout(()=>{Vn.current?.focus(),Vn.current?.select()},0);return()=>window.clearTimeout(i)},[Ze]),g.useEffect(()=>{if(!Ae){Dn("");return}Mt&&!vt.some(i=>i.generation_id===Mt)&&Dn("")},[Mt,Ae,vt]),g.useEffect(()=>{Sr(String(b.limit))},[b.limit]),g.useEffect(()=>{kn(String(G.count))},[G.count]),g.useEffect(()=>{if(!et.trim()){Kr([]);return}js(et)},[et,js]),g.useEffect(()=>{if(!Y)return;const i=Jl(Y.job_id);if(Ee!==i)return;const c=Oo(Y,st||kt);A(c.detail),k(c.dialog),gt(c.caseId)},[Y,st,Ee]),g.useEffect(()=>()=>{Nn()},[Nn]),g.useEffect(()=>{jt.length!==0&&ft(i=>{let c=!1;const d={...i.personalityPrompts};for(const L of jt)(typeof d[L.id]!="string"||d[L.id].trim().length===0)&&(d[L.id]=L.defaultPrompt,c=!0);let w=i.personalityId;return jt.some(L=>L.id===i.personalityId)||(w=jt[0].id,c=!0),c?{...i,personalityId:w,personalityPrompts:d}:i})},[jt]),g.useEffect(()=>{const i=localStorage.getItem(nd);if(i)try{const c=JSON.parse(i);if(c.filters){const d=c.filters;Re(w=>({...w,...d,limit:typeof d.limit=="number"?Math.max(1,Math.min(500,d.limit)):w.limit}))}typeof c.analysisDate=="string"&&se(Oa(c.analysisDate)),typeof c.autogenPersonalityPromptHeight=="number"&&Zr(od(c.autogenPersonalityPromptHeight)),c.groupsExpanded&&(typeof c.groupsExpanded.filters=="boolean"&&Fo(c.groupsExpanded.filters),typeof c.groupsExpanded.generationContext=="boolean"&&ro(c.groupsExpanded.generationContext),typeof c.groupsExpanded.autogen=="boolean"&&kr(c.groupsExpanded.autogen),typeof c.groupsExpanded.savedSessions=="boolean"&&ws(c.groupsExpanded.savedSessions)),c.autoGenSettings&&ft(d=>{const w={...d.personalityPrompts},L=c.autoGenSettings?.personalityPrompts??{};for(const[tt,Dt]of Object.entries(L))typeof Dt=="string"&&tt.trim().length>0&&(w[tt.trim()]=Dt);const Ne=typeof c.autoGenSettings?.personalityId=="string"&&c.autoGenSettings.personalityId.trim().length>0?c.autoGenSettings.personalityId.trim():d.personalityId;return{...d,mode:c.autoGenSettings?.mode==="codex_creative"||c.autoGenSettings?.mode==="qwen_seed"||c.autoGenSettings?.mode==="saved_user_sessions"?c.autoGenSettings.mode:d.mode,count:typeof c.autoGenSettings?.count=="number"?Math.max(1,Math.min(200,c.autoGenSettings.count)):d.count,personalityId:Ne,personalityPrompts:w,persistToEvalCases:typeof c.autoGenSettings?.persistToEvalCases=="boolean"?c.autoGenSettings.persistToEvalCases:d.persistToEvalCases,generatedBy:typeof c.autoGenSettings?.generatedBy=="string"?c.autoGenSettings.generatedBy:d.generatedBy}}),(c.annotationDecisionFilter==="all"||typeof c.annotationDecisionFilter=="string"&&c.annotationDecisionFilter.length>0)&&ge(c.annotationDecisionFilter),typeof c.hideResolvedAnnotations=="boolean"&&xe(c.hideResolvedAnnotations)}catch{}},[]);const fo=g.useCallback(()=>{const i={filters:b,analysisDate:Ge,autogenPersonalityPromptHeight:nr,groupsExpanded:{filters:wr,generationContext:Bn,autogen:Qn,savedSessions:jr},autoGenSettings:{mode:G.mode,count:G.count,personalityId:G.personalityId,personalityPrompts:G.personalityPrompts,persistToEvalCases:G.persistToEvalCases,generatedBy:G.generatedBy},annotationDecisionFilter:ce,hideResolvedAnnotations:ye};localStorage.setItem(nd,JSON.stringify(i))},[Ge,ce,G,Qn,nr,b,wr,Bn,ye,jr]);return g.useEffect(()=>{const i=()=>{fo(),q("Сохранены настройки панели автопрогонов.")};return window.addEventListener(rd,i),()=>{window.removeEventListener(rd,i)}},[q,fo]),o.jsxs(Zl,{className:"autoruns-frame",title:"",hideHeader:!0,children:[o.jsxs("div",{className:"autoruns-columns",children:[je?o.jsxs("section",{className:"autoruns-col autoruns-settings-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Настройки"})}),o.jsxs("div",{className:"autoruns-settings-stack",children:[o.jsx(np,{embedded:!0,value:a,modelOptions:h,modelsBusy:p,onChange:I,onReloadModels:B,onSaveLocalConfig:ae,onTestConnection:re,lastStatus:T,busy:E}),o.jsx(rp,{embedded:!0,value:z,onChange:Z,presets:ee,selectedPresetId:ne,onSelectPreset:Te,onLoadPreset:de,onSavePreset:fe,onResetDefaults:he,onDiffPrevious:Qe,presetName:Ke,onPresetNameChange:He,diffSummary:Me})]})]}):null,Ue?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Автопрогоны"})}),o.jsxs("div",{className:"autoruns-group-heading",children:[o.jsx("h4",{children:"Настройки выборки"}),o.jsx("button",{type:"button",className:"autoruns-group-toggle",onClick:()=>Fo(i=>!i),"aria-label":wr?"Скрыть группу настройки выборки":"Показать группу настройки выборки",title:wr?"Скрыть группу":"Показать группу",children:o.jsx(Kl,{expanded:wr})})]}),wr?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Дата с",o.jsx("input",{type:"datetime-local",value:b.fromLocal,onChange:i=>Re(c=>({...c,fromLocal:i.target.value}))})]}),o.jsxs("label",{children:["Дата по",o.jsx("input",{type:"datetime-local",value:b.toLocal,onChange:i=>Re(c=>({...c,toLocal:i.target.value}))})]}),o.jsxs("label",{children:["Целевой контур",o.jsxs("select",{value:b.target,onChange:i=>Re(c=>({...c,target:i.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(te?.available.targets??[]).map(i=>o.jsx("option",{value:i,children:i},i))]})]}),o.jsxs("label",{children:["Режим",o.jsxs("select",{value:b.mode,onChange:i=>Re(c=>({...c,mode:i.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(te?.available.modes??[]).map(i=>o.jsx("option",{value:i,children:i},i))]})]}),o.jsxs("label",{children:["Использовать mock",o.jsxs("select",{value:b.useMock,onChange:i=>Re(c=>({...c,useMock:i.target.value})),children:[o.jsx("option",{value:"any",children:"любой"}),o.jsx("option",{value:"true",children:"да"}),o.jsx("option",{value:"false",children:"нет"})]})]}),o.jsxs("label",{children:["Лимит",o.jsx("input",{type:"number",min:1,max:500,value:ti,onChange:i=>{const c=i.target.value;(c===""||/^\d+$/.test(c))&&Sr(c)},onBlur:i=>lo(i.target.value),onKeyDown:i=>{i.key==="Enter"&&lo(i.target.value)}})]}),o.jsxs("label",{className:"full-width",children:["Версия промпта содержит",o.jsx("input",{value:b.promptContains,onChange:i=>Re(c=>({...c,promptContains:i.target.value})),placeholder:"normalizer_v2_0_2 / address_query_runtime_v1",list:"autoruns-prompt-versions"})]})]}),o.jsx("datalist",{id:"autoruns-prompt-versions",children:(te?.available.prompt_versions??[]).map(i=>o.jsx("option",{value:i},i))}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:C,onClick:()=>{rs({keepSelection:!1})},children:C?"Обновляю...":"Применить"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>{Re({...Ia,fromLocal:ld()}),Ye("")},children:"Сбросить фильтры"})]})]}):null,o.jsxs("div",{className:"autoruns-group-heading",children:[o.jsx("h4",{children:"Контур генерации"}),o.jsx("button",{type:"button",className:"autoruns-group-toggle",onClick:()=>ro(i=>!i),"aria-label":Bn?"Скрыть группу контура генерации":"Показать группу контура генерации",title:Bn?"Скрыть группу":"Показать группу",children:o.jsx(Kl,{expanded:Bn})})]}),Bn?o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Провайдер:"}),o.jsx("strong",{children:a.llmProvider})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Модель:"}),o.jsx("strong",{children:a.model||"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт ассистента:"}),o.jsx("strong",{children:$})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт декомпозиции:"}),o.jsx("strong",{children:ie})]})]}):null,o.jsxs("div",{className:"autoruns-group-heading",children:[o.jsx("h4",{children:"Автопрогоны"}),o.jsx("button",{type:"button",className:"autoruns-group-toggle",onClick:()=>kr(i=>!i),"aria-label":Qn?"Скрыть группу автопрогонов":"Показать группу автопрогонов",title:Qn?"Скрыть группу":"Показать группу",children:o.jsx(Kl,{expanded:Qn})})]}),Qn?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Режимы",o.jsxs("select",{value:G.mode,onChange:i=>ft(c=>({...c,mode:i.target.value})),children:[o.jsx("option",{value:"codex_creative",children:"codex_creative"}),o.jsx("option",{value:"qwen_seed",children:"qwen_seed"}),o.jsx("option",{value:"saved_user_sessions",children:"Пользовательские сессии"})]})]}),Ae?null:o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Кол-во",o.jsx("input",{type:"number",min:1,max:200,value:Ss,onChange:i=>{const c=i.target.value;(c===""||/^\d+$/.test(c))&&kn(c)},onBlur:i=>yt(i.target.value),onKeyDown:i=>{i.key==="Enter"&&yt(i.target.value)}})]}),o.jsxs("label",{children:["Личность автогенерации",o.jsx("select",{value:G.personalityId,onChange:i=>ft(c=>({...c,personalityId:i.target.value})),children:jt.map(i=>o.jsx("option",{value:i.id,children:i.label},i.id))})]}),o.jsxs("label",{children:["Кто генерирует",o.jsx("input",{value:G.generatedBy,onChange:i=>ft(c=>({...c,generatedBy:i.target.value})),placeholder:"manual_reviewer"})]}),o.jsxs("label",{className:"full-width",children:["Промпт личности",o.jsx("textarea",{className:"autoruns-personality-prompt",value:G.personalityPrompts[G.personalityId]??"",onChange:i=>ft(c=>({...c,personalityPrompts:{...c.personalityPrompts,[c.personalityId]:i.target.value}})),placeholder:"Текст промпта для выбранной личности автогенерации",style:{height:`${nr}px`},onMouseUp:Ps,onTouchEnd:Ps})]}),o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:G.persistToEvalCases,onChange:i=>ft(c=>({...c,persistToEvalCases:i.target.checked}))}),"Сохранять кейс-сет в `eval_cases`"]})]})]}),Ae?null:o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Дата анализа (срез)",o.jsx("input",{type:"date",value:Ge,onChange:i=>se(Oa(i.target.value))})]}),o.jsx("div",{className:"button-row",children:o.jsx("button",{type:"button",className:"tab",disabled:!Ge,onClick:()=>se(""),children:"Сбросить дату среза"})})]}),o.jsxs("div",{className:"button-row",children:[Ae?null:o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:Vr,onClick:()=>{ns()},children:Vr?"Генерирую...":"Сгенерировать пачку"}),o.jsx("button",{type:"button",className:"tab",disabled:Fn,onClick:()=>{ir()},children:Fn?"Обновляю...":"Обновить историю"})]}),o.jsx("button",{type:"button",className:"autoruns-run-launch-btn",style:Ae?{display:"none"}:void 0,disabled:xr||me.length===0||!Oe,onClick:()=>{Ms()},children:xr?"Запускаю...":"Запустить прогон"})]}),o.jsx("div",{className:"autoruns-form-grid",children:o.jsxs("label",{className:"full-width",children:[Ae?"Сохраненная сессия":"Кейс-сет для запуска",o.jsxs("select",{value:Ve,onChange:i=>Ct(i.target.value),disabled:vt.length===0,children:[vt.length===0?o.jsx("option",{value:"",children:Ae?"нет сохраненных сессий":"нет генераций"}):null,vt.map(i=>o.jsxs("option",{value:i.generation_id,children:[yn(i.created_at)," | ",$a(i)??za(i.mode)," | ",i.count]},i.generation_id))]})]})}),o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"autoruns-generated-questions",style:Ae?{display:"none"}:void 0,children:[o.jsx("div",{className:"autoruns-generated-questions-head",children:o.jsxs("strong",{children:["Вопросы к запуску: ",me.length]})}),me.length===0?o.jsx("p",{className:"muted",children:Ae?"Список вопросов пуст. Сначала сохраните живую пользовательскую сессию.":"Список вопросов пуст. Сгенерируйте пачку или добавьте вопрос вручную."}):o.jsx("div",{className:"autoruns-generated-questions-list",children:me.map((i,c)=>o.jsxs("div",{className:["autoruns-generated-question-item",Sn===c?"drag-over":"",On===c?"dragging":"",Ze===c?"editing":""].filter(Boolean).join(" "),onDragOver:d=>qo(d,c),onDrop:d=>{Ko(d,c)},children:[o.jsx("button",{type:"button",className:"autoruns-question-grip-btn",draggable:!Je&&Ze!==c,disabled:Je||Ze===c,onDragStart:d=>Go(d,c),onDragEnd:Jo,title:"Перетащить вопрос","aria-label":`Перетащить вопрос ${c+1}`,children:o.jsx(pd,{})}),Ze===c?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:Vn,className:"autoruns-generated-question-input",value:yr,onChange:d=>on(d.target.value),onBlur:Ho,onKeyDown:Vo,placeholder:"Текст вопроса",disabled:Je}),o.jsx("button",{type:"button",className:"autoruns-remove-question-btn",onMouseDown:d=>d.preventDefault(),onClick:()=>{Wo(c)},title:"Удалить вопрос","aria-label":`Удалить вопрос ${c+1}`,disabled:Je,children:"×"})]}):o.jsxs("button",{type:"button",className:"autoruns-generated-question-text",onDoubleClick:()=>Qo(c),title:"Двойной клик для редактирования",children:[c+1,". ",i]})]},`${c}-${i.slice(0,24)}`))}),o.jsx("button",{type:"button",className:"autoruns-add-question-btn",onClick:()=>{ao()},disabled:!Oe||Je,children:"+"})]}),Ae?null:o.jsx("p",{className:"muted",children:"Запуск выполняет `assistant_stage1` eval по выбранному кейс-сету."})]})]}):null,o.jsxs("div",{className:"autoruns-group-heading",children:[o.jsx("h4",{children:Ae?"Сохраненные пользовательские сессии":"История автогенераций"}),o.jsx("button",{type:"button",className:"autoruns-group-toggle",onClick:()=>ws(i=>!i),"aria-label":jr?Ae?"Скрыть группу сохраненных пользовательских сессий":"Скрыть группу истории автогенераций":Ae?"Показать группу сохраненных пользовательских сессий":"Показать группу истории автогенераций",title:jr?"Скрыть группу":"Показать группу",children:o.jsx(Kl,{expanded:jr})})]}),jr?o.jsxs("div",{className:"autoruns-autogen-list",children:[Fn?o.jsx("p",{className:"muted",children:Ae?"Загружаю сохраненные пользовательские сессии...":"Загружаю историю автогенераций..."}):null,!Fn&&vt.length===0?o.jsx("p",{className:"muted",children:Ae?"Сохраненные пользовательские сессии пока пусты.":"История автогенераций пока пустая."}):null,vt.slice(0,30).map(i=>o.jsxs("article",{className:["autoruns-autogen-item",Ve===i.generation_id?"selected":"",Mt===i.generation_id?"expanded":"",Ae?"saved-session":""].filter(Boolean).join(" "),onClick:Ae?void 0:()=>Ct(i.generation_id),children:[Ae?o.jsxs("div",{className:"autoruns-saved-session-topbar",children:[o.jsx("button",{type:"button",className:"autoruns-saved-session-icon-btn",disabled:xr,onClick:c=>{c.preventDefault(),c.stopPropagation(),Ct(i.generation_id),Ms(i,Ve===i.generation_id?me:i.questions)},title:"Запустить прогон","aria-label":`Запустить прогон для ${$a(i)}`,children:o.jsx(fp,{})}),o.jsx("button",{type:"button",className:"autoruns-autogen-delete-btn",onClick:c=>{c.preventDefault(),c.stopPropagation(),Yo(i)},title:"Удалить сохраненный набор","aria-label":`Удалить набор ${i.generation_id}`,children:"×"})]}):null,o.jsxs("header",{children:[o.jsx("strong",{children:$a(i)}),o.jsxs("div",{className:"autoruns-autogen-card-actions",children:[o.jsx("span",{children:yn(i.created_at)}),o.jsx("button",{type:"button",className:"autoruns-autogen-delete-btn",onClick:c=>{c.preventDefault(),c.stopPropagation(),Yo(i)},title:"Удалить сохраненный набор","aria-label":`Удалить набор ${i.generation_id}`,children:"×"})]})]}),o.jsxs("div",{className:"autoruns-run-meta autoruns-run-id-row",children:[o.jsx("span",{children:i.generation_id}),o.jsx("span",{role:"button",tabIndex:0,className:"autoruns-copy-run-id-btn",onClick:c=>{Zt(c,i.generation_id,"set id")},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),Zt(c,i.generation_id,"set id"))},title:"Скопировать id набора","aria-label":`Скопировать id набора ${i.generation_id}`,children:o.jsx(fd,{})})]}),o.jsxs("div",{className:"autoruns-run-meta",children:["режим=",za(i.mode)]}),o.jsxs("div",{className:"autoruns-run-meta",children:["тип=",_d(i)?"АГЕНТНЫЙ ПРОГОН":"АВТОПРОГОН"]}),Ae?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"autoruns-saved-session-footer",children:o.jsx("button",{type:"button",className:"autoruns-saved-session-icon-btn",onClick:c=>{c.preventDefault(),c.stopPropagation(),ai(i.generation_id)},title:Mt===i.generation_id?"Скрыть вопросы":"Показать вопросы","aria-label":Mt===i.generation_id?"Скрыть вопросы":"Показать вопросы",children:o.jsx(dp,{expanded:Mt===i.generation_id})})}),o.jsx("div",{className:Mt===i.generation_id?"autoruns-saved-session-questions expanded":"autoruns-saved-session-questions",children:o.jsxs("div",{className:"autoruns-generated-questions autoruns-generated-questions-embedded",children:[o.jsx("div",{className:"autoruns-generated-questions-head",children:o.jsxs("strong",{children:["Вопросы к запуску:"," ",Ve===i.generation_id?me.length:i.questions.length]})}),(Ve===i.generation_id?me:i.questions).length===0?o.jsx("p",{className:"muted",children:"Список вопросов пуст."}):o.jsx("div",{className:"autoruns-generated-questions-list",children:(Ve===i.generation_id?me:i.questions).map((c,d)=>o.jsxs("div",{className:["autoruns-generated-question-item",Sn===d&&Ve===i.generation_id?"drag-over":"",On===d&&Ve===i.generation_id?"dragging":"",Ze===d&&Ve===i.generation_id?"editing":""].filter(Boolean).join(" "),onDragOver:w=>Ve===i.generation_id?qo(w,d):void 0,onDrop:w=>Ve===i.generation_id?void Ko(w,d):void 0,children:[o.jsx("button",{type:"button",className:"autoruns-question-grip-btn",draggable:Ve===i.generation_id&&!Je&&Ze!==d,disabled:Ve!==i.generation_id||Je||Ze===d,onDragStart:w=>{Ct(i.generation_id),Go(w,d)},onDragEnd:Jo,title:"Перетащить вопрос","aria-label":`Перетащить вопрос ${d+1}`,children:o.jsx(pd,{})}),Ve===i.generation_id&&Ze===d?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:Vn,className:"autoruns-generated-question-input",value:yr,onChange:w=>on(w.target.value),onBlur:Ho,onKeyDown:Vo,placeholder:"Текст вопроса",disabled:Je}),o.jsx("button",{type:"button",className:"autoruns-remove-question-btn",onMouseDown:w=>w.preventDefault(),onClick:()=>{Wo(d)},title:"Удалить вопрос","aria-label":`Удалить вопрос ${d+1}`,disabled:Je,children:"×"})]}):o.jsxs("button",{type:"button",className:"autoruns-generated-question-text",onDoubleClick:()=>{Ct(i.generation_id),Qo(d)},title:"Двойной клик для редактирования",children:[d+1,". ",c]})]},`${i.generation_id}-${d}-${c.slice(0,24)}`))}),o.jsx("button",{type:"button",className:"autoruns-add-question-btn",onClick:()=>{Ct(i.generation_id),ao()},disabled:Ve!==i.generation_id||Je,children:"+"})]})})]}):null]},i.generation_id))]}):null,o.jsxs("details",{className:"autoruns-prompt-details",children:[o.jsx("summary",{children:"Копия активного промпта (только чтение)"}),o.jsxs("label",{children:["Системный",o.jsx("textarea",{readOnly:!0,value:z.systemPrompt})]}),o.jsxs("label",{children:["Разработчика",o.jsx("textarea",{readOnly:!0,value:z.developerPrompt})]}),o.jsxs("label",{children:["Доменный",o.jsx("textarea",{readOnly:!0,value:z.domainPrompt})]}),o.jsxs("label",{children:["Заметки по схеме",o.jsx("textarea",{readOnly:!0,value:z.schemaNotes})]}),o.jsxs("label",{children:["Примеры few-shot",o.jsx("textarea",{readOnly:!0,value:z.fewShotExamples})]})]}),eo?o.jsx("p",{className:"error-text",children:eo}):null]}):null,o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Выдача прогонов"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Всего"}),o.jsx("strong",{children:(te?.stats.runs_total??0)+(Y?1:0)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний score"}),o.jsx("strong",{children:ql(te?.stats.avg_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:te?ad(te.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Блокеры"}),o.jsx("strong",{children:te?.stats.blocking_runs??0})]})]}),o.jsxs("div",{className:"autoruns-run-list",children:[Nr.map(i=>o.jsxs("button",{type:"button",className:Ee===i.run_id?"autoruns-run-item selected":"autoruns-run-item",onClick:()=>{Cn(i.run_id)},children:[o.jsxs("div",{className:"autoruns-run-head",children:[o.jsx("strong",{children:yn(i.run_timestamp)}),o.jsx("span",{children:up(i.eval_target)})]}),o.jsxs("div",{className:"autoruns-run-meta autoruns-run-id-row",children:[o.jsx("span",{children:i.run_id}),o.jsx("span",{role:"button",tabIndex:0,className:"autoruns-copy-run-id-btn",onClick:c=>{Zt(c,i.run_id,"run id")},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),Zt(c,i.run_id,"run id"))},title:"Скопировать run id","aria-label":`Скопировать run id ${i.run_id}`,children:o.jsx(fd,{})})]}),o.jsxs("div",{className:"autoruns-run-meta",children:["режим=",i.mode??"нет данных"," | mock=",String(i.use_mock)]}),o.jsxs("div",{className:"autoruns-run-meta",children:["analysis_date=",i.analysis_date??"current_state"]}),i.llm_provider||i.model?o.jsxs("div",{className:"autoruns-run-meta",children:["llm=",i.llm_provider??"нет данных"," | модель=",i.model??"нет данных"]}):null,o.jsxs("div",{className:"autoruns-run-meta",children:["промпт=",i.prompt_version??"нет данных"]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["оценка: ",ql(i.score_index)]}),o.jsxs("span",{children:["закрыто/открыто: ",i.closed_cases,"/",i.open_cases]})]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["блокеры: ",i.blocking_failures]}),o.jsxs("span",{children:["качество: ",i.quality_failures]})]})]},i.run_id)),Nr.length===0?o.jsx("p",{className:"muted",children:"За выбранный диапазон прогонов нет."}):null]})]}),o.jsxs("section",{className:"autoruns-col",children:[o.jsxs("div",{className:"autoruns-col-header",children:[o.jsx("h3",{children:"Диалог прогона"}),o.jsxs("div",{className:"autoruns-dialog-toolbar",children:[o.jsxs("label",{children:["Прогон",o.jsx("select",{value:Ee,onChange:i=>{const c=i.target.value;Cn(c)},children:Nr.map(i=>o.jsxs("option",{value:i.run_id,children:[yn(i.run_timestamp)," | ",i.run_id]},i.run_id))})]}),o.jsxs("label",{children:["Кейс",o.jsxs("select",{value:st,onChange:i=>{const c=i.target.value;gt(c),Ee&&c&&Gn(Ee,c)},children:[(F?.cases.length??0)>0?o.jsx("option",{value:kt,children:"ВСЕ кейсы подряд"}):null,(F?.cases??[]).map(i=>o.jsxs("option",{value:i.case_id,children:[i.case_id," | ",i.status]},i.case_id))]})]})]})]}),o.jsxs("div",{className:"autoruns-case-list",children:[(F?.cases.length??0)>0?o.jsxs("button",{type:"button",className:st===kt?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{gt(kt),Ee&&Gn(Ee,kt)},children:[o.jsx("span",{children:"ВСЕ кейсы подряд"}),o.jsx("span",{children:F?.cases.length})]},kt):null,(F?.cases??[]).map(i=>o.jsxs("button",{type:"button",className:st===i.case_id?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{gt(i.case_id),Ee&&Gn(Ee,i.case_id)},children:[o.jsx("span",{children:i.case_id}),o.jsxs("span",{children:[i.status,i.commented_count>0?` | комм=${i.commented_count}`:""]})]},i.case_id))]}),o.jsxs("div",{className:"autoruns-dialog-view",children:[ot||V?o.jsx("p",{className:"muted",children:"Загружаю диалог..."}):null,!ot&&!V&&(y?.messages.length??0)===0?o.jsx("p",{className:"muted",children:"Диалог для этого прогона не найден."}):null,(y?.messages??[]).map((i,c)=>{const d=i.role==="assistant"?"assistant":"user";return o.jsxs("article",{className:`autoruns-msg ${d}`,children:[o.jsxs("header",{children:[o.jsx("strong",{children:d==="assistant"?"Система":"Модель/вопрос"}),o.jsxs("div",{className:"autoruns-msg-head-actions",children:[i.case_id?o.jsx("span",{className:"autoruns-msg-case-tag",children:i.case_id}):null,id(i)?o.jsx("span",{className:"autoruns-msg-case-tag",children:id(i)}):null,o.jsx("span",{children:i.created_at?yn(i.created_at):"нет данных"}),d==="assistant"&&!Xs(Ee)?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:i.commented?"autoruns-comment-icon commented":"autoruns-comment-icon",onClick:()=>ni(i),title:"\\u041a\\u043e\\u043c\\u043c\\u0435\\u043d\\u0442\\u0438\\u0440\\u043e\\u0432\\u0430\\u0442\\u044c \\u043e\\u0442\\u0432\\u0435\\u0442 \\u0441\\u0438\\u0441\\u0442\\u0435\\u043c\\u044b","aria-label":"\\u041a\\u043e\\u043c\\u043c\\u0435\\u043d\\u0442\\u0438\\u0440\\u043e\\u0432\\u0430\\u0442\\u044c \\u043e\\u0442\\u0432\\u0435\\u0442 \\u0441\\u0438\\u0441\\u0442\\u0435\\u043c\\u044b",children:o.jsx(cp,{commented:i.commented})}),i.annotation?o.jsx("button",{type:"button",className:i.annotation.resolved?"autoruns-resolve-toggle resolved":"autoruns-resolve-toggle",onClick:()=>{Xo(i.annotation,!i.annotation.resolved)},disabled:bn===i.annotation.annotation_id,title:i.annotation.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный","aria-label":i.annotation.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный",children:o.jsx(dd,{resolved:i.annotation.resolved})}):null]}):null]})]}),o.jsx("p",{children:i.text}),d==="assistant"&&i.annotation?o.jsxs("div",{className:"autoruns-msg-annotation",children:[o.jsx("strong",{children:Fa(i.annotation.rating)}),o.jsx("span",{children:i.annotation.comment}),o.jsxs("span",{className:"muted",children:[i.annotation.manual_case_decision,i.annotation.annotation_author?` | ${i.annotation.annotation_author}`:""]})]}):null,(i.trace_id||i.reply_type)&&o.jsxs("footer",{children:[i.trace_id?o.jsxs("span",{children:["trace=",i.trace_id]}):null,i.reply_type?o.jsxs("span",{children:["reply_type=",i.reply_type]}):null]})]},i.message_id??`${d}-${c}`)})]})]}),ht?o.jsx("div",{className:"autoruns-col autoruns-assistant-live-col",children:o.jsx(Xf,{sessionId:et,conversation:Vt,inputValue:De,onInputChange:to,selectedContextChip:Jr,onSelectContextChip:_s,onClearContextChip:()=>_s(null),useMock:_r,onUseMockChange:ei,onSend:bo,onClear:Cs,onSaveSession:Ns,busy:no,saveBusy:At.saving,saveDisabled:!et.trim()||Vt.length===0||no,statusText:an,errorMessage:Wt,showSaveAction:!0,showCommentAction:!0,onCommentAssistantMessage:Bo,isAssistantMessageCommented:oi,canCommentAssistantMessage:si})}):null,ut?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Прогресс / регресс"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Последний score"}),o.jsx("strong",{children:ql(te?.stats.latest_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Предыдущий"}),o.jsx("strong",{children:ql(te?.stats.previous_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:te?ad(te.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Пробелы качества"}),o.jsx("strong",{children:te?.stats.quality_gap_runs??0})]})]}),o.jsx("h4",{children:"Покрытие доменов (история)"}),ud(te?.stats.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Покрытие доменов (выбранный прогон)"}),ud(F?.coverage.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Очереди фиксов пост-анализа"}),zn?o.jsx("p",{className:"muted",children:"Собираю пост-анализ..."}):null,zn?null:o.jsx("div",{className:"autoruns-stats-grid",children:Object.entries(er?.post_analysis.stats.by_queue??{}).map(([i,c])=>o.jsxs("div",{children:[o.jsx("span",{children:i}),o.jsx("strong",{children:c})]},i))}),o.jsxs("div",{className:"autoruns-autogen-list",children:[(er?.post_analysis.recommended_regression_candidates??[]).slice(0,12).map(i=>o.jsxs("article",{className:"autoruns-autogen-item",children:[o.jsxs("header",{children:[o.jsx("strong",{children:i.manual_case_decision}),o.jsxs("span",{children:[i.rating,"/5"]})]}),o.jsxs("div",{className:"autoruns-run-meta",children:[i.domain??"неизвестно"," / ",i.query_class??"неизвестно"]}),o.jsx("p",{children:i.comment})]},i.annotation_id)),!zn&&(er?.post_analysis.recommended_regression_candidates.length??0)===0?o.jsx("p",{className:"muted",children:"Рекомендованных кандидатов пока нет."}):null]})]}):null,Bt?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Комментарии"})}),o.jsx("h4",{children:"Размеченные ответы"}),o.jsxs("div",{className:"autoruns-comment-filter-row",children:[o.jsxs("label",{children:["Фильтр решений",o.jsxs("select",{value:ce,onChange:i=>ge(i.target.value),children:[o.jsx("option",{value:"all",children:"все"}),(sn.length>0?sn:Se?.enum??[]).map(i=>o.jsx("option",{value:i,children:String(Se?.labels?.[i]??i)},i))]})]}),o.jsx("button",{type:"button",className:"tab autoruns-resolved-filter-toggle",onClick:()=>xe(i=>!i),children:ye?"Показать выполненные":"Скрыть выполненные"})]}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Комментариев"}),o.jsx("strong",{children:Et.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний рейтинг"}),o.jsx("strong",{children:sr===null?"нет данных":`${sr.toFixed(2)} / 5`})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Последний"}),o.jsx("strong",{children:Et.length>0?yn(Et[0].updated_at):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Статус"}),o.jsx("strong",{children:Gr?"обновляю":"готово"})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:Gr,onClick:()=>{jn()},children:Gr?"Обновляю...":"Обновить список"}),o.jsx("button",{type:"button",className:"tab",disabled:zn,onClick:()=>{en()},children:zn?"Идет пост-анализ...":"Обновить пост-анализ"})]}),o.jsxs("div",{className:"autoruns-comments-list",children:[Gr?o.jsx("p",{className:"muted",children:"Загружаю комментарии..."}):null,!Gr&&Et.length===0?o.jsx("p",{className:"muted",children:oe.length===0&&qr.length===0?"Пока нет откомментированных ответов.":"Нет открытых кейсов по текущему фильтру."}):null,Et.map(i=>{if(i.source==="assistant_live"){const d=i.assistant;return o.jsxs("article",{className:"autoruns-comment-item",children:[o.jsxs("div",{className:"autoruns-comment-head",children:[o.jsx("strong",{children:Fa(d.rating)}),o.jsx("div",{className:"autoruns-comment-head-actions",children:o.jsx("span",{children:yn(d.updated_at)})})]}),o.jsxs("div",{className:"autoruns-run-meta",children:["live-session: ",d.session_id]}),o.jsxs("div",{className:"autoruns-run-meta",children:["msg=",d.message_index]}),o.jsxs("div",{className:"autoruns-run-meta",children:["source=assistant_live",d.annotation_author?` | author=${d.annotation_author}`:""]}),d.context.question_text?o.jsxs("p",{children:["Q: ",d.context.question_text]}):null,d.context.answer_text?o.jsxs("p",{children:["A: ",d.context.answer_text]}):null,o.jsx("p",{children:d.comment})]},i.key)}const c=i.autorun;return o.jsxs("article",{className:Ln===c.annotation_id?"autoruns-comment-item selected":"autoruns-comment-item",onClick:()=>{co(c)},role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),co(c))},children:[o.jsxs("div",{className:"autoruns-comment-head",children:[o.jsx("strong",{children:Fa(c.rating)}),o.jsxs("div",{className:"autoruns-comment-head-actions",children:[o.jsx("span",{children:yn(c.updated_at)}),o.jsx("button",{type:"button",className:c.resolved?"autoruns-resolve-toggle resolved":"autoruns-resolve-toggle",onClick:d=>{d.preventDefault(),d.stopPropagation(),Xo(c,!c.resolved)},disabled:bn===c.annotation_id,title:c.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный","aria-label":c.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный",children:o.jsx(dd,{resolved:c.resolved})})]})]}),o.jsx("div",{className:"autoruns-run-meta",children:c.run_id}),o.jsxs("div",{className:"autoruns-run-meta",children:["case=",c.case_id," | msg=",c.message_index]}),o.jsxs("div",{className:"autoruns-run-meta",children:["decision=",c.manual_case_decision,c.annotation_author?` | author=${c.annotation_author}`:""]}),c.resolved_at?o.jsxs("div",{className:"autoruns-run-meta",children:["выполнено",": ",yn(c.resolved_at),c.resolved_by?` | by=${c.resolved_by}`:""]}):null,c.context.question_text?o.jsxs("p",{children:["Q: ",c.context.question_text]}):null,c.context.answer_text?o.jsxs("p",{children:["A: ",c.context.answer_text]}):null,o.jsx("p",{children:c.comment})]},i.key)})]}),Le?o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Тех-контекст брака"}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"trace:"}),o.jsx("strong",{children:Le.technical_context.trace_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"reply_type:"}),o.jsx("strong",{children:Le.technical_context.reply_type??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"domain:"}),o.jsx("strong",{children:Le.technical_context.domain??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"query_class:"}),o.jsx("strong",{children:Le.technical_context.query_class??"нет данных"})]})]}),o.jsx("h4",{children:"JSON разбор"}),o.jsx(yd,{value:{annotation_id:Le.annotation_id,run_id:Le.run_id,case_id:Le.case_id,message_index:Le.message_index,rating:Le.rating,comment:Le.comment,manual_case_decision:Le.manual_case_decision,annotation_author:Le.annotation_author,resolved:Le.resolved,resolved_at:Le.resolved_at,resolved_by:Le.resolved_by,context:Le.context,technical_context:Le.technical_context,case_summary:Le.case_summary?{case_id:Le.case_summary.case_id,domain:Le.case_summary.domain,query_class:Le.case_summary.query_class,checks:Le.case_summary.checks,metric_subscores:Le.case_summary.metric_subscores}:null}})]}):null]}):null]}),At.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:i=>{i.target===i.currentTarget&&or()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Сохранить ручную сессию"}),o.jsx("p",{className:"muted",children:"Технический чат будет сохранен в автопрогоны как пользовательская multi-turn сессия."}),o.jsxs("label",{children:["Название",o.jsx("input",{value:At.title,onChange:i=>Hn(c=>({...c,title:i.target.value})),placeholder:"Например: НДС и склад на март 2020",disabled:At.saving})]}),At.error?o.jsx("p",{className:"error-text",children:At.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{Es()},disabled:At.saving,children:At.saving?"Сохраняю...":"Сохранить"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>or(),disabled:At.saving,children:"Отмена"})]})]})}):null,Lt.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:i=>{i.target===i.currentTarget&&Er()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Удалить вопрос"}),o.jsx("p",{className:"muted",children:"Действительно удалить вопрос из сохраненной пользовательской сессии?"}),o.jsx("p",{className:"autoruns-comment-quote",children:Lt.questionText}),Lt.error?o.jsx("p",{className:"error-text",children:Lt.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{ii()},disabled:Lt.saving,children:Lt.saving?"Удаляю...":"Да"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>Er(),disabled:Lt.saving,children:"Нет"})]})]})}):null,It.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:i=>{i.target===i.currentTarget&&ts()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Удалить сохраненный набор"}),o.jsx("p",{className:"muted",children:"Будет удалена карточка истории и связанный файл кейс-сета на бэке."}),o.jsx("p",{className:"autoruns-comment-quote",children:It.title}),It.error?o.jsx("p",{className:"error-text",children:It.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{uo()},disabled:It.saving,children:It.saving?"Удаляю...":"Да"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>ts(),disabled:It.saving,children:"Нет"})]})]})}):null,we.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:i=>{i.target===i.currentTarget&&Wn()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Комментарий к ответу ассистента"}),o.jsx("p",{className:"muted",children:"Комментарий будет добавлен в общий список комментариев справа с меткой `assistant_live`."}),Cr?o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Вопрос пользователя"}),o.jsx("p",{className:"autoruns-comment-quote",children:Cr.text})]}):null,Uo?o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Ответ ассистента"}),o.jsx("p",{className:"autoruns-comment-quote",children:Uo.text})]}):null,o.jsx("div",{className:"autoruns-rating-row",role:"group","aria-label":"Рейтинг ответа ассистента",children:[1,2,3,4,5].map(i=>o.jsx("button",{type:"button",className:we.rating>=i?"autoruns-rating-dot active":"autoruns-rating-dot",onClick:()=>qt(c=>({...c,rating:i})),disabled:we.saving,"aria-label":`Оценка ${i}`,children:we.rating>=i?"●":"○"},i))}),o.jsx("div",{className:"autoruns-form-grid",children:o.jsxs("label",{children:["Автор комментария",o.jsx("input",{value:we.annotationAuthor,onChange:i=>qt(c=>({...c,annotationAuthor:i.target.value})),placeholder:"manual_reviewer",disabled:we.saving})]})}),o.jsxs("label",{children:["Комментарий",o.jsx("textarea",{value:we.comment,onChange:i=>qt(c=>({...c,comment:i.target.value})),placeholder:"Что именно не так в ответе и что нужно исправить.",rows:4,disabled:we.saving})]}),we.error?o.jsx("p",{className:"error-text",children:we.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{li()},disabled:we.saving,children:we.saving?"Сохраняю...":"Готово"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>Wn(),disabled:we.saving,children:"Отмена"})]})]})}):null,Q.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:i=>{i.target===i.currentTarget&&Rs()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Комментарий к ответу системы"}),o.jsx("p",{className:"muted",children:"Оцените ответ по 5-балльной шкале и добавьте комментарий по браку."}),so?o.jsxs(o.Fragment,{children:[o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Вопрос пользователя"}),o.jsx("p",{className:"autoruns-comment-quote",children:ks?.text??"Вопрос в диалоге не найден."})]}),o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Ответ системы"}),o.jsx("p",{className:"autoruns-comment-quote",children:so.text})]})]}):null,o.jsx("div",{className:"autoruns-rating-row",role:"group","aria-label":"Рейтинг ответа",children:[1,2,3,4,5].map(i=>o.jsx("button",{type:"button",className:Q.rating>=i?"autoruns-rating-dot active":"autoruns-rating-dot",onClick:()=>Gt(c=>({...c,rating:i})),disabled:Q.saving,"aria-label":`Оценка ${i}`,children:Q.rating>=i?"●":"○"},i))}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Решение по кейсу",o.jsx("select",{value:Q.manualCaseDecision,onChange:i=>Gt(c=>({...c,manualCaseDecision:i.target.value})),disabled:Q.saving,children:(sn.length>0?sn:Se?.enum??[Wl]).map(i=>o.jsx("option",{value:i,children:String(Se?.labels?.[i]??i)},i))})]}),o.jsxs("label",{children:["Автор комментария",o.jsx("input",{value:Q.annotationAuthor,onChange:i=>Gt(c=>({...c,annotationAuthor:i.target.value})),placeholder:"manual_reviewer",disabled:Q.saving})]})]}),o.jsxs("label",{children:["Комментарий",o.jsx("textarea",{value:Q.comment,onChange:i=>Gt(c=>({...c,comment:i.target.value})),placeholder:"Почему ответ бракованный, что именно пошло не так, какие технические детали проверить.",rows:4,disabled:Q.saving})]}),Q.error?o.jsx("p",{className:"error-text",children:Q.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{ri()},disabled:Q.saving,children:Q.saving?"Сохраняю...":"Готово"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>Rs(),disabled:Q.saving,children:"Отмена"})]})]})}):null]})}const mp={llmProvider:"openai",apiKey:"",model:"gpt-4o-mini",baseUrl:"https://api.openai.com/v1",temperature:0,maxOutputTokens:700},md={systemPrompt:"Ты semantic-normalizer для бухгалтерского ассистента NDC. Возвращай только JSON по схеме normalized_query_v2_0_2.",developerPrompt:"Сначала делай decomposition сообщения на task fragments, затем определяй domain scope и route-critical flags. Для каждого fragment заполняй execution_readiness + route_status + no_route_reason. Если fragment routable, не оставляй его в no_route.",domainPrompt:"Контур: данные текущего предприятия в 1С/NDC. In-scope: документы, проводки, взаиморасчеты, остатки, периодное закрытие, аномалии и контрольные проверки. Out-of-scope: общая теория, законы и оффтоп.",schemaNotes:"schema_version: normalized_query_v2_0_2. Строгий JSON без дополнительных полей.",fewShotExamples:"Q: Проверь по поставщикам хвосты и разложи цепочку документов/оплат. => fragment in_scope, flags: multi_entity + chain_explanation. Q: Как вообще по ФСБУ? => out_of_scope/generic_accounting."},hp={userQuestion:"",batchQuestionsRaw:"",periodHint:"",businessContext:"",expectedRoute:""},Ua={colors:{backgroundRgb:"18, 18, 18",mainSurfaceRgb:"25, 25, 25",horizontalSurfaceRgb:"30, 30, 30",focusSurfaceRgb:"35, 35, 35",assistantChipRgb:"18, 18, 18",assistantChipHoverRgb:"44, 44, 44",assistantChipSelectedRgb:"167, 59, 255",assistantChipSelectedTextRgb:"240, 240, 240",activeRgb:"167, 59, 255",activeTextRgb:"240, 240, 240",textMainRgb:"240, 240, 240",textMutedRgb:"166, 166, 166",dangerRgb:"126, 126, 126",scrollbarTrackRgb:"20, 20, 20",scrollbarThumbRgb:"30, 30, 30",scrollbarThumbHoverRgb:"30, 50, 30"},layout:{modeColumnWidthPx:406,modeToggleWidthPx:188}},hd="ndc_normalizer_session_config_v1",gd="ndc_autoruns_layout_config_v1",gp="ndc-autoruns-save",vp="autoruns",ba="normalizer_v2_0_2",yp="address_query_runtime_v1",xp=["normalized","fragments","scope","flags","route","raw","validation","logs"];function _p(a){return`[${new Date().toLocaleTimeString("ru-RU")}] ${a}`}function Sp(a,h){if(!h)return"Previous preset is not selected.";const T=["systemPrompt","developerPrompt","domainPrompt","schemaNotes","fewShotExamples"].filter(E=>a[E]!==h[E]).map(E=>`${E}: ${Math.abs(a[E].length-h[E].length)} chars delta`);return T.length===0?"No changes against previous preset.":`Changed fields: ${T.length}. ${T.join(" | ")}`}function wp(){const[a,h]=g.useState(mp),[p,T]=g.useState(md),[E,I]=g.useState(hp),[B,ae]=g.useState(null),[re,z]=g.useState([]),[Z,ee]=g.useState([]),[ne,Te]=g.useState("normalized"),[de,fe]=g.useState(!1),[he,Qe]=g.useState(!1),[Ke,He]=g.useState([]),[Me,$]=g.useState(""),[ie,je]=g.useState([]),[Ue,ht]=g.useState(""),[ut,Bt]=g.useState("NDC custom preset"),[ct,b]=g.useState(null),[Re,Ge]=g.useState(""),[se,te]=g.useState(!1),[R,F]=g.useState([]),[A,y]=g.useState(""),[k,oe]=g.useState([]),[ue,ce]=g.useState(!1),[ge,ye]=g.useState(null),[xe,Se]=g.useState(""),[dt,sn]=g.useState(vp),[gr,Ln]=g.useState(!0),[xn,Ee]=g.useState(!0),[Qt,st]=g.useState(!0),[gt,jt]=g.useState(!0),[_n,G]=g.useState(!0),[ft,vr]=g.useState(!0),[In,Ve]=g.useState(!0),[Ct,Mt]=g.useState(!0),[Dn,me]=g.useState(!0),[Nt,Je]=g.useState(!0),[vs,Ze]=g.useState(!0),[Zn,yr]=g.useState(!0),[on,On]=g.useState(!0),Rt=g.useRef(!1),Sn=g.useRef(!1),Ht=g.useRef(!1);g.useEffect(()=>{const C=document.documentElement,{colors:X}=Ua;C.style.setProperty("--rgb-background",X.backgroundRgb),C.style.setProperty("--rgb-surface-main",X.mainSurfaceRgb),C.style.setProperty("--rgb-surface-horizontal",X.horizontalSurfaceRgb),C.style.setProperty("--rgb-surface-focus",X.focusSurfaceRgb),C.style.setProperty("--rgb-assistant-chip",X.assistantChipRgb),C.style.setProperty("--rgb-assistant-chip-hover",X.assistantChipHoverRgb),C.style.setProperty("--rgb-assistant-chip-selected",X.assistantChipSelectedRgb),C.style.setProperty("--rgb-assistant-chip-selected-text",X.assistantChipSelectedTextRgb),C.style.setProperty("--rgb-active",X.activeRgb),C.style.setProperty("--rgb-active-text",X.activeTextRgb),C.style.setProperty("--rgb-text-main",X.textMainRgb),C.style.setProperty("--rgb-text-muted",X.textMutedRgb),C.style.setProperty("--rgb-danger",X.dangerRgb),C.style.setProperty("--rgb-scrollbar-track",X.scrollbarTrackRgb),C.style.setProperty("--rgb-scrollbar-thumb",X.scrollbarThumbRgb),C.style.setProperty("--rgb-scrollbar-thumb-hover",X.scrollbarThumbHoverRgb),C.style.setProperty("--mode-column-width",`${Ua.layout.modeColumnWidthPx}px`),C.style.setProperty("--mode-toggle-width",`${Ua.layout.modeToggleWidthPx}px`)},[]);const Y=C=>{ee(X=>[_p(C),...X].slice(0,300))};g.useEffect(()=>{(async()=>{const V=localStorage.getItem(hd);if(V)try{const Ce=JSON.parse(V);h(ot=>({...ot,llmProvider:Ce.llmProvider==="local"?"local":"openai",model:Ce.model??ot.model,baseUrl:Ce.baseUrl??ot.baseUrl,temperature:Ce.temperature??ot.temperature,maxOutputTokens:Ce.maxOutputTokens??ot.maxOutputTokens}))}catch{}try{const Ce=await Pe.loadSharedConnectionConfig();Ce.connection&&Ce.connection.llmProvider==="local"&&(h(ot=>({...ot,llmProvider:"local",model:Ce.connection?.model??ot.model,baseUrl:Ce.connection?.baseUrl??ot.baseUrl,temperature:Ce.connection?.temperature??ot.temperature,maxOutputTokens:Ce.connection?.maxOutputTokens??ot.maxOutputTokens})),Y(`Shared local LLM config loaded: ${Ce.connection.model}`))}catch(Ce){Y(`Shared local config load error: ${Ce instanceof Error?Ce.message:String(Ce)}`)}finally{Ht.current=!0}})();const X=localStorage.getItem(gd);if(X)try{const V=JSON.parse(X);(V.uiMode==="assistant"||V.uiMode==="autoruns"||V.uiMode==="decomposition")&&sn("autoruns"),V.activeTab&&xp.includes(V.activeTab)&&Te(V.activeTab),typeof V.showAutorunsSettingsMode=="boolean"&&Ln(V.showAutorunsSettingsMode),typeof V.showAutorunsAutoRunsMode=="boolean"&&Ee(V.showAutorunsAutoRunsMode),typeof V.showAutorunsAssistantMode=="boolean"&&st(V.showAutorunsAssistantMode),typeof V.showAutorunsDecompositionMode=="boolean"&&jt(V.showAutorunsDecompositionMode),typeof V.showAutorunsProgressMode=="boolean"&&G(V.showAutorunsProgressMode),typeof V.showAutorunsCommentsMode=="boolean"&&vr(V.showAutorunsCommentsMode),typeof V.showDecompositionConnectionMode=="boolean"&&Ve(V.showDecompositionConnectionMode),typeof V.showDecompositionPromptMode=="boolean"&&Mt(V.showDecompositionPromptMode),typeof V.showDecompositionQueryMode=="boolean"&&me(V.showDecompositionQueryMode),typeof V.showDecompositionOutputMode=="boolean"&&Je(V.showDecompositionOutputMode),typeof V.showDecompositionMetricsMode=="boolean"&&Ze(V.showDecompositionMetricsMode),typeof V.showDecompositionHistoryMode=="boolean"&&yr(V.showDecompositionHistoryMode),typeof V.showDecompositionRuntimeMode=="boolean"&&On(V.showDecompositionRuntimeMode),V.prompts&&(T(Ce=>({...Ce,...V.prompts})),Sn.current=!0)}catch{}ln(),er(),Hr()},[]),g.useEffect(()=>{if(!Ht.current||a.llmProvider!=="local")return;const C=window.setTimeout(()=>{Pe.saveSharedConnectionConfig(a).catch(X=>Y(`Shared local config sync error: ${X instanceof Error?X.message:String(X)}`))},250);return()=>window.clearTimeout(C)},[a.baseUrl,a.llmProvider,a.maxOutputTokens,a.model,a.temperature]);async function ln(){try{const C=await Pe.loadHistory();z(C.items??[])}catch(C){Y(`History load error: ${C instanceof Error?C.message:String(C)}`)}}async function er(){try{const X=(await Pe.loadPresets()).presets??[];if(je(X),Sn.current){Rt.current=!0;return}if(Rt.current)return;const V=X.find(Ce=>Ce.prompt_version===ba)??X.find(Ce=>Ce.id==="default-normalizer-v2_0_2");if(!V){Rt.current=!0,Y(`Preset autoload skipped: ${ba} not found.`);return}ht(V.id),b(p),T({systemPrompt:V.systemPrompt,developerPrompt:V.developerPrompt,domainPrompt:V.domainPrompt,schemaNotes:V.schemaNotes??"",fewShotExamples:V.fewShotExamples??""}),Rt.current=!0,Y(`Preset autoloaded: ${V.name} (${V.prompt_version}).`)}catch(C){Y(`Presets load error: ${C instanceof Error?C.message:String(C)}`)}}async function Hr(){try{const C=await Pe.listRuns();F(C.items??[])}catch(C){Y(`Runs load error: ${C instanceof Error?C.message:String(C)}`)}}function Vr(){if(localStorage.setItem(hd,JSON.stringify({model:a.model,llmProvider:a.llmProvider,baseUrl:a.baseUrl,temperature:a.temperature,maxOutputTokens:a.maxOutputTokens})),a.llmProvider==="local"){Pe.saveSharedConnectionConfig(a).then(()=>{Y("Local config saved and synced to shared agent config (without API key).")}).catch(C=>{Y(`Local config saved, but shared sync failed: ${C instanceof Error?C.message:String(C)}`)});return}Y("Local config saved (without API key).")}function Wr(){localStorage.setItem(gd,JSON.stringify({uiMode:dt,activeTab:ne,showAutorunsSettingsMode:gr,showAutorunsAutoRunsMode:xn,showAutorunsAssistantMode:Qt,showAutorunsDecompositionMode:gt,showAutorunsProgressMode:_n,showAutorunsCommentsMode:ft,showDecompositionConnectionMode:In,showDecompositionPromptMode:Ct,showDecompositionQueryMode:Dn,showDecompositionOutputMode:Nt,showDecompositionMetricsMode:vs,showDecompositionHistoryMode:Zn,showDecompositionRuntimeMode:on,prompts:p})),window.dispatchEvent(new CustomEvent(gp)),Y("UI layout and prompts saved.")}async function xr(){fe(!0),Se("");try{const C=await Pe.testConnection(a);C.provider==="local"?C.model_found===!0?($(`LOCAL OK - ${C.model}`),Y(`Local model is available: ${C.model} (catalog size=${C.models_count??"n/a"}).`)):C.model_found===!1?($(`LOCAL OK, model not loaded - ${C.model}`),Y(`Local server is reachable, but model '${C.model}' is not in loaded catalog. Use 'Load model list' and select one of loaded models.`)):($(`LOCAL OK (model list unavailable) - ${C.model}`),Y("Local server is reachable, but model catalog could not be verified.")):($(`OPENAI OK - ${C.model}`),Y(`OpenAI connection ok: ${C.model}`))}catch(C){const X=C instanceof Error?C.message:String(C);$("Connection error"),Se(`Test connection: ${X}`),Y(`Test connection error: ${X}`)}finally{fe(!1)}}async function wn(){Qe(!0);try{const X=(await Pe.listModels(a)).models??[];He(X),X.length>0&&h(V=>V.model&&X.includes(V.model)?V:{...V,model:X[0]}),Y(`Model catalog loaded (${a.llmProvider}): ${X.length} items.`)}catch(C){const X=C instanceof Error?C.message:String(C);Y(`Load model list error: ${X}`)}finally{Qe(!1)}}g.useEffect(()=>{He([])},[a.llmProvider,a.baseUrl]);function zn(){const C=ie.find(X=>X.id===Ue);if(!C){Y("Preset is not selected.");return}b(p),T({systemPrompt:C.systemPrompt,developerPrompt:C.developerPrompt,domainPrompt:C.domainPrompt,schemaNotes:C.schemaNotes??"",fewShotExamples:C.fewShotExamples??""}),Y(`Preset loaded: ${C.name}`)}async function $n(){try{await Pe.savePreset({name:ut||"NDC preset",prompt_version:"normalizer_v2_0_2",systemPrompt:p.systemPrompt,developerPrompt:p.developerPrompt,domainPrompt:p.domainPrompt,schemaNotes:p.schemaNotes,fewShotExamples:p.fewShotExamples}),Y("Preset saved."),await er()}catch(C){Y(`Preset save error: ${C instanceof Error?C.message:String(C)}`)}}function Fn(){T(md),Y("Prompt panel reset to defaults.")}function Un(){const C=Sp(p,ct);Ge(C),Y(C)}return g.useEffect(()=>{if(!A){oe([]);return}Pe.runTrace(A).then(C=>oe(C.items)).catch(C=>Y(`Run trace error: ${C instanceof Error?C.message:String(C)}`))},[A]),o.jsxs("main",{className:"app-root app-root-autoruns",children:[o.jsxs("header",{className:"app-topbar",children:[o.jsxs("div",{className:"mode-switch-row",children:[o.jsx("button",{type:"button",className:"tab active",onClick:()=>sn("autoruns"),children:"Управление ассистентом"}),o.jsx("button",{type:"button",className:"tab",onClick:Wr,children:"Сохранить"})]}),o.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[o.jsx("button",{type:"button",className:gr?"tab active":"tab",onClick:()=>Ln(C=>!C),children:"Настройки"}),o.jsx("button",{type:"button",className:xn?"tab active":"tab",onClick:()=>Ee(C=>!C),children:"Автопрогоны"}),o.jsx("button",{type:"button",className:Qt?"tab active":"tab",onClick:()=>st(C=>!C),children:"Режим ассистента"}),o.jsx("button",{type:"button",className:_n?"tab active":"tab",onClick:()=>G(C=>!C),children:"Прогресс/регресс"}),o.jsx("button",{type:"button",className:ft?"tab active":"tab",onClick:()=>vr(C=>!C),children:"Комментарии"})]})]}),o.jsx("div",{className:"layout-grid layout-grid-autoruns",children:o.jsx(pp,{connection:a,modelOptions:Ke,modelsBusy:he,connectionStatus:Me,connectionBusy:de,onConnectionChange:h,onReloadModels:wn,onSaveLocalConfig:Vr,onTestConnection:xr,prompts:p,onPromptsChange:T,promptPresets:ie,selectedPresetId:Ue,onSelectPreset:ht,onLoadPreset:zn,onSavePreset:$n,onResetDefaults:Fn,onDiffPrevious:Un,presetName:ut,onPresetNameChange:Bt,diffSummary:Re,assistantPromptVersion:yp,decompositionPromptVersion:ba,showSettingsMode:gr,showAutoRunsMode:xn,showAssistantMode:Qt,showProgressMode:_n,showCommentsMode:ft,onLog:Y})})]})}Af.createRoot(document.getElementById("root")).render(o.jsx(Cf.StrictMode,{children:o.jsx(wp,{})}));