@orion-agents/orion-code 0.3.12 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-IkCttxgw.js","assets/TerminalPanel-DLuoa74B.css","assets/FilesPanel-BcFY6L1a.js","assets/ResourceSplitLayout-fPYE9JKJ.js","assets/GitPanel-B6E5IEXm.js","assets/DiffViewer-BrHqudpK.js","assets/ReviewPanel-5ecTVmhT.js"])))=>i.map(i=>d[i]);
2
+ var pm=Object.defineProperty;var hm=(n,r,o)=>r in n?pm(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var Bt=(n,r,o)=>hm(n,typeof r!="symbol"?r+"":r,o);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))a(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();function Lf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Sa={exports:{}},Us={},Ca={exports:{}},Ee={};var Md;function mm(){if(Md)return Ee;Md=1;var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),h=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),C=Symbol.iterator;function O(y){return y===null||typeof y!="object"?null:(y=C&&y[C]||y["@@iterator"],typeof y=="function"?y:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,L={};function q(y,$,A){this.props=y,this.context=$,this.refs=L,this.updater=A||R}q.prototype.isReactComponent={},q.prototype.setState=function(y,$){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,$,"setState")},q.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function X(){}X.prototype=q.prototype;function W(y,$,A){this.props=y,this.context=$,this.refs=L,this.updater=A||R}var he=W.prototype=new X;he.constructor=W,z(he,q.prototype),he.isPureReactComponent=!0;var Z=Array.isArray,ee=Object.prototype.hasOwnProperty,N={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function re(y,$,A){var ne,ye={},we=null,be=null;if($!=null)for(ne in $.ref!==void 0&&(be=$.ref),$.key!==void 0&&(we=""+$.key),$)ee.call($,ne)&&!F.hasOwnProperty(ne)&&(ye[ne]=$[ne]);var Se=arguments.length-2;if(Se===1)ye.children=A;else if(1<Se){for(var _e=Array(Se),Le=0;Le<Se;Le++)_e[Le]=arguments[Le+2];ye.children=_e}if(y&&y.defaultProps)for(ne in Se=y.defaultProps,Se)ye[ne]===void 0&&(ye[ne]=Se[ne]);return{$$typeof:n,type:y,key:we,ref:be,props:ye,_owner:N.current}}function je(y,$){return{$$typeof:n,type:y.type,key:$,ref:y.ref,props:y.props,_owner:y._owner}}function xe(y){return typeof y=="object"&&y!==null&&y.$$typeof===n}function Y(y){var $={"=":"=0",":":"=2"};return"$"+y.replace(/[=:]/g,function(A){return $[A]})}var pe=/\/+/g;function te(y,$){return typeof y=="object"&&y!==null&&y.key!=null?Y(""+y.key):$.toString(36)}function Ce(y,$,A,ne,ye){var we=typeof y;(we==="undefined"||we==="boolean")&&(y=null);var be=!1;if(y===null)be=!0;else switch(we){case"string":case"number":be=!0;break;case"object":switch(y.$$typeof){case n:case r:be=!0}}if(be)return be=y,ye=ye(be),y=ne===""?"."+te(be,0):ne,Z(ye)?(A="",y!=null&&(A=y.replace(pe,"$&/")+"/"),Ce(ye,$,A,"",function(Le){return Le})):ye!=null&&(xe(ye)&&(ye=je(ye,A+(!ye.key||be&&be.key===ye.key?"":(""+ye.key).replace(pe,"$&/")+"/")+y)),$.push(ye)),1;if(be=0,ne=ne===""?".":ne+":",Z(y))for(var Se=0;Se<y.length;Se++){we=y[Se];var _e=ne+te(we,Se);be+=Ce(we,$,A,_e,ye)}else if(_e=O(y),typeof _e=="function")for(y=_e.call(y),Se=0;!(we=y.next()).done;)we=we.value,_e=ne+te(we,Se++),be+=Ce(we,$,A,_e,ye);else if(we==="object")throw $=String(y),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(y).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return be}function D(y,$,A){if(y==null)return y;var ne=[],ye=0;return Ce(y,ne,"","",function(we){return $.call(A,we,ye++)}),ne}function ue(y){if(y._status===-1){var $=y._result;$=$(),$.then(function(A){(y._status===0||y._status===-1)&&(y._status=1,y._result=A)},function(A){(y._status===0||y._status===-1)&&(y._status=2,y._result=A)}),y._status===-1&&(y._status=0,y._result=$)}if(y._status===1)return y._result.default;throw y._result}var de={current:null},E={transition:null},K={ReactCurrentDispatcher:de,ReactCurrentBatchConfig:E,ReactCurrentOwner:N};function T(){throw Error("act(...) is not supported in production builds of React.")}return Ee.Children={map:D,forEach:function(y,$,A){D(y,function(){$.apply(this,arguments)},A)},count:function(y){var $=0;return D(y,function(){$++}),$},toArray:function(y){return D(y,function($){return $})||[]},only:function(y){if(!xe(y))throw Error("React.Children.only expected to receive a single React element child.");return y}},Ee.Component=q,Ee.Fragment=o,Ee.Profiler=d,Ee.PureComponent=W,Ee.StrictMode=a,Ee.Suspense=w,Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,Ee.act=T,Ee.cloneElement=function(y,$,A){if(y==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+y+".");var ne=z({},y.props),ye=y.key,we=y.ref,be=y._owner;if($!=null){if($.ref!==void 0&&(we=$.ref,be=N.current),$.key!==void 0&&(ye=""+$.key),y.type&&y.type.defaultProps)var Se=y.type.defaultProps;for(_e in $)ee.call($,_e)&&!F.hasOwnProperty(_e)&&(ne[_e]=$[_e]===void 0&&Se!==void 0?Se[_e]:$[_e])}var _e=arguments.length-2;if(_e===1)ne.children=A;else if(1<_e){Se=Array(_e);for(var Le=0;Le<_e;Le++)Se[Le]=arguments[Le+2];ne.children=Se}return{$$typeof:n,type:y.type,key:ye,ref:we,props:ne,_owner:be}},Ee.createContext=function(y){return y={$$typeof:h,_currentValue:y,_currentValue2:y,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},y.Provider={$$typeof:f,_context:y},y.Consumer=y},Ee.createElement=re,Ee.createFactory=function(y){var $=re.bind(null,y);return $.type=y,$},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(y){return{$$typeof:g,render:y}},Ee.isValidElement=xe,Ee.lazy=function(y){return{$$typeof:P,_payload:{_status:-1,_result:y},_init:ue}},Ee.memo=function(y,$){return{$$typeof:j,type:y,compare:$===void 0?null:$}},Ee.startTransition=function(y){var $=E.transition;E.transition={};try{y()}finally{E.transition=$}},Ee.unstable_act=T,Ee.useCallback=function(y,$){return de.current.useCallback(y,$)},Ee.useContext=function(y){return de.current.useContext(y)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(y){return de.current.useDeferredValue(y)},Ee.useEffect=function(y,$){return de.current.useEffect(y,$)},Ee.useId=function(){return de.current.useId()},Ee.useImperativeHandle=function(y,$,A){return de.current.useImperativeHandle(y,$,A)},Ee.useInsertionEffect=function(y,$){return de.current.useInsertionEffect(y,$)},Ee.useLayoutEffect=function(y,$){return de.current.useLayoutEffect(y,$)},Ee.useMemo=function(y,$){return de.current.useMemo(y,$)},Ee.useReducer=function(y,$,A){return de.current.useReducer(y,$,A)},Ee.useRef=function(y){return de.current.useRef(y)},Ee.useState=function(y){return de.current.useState(y)},Ee.useSyncExternalStore=function(y,$,A){return de.current.useSyncExternalStore(y,$,A)},Ee.useTransition=function(){return de.current.useTransition()},Ee.version="18.3.1",Ee}var Od;function Va(){return Od||(Od=1,Ca.exports=mm()),Ca.exports}var Ad;function gm(){if(Ad)return Us;Ad=1;var n=Va(),r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function h(g,w,j){var P,C={},O=null,R=null;j!==void 0&&(O=""+j),w.key!==void 0&&(O=""+w.key),w.ref!==void 0&&(R=w.ref);for(P in w)a.call(w,P)&&!f.hasOwnProperty(P)&&(C[P]=w[P]);if(g&&g.defaultProps)for(P in w=g.defaultProps,w)C[P]===void 0&&(C[P]=w[P]);return{$$typeof:r,type:g,key:O,ref:R,props:C,_owner:d.current}}return Us.Fragment=o,Us.jsx=h,Us.jsxs=h,Us}var $d;function vm(){return $d||($d=1,Sa.exports=gm()),Sa.exports}var i=vm(),m=Va();const ym=Lf(m);var co={},Na={exports:{}},St={},ba={exports:{}},_a={};var Ld;function xm(){return Ld||(Ld=1,(function(n){function r(E,K){var T=E.length;E.push(K);e:for(;0<T;){var y=T-1>>>1,$=E[y];if(0<d($,K))E[y]=K,E[T]=$,T=y;else break e}}function o(E){return E.length===0?null:E[0]}function a(E){if(E.length===0)return null;var K=E[0],T=E.pop();if(T!==K){E[0]=T;e:for(var y=0,$=E.length,A=$>>>1;y<A;){var ne=2*(y+1)-1,ye=E[ne],we=ne+1,be=E[we];if(0>d(ye,T))we<$&&0>d(be,ye)?(E[y]=be,E[we]=T,y=we):(E[y]=ye,E[ne]=T,y=ne);else if(we<$&&0>d(be,T))E[y]=be,E[we]=T,y=we;else break e}}return K}function d(E,K){var T=E.sortIndex-K.sortIndex;return T!==0?T:E.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,g=h.now();n.unstable_now=function(){return h.now()-g}}var w=[],j=[],P=1,C=null,O=3,R=!1,z=!1,L=!1,q=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,W=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(E){for(var K=o(j);K!==null;){if(K.callback===null)a(j);else if(K.startTime<=E)a(j),K.sortIndex=K.expirationTime,r(w,K);else break;K=o(j)}}function Z(E){if(L=!1,he(E),!z)if(o(w)!==null)z=!0,ue(ee);else{var K=o(j);K!==null&&de(Z,K.startTime-E)}}function ee(E,K){z=!1,L&&(L=!1,X(re),re=-1),R=!0;var T=O;try{for(he(K),C=o(w);C!==null&&(!(C.expirationTime>K)||E&&!Y());){var y=C.callback;if(typeof y=="function"){C.callback=null,O=C.priorityLevel;var $=y(C.expirationTime<=K);K=n.unstable_now(),typeof $=="function"?C.callback=$:C===o(w)&&a(w),he(K)}else a(w);C=o(w)}if(C!==null)var A=!0;else{var ne=o(j);ne!==null&&de(Z,ne.startTime-K),A=!1}return A}finally{C=null,O=T,R=!1}}var N=!1,F=null,re=-1,je=5,xe=-1;function Y(){return!(n.unstable_now()-xe<je)}function pe(){if(F!==null){var E=n.unstable_now();xe=E;var K=!0;try{K=F(!0,E)}finally{K?te():(N=!1,F=null)}}else N=!1}var te;if(typeof W=="function")te=function(){W(pe)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,D=Ce.port2;Ce.port1.onmessage=pe,te=function(){D.postMessage(null)}}else te=function(){q(pe,0)};function ue(E){F=E,N||(N=!0,te())}function de(E,K){re=q(function(){E(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(E){E.callback=null},n.unstable_continueExecution=function(){z||R||(z=!0,ue(ee))},n.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):je=0<E?Math.floor(1e3/E):5},n.unstable_getCurrentPriorityLevel=function(){return O},n.unstable_getFirstCallbackNode=function(){return o(w)},n.unstable_next=function(E){switch(O){case 1:case 2:case 3:var K=3;break;default:K=O}var T=O;O=K;try{return E()}finally{O=T}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(E,K){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var T=O;O=E;try{return K()}finally{O=T}},n.unstable_scheduleCallback=function(E,K,T){var y=n.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?y+T:y):T=y,E){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=T+$,E={id:P++,callback:K,priorityLevel:E,startTime:T,expirationTime:$,sortIndex:-1},T>y?(E.sortIndex=T,r(j,E),o(w)===null&&E===o(j)&&(L?(X(re),re=-1):L=!0,de(Z,T-y))):(E.sortIndex=$,r(w,E),z||R||(z=!0,ue(ee))),E},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(E){var K=O;return function(){var T=O;O=K;try{return E.apply(this,arguments)}finally{O=T}}}})(_a)),_a}var Dd;function wm(){return Dd||(Dd=1,ba.exports=xm()),ba.exports}var zd;function km(){if(zd)return St;zd=1;var n=Va(),r=wm();function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,d={};function f(e,t){h(e,t),h(e+"Capture",t)}function h(e,t){for(d[e]=t,e=0;e<t.length;e++)a.add(t[e])}var g=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),w=Object.prototype.hasOwnProperty,j=/^[: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]*$/,P={},C={};function O(e){return w.call(C,e)?!0:w.call(P,e)?!1:j.test(e)?C[e]=!0:(P[e]=!0,!1)}function R(e,t,s,l){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function z(e,t,s,l){if(t===null||typeof t>"u"||R(e,t,s,l))return!0;if(l)return!1;if(s!==null)switch(s.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 L(e,t,s,l,c,u,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=c,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=p}var q={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){q[e]=new L(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];q[t]=new L(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){q[e]=new L(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){q[e]=new L(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){q[e]=new L(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){q[e]=new L(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){q[e]=new L(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){q[e]=new L(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){q[e]=new L(e,5,!1,e.toLowerCase(),null,!1,!1)});var X=/[\-:]([a-z])/g;function W(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(X,W);q[t]=new L(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(X,W);q[t]=new L(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(X,W);q[t]=new L(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){q[e]=new L(e,1,!1,e.toLowerCase(),null,!1,!1)}),q.xlinkHref=new L("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){q[e]=new L(e,1,!1,e.toLowerCase(),null,!0,!0)});function he(e,t,s,l){var c=q.hasOwnProperty(t)?q[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(z(t,s,c,l)&&(s=null),l||c===null?O(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):c.mustUseProperty?e[c.propertyName]=s===null?c.type===3?!1:"":s:(t=c.attributeName,l=c.attributeNamespace,s===null?e.removeAttribute(t):(c=c.type,s=c===3||c===4&&s===!0?"":""+s,l?e.setAttributeNS(l,t,s):e.setAttribute(t,s))))}var Z=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ee=Symbol.for("react.element"),N=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),re=Symbol.for("react.strict_mode"),je=Symbol.for("react.profiler"),xe=Symbol.for("react.provider"),Y=Symbol.for("react.context"),pe=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),Ce=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),ue=Symbol.for("react.lazy"),de=Symbol.for("react.offscreen"),E=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=E&&e[E]||e["@@iterator"],typeof e=="function"?e:null)}var T=Object.assign,y;function $(e){if(y===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);y=t&&t[1]||""}return`
3
+ `+y+e}var A=!1;function ne(e,t){if(!e||A)return"";A=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(M){var l=M}Reflect.construct(e,[],t)}else{try{t.call()}catch(M){l=M}e.call(t.prototype)}else{try{throw Error()}catch(M){l=M}e()}}catch(M){if(M&&l&&typeof M.stack=="string"){for(var c=M.stack.split(`
4
+ `),u=l.stack.split(`
5
+ `),p=c.length-1,v=u.length-1;1<=p&&0<=v&&c[p]!==u[v];)v--;for(;1<=p&&0<=v;p--,v--)if(c[p]!==u[v]){if(p!==1||v!==1)do if(p--,v--,0>v||c[p]!==u[v]){var x=`
6
+ `+c[p].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),x}while(1<=p&&0<=v);break}}}finally{A=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?$(e):""}function ye(e){switch(e.tag){case 5:return $(e.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return e=ne(e.type,!1),e;case 11:return e=ne(e.type.render,!1),e;case 1:return e=ne(e.type,!0),e;default:return""}}function we(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 F:return"Fragment";case N:return"Portal";case je:return"Profiler";case re:return"StrictMode";case te:return"Suspense";case Ce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case xe:return(e._context.displayName||"Context")+".Provider";case pe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D:return t=e.displayName||null,t!==null?t:we(e.type)||"Memo";case ue:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}function be(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 we(t);case 8:return t===re?"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 Se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _e(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Le(e){var t=_e(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){l=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Re(e){e._valueTracker||(e._valueTracker=Le(e))}function mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),l="";return e&&(l=_e(e)?e.checked?"true":"false":e.value),e=l,e!==s?(t.setValue(e),!0):!1}function Tt(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 Mt(e,t){var s=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function at(e,t){var s=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;s=Se(t.value!=null?t.value:s),e._wrapperState={initialChecked:l,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function st(e,t){t=t.checked,t!=null&&he(e,"checked",t,!1)}function Ye(e,t){st(e,t);var s=Se(t.value),l=t.type;if(s!=null)l==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pn(e,t.type,s):t.hasOwnProperty("defaultValue")&&pn(e,t.type,Se(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function it(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function pn(e,t,s){(t!=="number"||Tt(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var rn=Array.isArray;function Ht(e,t,s,l){if(e=e.options,t){t={};for(var c=0;c<s.length;c++)t["$"+s[c]]=!0;for(s=0;s<e.length;s++)c=t.hasOwnProperty("$"+e[s].value),e[s].selected!==c&&(e[s].selected=c),c&&l&&(e[s].defaultSelected=!0)}else{for(s=""+Se(s),t=null,c=0;c<e.length;c++){if(e[c].value===s){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Tn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(o(91));return T({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ct(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(o(92));if(rn(s)){if(1<s.length)throw Error(o(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:Se(s)}}function tr(e,t){var s=Se(t.value),l=Se(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),l!=null&&(e.defaultValue=""+l)}function nr(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function sn(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function hn(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?sn(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var mn,J=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,l,c){MSApp.execUnsafeLocalFunction(function(){return e(t,s,l,c)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(mn=mn||document.createElement("div"),mn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=mn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function me(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Ne={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},Fe=["Webkit","ms","Moz","O"];Object.keys(Ne).forEach(function(e){Fe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ne[t]=Ne[e]})});function Ot(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Ne.hasOwnProperty(e)&&Ne[e]?(""+t).trim():t+"px"}function gn(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var l=s.indexOf("--")===0,c=Ot(s,t[s],l);s==="float"&&(s="cssFloat"),l?e.setProperty(s,c):e[s]=c}}var rr=T({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 Vt(e,t){if(t){if(rr[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(o(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(o(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(t.style!=null&&typeof t.style!="object")throw Error(o(62))}}function Nr(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 br=null;function _r(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ir=null,vn=null,yn=null;function ls(e){if(e=Es(e)){if(typeof Ir!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Ci(t),Ir(e.stateNode,e.type,t))}}function as(e){vn?yn?yn.push(e):yn=[e]:vn=e}function cs(){if(vn){var e=vn,t=yn;if(yn=vn=null,ls(e),t)for(e=0;e<t.length;e++)ls(t[e])}}function ti(e,t){return e(t)}function S(){}var b=!1;function B(e,t,s){if(b)return e(t,s);b=!0;try{return ti(e,t,s)}finally{b=!1,(vn!==null||yn!==null)&&(S(),cs())}}function ie(e,t){var s=e.stateNode;if(s===null)return null;var l=Ci(s);if(l===null)return null;s=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(o(231,t,typeof s));return s}var ae=!1;if(g)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){ae=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{ae=!1}function Ke(e,t,s,l,c,u,p,v,x){var M=Array.prototype.slice.call(arguments,3);try{t.apply(s,M)}catch(H){this.onError(H)}}var He=!1,At=null,Er=!1,us=null,ut={onError:function(e){He=!0,At=e}};function ni(e,t,s,l,c,u,p,v,x){He=!1,At=null,Ke.apply(ut,arguments)}function ri(e,t,s,l,c,u,p,v,x){if(ni.apply(this,arguments),He){if(He){var M=At;He=!1,At=null}else throw Error(o(198));Er||(Er=!0,us=M)}}function on(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function nc(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function rc(e){if(on(e)!==e)throw Error(o(188))}function Sp(e){var t=e.alternate;if(!t){if(t=on(e),t===null)throw Error(o(188));return t!==e?null:e}for(var s=e,l=t;;){var c=s.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){s=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===s)return rc(c),e;if(u===l)return rc(c),t;u=u.sibling}throw Error(o(188))}if(s.return!==l.return)s=c,l=u;else{for(var p=!1,v=c.child;v;){if(v===s){p=!0,s=c,l=u;break}if(v===l){p=!0,l=c,s=u;break}v=v.sibling}if(!p){for(v=u.child;v;){if(v===s){p=!0,s=u,l=c;break}if(v===l){p=!0,l=u,s=c;break}v=v.sibling}if(!p)throw Error(o(189))}}if(s.alternate!==l)throw Error(o(190))}if(s.tag!==3)throw Error(o(188));return s.stateNode.current===s?e:t}function sc(e){return e=Sp(e),e!==null?ic(e):null}function ic(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ic(e);if(t!==null)return t;e=e.sibling}return null}var oc=r.unstable_scheduleCallback,lc=r.unstable_cancelCallback,Cp=r.unstable_shouldYield,Np=r.unstable_requestPaint,Ge=r.unstable_now,bp=r.unstable_getCurrentPriorityLevel,qo=r.unstable_ImmediatePriority,ac=r.unstable_UserBlockingPriority,si=r.unstable_NormalPriority,_p=r.unstable_LowPriority,cc=r.unstable_IdlePriority,ii=null,ln=null;function Ip(e){if(ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(ii,e,void 0,(e.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Rp,Ep=Math.log,Pp=Math.LN2;function Rp(e){return e>>>=0,e===0?32:31-(Ep(e)/Pp|0)|0}var oi=64,li=4194304;function ds(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 ai(e,t){var s=e.pendingLanes;if(s===0)return 0;var l=0,c=e.suspendedLanes,u=e.pingedLanes,p=s&268435455;if(p!==0){var v=p&~c;v!==0?l=ds(v):(u&=p,u!==0&&(l=ds(u)))}else p=s&~c,p!==0?l=ds(p):u!==0&&(l=ds(u));if(l===0)return 0;if(t!==0&&t!==l&&(t&c)===0&&(c=l&-l,u=t&-t,c>=u||c===16&&(u&4194240)!==0))return t;if((l&4)!==0&&(l|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)s=31-Kt(t),c=1<<s,l|=e[s],t&=~c;return l}function Tp(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mp(e,t){for(var s=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes;0<u;){var p=31-Kt(u),v=1<<p,x=c[p];x===-1?((v&s)===0||(v&l)!==0)&&(c[p]=Tp(v,t)):x<=t&&(e.expiredLanes|=v),u&=~v}}function Uo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function uc(){var e=oi;return oi<<=1,(oi&4194240)===0&&(oi=64),e}function Ho(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function fs(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kt(t),e[t]=s}function Op(e,t){var s=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 l=e.eventTimes;for(e=e.expirationTimes;0<s;){var c=31-Kt(s),u=1<<c;t[c]=0,l[c]=-1,e[c]=-1,s&=~u}}function Vo(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var l=31-Kt(s),c=1<<l;c&t|e[l]&t&&(e[l]|=t),s&=~c}}var Ae=0;function dc(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var fc,Ko,pc,hc,mc,Go=!1,ci=[],Mn=null,On=null,An=null,ps=new Map,hs=new Map,$n=[],Ap="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function gc(e,t){switch(e){case"focusin":case"focusout":Mn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":An=null;break;case"pointerover":case"pointerout":ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":hs.delete(t.pointerId)}}function ms(e,t,s,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:s,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=Es(t),t!==null&&Ko(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function $p(e,t,s,l,c){switch(t){case"focusin":return Mn=ms(Mn,e,t,s,l,c),!0;case"dragenter":return On=ms(On,e,t,s,l,c),!0;case"mouseover":return An=ms(An,e,t,s,l,c),!0;case"pointerover":var u=c.pointerId;return ps.set(u,ms(ps.get(u)||null,e,t,s,l,c)),!0;case"gotpointercapture":return u=c.pointerId,hs.set(u,ms(hs.get(u)||null,e,t,s,l,c)),!0}return!1}function vc(e){var t=sr(e.target);if(t!==null){var s=on(t);if(s!==null){if(t=s.tag,t===13){if(t=nc(s),t!==null){e.blockedOn=t,mc(e.priority,function(){pc(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ui(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Yo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);br=l,s.target.dispatchEvent(l),br=null}else return t=Es(s),t!==null&&Ko(t),e.blockedOn=s,!1;t.shift()}return!0}function yc(e,t,s){ui(e)&&s.delete(t)}function Lp(){Go=!1,Mn!==null&&ui(Mn)&&(Mn=null),On!==null&&ui(On)&&(On=null),An!==null&&ui(An)&&(An=null),ps.forEach(yc),hs.forEach(yc)}function gs(e,t){e.blockedOn===t&&(e.blockedOn=null,Go||(Go=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Lp)))}function vs(e){function t(c){return gs(c,e)}if(0<ci.length){gs(ci[0],e);for(var s=1;s<ci.length;s++){var l=ci[s];l.blockedOn===e&&(l.blockedOn=null)}}for(Mn!==null&&gs(Mn,e),On!==null&&gs(On,e),An!==null&&gs(An,e),ps.forEach(t),hs.forEach(t),s=0;s<$n.length;s++)l=$n[s],l.blockedOn===e&&(l.blockedOn=null);for(;0<$n.length&&(s=$n[0],s.blockedOn===null);)vc(s),s.blockedOn===null&&$n.shift()}var Pr=Z.ReactCurrentBatchConfig,di=!0;function Dp(e,t,s,l){var c=Ae,u=Pr.transition;Pr.transition=null;try{Ae=1,Qo(e,t,s,l)}finally{Ae=c,Pr.transition=u}}function zp(e,t,s,l){var c=Ae,u=Pr.transition;Pr.transition=null;try{Ae=4,Qo(e,t,s,l)}finally{Ae=c,Pr.transition=u}}function Qo(e,t,s,l){if(di){var c=Yo(e,t,s,l);if(c===null)pl(e,t,l,fi,s),gc(e,l);else if($p(c,e,t,s,l))l.stopPropagation();else if(gc(e,l),t&4&&-1<Ap.indexOf(e)){for(;c!==null;){var u=Es(c);if(u!==null&&fc(u),u=Yo(e,t,s,l),u===null&&pl(e,t,l,fi,s),u===c)break;c=u}c!==null&&l.stopPropagation()}else pl(e,t,l,null,s)}}var fi=null;function Yo(e,t,s,l){if(fi=null,e=_r(l),e=sr(e),e!==null)if(t=on(e),t===null)e=null;else if(s=t.tag,s===13){if(e=nc(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return fi=e,null}function xc(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(bp()){case qo:return 1;case ac:return 4;case si:case _p:return 16;case cc:return 536870912;default:return 16}default:return 16}}var Ln=null,Xo=null,pi=null;function wc(){if(pi)return pi;var e,t=Xo,s=t.length,l,c="value"in Ln?Ln.value:Ln.textContent,u=c.length;for(e=0;e<s&&t[e]===c[e];e++);var p=s-e;for(l=1;l<=p&&t[s-l]===c[u-l];l++);return pi=c.slice(e,1<l?1-l:void 0)}function hi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function mi(){return!0}function kc(){return!1}function It(e){function t(s,l,c,u,p){this._reactName=s,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(s=e[v],this[v]=s?s(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?mi:kc,this.isPropagationStopped=kc,this}return T(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=mi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=mi)},persist:function(){},isPersistent:mi}),t}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=It(Rr),ys=T({},Rr,{view:0,detail:0}),Wp=It(ys),Zo,el,xs,gi=T({},ys,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nl,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==xs&&(xs&&e.type==="mousemove"?(Zo=e.screenX-xs.screenX,el=e.screenY-xs.screenY):el=Zo=0,xs=e),Zo)},movementY:function(e){return"movementY"in e?e.movementY:el}}),jc=It(gi),Fp=T({},gi,{dataTransfer:0}),Bp=It(Fp),qp=T({},ys,{relatedTarget:0}),tl=It(qp),Up=T({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),Hp=It(Up),Vp=T({},Rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Kp=It(Vp),Gp=T({},Rr,{data:0}),Sc=It(Gp),Qp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yp={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Xp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Jp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xp[e])?!!t[e]:!1}function nl(){return Jp}var Zp=T({},ys,{key:function(e){if(e.key){var t=Qp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Yp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nl,charCode:function(e){return e.type==="keypress"?hi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),eh=It(Zp),th=T({},gi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cc=It(th),nh=T({},ys,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nl}),rh=It(nh),sh=T({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ih=It(sh),oh=T({},gi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),lh=It(oh),ah=[9,13,27,32],rl=g&&"CompositionEvent"in window,ws=null;g&&"documentMode"in document&&(ws=document.documentMode);var ch=g&&"TextEvent"in window&&!ws,Nc=g&&(!rl||ws&&8<ws&&11>=ws),bc=" ",_c=!1;function Ic(e,t){switch(e){case"keyup":return ah.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ec(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tr=!1;function uh(e,t){switch(e){case"compositionend":return Ec(t);case"keypress":return t.which!==32?null:(_c=!0,bc);case"textInput":return e=t.data,e===bc&&_c?null:e;default:return null}}function dh(e,t){if(Tr)return e==="compositionend"||!rl&&Ic(e,t)?(e=wc(),pi=Xo=Ln=null,Tr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Nc&&t.locale!=="ko"?null:t.data;default:return null}}var fh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Pc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!fh[e.type]:t==="textarea"}function Rc(e,t,s,l){as(l),t=ki(t,"onChange"),0<t.length&&(s=new Jo("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var ks=null,js=null;function ph(e){Qc(e,0)}function vi(e){var t=Lr(e);if(mt(t))return e}function hh(e,t){if(e==="change")return t}var Tc=!1;if(g){var sl;if(g){var il="oninput"in document;if(!il){var Mc=document.createElement("div");Mc.setAttribute("oninput","return;"),il=typeof Mc.oninput=="function"}sl=il}else sl=!1;Tc=sl&&(!document.documentMode||9<document.documentMode)}function Oc(){ks&&(ks.detachEvent("onpropertychange",Ac),js=ks=null)}function Ac(e){if(e.propertyName==="value"&&vi(js)){var t=[];Rc(t,js,e,_r(e)),B(ph,t)}}function mh(e,t,s){e==="focusin"?(Oc(),ks=t,js=s,ks.attachEvent("onpropertychange",Ac)):e==="focusout"&&Oc()}function gh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(js)}function vh(e,t){if(e==="click")return vi(t)}function yh(e,t){if(e==="input"||e==="change")return vi(t)}function xh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:xh;function Ss(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),l=Object.keys(t);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var c=s[l];if(!w.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function $c(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lc(e,t){var s=$c(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=t&&l>=t)return{node:s,offset:t-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=$c(s)}}function Dc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zc(){for(var e=window,t=Tt();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Tt(e.document)}return t}function ol(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 wh(e){var t=zc(),s=e.focusedElem,l=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Dc(s.ownerDocument.documentElement,s)){if(l!==null&&ol(s)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var c=s.textContent.length,u=Math.min(l.start,c);l=l.end===void 0?u:Math.min(l.end,c),!e.extend&&u>l&&(c=l,l=u,u=c),c=Lc(s,u);var p=Lc(s,l);c&&p&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),u>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var kh=g&&"documentMode"in document&&11>=document.documentMode,Mr=null,ll=null,Cs=null,al=!1;function Wc(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;al||Mr==null||Mr!==Tt(l)||(l=Mr,"selectionStart"in l&&ol(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Cs&&Ss(Cs,l)||(Cs=l,l=ki(ll,"onSelect"),0<l.length&&(t=new Jo("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=Mr)))}function yi(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Or={animationend:yi("Animation","AnimationEnd"),animationiteration:yi("Animation","AnimationIteration"),animationstart:yi("Animation","AnimationStart"),transitionend:yi("Transition","TransitionEnd")},cl={},Fc={};g&&(Fc=document.createElement("div").style,"AnimationEvent"in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),"TransitionEvent"in window||delete Or.transitionend.transition);function xi(e){if(cl[e])return cl[e];if(!Or[e])return e;var t=Or[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Fc)return cl[e]=t[s];return e}var Bc=xi("animationend"),qc=xi("animationiteration"),Uc=xi("animationstart"),Hc=xi("transitionend"),Vc=new Map,Kc="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Dn(e,t){Vc.set(e,t),f(t,[e])}for(var ul=0;ul<Kc.length;ul++){var dl=Kc[ul],jh=dl.toLowerCase(),Sh=dl[0].toUpperCase()+dl.slice(1);Dn(jh,"on"+Sh)}Dn(Bc,"onAnimationEnd"),Dn(qc,"onAnimationIteration"),Dn(Uc,"onAnimationStart"),Dn("dblclick","onDoubleClick"),Dn("focusin","onFocus"),Dn("focusout","onBlur"),Dn(Hc,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),f("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),f("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),f("onBeforeInput",["compositionend","keypress","textInput","paste"]),f("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),f("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),f("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ch=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ns));function Gc(e,t,s){var l=e.type||"unknown-event";e.currentTarget=s,ri(l,t,void 0,e),e.currentTarget=null}function Qc(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var v=l[p],x=v.instance,M=v.currentTarget;if(v=v.listener,x!==u&&c.isPropagationStopped())break e;Gc(c,v,M),u=x}else for(p=0;p<l.length;p++){if(v=l[p],x=v.instance,M=v.currentTarget,v=v.listener,x!==u&&c.isPropagationStopped())break e;Gc(c,v,M),u=x}}}if(Er)throw e=us,Er=!1,us=null,e}function De(e,t){var s=t[xl];s===void 0&&(s=t[xl]=new Set);var l=e+"__bubble";s.has(l)||(Yc(t,e,2,!1),s.add(l))}function fl(e,t,s){var l=0;t&&(l|=4),Yc(s,e,l,t)}var wi="_reactListening"+Math.random().toString(36).slice(2);function bs(e){if(!e[wi]){e[wi]=!0,a.forEach(function(s){s!=="selectionchange"&&(Ch.has(s)||fl(s,!1,e),fl(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wi]||(t[wi]=!0,fl("selectionchange",!1,t))}}function Yc(e,t,s,l){switch(xc(t)){case 1:var c=Dp;break;case 4:c=zp;break;default:c=Qo}s=c.bind(null,t,s,e),c=void 0,!ae||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,s,{capture:!0,passive:c}):e.addEventListener(t,s,!0):c!==void 0?e.addEventListener(t,s,{passive:c}):e.addEventListener(t,s,!1)}function pl(e,t,s,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var v=l.stateNode.containerInfo;if(v===c||v.nodeType===8&&v.parentNode===c)break;if(p===4)for(p=l.return;p!==null;){var x=p.tag;if((x===3||x===4)&&(x=p.stateNode.containerInfo,x===c||x.nodeType===8&&x.parentNode===c))return;p=p.return}for(;v!==null;){if(p=sr(v),p===null)return;if(x=p.tag,x===5||x===6){l=u=p;continue e}v=v.parentNode}}l=l.return}B(function(){var M=u,H=_r(s),V=[];e:{var U=Vc.get(e);if(U!==void 0){var se=Jo,le=e;switch(e){case"keypress":if(hi(s)===0)break e;case"keydown":case"keyup":se=eh;break;case"focusin":le="focus",se=tl;break;case"focusout":le="blur",se=tl;break;case"beforeblur":case"afterblur":se=tl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=jc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Bp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=rh;break;case Bc:case qc:case Uc:se=Hp;break;case Hc:se=ih;break;case"scroll":se=Wp;break;case"wheel":se=lh;break;case"copy":case"cut":case"paste":se=Kp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=Cc}var ce=(t&4)!==0,Qe=!ce&&e==="scroll",_=ce?U!==null?U+"Capture":null:U;ce=[];for(var k=M,I;k!==null;){I=k;var G=I.stateNode;if(I.tag===5&&G!==null&&(I=G,_!==null&&(G=ie(k,_),G!=null&&ce.push(_s(k,G,I)))),Qe)break;k=k.return}0<ce.length&&(U=new se(U,le,null,s,H),V.push({event:U,listeners:ce}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",se=e==="mouseout"||e==="pointerout",U&&s!==br&&(le=s.relatedTarget||s.fromElement)&&(sr(le)||le[xn]))break e;if((se||U)&&(U=H.window===H?H:(U=H.ownerDocument)?U.defaultView||U.parentWindow:window,se?(le=s.relatedTarget||s.toElement,se=M,le=le?sr(le):null,le!==null&&(Qe=on(le),le!==Qe||le.tag!==5&&le.tag!==6)&&(le=null)):(se=null,le=M),se!==le)){if(ce=jc,G="onMouseLeave",_="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ce=Cc,G="onPointerLeave",_="onPointerEnter",k="pointer"),Qe=se==null?U:Lr(se),I=le==null?U:Lr(le),U=new ce(G,k+"leave",se,s,H),U.target=Qe,U.relatedTarget=I,G=null,sr(H)===M&&(ce=new ce(_,k+"enter",le,s,H),ce.target=I,ce.relatedTarget=Qe,G=ce),Qe=G,se&&le)t:{for(ce=se,_=le,k=0,I=ce;I;I=Ar(I))k++;for(I=0,G=_;G;G=Ar(G))I++;for(;0<k-I;)ce=Ar(ce),k--;for(;0<I-k;)_=Ar(_),I--;for(;k--;){if(ce===_||_!==null&&ce===_.alternate)break t;ce=Ar(ce),_=Ar(_)}ce=null}else ce=null;se!==null&&Xc(V,U,se,ce,!1),le!==null&&Qe!==null&&Xc(V,Qe,le,ce,!0)}}e:{if(U=M?Lr(M):window,se=U.nodeName&&U.nodeName.toLowerCase(),se==="select"||se==="input"&&U.type==="file")var fe=hh;else if(Pc(U))if(Tc)fe=yh;else{fe=gh;var ge=mh}else(se=U.nodeName)&&se.toLowerCase()==="input"&&(U.type==="checkbox"||U.type==="radio")&&(fe=vh);if(fe&&(fe=fe(e,M))){Rc(V,fe,s,H);break e}ge&&ge(e,U,M),e==="focusout"&&(ge=U._wrapperState)&&ge.controlled&&U.type==="number"&&pn(U,"number",U.value)}switch(ge=M?Lr(M):window,e){case"focusin":(Pc(ge)||ge.contentEditable==="true")&&(Mr=ge,ll=M,Cs=null);break;case"focusout":Cs=ll=Mr=null;break;case"mousedown":al=!0;break;case"contextmenu":case"mouseup":case"dragend":al=!1,Wc(V,s,H);break;case"selectionchange":if(kh)break;case"keydown":case"keyup":Wc(V,s,H)}var ve;if(rl)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Tr?Ic(e,s)&&(ke="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(ke="onCompositionStart");ke&&(Nc&&s.locale!=="ko"&&(Tr||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Tr&&(ve=wc()):(Ln=H,Xo="value"in Ln?Ln.value:Ln.textContent,Tr=!0)),ge=ki(M,ke),0<ge.length&&(ke=new Sc(ke,e,null,s,H),V.push({event:ke,listeners:ge}),ve?ke.data=ve:(ve=Ec(s),ve!==null&&(ke.data=ve)))),(ve=ch?uh(e,s):dh(e,s))&&(M=ki(M,"onBeforeInput"),0<M.length&&(H=new Sc("onBeforeInput","beforeinput",null,s,H),V.push({event:H,listeners:M}),H.data=ve))}Qc(V,t)})}function _s(e,t,s){return{instance:e,listener:t,currentTarget:s}}function ki(e,t){for(var s=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=ie(e,s),u!=null&&l.unshift(_s(e,u,c)),u=ie(e,t),u!=null&&l.push(_s(e,u,c))),e=e.return}return l}function Ar(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Xc(e,t,s,l,c){for(var u=t._reactName,p=[];s!==null&&s!==l;){var v=s,x=v.alternate,M=v.stateNode;if(x!==null&&x===l)break;v.tag===5&&M!==null&&(v=M,c?(x=ie(s,u),x!=null&&p.unshift(_s(s,x,v))):c||(x=ie(s,u),x!=null&&p.push(_s(s,x,v)))),s=s.return}p.length!==0&&e.push({event:t,listeners:p})}var Nh=/\r\n?/g,bh=/\u0000|\uFFFD/g;function Jc(e){return(typeof e=="string"?e:""+e).replace(Nh,`
7
+ `).replace(bh,"")}function ji(e,t,s){if(t=Jc(t),Jc(e)!==t&&s)throw Error(o(425))}function Si(){}var hl=null,ml=null;function gl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vl=typeof setTimeout=="function"?setTimeout:void 0,_h=typeof clearTimeout=="function"?clearTimeout:void 0,Zc=typeof Promise=="function"?Promise:void 0,Ih=typeof queueMicrotask=="function"?queueMicrotask:typeof Zc<"u"?function(e){return Zc.resolve(null).then(e).catch(Eh)}:vl;function Eh(e){setTimeout(function(){throw e})}function yl(e,t){var s=t,l=0;do{var c=s.nextSibling;if(e.removeChild(s),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(l===0){e.removeChild(c),vs(t);return}l--}else s!=="$"&&s!=="$?"&&s!=="$!"||l++;s=c}while(s);vs(t)}function zn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function eu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var $r=Math.random().toString(36).slice(2),an="__reactFiber$"+$r,Is="__reactProps$"+$r,xn="__reactContainer$"+$r,xl="__reactEvents$"+$r,Ph="__reactListeners$"+$r,Rh="__reactHandles$"+$r;function sr(e){var t=e[an];if(t)return t;for(var s=e.parentNode;s;){if(t=s[xn]||s[an]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=eu(e);e!==null;){if(s=e[an])return s;e=eu(e)}return t}e=s,s=e.parentNode}return null}function Es(e){return e=e[an]||e[xn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Lr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function Ci(e){return e[Is]||null}var wl=[],Dr=-1;function Wn(e){return{current:e}}function ze(e){0>Dr||(e.current=wl[Dr],wl[Dr]=null,Dr--)}function $e(e,t){Dr++,wl[Dr]=e.current,e.current=t}var Fn={},dt=Wn(Fn),yt=Wn(!1),ir=Fn;function zr(e,t){var s=e.type.contextTypes;if(!s)return Fn;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var c={},u;for(u in s)c[u]=t[u];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function xt(e){return e=e.childContextTypes,e!=null}function Ni(){ze(yt),ze(dt)}function tu(e,t,s){if(dt.current!==Fn)throw Error(o(168));$e(dt,t),$e(yt,s)}function nu(e,t,s){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return s;l=l.getChildContext();for(var c in l)if(!(c in t))throw Error(o(108,be(e)||"Unknown",c));return T({},s,l)}function bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fn,ir=dt.current,$e(dt,e),$e(yt,yt.current),!0}function ru(e,t,s){var l=e.stateNode;if(!l)throw Error(o(169));s?(e=nu(e,t,ir),l.__reactInternalMemoizedMergedChildContext=e,ze(yt),ze(dt),$e(dt,e)):ze(yt),$e(yt,s)}var wn=null,_i=!1,kl=!1;function su(e){wn===null?wn=[e]:wn.push(e)}function Th(e){_i=!0,su(e)}function Bn(){if(!kl&&wn!==null){kl=!0;var e=0,t=Ae;try{var s=wn;for(Ae=1;e<s.length;e++){var l=s[e];do l=l(!0);while(l!==null)}wn=null,_i=!1}catch(c){throw wn!==null&&(wn=wn.slice(e+1)),oc(qo,Bn),c}finally{Ae=t,kl=!1}}return null}var Wr=[],Fr=0,Ii=null,Ei=0,$t=[],Lt=0,or=null,kn=1,jn="";function lr(e,t){Wr[Fr++]=Ei,Wr[Fr++]=Ii,Ii=e,Ei=t}function iu(e,t,s){$t[Lt++]=kn,$t[Lt++]=jn,$t[Lt++]=or,or=e;var l=kn;e=jn;var c=32-Kt(l)-1;l&=~(1<<c),s+=1;var u=32-Kt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,kn=1<<32-Kt(t)+c|s<<c|l,jn=u+e}else kn=1<<u|s<<c|l,jn=e}function jl(e){e.return!==null&&(lr(e,1),iu(e,1,0))}function Sl(e){for(;e===Ii;)Ii=Wr[--Fr],Wr[Fr]=null,Ei=Wr[--Fr],Wr[Fr]=null;for(;e===or;)or=$t[--Lt],$t[Lt]=null,jn=$t[--Lt],$t[Lt]=null,kn=$t[--Lt],$t[Lt]=null}var Et=null,Pt=null,Be=!1,Qt=null;function ou(e,t){var s=Ft(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function lu(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Et=e,Pt=zn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,Pt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=or!==null?{id:kn,overflow:jn}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Ft(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,Et=e,Pt=null,!0):!1;default:return!1}}function Cl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Nl(e){if(Be){var t=Pt;if(t){var s=t;if(!lu(e,t)){if(Cl(e))throw Error(o(418));t=zn(s.nextSibling);var l=Et;t&&lu(e,t)?ou(l,s):(e.flags=e.flags&-4097|2,Be=!1,Et=e)}}else{if(Cl(e))throw Error(o(418));e.flags=e.flags&-4097|2,Be=!1,Et=e}}}function au(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Et=e}function Pi(e){if(e!==Et)return!1;if(!Be)return au(e),Be=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!gl(e.type,e.memoizedProps)),t&&(t=Pt)){if(Cl(e))throw cu(),Error(o(418));for(;t;)ou(e,t),t=zn(t.nextSibling)}if(au(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){Pt=zn(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Pt=null}}else Pt=Et?zn(e.stateNode.nextSibling):null;return!0}function cu(){for(var e=Pt;e;)e=zn(e.nextSibling)}function Br(){Pt=Et=null,Be=!1}function bl(e){Qt===null?Qt=[e]:Qt.push(e)}var Mh=Z.ReactCurrentBatchConfig;function Ps(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(o(309));var l=s.stateNode}if(!l)throw Error(o(147,e));var c=l,u=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===u?t.ref:(t=function(p){var v=c.refs;p===null?delete v[u]:v[u]=p},t._stringRef=u,t)}if(typeof e!="string")throw Error(o(284));if(!s._owner)throw Error(o(290,e))}return e}function Ri(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function uu(e){var t=e._init;return t(e._payload)}function du(e){function t(_,k){if(e){var I=_.deletions;I===null?(_.deletions=[k],_.flags|=16):I.push(k)}}function s(_,k){if(!e)return null;for(;k!==null;)t(_,k),k=k.sibling;return null}function l(_,k){for(_=new Map;k!==null;)k.key!==null?_.set(k.key,k):_.set(k.index,k),k=k.sibling;return _}function c(_,k){return _=Yn(_,k),_.index=0,_.sibling=null,_}function u(_,k,I){return _.index=I,e?(I=_.alternate,I!==null?(I=I.index,I<k?(_.flags|=2,k):I):(_.flags|=2,k)):(_.flags|=1048576,k)}function p(_){return e&&_.alternate===null&&(_.flags|=2),_}function v(_,k,I,G){return k===null||k.tag!==6?(k=va(I,_.mode,G),k.return=_,k):(k=c(k,I),k.return=_,k)}function x(_,k,I,G){var fe=I.type;return fe===F?H(_,k,I.props.children,G,I.key):k!==null&&(k.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ue&&uu(fe)===k.type)?(G=c(k,I.props),G.ref=Ps(_,k,I),G.return=_,G):(G=to(I.type,I.key,I.props,null,_.mode,G),G.ref=Ps(_,k,I),G.return=_,G)}function M(_,k,I,G){return k===null||k.tag!==4||k.stateNode.containerInfo!==I.containerInfo||k.stateNode.implementation!==I.implementation?(k=ya(I,_.mode,G),k.return=_,k):(k=c(k,I.children||[]),k.return=_,k)}function H(_,k,I,G,fe){return k===null||k.tag!==7?(k=mr(I,_.mode,G,fe),k.return=_,k):(k=c(k,I),k.return=_,k)}function V(_,k,I){if(typeof k=="string"&&k!==""||typeof k=="number")return k=va(""+k,_.mode,I),k.return=_,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ee:return I=to(k.type,k.key,k.props,null,_.mode,I),I.ref=Ps(_,null,k),I.return=_,I;case N:return k=ya(k,_.mode,I),k.return=_,k;case ue:var G=k._init;return V(_,G(k._payload),I)}if(rn(k)||K(k))return k=mr(k,_.mode,I,null),k.return=_,k;Ri(_,k)}return null}function U(_,k,I,G){var fe=k!==null?k.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return fe!==null?null:v(_,k,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:return I.key===fe?x(_,k,I,G):null;case N:return I.key===fe?M(_,k,I,G):null;case ue:return fe=I._init,U(_,k,fe(I._payload),G)}if(rn(I)||K(I))return fe!==null?null:H(_,k,I,G,null);Ri(_,I)}return null}function se(_,k,I,G,fe){if(typeof G=="string"&&G!==""||typeof G=="number")return _=_.get(I)||null,v(k,_,""+G,fe);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case ee:return _=_.get(G.key===null?I:G.key)||null,x(k,_,G,fe);case N:return _=_.get(G.key===null?I:G.key)||null,M(k,_,G,fe);case ue:var ge=G._init;return se(_,k,I,ge(G._payload),fe)}if(rn(G)||K(G))return _=_.get(I)||null,H(k,_,G,fe,null);Ri(k,G)}return null}function le(_,k,I,G){for(var fe=null,ge=null,ve=k,ke=k=0,rt=null;ve!==null&&ke<I.length;ke++){ve.index>ke?(rt=ve,ve=null):rt=ve.sibling;var Me=U(_,ve,I[ke],G);if(Me===null){ve===null&&(ve=rt);break}e&&ve&&Me.alternate===null&&t(_,ve),k=u(Me,k,ke),ge===null?fe=Me:ge.sibling=Me,ge=Me,ve=rt}if(ke===I.length)return s(_,ve),Be&&lr(_,ke),fe;if(ve===null){for(;ke<I.length;ke++)ve=V(_,I[ke],G),ve!==null&&(k=u(ve,k,ke),ge===null?fe=ve:ge.sibling=ve,ge=ve);return Be&&lr(_,ke),fe}for(ve=l(_,ve);ke<I.length;ke++)rt=se(ve,_,ke,I[ke],G),rt!==null&&(e&&rt.alternate!==null&&ve.delete(rt.key===null?ke:rt.key),k=u(rt,k,ke),ge===null?fe=rt:ge.sibling=rt,ge=rt);return e&&ve.forEach(function(Xn){return t(_,Xn)}),Be&&lr(_,ke),fe}function ce(_,k,I,G){var fe=K(I);if(typeof fe!="function")throw Error(o(150));if(I=fe.call(I),I==null)throw Error(o(151));for(var ge=fe=null,ve=k,ke=k=0,rt=null,Me=I.next();ve!==null&&!Me.done;ke++,Me=I.next()){ve.index>ke?(rt=ve,ve=null):rt=ve.sibling;var Xn=U(_,ve,Me.value,G);if(Xn===null){ve===null&&(ve=rt);break}e&&ve&&Xn.alternate===null&&t(_,ve),k=u(Xn,k,ke),ge===null?fe=Xn:ge.sibling=Xn,ge=Xn,ve=rt}if(Me.done)return s(_,ve),Be&&lr(_,ke),fe;if(ve===null){for(;!Me.done;ke++,Me=I.next())Me=V(_,Me.value,G),Me!==null&&(k=u(Me,k,ke),ge===null?fe=Me:ge.sibling=Me,ge=Me);return Be&&lr(_,ke),fe}for(ve=l(_,ve);!Me.done;ke++,Me=I.next())Me=se(ve,_,ke,Me.value,G),Me!==null&&(e&&Me.alternate!==null&&ve.delete(Me.key===null?ke:Me.key),k=u(Me,k,ke),ge===null?fe=Me:ge.sibling=Me,ge=Me);return e&&ve.forEach(function(fm){return t(_,fm)}),Be&&lr(_,ke),fe}function Qe(_,k,I,G){if(typeof I=="object"&&I!==null&&I.type===F&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:e:{for(var fe=I.key,ge=k;ge!==null;){if(ge.key===fe){if(fe=I.type,fe===F){if(ge.tag===7){s(_,ge.sibling),k=c(ge,I.props.children),k.return=_,_=k;break e}}else if(ge.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===ue&&uu(fe)===ge.type){s(_,ge.sibling),k=c(ge,I.props),k.ref=Ps(_,ge,I),k.return=_,_=k;break e}s(_,ge);break}else t(_,ge);ge=ge.sibling}I.type===F?(k=mr(I.props.children,_.mode,G,I.key),k.return=_,_=k):(G=to(I.type,I.key,I.props,null,_.mode,G),G.ref=Ps(_,k,I),G.return=_,_=G)}return p(_);case N:e:{for(ge=I.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===I.containerInfo&&k.stateNode.implementation===I.implementation){s(_,k.sibling),k=c(k,I.children||[]),k.return=_,_=k;break e}else{s(_,k);break}else t(_,k);k=k.sibling}k=ya(I,_.mode,G),k.return=_,_=k}return p(_);case ue:return ge=I._init,Qe(_,k,ge(I._payload),G)}if(rn(I))return le(_,k,I,G);if(K(I))return ce(_,k,I,G);Ri(_,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,k!==null&&k.tag===6?(s(_,k.sibling),k=c(k,I),k.return=_,_=k):(s(_,k),k=va(I,_.mode,G),k.return=_,_=k),p(_)):s(_,k)}return Qe}var qr=du(!0),fu=du(!1),Ti=Wn(null),Mi=null,Ur=null,_l=null;function Il(){_l=Ur=Mi=null}function El(e){var t=Ti.current;ze(Ti),e._currentValue=t}function Pl(e,t,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===s)break;e=e.return}}function Hr(e,t){Mi=e,_l=Ur=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(wt=!0),e.firstContext=null)}function Dt(e){var t=e._currentValue;if(_l!==e)if(e={context:e,memoizedValue:t,next:null},Ur===null){if(Mi===null)throw Error(o(308));Ur=e,Mi.dependencies={lanes:0,firstContext:e}}else Ur=Ur.next=e;return t}var ar=null;function Rl(e){ar===null?ar=[e]:ar.push(e)}function pu(e,t,s,l){var c=t.interleaved;return c===null?(s.next=s,Rl(t)):(s.next=c.next,c.next=s),t.interleaved=s,Sn(e,l)}function Sn(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var qn=!1;function Tl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hu(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 Cn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Te&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,Sn(e,s)}return c=l.interleaved,c===null?(t.next=t,Rl(l)):(t.next=c.next,c.next=t),l.interleaved=t,Sn(e,s)}function Oi(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Vo(e,s)}}function mu(e,t){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var c=null,u=null;if(s=s.firstBaseUpdate,s!==null){do{var p={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};u===null?c=u=p:u=u.next=p,s=s.next}while(s!==null);u===null?c=u=t:u=u.next=t}else c=u=t;s={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,effects:l.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function Ai(e,t,s,l){var c=e.updateQueue;qn=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var x=v,M=x.next;x.next=null,p===null?u=M:p.next=M,p=x;var H=e.alternate;H!==null&&(H=H.updateQueue,v=H.lastBaseUpdate,v!==p&&(v===null?H.firstBaseUpdate=M:v.next=M,H.lastBaseUpdate=x))}if(u!==null){var V=c.baseState;p=0,H=M=x=null,v=u;do{var U=v.lane,se=v.eventTime;if((l&U)===U){H!==null&&(H=H.next={eventTime:se,lane:0,tag:v.tag,payload:v.payload,callback:v.callback,next:null});e:{var le=e,ce=v;switch(U=t,se=s,ce.tag){case 1:if(le=ce.payload,typeof le=="function"){V=le.call(se,V,U);break e}V=le;break e;case 3:le.flags=le.flags&-65537|128;case 0:if(le=ce.payload,U=typeof le=="function"?le.call(se,V,U):le,U==null)break e;V=T({},V,U);break e;case 2:qn=!0}}v.callback!==null&&v.lane!==0&&(e.flags|=64,U=c.effects,U===null?c.effects=[v]:U.push(v))}else se={eventTime:se,lane:U,tag:v.tag,payload:v.payload,callback:v.callback,next:null},H===null?(M=H=se,x=V):H=H.next=se,p|=U;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;U=v,v=U.next,U.next=null,c.lastBaseUpdate=U,c.shared.pending=null}}while(!0);if(H===null&&(x=V),c.baseState=x,c.firstBaseUpdate=M,c.lastBaseUpdate=H,t=c.shared.interleaved,t!==null){c=t;do p|=c.lane,c=c.next;while(c!==t)}else u===null&&(c.shared.lanes=0);dr|=p,e.lanes=p,e.memoizedState=V}}function gu(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],c=l.callback;if(c!==null){if(l.callback=null,l=s,typeof c!="function")throw Error(o(191,c));c.call(l)}}}var Rs={},cn=Wn(Rs),Ts=Wn(Rs),Ms=Wn(Rs);function cr(e){if(e===Rs)throw Error(o(174));return e}function Ml(e,t){switch($e(Ms,t),$e(Ts,e),$e(cn,Rs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:hn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=hn(t,e)}ze(cn),$e(cn,t)}function Vr(){ze(cn),ze(Ts),ze(Ms)}function vu(e){cr(Ms.current);var t=cr(cn.current),s=hn(t,e.type);t!==s&&($e(Ts,e),$e(cn,s))}function Ol(e){Ts.current===e&&(ze(cn),ze(Ts))}var qe=Wn(0);function $i(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Al=[];function $l(){for(var e=0;e<Al.length;e++)Al[e]._workInProgressVersionPrimary=null;Al.length=0}var Li=Z.ReactCurrentDispatcher,Ll=Z.ReactCurrentBatchConfig,ur=0,Ue=null,Ze=null,tt=null,Di=!1,Os=!1,As=0,Oh=0;function ft(){throw Error(o(321))}function Dl(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Gt(e[s],t[s]))return!1;return!0}function zl(e,t,s,l,c,u){if(ur=u,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Li.current=e===null||e.memoizedState===null?Dh:zh,e=s(l,c),Os){u=0;do{if(Os=!1,As=0,25<=u)throw Error(o(301));u+=1,tt=Ze=null,t.updateQueue=null,Li.current=Wh,e=s(l,c)}while(Os)}if(Li.current=Fi,t=Ze!==null&&Ze.next!==null,ur=0,tt=Ze=Ue=null,Di=!1,t)throw Error(o(300));return e}function Wl(){var e=As!==0;return As=0,e}function un(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tt===null?Ue.memoizedState=tt=e:tt=tt.next=e,tt}function zt(){if(Ze===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=Ze.next;var t=tt===null?Ue.memoizedState:tt.next;if(t!==null)tt=t,Ze=e;else{if(e===null)throw Error(o(310));Ze=e,e={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},tt===null?Ue.memoizedState=tt=e:tt=tt.next=e}return tt}function $s(e,t){return typeof t=="function"?t(e):t}function Fl(e){var t=zt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=Ze,c=l.baseQueue,u=s.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}l.baseQueue=c=u,s.pending=null}if(c!==null){u=c.next,l=l.baseState;var v=p=null,x=null,M=u;do{var H=M.lane;if((ur&H)===H)x!==null&&(x=x.next={lane:0,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),l=M.hasEagerState?M.eagerState:e(l,M.action);else{var V={lane:H,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null};x===null?(v=x=V,p=l):x=x.next=V,Ue.lanes|=H,dr|=H}M=M.next}while(M!==null&&M!==u);x===null?p=l:x.next=v,Gt(l,t.memoizedState)||(wt=!0),t.memoizedState=l,t.baseState=p,t.baseQueue=x,s.lastRenderedState=l}if(e=s.interleaved,e!==null){c=e;do u=c.lane,Ue.lanes|=u,dr|=u,c=c.next;while(c!==e)}else c===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function Bl(e){var t=zt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=s.dispatch,c=s.pending,u=t.memoizedState;if(c!==null){s.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(wt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),s.lastRenderedState=u}return[u,l]}function yu(){}function xu(e,t){var s=Ue,l=zt(),c=t(),u=!Gt(l.memoizedState,c);if(u&&(l.memoizedState=c,wt=!0),l=l.queue,ql(ju.bind(null,s,l,e),[e]),l.getSnapshot!==t||u||tt!==null&&tt.memoizedState.tag&1){if(s.flags|=2048,Ls(9,ku.bind(null,s,l,c,t),void 0,null),nt===null)throw Error(o(349));(ur&30)!==0||wu(s,t,c)}return c}function wu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ue.updateQueue,t===null?(t={lastEffect:null,stores:null},Ue.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function ku(e,t,s,l){t.value=s,t.getSnapshot=l,Su(t)&&Cu(e)}function ju(e,t,s){return s(function(){Su(t)&&Cu(e)})}function Su(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Gt(e,s)}catch{return!0}}function Cu(e){var t=Sn(e,1);t!==null&&Zt(t,e,1,-1)}function Nu(e){var t=un();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$s,lastRenderedState:e},t.queue=e,e=e.dispatch=Lh.bind(null,Ue,e),[t.memoizedState,e]}function Ls(e,t,s,l){return e={tag:e,create:t,destroy:s,deps:l,next:null},t=Ue.updateQueue,t===null?(t={lastEffect:null,stores:null},Ue.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,t.lastEffect=e)),e}function bu(){return zt().memoizedState}function zi(e,t,s,l){var c=un();Ue.flags|=e,c.memoizedState=Ls(1|t,s,void 0,l===void 0?null:l)}function Wi(e,t,s,l){var c=zt();l=l===void 0?null:l;var u=void 0;if(Ze!==null){var p=Ze.memoizedState;if(u=p.destroy,l!==null&&Dl(l,p.deps)){c.memoizedState=Ls(t,s,u,l);return}}Ue.flags|=e,c.memoizedState=Ls(1|t,s,u,l)}function _u(e,t){return zi(8390656,8,e,t)}function ql(e,t){return Wi(2048,8,e,t)}function Iu(e,t){return Wi(4,2,e,t)}function Eu(e,t){return Wi(4,4,e,t)}function Pu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ru(e,t,s){return s=s!=null?s.concat([e]):null,Wi(4,4,Pu.bind(null,t,e),s)}function Ul(){}function Tu(e,t){var s=zt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&Dl(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function Mu(e,t){var s=zt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&Dl(t,l[1])?l[0]:(e=e(),s.memoizedState=[e,t],e)}function Ou(e,t,s){return(ur&21)===0?(e.baseState&&(e.baseState=!1,wt=!0),e.memoizedState=s):(Gt(s,t)||(s=uc(),Ue.lanes|=s,dr|=s,e.baseState=!0),t)}function Ah(e,t){var s=Ae;Ae=s!==0&&4>s?s:4,e(!0);var l=Ll.transition;Ll.transition={};try{e(!1),t()}finally{Ae=s,Ll.transition=l}}function Au(){return zt().memoizedState}function $h(e,t,s){var l=Gn(e);if(s={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null},$u(e))Lu(t,s);else if(s=pu(e,t,s,l),s!==null){var c=vt();Zt(s,e,l,c),Du(s,t,l)}}function Lh(e,t,s){var l=Gn(e),c={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null};if($u(e))Lu(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,v=u(p,s);if(c.hasEagerState=!0,c.eagerState=v,Gt(v,p)){var x=t.interleaved;x===null?(c.next=c,Rl(t)):(c.next=x.next,x.next=c),t.interleaved=c;return}}catch{}s=pu(e,t,c,l),s!==null&&(c=vt(),Zt(s,e,l,c),Du(s,t,l))}}function $u(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function Lu(e,t){Os=Di=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Du(e,t,s){if((s&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Vo(e,s)}}var Fi={readContext:Dt,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useInsertionEffect:ft,useLayoutEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useMutableSource:ft,useSyncExternalStore:ft,useId:ft,unstable_isNewReconciler:!1},Dh={readContext:Dt,useCallback:function(e,t){return un().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:_u,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,zi(4194308,4,Pu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return zi(4194308,4,e,t)},useInsertionEffect:function(e,t){return zi(4,2,e,t)},useMemo:function(e,t){var s=un();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var l=un();return t=s!==void 0?s(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=$h.bind(null,Ue,e),[l.memoizedState,e]},useRef:function(e){var t=un();return e={current:e},t.memoizedState=e},useState:Nu,useDebugValue:Ul,useDeferredValue:function(e){return un().memoizedState=e},useTransition:function(){var e=Nu(!1),t=e[0];return e=Ah.bind(null,e[1]),un().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var l=Ue,c=un();if(Be){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),nt===null)throw Error(o(349));(ur&30)!==0||wu(l,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,_u(ju.bind(null,l,u,e),[e]),l.flags|=2048,Ls(9,ku.bind(null,l,u,s,t),void 0,null),s},useId:function(){var e=un(),t=nt.identifierPrefix;if(Be){var s=jn,l=kn;s=(l&~(1<<32-Kt(l)-1)).toString(32)+s,t=":"+t+"R"+s,s=As++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=Oh++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},zh={readContext:Dt,useCallback:Tu,useContext:Dt,useEffect:ql,useImperativeHandle:Ru,useInsertionEffect:Iu,useLayoutEffect:Eu,useMemo:Mu,useReducer:Fl,useRef:bu,useState:function(){return Fl($s)},useDebugValue:Ul,useDeferredValue:function(e){var t=zt();return Ou(t,Ze.memoizedState,e)},useTransition:function(){var e=Fl($s)[0],t=zt().memoizedState;return[e,t]},useMutableSource:yu,useSyncExternalStore:xu,useId:Au,unstable_isNewReconciler:!1},Wh={readContext:Dt,useCallback:Tu,useContext:Dt,useEffect:ql,useImperativeHandle:Ru,useInsertionEffect:Iu,useLayoutEffect:Eu,useMemo:Mu,useReducer:Bl,useRef:bu,useState:function(){return Bl($s)},useDebugValue:Ul,useDeferredValue:function(e){var t=zt();return Ze===null?t.memoizedState=e:Ou(t,Ze.memoizedState,e)},useTransition:function(){var e=Bl($s)[0],t=zt().memoizedState;return[e,t]},useMutableSource:yu,useSyncExternalStore:xu,useId:Au,unstable_isNewReconciler:!1};function Yt(e,t){if(e&&e.defaultProps){t=T({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function Hl(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:T({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Bi={isMounted:function(e){return(e=e._reactInternals)?on(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var l=vt(),c=Gn(e),u=Cn(l,c);u.payload=t,s!=null&&(u.callback=s),t=Un(e,u,c),t!==null&&(Zt(t,e,c,l),Oi(t,e,c))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=vt(),c=Gn(e),u=Cn(l,c);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=Un(e,u,c),t!==null&&(Zt(t,e,c,l),Oi(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=vt(),l=Gn(e),c=Cn(s,l);c.tag=2,t!=null&&(c.callback=t),t=Un(e,c,l),t!==null&&(Zt(t,e,l,s),Oi(t,e,l))}};function zu(e,t,s,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Ss(s,l)||!Ss(c,u):!0}function Wu(e,t,s){var l=!1,c=Fn,u=t.contextType;return typeof u=="object"&&u!==null?u=Dt(u):(c=xt(t)?ir:dt.current,l=t.contextTypes,u=(l=l!=null)?zr(e,c):Fn),t=new t(s,u),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Bi,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Fu(e,t,s,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,l),t.state!==e&&Bi.enqueueReplaceState(t,t.state,null)}function Vl(e,t,s,l){var c=e.stateNode;c.props=s,c.state=e.memoizedState,c.refs={},Tl(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Dt(u):(u=xt(t)?ir:dt.current,c.context=zr(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(Hl(e,t,u,s),c.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(t=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),t!==c.state&&Bi.enqueueReplaceState(c,c.state,null),Ai(e,s,c,l),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Kr(e,t){try{var s="",l=t;do s+=ye(l),l=l.return;while(l);var c=s}catch(u){c=`
8
+ Error generating stack: `+u.message+`
9
+ `+u.stack}return{value:e,source:t,stack:c,digest:null}}function Kl(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function Gl(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var Fh=typeof WeakMap=="function"?WeakMap:Map;function Bu(e,t,s){s=Cn(-1,s),s.tag=3,s.payload={element:null};var l=t.value;return s.callback=function(){Qi||(Qi=!0,ca=l),Gl(e,t)},s}function qu(e,t,s){s=Cn(-1,s),s.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var c=t.value;s.payload=function(){return l(c)},s.callback=function(){Gl(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(s.callback=function(){Gl(e,t),typeof l!="function"&&(Vn===null?Vn=new Set([this]):Vn.add(this));var p=t.stack;this.componentDidCatch(t.value,{componentStack:p!==null?p:""})}),s}function Uu(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new Fh;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(s)||(c.add(s),e=tm.bind(null,e,t,s),t.then(e,e))}function Hu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Vu(e,t,s,l,c){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=Cn(-1,1),t.tag=2,Un(s,t,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=c,e)}var Bh=Z.ReactCurrentOwner,wt=!1;function gt(e,t,s,l){t.child=e===null?fu(t,null,s,l):qr(t,e.child,s,l)}function Ku(e,t,s,l,c){s=s.render;var u=t.ref;return Hr(t,c),l=zl(e,t,s,l,u,c),s=Wl(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Nn(e,t,c)):(Be&&s&&jl(t),t.flags|=1,gt(e,t,l,c),t.child)}function Gu(e,t,s,l,c){if(e===null){var u=s.type;return typeof u=="function"&&!ga(u)&&u.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=u,Qu(e,t,u,l,c)):(e=to(s.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,(e.lanes&c)===0){var p=u.memoizedProps;if(s=s.compare,s=s!==null?s:Ss,s(p,l)&&e.ref===t.ref)return Nn(e,t,c)}return t.flags|=1,e=Yn(u,l),e.ref=t.ref,e.return=t,t.child=e}function Qu(e,t,s,l,c){if(e!==null){var u=e.memoizedProps;if(Ss(u,l)&&e.ref===t.ref)if(wt=!1,t.pendingProps=l=u,(e.lanes&c)!==0)(e.flags&131072)!==0&&(wt=!0);else return t.lanes=e.lanes,Nn(e,t,c)}return Ql(e,t,s,l,c)}function Yu(e,t,s){var l=t.pendingProps,c=l.children,u=e!==null?e.memoizedState:null;if(l.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(Qr,Rt),Rt|=s;else{if((s&1073741824)===0)return e=u!==null?u.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$e(Qr,Rt),Rt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=u!==null?u.baseLanes:s,$e(Qr,Rt),Rt|=l}else u!==null?(l=u.baseLanes|s,t.memoizedState=null):l=s,$e(Qr,Rt),Rt|=l;return gt(e,t,c,s),t.child}function Xu(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function Ql(e,t,s,l,c){var u=xt(s)?ir:dt.current;return u=zr(t,u),Hr(t,c),s=zl(e,t,s,l,u,c),l=Wl(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Nn(e,t,c)):(Be&&l&&jl(t),t.flags|=1,gt(e,t,s,c),t.child)}function Ju(e,t,s,l,c){if(xt(s)){var u=!0;bi(t)}else u=!1;if(Hr(t,c),t.stateNode===null)Ui(e,t),Wu(t,s,l),Vl(t,s,l,c),l=!0;else if(e===null){var p=t.stateNode,v=t.memoizedProps;p.props=v;var x=p.context,M=s.contextType;typeof M=="object"&&M!==null?M=Dt(M):(M=xt(s)?ir:dt.current,M=zr(t,M));var H=s.getDerivedStateFromProps,V=typeof H=="function"||typeof p.getSnapshotBeforeUpdate=="function";V||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==l||x!==M)&&Fu(t,p,l,M),qn=!1;var U=t.memoizedState;p.state=U,Ai(t,l,p,c),x=t.memoizedState,v!==l||U!==x||yt.current||qn?(typeof H=="function"&&(Hl(t,s,H,l),x=t.memoizedState),(v=qn||zu(t,s,v,l,U,x,M))?(V||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=x),p.props=l,p.state=x,p.context=M,l=v):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{p=t.stateNode,hu(e,t),v=t.memoizedProps,M=t.type===t.elementType?v:Yt(t.type,v),p.props=M,V=t.pendingProps,U=p.context,x=s.contextType,typeof x=="object"&&x!==null?x=Dt(x):(x=xt(s)?ir:dt.current,x=zr(t,x));var se=s.getDerivedStateFromProps;(H=typeof se=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==V||U!==x)&&Fu(t,p,l,x),qn=!1,U=t.memoizedState,p.state=U,Ai(t,l,p,c);var le=t.memoizedState;v!==V||U!==le||yt.current||qn?(typeof se=="function"&&(Hl(t,s,se,l),le=t.memoizedState),(M=qn||zu(t,s,M,l,U,le,x)||!1)?(H||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,le,x),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,le,x)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=le),p.props=l,p.state=le,p.context=x,l=M):(typeof p.componentDidUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),l=!1)}return Yl(e,t,s,l,u,c)}function Yl(e,t,s,l,c,u){Xu(e,t);var p=(t.flags&128)!==0;if(!l&&!p)return c&&ru(t,s,!1),Nn(e,t,u);l=t.stateNode,Bh.current=t;var v=p&&typeof s.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&p?(t.child=qr(t,e.child,null,u),t.child=qr(t,null,v,u)):gt(e,t,v,u),t.memoizedState=l.state,c&&ru(t,s,!0),t.child}function Zu(e){var t=e.stateNode;t.pendingContext?tu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tu(e,t.context,!1),Ml(e,t.containerInfo)}function ed(e,t,s,l,c){return Br(),bl(c),t.flags|=256,gt(e,t,s,l),t.child}var Xl={dehydrated:null,treeContext:null,retryLane:0};function Jl(e){return{baseLanes:e,cachePool:null,transitions:null}}function td(e,t,s){var l=t.pendingProps,c=qe.current,u=!1,p=(t.flags&128)!==0,v;if((v=p)||(v=e!==null&&e.memoizedState===null?!1:(c&2)!==0),v?(u=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),$e(qe,c&1),e===null)return Nl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(p=l.children,e=l.fallback,u?(l=t.mode,u=t.child,p={mode:"hidden",children:p},(l&1)===0&&u!==null?(u.childLanes=0,u.pendingProps=p):u=no(p,l,0,null),e=mr(e,l,s,null),u.return=t,e.return=t,u.sibling=e,t.child=u,t.child.memoizedState=Jl(s),t.memoizedState=Xl,e):Zl(t,p));if(c=e.memoizedState,c!==null&&(v=c.dehydrated,v!==null))return qh(e,t,p,l,v,c,s);if(u){u=l.fallback,p=t.mode,c=e.child,v=c.sibling;var x={mode:"hidden",children:l.children};return(p&1)===0&&t.child!==c?(l=t.child,l.childLanes=0,l.pendingProps=x,t.deletions=null):(l=Yn(c,x),l.subtreeFlags=c.subtreeFlags&14680064),v!==null?u=Yn(v,u):(u=mr(u,p,s,null),u.flags|=2),u.return=t,l.return=t,l.sibling=u,t.child=l,l=u,u=t.child,p=e.child.memoizedState,p=p===null?Jl(s):{baseLanes:p.baseLanes|s,cachePool:null,transitions:p.transitions},u.memoizedState=p,u.childLanes=e.childLanes&~s,t.memoizedState=Xl,l}return u=e.child,e=u.sibling,l=Yn(u,{mode:"visible",children:l.children}),(t.mode&1)===0&&(l.lanes=s),l.return=t,l.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=l,t.memoizedState=null,l}function Zl(e,t){return t=no({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function qi(e,t,s,l){return l!==null&&bl(l),qr(t,e.child,null,s),e=Zl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qh(e,t,s,l,c,u,p){if(s)return t.flags&256?(t.flags&=-257,l=Kl(Error(o(422))),qi(e,t,p,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=l.fallback,c=t.mode,l=no({mode:"visible",children:l.children},c,0,null),u=mr(u,c,p,null),u.flags|=2,l.return=t,u.return=t,l.sibling=u,t.child=l,(t.mode&1)!==0&&qr(t,e.child,null,p),t.child.memoizedState=Jl(p),t.memoizedState=Xl,u);if((t.mode&1)===0)return qi(e,t,p,null);if(c.data==="$!"){if(l=c.nextSibling&&c.nextSibling.dataset,l)var v=l.dgst;return l=v,u=Error(o(419)),l=Kl(u,l,void 0),qi(e,t,p,l)}if(v=(p&e.childLanes)!==0,wt||v){if(l=nt,l!==null){switch(p&-p){case 4:c=2;break;case 16:c=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:c=32;break;case 536870912:c=268435456;break;default:c=0}c=(c&(l.suspendedLanes|p))!==0?0:c,c!==0&&c!==u.retryLane&&(u.retryLane=c,Sn(e,c),Zt(l,e,c,-1))}return ma(),l=Kl(Error(o(421))),qi(e,t,p,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=nm.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,Pt=zn(c.nextSibling),Et=t,Be=!0,Qt=null,e!==null&&($t[Lt++]=kn,$t[Lt++]=jn,$t[Lt++]=or,kn=e.id,jn=e.overflow,or=t),t=Zl(t,l.children),t.flags|=4096,t)}function nd(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Pl(e.return,t,s)}function ea(e,t,s,l,c){var u=e.memoizedState;u===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:c}:(u.isBackwards=t,u.rendering=null,u.renderingStartTime=0,u.last=l,u.tail=s,u.tailMode=c)}function rd(e,t,s){var l=t.pendingProps,c=l.revealOrder,u=l.tail;if(gt(e,t,l.children,s),l=qe.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nd(e,s,t);else if(e.tag===19)nd(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}if($e(qe,l),(t.mode&1)===0)t.memoizedState=null;else switch(c){case"forwards":for(s=t.child,c=null;s!==null;)e=s.alternate,e!==null&&$i(e)===null&&(c=s),s=s.sibling;s=c,s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),ea(t,!1,c,s,u);break;case"backwards":for(s=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&$i(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}ea(t,!0,s,null,u);break;case"together":ea(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ui(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Nn(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),dr|=t.lanes,(s&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,s=Yn(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Yn(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Uh(e,t,s){switch(t.tag){case 3:Zu(t),Br();break;case 5:vu(t);break;case 1:xt(t.type)&&bi(t);break;case 4:Ml(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;$e(Ti,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?($e(qe,qe.current&1),t.flags|=128,null):(s&t.child.childLanes)!==0?td(e,t,s):($e(qe,qe.current&1),e=Nn(e,t,s),e!==null?e.sibling:null);$e(qe,qe.current&1);break;case 19:if(l=(s&t.childLanes)!==0,(e.flags&128)!==0){if(l)return rd(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),$e(qe,qe.current),l)break;return null;case 22:case 23:return t.lanes=0,Yu(e,t,s)}return Nn(e,t,s)}var sd,ta,id,od;sd=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},ta=function(){},id=function(e,t,s,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,cr(cn.current);var u=null;switch(s){case"input":c=Mt(e,c),l=Mt(e,l),u=[];break;case"select":c=T({},c,{value:void 0}),l=T({},l,{value:void 0}),u=[];break;case"textarea":c=Tn(e,c),l=Tn(e,l),u=[];break;default:typeof c.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=Si)}Vt(s,l);var p;s=null;for(M in c)if(!l.hasOwnProperty(M)&&c.hasOwnProperty(M)&&c[M]!=null)if(M==="style"){var v=c[M];for(p in v)v.hasOwnProperty(p)&&(s||(s={}),s[p]="")}else M!=="dangerouslySetInnerHTML"&&M!=="children"&&M!=="suppressContentEditableWarning"&&M!=="suppressHydrationWarning"&&M!=="autoFocus"&&(d.hasOwnProperty(M)?u||(u=[]):(u=u||[]).push(M,null));for(M in l){var x=l[M];if(v=c?.[M],l.hasOwnProperty(M)&&x!==v&&(x!=null||v!=null))if(M==="style")if(v){for(p in v)!v.hasOwnProperty(p)||x&&x.hasOwnProperty(p)||(s||(s={}),s[p]="");for(p in x)x.hasOwnProperty(p)&&v[p]!==x[p]&&(s||(s={}),s[p]=x[p])}else s||(u||(u=[]),u.push(M,s)),s=x;else M==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,v=v?v.__html:void 0,x!=null&&v!==x&&(u=u||[]).push(M,x)):M==="children"?typeof x!="string"&&typeof x!="number"||(u=u||[]).push(M,""+x):M!=="suppressContentEditableWarning"&&M!=="suppressHydrationWarning"&&(d.hasOwnProperty(M)?(x!=null&&M==="onScroll"&&De("scroll",e),u||v===x||(u=[])):(u=u||[]).push(M,x))}s&&(u=u||[]).push("style",s);var M=u;(t.updateQueue=M)&&(t.flags|=4)}},od=function(e,t,s,l){s!==l&&(t.flags|=4)};function Ds(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(t)for(var c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags&14680064,l|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=s,t}function Hh(e,t,s){var l=t.pendingProps;switch(Sl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return xt(t.type)&&Ni(),pt(t),null;case 3:return l=t.stateNode,Vr(),ze(yt),ze(dt),$l(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qt!==null&&(fa(Qt),Qt=null))),ta(e,t),pt(t),null;case 5:Ol(t);var c=cr(Ms.current);if(s=t.type,e!==null&&t.stateNode!=null)id(e,t,s,l,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(e=cr(cn.current),Pi(t)){l=t.stateNode,s=t.type;var u=t.memoizedProps;switch(l[an]=t,l[Is]=u,e=(t.mode&1)!==0,s){case"dialog":De("cancel",l),De("close",l);break;case"iframe":case"object":case"embed":De("load",l);break;case"video":case"audio":for(c=0;c<Ns.length;c++)De(Ns[c],l);break;case"source":De("error",l);break;case"img":case"image":case"link":De("error",l),De("load",l);break;case"details":De("toggle",l);break;case"input":at(l,u),De("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!u.multiple},De("invalid",l);break;case"textarea":ct(l,u),De("invalid",l)}Vt(s,u),c=null;for(var p in u)if(u.hasOwnProperty(p)){var v=u[p];p==="children"?typeof v=="string"?l.textContent!==v&&(u.suppressHydrationWarning!==!0&&ji(l.textContent,v,e),c=["children",v]):typeof v=="number"&&l.textContent!==""+v&&(u.suppressHydrationWarning!==!0&&ji(l.textContent,v,e),c=["children",""+v]):d.hasOwnProperty(p)&&v!=null&&p==="onScroll"&&De("scroll",l)}switch(s){case"input":Re(l),it(l,u,!0);break;case"textarea":Re(l),nr(l);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(l.onclick=Si)}l=c,t.updateQueue=l,l!==null&&(t.flags|=4)}else{p=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=sn(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=p.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(s,{is:l.is}):(e=p.createElement(s),s==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,s),e[an]=t,e[Is]=l,sd(e,t,!1,!1),t.stateNode=e;e:{switch(p=Nr(s,l),s){case"dialog":De("cancel",e),De("close",e),c=l;break;case"iframe":case"object":case"embed":De("load",e),c=l;break;case"video":case"audio":for(c=0;c<Ns.length;c++)De(Ns[c],e);c=l;break;case"source":De("error",e),c=l;break;case"img":case"image":case"link":De("error",e),De("load",e),c=l;break;case"details":De("toggle",e),c=l;break;case"input":at(e,l),c=Mt(e,l),De("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=T({},l,{value:void 0}),De("invalid",e);break;case"textarea":ct(e,l),c=Tn(e,l),De("invalid",e);break;default:c=l}Vt(s,c),v=c;for(u in v)if(v.hasOwnProperty(u)){var x=v[u];u==="style"?gn(e,x):u==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,x!=null&&J(e,x)):u==="children"?typeof x=="string"?(s!=="textarea"||x!=="")&&me(e,x):typeof x=="number"&&me(e,""+x):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(d.hasOwnProperty(u)?x!=null&&u==="onScroll"&&De("scroll",e):x!=null&&he(e,u,x,p))}switch(s){case"input":Re(e),it(e,l,!1);break;case"textarea":Re(e),nr(e);break;case"option":l.value!=null&&e.setAttribute("value",""+Se(l.value));break;case"select":e.multiple=!!l.multiple,u=l.value,u!=null?Ht(e,!!l.multiple,u,!1):l.defaultValue!=null&&Ht(e,!!l.multiple,l.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Si)}switch(s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return pt(t),null;case 6:if(e&&t.stateNode!=null)od(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(s=cr(Ms.current),cr(cn.current),Pi(t)){if(l=t.stateNode,s=t.memoizedProps,l[an]=t,(u=l.nodeValue!==s)&&(e=Et,e!==null))switch(e.tag){case 3:ji(l.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ji(l.nodeValue,s,(e.mode&1)!==0)}u&&(t.flags|=4)}else l=(s.nodeType===9?s:s.ownerDocument).createTextNode(l),l[an]=t,t.stateNode=l}return pt(t),null;case 13:if(ze(qe),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Be&&Pt!==null&&(t.mode&1)!==0&&(t.flags&128)===0)cu(),Br(),t.flags|=98560,u=!1;else if(u=Pi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[an]=t}else Br(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),u=!1}else Qt!==null&&(fa(Qt),Qt=null),u=!0;if(!u)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=s,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(qe.current&1)!==0?et===0&&(et=3):ma())),t.updateQueue!==null&&(t.flags|=4),pt(t),null);case 4:return Vr(),ta(e,t),e===null&&bs(t.stateNode.containerInfo),pt(t),null;case 10:return El(t.type._context),pt(t),null;case 17:return xt(t.type)&&Ni(),pt(t),null;case 19:if(ze(qe),u=t.memoizedState,u===null)return pt(t),null;if(l=(t.flags&128)!==0,p=u.rendering,p===null)if(l)Ds(u,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(p=$i(e),p!==null){for(t.flags|=128,Ds(u,!1),l=p.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=s,s=t.child;s!==null;)u=s,e=l,u.flags&=14680066,p=u.alternate,p===null?(u.childLanes=0,u.lanes=e,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=p.childLanes,u.lanes=p.lanes,u.child=p.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=p.memoizedProps,u.memoizedState=p.memoizedState,u.updateQueue=p.updateQueue,u.type=p.type,e=p.dependencies,u.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return $e(qe,qe.current&1|2),t.child}e=e.sibling}u.tail!==null&&Ge()>Yr&&(t.flags|=128,l=!0,Ds(u,!1),t.lanes=4194304)}else{if(!l)if(e=$i(p),e!==null){if(t.flags|=128,l=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Ds(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!Be)return pt(t),null}else 2*Ge()-u.renderingStartTime>Yr&&s!==1073741824&&(t.flags|=128,l=!0,Ds(u,!1),t.lanes=4194304);u.isBackwards?(p.sibling=t.child,t.child=p):(s=u.last,s!==null?s.sibling=p:t.child=p,u.last=p)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Ge(),t.sibling=null,s=qe.current,$e(qe,l?s&1|2:s&1),t):(pt(t),null);case 22:case 23:return ha(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Rt&1073741824)!==0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Vh(e,t){switch(Sl(t),t.tag){case 1:return xt(t.type)&&Ni(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vr(),ze(yt),ze(dt),$l(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ol(t),null;case 13:if(ze(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Br()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ze(qe),null;case 4:return Vr(),null;case 10:return El(t.type._context),null;case 22:case 23:return ha(),null;case 24:return null;default:return null}}var Hi=!1,ht=!1,Kh=typeof WeakSet=="function"?WeakSet:Set,oe=null;function Gr(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(l){Ve(e,t,l)}else s.current=null}function na(e,t,s){try{s()}catch(l){Ve(e,t,l)}}var ld=!1;function Gh(e,t){if(hl=di,e=zc(),ol(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{s.nodeType,u.nodeType}catch{s=null;break e}var p=0,v=-1,x=-1,M=0,H=0,V=e,U=null;t:for(;;){for(var se;V!==s||c!==0&&V.nodeType!==3||(v=p+c),V!==u||l!==0&&V.nodeType!==3||(x=p+l),V.nodeType===3&&(p+=V.nodeValue.length),(se=V.firstChild)!==null;)U=V,V=se;for(;;){if(V===e)break t;if(U===s&&++M===c&&(v=p),U===u&&++H===l&&(x=p),(se=V.nextSibling)!==null)break;V=U,U=V.parentNode}V=se}s=v===-1||x===-1?null:{start:v,end:x}}else s=null}s=s||{start:0,end:0}}else s=null;for(ml={focusedElem:e,selectionRange:s},di=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var le=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(le!==null){var ce=le.memoizedProps,Qe=le.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?ce:Yt(t.type,ce),Qe);_.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var I=t.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(G){Ve(t,t.return,G)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return le=ld,ld=!1,le}function zs(e,t,s){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var c=l=l.next;do{if((c.tag&e)===e){var u=c.destroy;c.destroy=void 0,u!==void 0&&na(t,s,u)}c=c.next}while(c!==l)}}function Vi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var l=s.create;s.destroy=l()}s=s.next}while(s!==t)}}function ra(e){var t=e.ref;if(t!==null){var s=e.stateNode;e.tag,e=s,typeof t=="function"?t(e):t.current=e}}function ad(e){var t=e.alternate;t!==null&&(e.alternate=null,ad(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[an],delete t[Is],delete t[xl],delete t[Ph],delete t[Rh])),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 cd(e){return e.tag===5||e.tag===3||e.tag===4}function ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cd(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 sa(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Si));else if(l!==4&&(e=e.child,e!==null))for(sa(e,t,s),e=e.sibling;e!==null;)sa(e,t,s),e=e.sibling}function ia(e,t,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(ia(e,t,s),e=e.sibling;e!==null;)ia(e,t,s),e=e.sibling}var ot=null,Xt=!1;function Hn(e,t,s){for(s=s.child;s!==null;)dd(e,t,s),s=s.sibling}function dd(e,t,s){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(ii,s)}catch{}switch(s.tag){case 5:ht||Gr(s,t);case 6:var l=ot,c=Xt;ot=null,Hn(e,t,s),ot=l,Xt=c,ot!==null&&(Xt?(e=ot,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):ot.removeChild(s.stateNode));break;case 18:ot!==null&&(Xt?(e=ot,s=s.stateNode,e.nodeType===8?yl(e.parentNode,s):e.nodeType===1&&yl(e,s),vs(e)):yl(ot,s.stateNode));break;case 4:l=ot,c=Xt,ot=s.stateNode.containerInfo,Xt=!0,Hn(e,t,s),ot=l,Xt=c;break;case 0:case 11:case 14:case 15:if(!ht&&(l=s.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){c=l=l.next;do{var u=c,p=u.destroy;u=u.tag,p!==void 0&&((u&2)!==0||(u&4)!==0)&&na(s,t,p),c=c.next}while(c!==l)}Hn(e,t,s);break;case 1:if(!ht&&(Gr(s,t),l=s.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=s.memoizedProps,l.state=s.memoizedState,l.componentWillUnmount()}catch(v){Ve(s,t,v)}Hn(e,t,s);break;case 21:Hn(e,t,s);break;case 22:s.mode&1?(ht=(l=ht)||s.memoizedState!==null,Hn(e,t,s),ht=l):Hn(e,t,s);break;default:Hn(e,t,s)}}function fd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Kh),t.forEach(function(l){var c=rm.bind(null,e,l);s.has(l)||(s.add(l),l.then(c,c))})}}function Jt(e,t){var s=t.deletions;if(s!==null)for(var l=0;l<s.length;l++){var c=s[l];try{var u=e,p=t,v=p;e:for(;v!==null;){switch(v.tag){case 5:ot=v.stateNode,Xt=!1;break e;case 3:ot=v.stateNode.containerInfo,Xt=!0;break e;case 4:ot=v.stateNode.containerInfo,Xt=!0;break e}v=v.return}if(ot===null)throw Error(o(160));dd(u,p,c),ot=null,Xt=!1;var x=c.alternate;x!==null&&(x.return=null),c.return=null}catch(M){Ve(c,t,M)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)pd(t,e),t=t.sibling}function pd(e,t){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Jt(t,e),dn(e),l&4){try{zs(3,e,e.return),Vi(3,e)}catch(ce){Ve(e,e.return,ce)}try{zs(5,e,e.return)}catch(ce){Ve(e,e.return,ce)}}break;case 1:Jt(t,e),dn(e),l&512&&s!==null&&Gr(s,s.return);break;case 5:if(Jt(t,e),dn(e),l&512&&s!==null&&Gr(s,s.return),e.flags&32){var c=e.stateNode;try{me(c,"")}catch(ce){Ve(e,e.return,ce)}}if(l&4&&(c=e.stateNode,c!=null)){var u=e.memoizedProps,p=s!==null?s.memoizedProps:u,v=e.type,x=e.updateQueue;if(e.updateQueue=null,x!==null)try{v==="input"&&u.type==="radio"&&u.name!=null&&st(c,u),Nr(v,p);var M=Nr(v,u);for(p=0;p<x.length;p+=2){var H=x[p],V=x[p+1];H==="style"?gn(c,V):H==="dangerouslySetInnerHTML"?J(c,V):H==="children"?me(c,V):he(c,H,V,M)}switch(v){case"input":Ye(c,u);break;case"textarea":tr(c,u);break;case"select":var U=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var se=u.value;se!=null?Ht(c,!!u.multiple,se,!1):U!==!!u.multiple&&(u.defaultValue!=null?Ht(c,!!u.multiple,u.defaultValue,!0):Ht(c,!!u.multiple,u.multiple?[]:"",!1))}c[Is]=u}catch(ce){Ve(e,e.return,ce)}}break;case 6:if(Jt(t,e),dn(e),l&4){if(e.stateNode===null)throw Error(o(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(ce){Ve(e,e.return,ce)}}break;case 3:if(Jt(t,e),dn(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{vs(t.containerInfo)}catch(ce){Ve(e,e.return,ce)}break;case 4:Jt(t,e),dn(e);break;case 13:Jt(t,e),dn(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(aa=Ge())),l&4&&fd(e);break;case 22:if(H=s!==null&&s.memoizedState!==null,e.mode&1?(ht=(M=ht)||H,Jt(t,e),ht=M):Jt(t,e),dn(e),l&8192){if(M=e.memoizedState!==null,(e.stateNode.isHidden=M)&&!H&&(e.mode&1)!==0)for(oe=e,H=e.child;H!==null;){for(V=oe=H;oe!==null;){switch(U=oe,se=U.child,U.tag){case 0:case 11:case 14:case 15:zs(4,U,U.return);break;case 1:Gr(U,U.return);var le=U.stateNode;if(typeof le.componentWillUnmount=="function"){l=U,s=U.return;try{t=l,le.props=t.memoizedProps,le.state=t.memoizedState,le.componentWillUnmount()}catch(ce){Ve(l,s,ce)}}break;case 5:Gr(U,U.return);break;case 22:if(U.memoizedState!==null){gd(V);continue}}se!==null?(se.return=U,oe=se):gd(V)}H=H.sibling}e:for(H=null,V=e;;){if(V.tag===5){if(H===null){H=V;try{c=V.stateNode,M?(u=c.style,typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"):(v=V.stateNode,x=V.memoizedProps.style,p=x!=null&&x.hasOwnProperty("display")?x.display:null,v.style.display=Ot("display",p))}catch(ce){Ve(e,e.return,ce)}}}else if(V.tag===6){if(H===null)try{V.stateNode.nodeValue=M?"":V.memoizedProps}catch(ce){Ve(e,e.return,ce)}}else if((V.tag!==22&&V.tag!==23||V.memoizedState===null||V===e)&&V.child!==null){V.child.return=V,V=V.child;continue}if(V===e)break e;for(;V.sibling===null;){if(V.return===null||V.return===e)break e;H===V&&(H=null),V=V.return}H===V&&(H=null),V.sibling.return=V.return,V=V.sibling}}break;case 19:Jt(t,e),dn(e),l&4&&fd(e);break;case 21:break;default:Jt(t,e),dn(e)}}function dn(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(cd(s)){var l=s;break e}s=s.return}throw Error(o(160))}switch(l.tag){case 5:var c=l.stateNode;l.flags&32&&(me(c,""),l.flags&=-33);var u=ud(e);ia(e,u,c);break;case 3:case 4:var p=l.stateNode.containerInfo,v=ud(e);sa(e,v,p);break;default:throw Error(o(161))}}catch(x){Ve(e,e.return,x)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qh(e,t,s){oe=e,hd(e)}function hd(e,t,s){for(var l=(e.mode&1)!==0;oe!==null;){var c=oe,u=c.child;if(c.tag===22&&l){var p=c.memoizedState!==null||Hi;if(!p){var v=c.alternate,x=v!==null&&v.memoizedState!==null||ht;v=Hi;var M=ht;if(Hi=p,(ht=x)&&!M)for(oe=c;oe!==null;)p=oe,x=p.child,p.tag===22&&p.memoizedState!==null?vd(c):x!==null?(x.return=p,oe=x):vd(c);for(;u!==null;)oe=u,hd(u),u=u.sibling;oe=c,Hi=v,ht=M}md(e)}else(c.subtreeFlags&8772)!==0&&u!==null?(u.return=c,oe=u):md(e)}}function md(e){for(;oe!==null;){var t=oe;if((t.flags&8772)!==0){var s=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:ht||Vi(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!ht)if(s===null)l.componentDidMount();else{var c=t.elementType===t.type?s.memoizedProps:Yt(t.type,s.memoizedProps);l.componentDidUpdate(c,s.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var u=t.updateQueue;u!==null&&gu(t,u,l);break;case 3:var p=t.updateQueue;if(p!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}gu(t,p,s)}break;case 5:var v=t.stateNode;if(s===null&&t.flags&4){s=v;var x=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":x.autoFocus&&s.focus();break;case"img":x.src&&(s.src=x.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var M=t.alternate;if(M!==null){var H=M.memoizedState;if(H!==null){var V=H.dehydrated;V!==null&&vs(V)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}ht||t.flags&512&&ra(t)}catch(U){Ve(t,t.return,U)}}if(t===e){oe=null;break}if(s=t.sibling,s!==null){s.return=t.return,oe=s;break}oe=t.return}}function gd(e){for(;oe!==null;){var t=oe;if(t===e){oe=null;break}var s=t.sibling;if(s!==null){s.return=t.return,oe=s;break}oe=t.return}}function vd(e){for(;oe!==null;){var t=oe;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{Vi(4,t)}catch(x){Ve(t,s,x)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var c=t.return;try{l.componentDidMount()}catch(x){Ve(t,c,x)}}var u=t.return;try{ra(t)}catch(x){Ve(t,u,x)}break;case 5:var p=t.return;try{ra(t)}catch(x){Ve(t,p,x)}}}catch(x){Ve(t,t.return,x)}if(t===e){oe=null;break}var v=t.sibling;if(v!==null){v.return=t.return,oe=v;break}oe=t.return}}var Yh=Math.ceil,Ki=Z.ReactCurrentDispatcher,oa=Z.ReactCurrentOwner,Wt=Z.ReactCurrentBatchConfig,Te=0,nt=null,Xe=null,lt=0,Rt=0,Qr=Wn(0),et=0,Ws=null,dr=0,Gi=0,la=0,Fs=null,kt=null,aa=0,Yr=1/0,bn=null,Qi=!1,ca=null,Vn=null,Yi=!1,Kn=null,Xi=0,Bs=0,ua=null,Ji=-1,Zi=0;function vt(){return(Te&6)!==0?Ge():Ji!==-1?Ji:Ji=Ge()}function Gn(e){return(e.mode&1)===0?1:(Te&2)!==0&&lt!==0?lt&-lt:Mh.transition!==null?(Zi===0&&(Zi=uc()),Zi):(e=Ae,e!==0||(e=window.event,e=e===void 0?16:xc(e.type)),e)}function Zt(e,t,s,l){if(50<Bs)throw Bs=0,ua=null,Error(o(185));fs(e,s,l),((Te&2)===0||e!==nt)&&(e===nt&&((Te&2)===0&&(Gi|=s),et===4&&Qn(e,lt)),jt(e,l),s===1&&Te===0&&(t.mode&1)===0&&(Yr=Ge()+500,_i&&Bn()))}function jt(e,t){var s=e.callbackNode;Mp(e,t);var l=ai(e,e===nt?lt:0);if(l===0)s!==null&&lc(s),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(s!=null&&lc(s),t===1)e.tag===0?Th(xd.bind(null,e)):su(xd.bind(null,e)),Ih(function(){(Te&6)===0&&Bn()}),s=null;else{switch(dc(l)){case 1:s=qo;break;case 4:s=ac;break;case 16:s=si;break;case 536870912:s=cc;break;default:s=si}s=_d(s,yd.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function yd(e,t){if(Ji=-1,Zi=0,(Te&6)!==0)throw Error(o(327));var s=e.callbackNode;if(Xr()&&e.callbackNode!==s)return null;var l=ai(e,e===nt?lt:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=eo(e,l);else{t=l;var c=Te;Te|=2;var u=kd();(nt!==e||lt!==t)&&(bn=null,Yr=Ge()+500,pr(e,t));do try{Zh();break}catch(v){wd(e,v)}while(!0);Il(),Ki.current=u,Te=c,Xe!==null?t=0:(nt=null,lt=0,t=et)}if(t!==0){if(t===2&&(c=Uo(e),c!==0&&(l=c,t=da(e,c))),t===1)throw s=Ws,pr(e,0),Qn(e,l),jt(e,Ge()),s;if(t===6)Qn(e,l);else{if(c=e.current.alternate,(l&30)===0&&!Xh(c)&&(t=eo(e,l),t===2&&(u=Uo(e),u!==0&&(l=u,t=da(e,u))),t===1))throw s=Ws,pr(e,0),Qn(e,l),jt(e,Ge()),s;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(o(345));case 2:hr(e,kt,bn);break;case 3:if(Qn(e,l),(l&130023424)===l&&(t=aa+500-Ge(),10<t)){if(ai(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){vt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=vl(hr.bind(null,e,kt,bn),t);break}hr(e,kt,bn);break;case 4:if(Qn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,c=-1;0<l;){var p=31-Kt(l);u=1<<p,p=t[p],p>c&&(c=p),l&=~u}if(l=c,l=Ge()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Yh(l/1960))-l,10<l){e.timeoutHandle=vl(hr.bind(null,e,kt,bn),l);break}hr(e,kt,bn);break;case 5:hr(e,kt,bn);break;default:throw Error(o(329))}}}return jt(e,Ge()),e.callbackNode===s?yd.bind(null,e):null}function da(e,t){var s=Fs;return e.current.memoizedState.isDehydrated&&(pr(e,t).flags|=256),e=eo(e,t),e!==2&&(t=kt,kt=s,t!==null&&fa(t)),e}function fa(e){kt===null?kt=e:kt.push.apply(kt,e)}function Xh(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var l=0;l<s.length;l++){var c=s[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Qn(e,t){for(t&=~la,t&=~Gi,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-Kt(t),l=1<<s;e[s]=-1,t&=~l}}function xd(e){if((Te&6)!==0)throw Error(o(327));Xr();var t=ai(e,0);if((t&1)===0)return jt(e,Ge()),null;var s=eo(e,t);if(e.tag!==0&&s===2){var l=Uo(e);l!==0&&(t=l,s=da(e,l))}if(s===1)throw s=Ws,pr(e,0),Qn(e,t),jt(e,Ge()),s;if(s===6)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hr(e,kt,bn),jt(e,Ge()),null}function pa(e,t){var s=Te;Te|=1;try{return e(t)}finally{Te=s,Te===0&&(Yr=Ge()+500,_i&&Bn())}}function fr(e){Kn!==null&&Kn.tag===0&&(Te&6)===0&&Xr();var t=Te;Te|=1;var s=Wt.transition,l=Ae;try{if(Wt.transition=null,Ae=1,e)return e()}finally{Ae=l,Wt.transition=s,Te=t,(Te&6)===0&&Bn()}}function ha(){Rt=Qr.current,ze(Qr)}function pr(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,_h(s)),Xe!==null)for(s=Xe.return;s!==null;){var l=s;switch(Sl(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Ni();break;case 3:Vr(),ze(yt),ze(dt),$l();break;case 5:Ol(l);break;case 4:Vr();break;case 13:ze(qe);break;case 19:ze(qe);break;case 10:El(l.type._context);break;case 22:case 23:ha()}s=s.return}if(nt=e,Xe=e=Yn(e.current,null),lt=Rt=t,et=0,Ws=null,la=Gi=dr=0,kt=Fs=null,ar!==null){for(t=0;t<ar.length;t++)if(s=ar[t],l=s.interleaved,l!==null){s.interleaved=null;var c=l.next,u=s.pending;if(u!==null){var p=u.next;u.next=c,l.next=p}s.pending=l}ar=null}return e}function wd(e,t){do{var s=Xe;try{if(Il(),Li.current=Fi,Di){for(var l=Ue.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}Di=!1}if(ur=0,tt=Ze=Ue=null,Os=!1,As=0,oa.current=null,s===null||s.return===null){et=1,Ws=t,Xe=null;break}e:{var u=e,p=s.return,v=s,x=t;if(t=lt,v.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){var M=x,H=v,V=H.tag;if((H.mode&1)===0&&(V===0||V===11||V===15)){var U=H.alternate;U?(H.updateQueue=U.updateQueue,H.memoizedState=U.memoizedState,H.lanes=U.lanes):(H.updateQueue=null,H.memoizedState=null)}var se=Hu(p);if(se!==null){se.flags&=-257,Vu(se,p,v,u,t),se.mode&1&&Uu(u,M,t),t=se,x=M;var le=t.updateQueue;if(le===null){var ce=new Set;ce.add(x),t.updateQueue=ce}else le.add(x);break e}else{if((t&1)===0){Uu(u,M,t),ma();break e}x=Error(o(426))}}else if(Be&&v.mode&1){var Qe=Hu(p);if(Qe!==null){(Qe.flags&65536)===0&&(Qe.flags|=256),Vu(Qe,p,v,u,t),bl(Kr(x,v));break e}}u=x=Kr(x,v),et!==4&&(et=2),Fs===null?Fs=[u]:Fs.push(u),u=p;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var _=Bu(u,x,t);mu(u,_);break e;case 1:v=x;var k=u.type,I=u.stateNode;if((u.flags&128)===0&&(typeof k.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Vn===null||!Vn.has(I)))){u.flags|=65536,t&=-t,u.lanes|=t;var G=qu(u,v,t);mu(u,G);break e}}u=u.return}while(u!==null)}Sd(s)}catch(fe){t=fe,Xe===s&&s!==null&&(Xe=s=s.return);continue}break}while(!0)}function kd(){var e=Ki.current;return Ki.current=Fi,e===null?Fi:e}function ma(){(et===0||et===3||et===2)&&(et=4),nt===null||(dr&268435455)===0&&(Gi&268435455)===0||Qn(nt,lt)}function eo(e,t){var s=Te;Te|=2;var l=kd();(nt!==e||lt!==t)&&(bn=null,pr(e,t));do try{Jh();break}catch(c){wd(e,c)}while(!0);if(Il(),Te=s,Ki.current=l,Xe!==null)throw Error(o(261));return nt=null,lt=0,et}function Jh(){for(;Xe!==null;)jd(Xe)}function Zh(){for(;Xe!==null&&!Cp();)jd(Xe)}function jd(e){var t=bd(e.alternate,e,Rt);e.memoizedProps=e.pendingProps,t===null?Sd(e):Xe=t,oa.current=null}function Sd(e){var t=e;do{var s=t.alternate;if(e=t.return,(t.flags&32768)===0){if(s=Hh(s,t,Rt),s!==null){Xe=s;return}}else{if(s=Vh(s,t),s!==null){s.flags&=32767,Xe=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{et=6,Xe=null;return}}if(t=t.sibling,t!==null){Xe=t;return}Xe=t=e}while(t!==null);et===0&&(et=5)}function hr(e,t,s){var l=Ae,c=Wt.transition;try{Wt.transition=null,Ae=1,em(e,t,s,l)}finally{Wt.transition=c,Ae=l}return null}function em(e,t,s,l){do Xr();while(Kn!==null);if((Te&6)!==0)throw Error(o(327));s=e.finishedWork;var c=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var u=s.lanes|s.childLanes;if(Op(e,u),e===nt&&(Xe=nt=null,lt=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Yi||(Yi=!0,_d(si,function(){return Xr(),null})),u=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||u){u=Wt.transition,Wt.transition=null;var p=Ae;Ae=1;var v=Te;Te|=4,oa.current=null,Gh(e,s),pd(s,e),wh(ml),di=!!hl,ml=hl=null,e.current=s,Qh(s),Np(),Te=v,Ae=p,Wt.transition=u}else e.current=s;if(Yi&&(Yi=!1,Kn=e,Xi=c),u=e.pendingLanes,u===0&&(Vn=null),Ip(s.stateNode),jt(e,Ge()),t!==null)for(l=e.onRecoverableError,s=0;s<t.length;s++)c=t[s],l(c.value,{componentStack:c.stack,digest:c.digest});if(Qi)throw Qi=!1,e=ca,ca=null,e;return(Xi&1)!==0&&e.tag!==0&&Xr(),u=e.pendingLanes,(u&1)!==0?e===ua?Bs++:(Bs=0,ua=e):Bs=0,Bn(),null}function Xr(){if(Kn!==null){var e=dc(Xi),t=Wt.transition,s=Ae;try{if(Wt.transition=null,Ae=16>e?16:e,Kn===null)var l=!1;else{if(e=Kn,Kn=null,Xi=0,(Te&6)!==0)throw Error(o(331));var c=Te;for(Te|=4,oe=e.current;oe!==null;){var u=oe,p=u.child;if((oe.flags&16)!==0){var v=u.deletions;if(v!==null){for(var x=0;x<v.length;x++){var M=v[x];for(oe=M;oe!==null;){var H=oe;switch(H.tag){case 0:case 11:case 15:zs(8,H,u)}var V=H.child;if(V!==null)V.return=H,oe=V;else for(;oe!==null;){H=oe;var U=H.sibling,se=H.return;if(ad(H),H===M){oe=null;break}if(U!==null){U.return=se,oe=U;break}oe=se}}}var le=u.alternate;if(le!==null){var ce=le.child;if(ce!==null){le.child=null;do{var Qe=ce.sibling;ce.sibling=null,ce=Qe}while(ce!==null)}}oe=u}}if((u.subtreeFlags&2064)!==0&&p!==null)p.return=u,oe=p;else e:for(;oe!==null;){if(u=oe,(u.flags&2048)!==0)switch(u.tag){case 0:case 11:case 15:zs(9,u,u.return)}var _=u.sibling;if(_!==null){_.return=u.return,oe=_;break e}oe=u.return}}var k=e.current;for(oe=k;oe!==null;){p=oe;var I=p.child;if((p.subtreeFlags&2064)!==0&&I!==null)I.return=p,oe=I;else e:for(p=k;oe!==null;){if(v=oe,(v.flags&2048)!==0)try{switch(v.tag){case 0:case 11:case 15:Vi(9,v)}}catch(fe){Ve(v,v.return,fe)}if(v===p){oe=null;break e}var G=v.sibling;if(G!==null){G.return=v.return,oe=G;break e}oe=v.return}}if(Te=c,Bn(),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(ii,e)}catch{}l=!0}return l}finally{Ae=s,Wt.transition=t}}return!1}function Cd(e,t,s){t=Kr(s,t),t=Bu(e,t,1),e=Un(e,t,1),t=vt(),e!==null&&(fs(e,1,t),jt(e,t))}function Ve(e,t,s){if(e.tag===3)Cd(e,e,s);else for(;t!==null;){if(t.tag===3){Cd(t,e,s);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Vn===null||!Vn.has(l))){e=Kr(s,e),e=qu(t,e,1),t=Un(t,e,1),e=vt(),t!==null&&(fs(t,1,e),jt(t,e));break}}t=t.return}}function tm(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),t=vt(),e.pingedLanes|=e.suspendedLanes&s,nt===e&&(lt&s)===s&&(et===4||et===3&&(lt&130023424)===lt&&500>Ge()-aa?pr(e,0):la|=s),jt(e,t)}function Nd(e,t){t===0&&((e.mode&1)===0?t=1:(t=li,li<<=1,(li&130023424)===0&&(li=4194304)));var s=vt();e=Sn(e,t),e!==null&&(fs(e,t,s),jt(e,s))}function nm(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Nd(e,s)}function rm(e,t){var s=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(o(314))}l!==null&&l.delete(t),Nd(e,s)}var bd;bd=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)wt=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return wt=!1,Uh(e,t,s);wt=(e.flags&131072)!==0}else wt=!1,Be&&(t.flags&1048576)!==0&&iu(t,Ei,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Ui(e,t),e=t.pendingProps;var c=zr(t,dt.current);Hr(t,s),c=zl(null,t,l,e,c,s);var u=Wl();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(l)?(u=!0,bi(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Tl(t),c.updater=Bi,t.stateNode=c,c._reactInternals=t,Vl(t,l,e,s),t=Yl(null,t,l,!0,u,s)):(t.tag=0,Be&&u&&jl(t),gt(null,t,c,s),t=t.child),t;case 16:l=t.elementType;e:{switch(Ui(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=im(l),e=Yt(l,e),c){case 0:t=Ql(null,t,l,e,s);break e;case 1:t=Ju(null,t,l,e,s);break e;case 11:t=Ku(null,t,l,e,s);break e;case 14:t=Gu(null,t,l,Yt(l.type,e),s);break e}throw Error(o(306,l,""))}return t;case 0:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Ql(e,t,l,c,s);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Ju(e,t,l,c,s);case 3:e:{if(Zu(t),e===null)throw Error(o(387));l=t.pendingProps,u=t.memoizedState,c=u.element,hu(e,t),Ai(t,l,null,s);var p=t.memoizedState;if(l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){c=Kr(Error(o(423)),t),t=ed(e,t,l,s,c);break e}else if(l!==c){c=Kr(Error(o(424)),t),t=ed(e,t,l,s,c);break e}else for(Pt=zn(t.stateNode.containerInfo.firstChild),Et=t,Be=!0,Qt=null,s=fu(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Br(),l===c){t=Nn(e,t,s);break e}gt(e,t,l,s)}t=t.child}return t;case 5:return vu(t),e===null&&Nl(t),l=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,p=c.children,gl(l,c)?p=null:u!==null&&gl(l,u)&&(t.flags|=32),Xu(e,t),gt(e,t,p,s),t.child;case 6:return e===null&&Nl(t),null;case 13:return td(e,t,s);case 4:return Ml(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=qr(t,null,l,s):gt(e,t,l,s),t.child;case 11:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Ku(e,t,l,c,s);case 7:return gt(e,t,t.pendingProps,s),t.child;case 8:return gt(e,t,t.pendingProps.children,s),t.child;case 12:return gt(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(l=t.type._context,c=t.pendingProps,u=t.memoizedProps,p=c.value,$e(Ti,l._currentValue),l._currentValue=p,u!==null)if(Gt(u.value,p)){if(u.children===c.children&&!yt.current){t=Nn(e,t,s);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var v=u.dependencies;if(v!==null){p=u.child;for(var x=v.firstContext;x!==null;){if(x.context===l){if(u.tag===1){x=Cn(-1,s&-s),x.tag=2;var M=u.updateQueue;if(M!==null){M=M.shared;var H=M.pending;H===null?x.next=x:(x.next=H.next,H.next=x),M.pending=x}}u.lanes|=s,x=u.alternate,x!==null&&(x.lanes|=s),Pl(u.return,s,t),v.lanes|=s;break}x=x.next}}else if(u.tag===10)p=u.type===t.type?null:u.child;else if(u.tag===18){if(p=u.return,p===null)throw Error(o(341));p.lanes|=s,v=p.alternate,v!==null&&(v.lanes|=s),Pl(p,s,t),p=u.sibling}else p=u.child;if(p!==null)p.return=u;else for(p=u;p!==null;){if(p===t){p=null;break}if(u=p.sibling,u!==null){u.return=p.return,p=u;break}p=p.return}u=p}gt(e,t,c.children,s),t=t.child}return t;case 9:return c=t.type,l=t.pendingProps.children,Hr(t,s),c=Dt(c),l=l(c),t.flags|=1,gt(e,t,l,s),t.child;case 14:return l=t.type,c=Yt(l,t.pendingProps),c=Yt(l.type,c),Gu(e,t,l,c,s);case 15:return Qu(e,t,t.type,t.pendingProps,s);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Ui(e,t),t.tag=1,xt(l)?(e=!0,bi(t)):e=!1,Hr(t,s),Wu(t,l,c),Vl(t,l,c,s),Yl(null,t,l,!0,e,s);case 19:return rd(e,t,s);case 22:return Yu(e,t,s)}throw Error(o(156,t.tag))};function _d(e,t){return oc(e,t)}function sm(e,t,s,l){this.tag=e,this.key=s,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,t,s,l){return new sm(e,t,s,l)}function ga(e){return e=e.prototype,!(!e||!e.isReactComponent)}function im(e){if(typeof e=="function")return ga(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pe)return 11;if(e===D)return 14}return 2}function Yn(e,t){var s=e.alternate;return s===null?(s=Ft(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function to(e,t,s,l,c,u){var p=2;if(l=e,typeof e=="function")ga(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case F:return mr(s.children,c,u,t);case re:p=8,c|=8;break;case je:return e=Ft(12,s,t,c|2),e.elementType=je,e.lanes=u,e;case te:return e=Ft(13,s,t,c),e.elementType=te,e.lanes=u,e;case Ce:return e=Ft(19,s,t,c),e.elementType=Ce,e.lanes=u,e;case de:return no(s,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xe:p=10;break e;case Y:p=9;break e;case pe:p=11;break e;case D:p=14;break e;case ue:p=16,l=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Ft(p,s,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function mr(e,t,s,l){return e=Ft(7,e,l,t),e.lanes=s,e}function no(e,t,s,l){return e=Ft(22,e,l,t),e.elementType=de,e.lanes=s,e.stateNode={isHidden:!1},e}function va(e,t,s){return e=Ft(6,e,null,t),e.lanes=s,e}function ya(e,t,s){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function om(e,t,s,l,c){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=Ho(0),this.expirationTimes=Ho(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ho(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function xa(e,t,s,l,c,u,p,v,x){return e=new om(e,t,s,v,x),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Ft(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:l,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tl(u),e}function lm(e,t,s){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:l==null?null:""+l,children:e,containerInfo:t,implementation:s}}function Id(e){if(!e)return Fn;e=e._reactInternals;e:{if(on(e)!==e||e.tag!==1)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(o(171))}if(e.tag===1){var s=e.type;if(xt(s))return nu(e,s,t)}return t}function Ed(e,t,s,l,c,u,p,v,x){return e=xa(s,l,!0,e,c,u,p,v,x),e.context=Id(null),s=e.current,l=vt(),c=Gn(s),u=Cn(l,c),u.callback=t??null,Un(s,u,c),e.current.lanes=c,fs(e,c,l),jt(e,l),e}function ro(e,t,s,l){var c=t.current,u=vt(),p=Gn(c);return s=Id(s),t.context===null?t.context=s:t.pendingContext=s,t=Cn(u,p),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=Un(c,t,p),e!==null&&(Zt(e,c,p,u),Oi(e,c,p)),p}function so(e){return e=e.current,e.child?(e.child.tag===5,e.child.stateNode):null}function Pd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function wa(e,t){Pd(e,t),(e=e.alternate)&&Pd(e,t)}function am(){return null}var Rd=typeof reportError=="function"?reportError:function(e){console.error(e)};function ka(e){this._internalRoot=e}io.prototype.render=ka.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));ro(e,t,null,null)},io.prototype.unmount=ka.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fr(function(){ro(null,e,null,null)}),t[xn]=null}};function io(e){this._internalRoot=e}io.prototype.unstable_scheduleHydration=function(e){if(e){var t=hc();e={blockedOn:null,target:e,priority:t};for(var s=0;s<$n.length&&t!==0&&t<$n[s].priority;s++);$n.splice(s,0,e),s===0&&vc(e)}};function ja(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function oo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Td(){}function cm(e,t,s,l,c){if(c){if(typeof l=="function"){var u=l;l=function(){var M=so(p);u.call(M)}}var p=Ed(t,l,e,0,null,!1,!1,"",Td);return e._reactRootContainer=p,e[xn]=p.current,bs(e.nodeType===8?e.parentNode:e),fr(),p}for(;c=e.lastChild;)e.removeChild(c);if(typeof l=="function"){var v=l;l=function(){var M=so(x);v.call(M)}}var x=xa(e,0,!1,null,null,!1,!1,"",Td);return e._reactRootContainer=x,e[xn]=x.current,bs(e.nodeType===8?e.parentNode:e),fr(function(){ro(t,x,s,l)}),x}function lo(e,t,s,l,c){var u=s._reactRootContainer;if(u){var p=u;if(typeof c=="function"){var v=c;c=function(){var x=so(p);v.call(x)}}ro(t,p,e,c)}else p=cm(s,t,e,c,l);return so(p)}fc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=ds(t.pendingLanes);s!==0&&(Vo(t,s|1),jt(t,Ge()),(Te&6)===0&&(Yr=Ge()+500,Bn()))}break;case 13:fr(function(){var l=Sn(e,1);if(l!==null){var c=vt();Zt(l,e,1,c)}}),wa(e,1)}},Ko=function(e){if(e.tag===13){var t=Sn(e,134217728);if(t!==null){var s=vt();Zt(t,e,134217728,s)}wa(e,134217728)}},pc=function(e){if(e.tag===13){var t=Gn(e),s=Sn(e,t);if(s!==null){var l=vt();Zt(s,e,t,l)}wa(e,t)}},hc=function(){return Ae},mc=function(e,t){var s=Ae;try{return Ae=e,t()}finally{Ae=s}},Ir=function(e,t,s){switch(t){case"input":if(Ye(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var l=s[t];if(l!==e&&l.form===e.form){var c=Ci(l);if(!c)throw Error(o(90));mt(l),Ye(l,c)}}}break;case"textarea":tr(e,s);break;case"select":t=s.value,t!=null&&Ht(e,!!s.multiple,t,!1)}},ti=pa,S=fr;var um={usingClientEntryPoint:!1,Events:[Es,Lr,Ci,as,cs,pa]},qs={findFiberByHostInstance:sr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},dm={bundleType:qs.bundleType,version:qs.version,rendererPackageName:qs.rendererPackageName,rendererConfig:qs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Z.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=sc(e),e===null?null:e.stateNode},findFiberByHostInstance:qs.findFiberByHostInstance||am,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ao=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ao.isDisabled&&ao.supportsFiber)try{ii=ao.inject(dm),ln=ao}catch{}}return St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=um,St.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ja(t))throw Error(o(200));return lm(e,t,null,s)},St.createRoot=function(e,t){if(!ja(e))throw Error(o(299));var s=!1,l="",c=Rd;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=xa(e,1,!1,null,null,s,!1,l,c),e[xn]=t.current,bs(e.nodeType===8?e.parentNode:e),new ka(t)},St.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=sc(t),e=e===null?null:e.stateNode,e},St.flushSync=function(e){return fr(e)},St.hydrate=function(e,t,s){if(!oo(t))throw Error(o(200));return lo(null,e,t,!0,s)},St.hydrateRoot=function(e,t,s){if(!ja(e))throw Error(o(405));var l=s!=null&&s.hydratedSources||null,c=!1,u="",p=Rd;if(s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),t=Ed(t,null,e,1,s??null,c,!1,u,p),e[xn]=t.current,bs(e),l)for(e=0;e<l.length;e++)s=l[e],c=s._getVersion,c=c(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,c]:t.mutableSourceEagerHydrationData.push(s,c);return new io(t)},St.render=function(e,t,s){if(!oo(t))throw Error(o(200));return lo(null,e,t,!1,s)},St.unmountComponentAtNode=function(e){if(!oo(e))throw Error(o(40));return e._reactRootContainer?(fr(function(){lo(null,null,e,!1,function(){e._reactRootContainer=null,e[xn]=null})}),!0):!1},St.unstable_batchedUpdates=pa,St.unstable_renderSubtreeIntoContainer=function(e,t,s,l){if(!oo(s))throw Error(o(200));if(e==null||e._reactInternals===void 0)throw Error(o(38));return lo(e,t,s,!1,l)},St.version="18.3.1-next-f1338f8080-20240426",St}var Wd;function jm(){if(Wd)return Na.exports;Wd=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),Na.exports=km(),Na.exports}var Fd;function Sm(){if(Fd)return co;Fd=1;var n=jm();return co.createRoot=n.createRoot,co.hydrateRoot=n.hydrateRoot,co}var Cm=Sm();const Nm=Lf(Cm),Df={boot:"loading",bootstrap:null,connection:"connecting",connectionAttempt:0,lastCursor:0,lastEventId:null,contextRevision:"",workspaceId:"",workspace:"",workspaces:[],sessions:[],workspaceSessions:{},archivedSessions:{status:"idle",items:[],nextCursor:null,ownerWorkspaceId:""},workspaceProjectSummaries:{},workspaceResourceEpochs:{},workspaceNextCursor:null,sessionNextCursor:null,activeSessionId:null,sessionSync:{},clientTelemetry:{sessionSwitches:0,snapshotCacheHits:0,snapshotLoads:0,snapshotFailures:0},sessionProjectionById:{},sessionRuntimeById:{},transcript:[],tools:[],edits:[],subtasks:[],research:[],permission:null,processing:!1,statusMessage:"正在连接本地 Web Host…",mode:{baseMode:"interactive",pendingBaseMode:null},effort:null,queue:{items:[],limit:16},goal:null,goalEvidence:[],goalActivity:[],diagnostics:null,settings:null,settingsMirror:{status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:0},sessionSnapshot:null,composer:null,modelCatalog:null,plan:null,skills:[],mcpServers:[],toolDetails:[],skillNextCursor:null,mcpNextCursor:null,toolDetailNextCursor:null,loopStats:null,traces:[],pendingAction:null,notice:null,announcement:""},Bd=Object.freeze({status:"idle",requestId:null});function Mo(n){return n.activeSessionId?n.sessionSync[n.activeSessionId]??Bd:Bd}function Sr(n){return!!(n.activeSessionId&&n.sessionSnapshot?.session.id===n.activeSessionId&&Mo(n).status==="ready")}function Q({name:n,size:r=18,...o}){return i.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",width:r,height:r,fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",...o,children:bm[n]})}const bm={activity:i.jsx("path",{d:"M3 12h4l2.2-6 4.2 12 2.2-6H21"}),add:i.jsx("path",{d:"M12 5v14M5 12h14"}),"arrow-up":i.jsx("path",{d:"m6 11 6-6 6 6M12 5v14"}),branch:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"6",cy:"5",r:"2"}),i.jsx("circle",{cx:"18",cy:"7",r:"2"}),i.jsx("circle",{cx:"6",cy:"19",r:"2"}),i.jsx("path",{d:"M6 7v10M8 12h4a6 6 0 0 0 6-3"})]}),check:i.jsx("path",{d:"m5 12 4 4L19 6"}),chevron:i.jsx("path",{d:"m9 7 5 5-5 5"}),close:i.jsx("path",{d:"m6 6 12 12M18 6 6 18"}),code:i.jsx("path",{d:"m8 9-4 3 4 3M16 9l4 3-4 3M14 5l-4 14"}),copy:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),i.jsx("path",{d:"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"})]}),diagnostics:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 19V9M10 19V5M16 19v-7M22 19V3"}),i.jsx("path",{d:"M2 19h21"})]}),edit:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L8 18l-4 1 1-4Z"})]}),goal:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"8"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"m15 9 5-5M17 4h3v3"})]}),info:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 11v5M12 8h.01"})]}),keyboard:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),i.jsx("path",{d:"M6 10h.01M10 10h.01M14 10h.01M18 10h.01M6 14h.01M18 14h.01M9.5 14.5h5"})]}),menu:i.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),monitor:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("path",{d:"M8 21h8M12 17v4"})]}),moon:i.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"}),more:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"5",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"19",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),pause:i.jsx("path",{d:"M9 5v14M15 5v14"}),refresh:i.jsx("path",{d:"M20 7v5h-5M4 17v-5h5M6.1 9A7 7 0 0 1 18 6l2 6M17.9 15A7 7 0 0 1 6 18l-2-6"}),search:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("path",{d:"m20 20-4-4"})]}),settings:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1-2.8 2.8-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.6v.2h-4V21a1.7 1.7 0 0 0-1-1.6 1.7 1.7 0 0 0-1.9.3l-.1.1L4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9A1.7 1.7 0 0 0 3 14H2.8v-4H3a1.7 1.7 0 0 0 1.6-1 1.7 1.7 0 0 0-.3-1.9L4.2 7 7 4.2l.1.1A1.7 1.7 0 0 0 9 4.6a1.7 1.7 0 0 0 1-1.6v-.2h4V3a1.7 1.7 0 0 0 1 1.6 1.7 1.7 0 0 0 1.9-.3l.1-.1L19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9 1.7 1.7 0 0 0 1.6 1h.2v4H21a1.7 1.7 0 0 0-1.6 1Z"})]}),sidebar:i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("path",{d:"M9 4v16"})]}),spark:i.jsx("path",{d:"m12 3 1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5ZM19 16l.7 2.3L22 19l-2.3.7L19 22l-.7-2.3L16 19l2.3-.7Z"}),stop:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),sun:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),terminal:i.jsx("path",{d:"m5 7 4 4-4 4M11 16h8"}),trash:i.jsx(i.Fragment,{children:i.jsx("path",{d:"M4 7h16M9 7V4h6v3M7 7l1 13h8l1-13M10 11v5M14 11v5"})}),warning:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 3 2.5 20h19Z"}),i.jsx("path",{d:"M12 9v4M12 17h.01"})]}),workspace:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M3 7h7l2 2h9v10H3Z"}),i.jsx("path",{d:"M3 7V5h7l2 2"})]})};function Xs({children:n,className:r=""}){return i.jsx("div",{className:`markdown ${r}`.trim(),children:zf(n)})}function zf(n){const r=n.replace(/\r\n?/g,`
10
+ `).split(`
11
+ `),o=[];let a=0;for(;a<r.length;){const d=r[a];if(!d.trim()){a+=1;continue}const f=d.match(/^\s*```([^`]*)$/);if(f){const P=[];for(a+=1;a<r.length&&!/^\s*```\s*$/.test(r[a]);)P.push(r[a]),a+=1;a<r.length&&(a+=1),o.push(i.jsx(Tm,{language:f[1].trim(),content:P.join(`
12
+ `)},`code-${a}`));continue}const h=d.match(/^(#{1,6})\s+(.+)$/);if(h){const P=Math.min(6,h[1].length);o.push(Rm(P,Qs(h[2],`heading-${a}`),`heading-${a}`)),a+=1;continue}if(/^\s*>\s?/.test(d)){const P=[];for(;a<r.length&&/^\s*>\s?/.test(r[a]);)P.push(r[a].replace(/^\s*>\s?/,"")),a+=1;o.push(i.jsx("blockquote",{children:zf(P.join(`
13
+ `))},`quote-${a}`));continue}if(d.match(/^\s*(?:[-*+] |\d+[.)] )(.+)$/)){const P=/^\s*\d/.test(d),C=[],O=P?/^\s*\d+[.)]\s+(.+)$/:/^\s*[-*+]\s+(.+)$/;for(;a<r.length;){const z=r[a].match(O);if(!z)break;C.push(z[1]),a+=1}const R=C.map((z,L)=>i.jsx("li",{children:Qs(z,`list-${a}-${L}`)},`item-${a}-${L}`));o.push(P?i.jsx("ol",{children:R},`list-${a}`):i.jsx("ul",{children:R},`list-${a}`));continue}const w=Ma(d);if(w&&w.length>=1&&a+1<r.length){const P=Im(r[a+1]);if(P&&P.length===w.length){const C=[w];for(a+=2;a<r.length;){const O=Ma(r[a]);if(!O||O.length!==w.length)break;C.push(O),a+=1}o.push(Em(C,P,`table-${a}`));continue}}const j=[d.trim()];for(a+=1;a<r.length&&r[a].trim()&&!_m(r[a]);)j.push(r[a].trim()),a+=1;o.push(i.jsx("p",{children:Qs(j.join(" "),`paragraph-${a}`)},`paragraph-${a}`))}return o}function _m(n){return/^\s*```/.test(n)||/^(#{1,6})\s+/.test(n)||/^\s*>\s?/.test(n)||/^\s*(?:[-*+] |\d+[.)] )/.test(n)||Ma(n)!==null}function Ma(n){if(!n.includes("|"))return null;const r=n.split("|"),o=r[0].trim()==="",a=r[r.length-1].trim()==="",d=o&&a?r.slice(1,-1):r;return d.length===0?null:d.map(f=>f.trim())}function Im(n){if(!n.includes("|")&&!/[-:]/.test(n))return null;let r=n.split("|").map(a=>a.trim());if(r.length>=2&&r[0]===""&&r[r.length-1]===""&&(r=r.slice(1,-1)),r.length<1)return null;const o=[];for(const a of r){if(a===""||!/^:?-+:?$/.test(a))return null;const d=a.startsWith(":"),f=a.endsWith(":");d&&f?o.push("center"):f?o.push("right"):o.push("left")}return o}function Em(n,r,o){const[a,...d]=n,f=h=>h==="left"?void 0:{textAlign:h};return i.jsxs("table",{className:"markdown-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:a.map((h,g)=>i.jsx("th",{style:f(r[g]),children:Qs(h,`${o}-th-${g}`)},`th-${g}`))})}),i.jsx("tbody",{children:d.map((h,g)=>i.jsx("tr",{children:h.map((w,j)=>i.jsx("td",{style:f(r[j]),children:Qs(w,`${o}-td-${g}-${j}`)},`td-${g}-${j}`))},`tr-${g}`))})]},o)}function Qs(n,r){const o=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\[[^\]\n]+\]\([^\s)]+\))/g,a=[];let d=0,f,h=0;for(;f=o.exec(n);){f.index>d&&a.push(n.slice(d,f.index));const g=f[0],w=`${r}-${h++}`;if(g.startsWith("`"))a.push(i.jsx("code",{children:g.slice(1,-1)},w));else if(g.startsWith("**"))a.push(i.jsx("strong",{children:g.slice(2,-2)},w));else{const j=g.match(/^\[([^\]]+)\]\(([^)]+)\)$/);j&&Pm(j[2])?a.push(i.jsx("a",{href:j[2],target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:j[1]},w)):a.push(g)}d=f.index+g.length}return d<n.length&&a.push(n.slice(d)),a}function Pm(n){try{const r=new URL(n);return r.protocol==="https:"||r.protocol==="http:"||r.protocol==="mailto:"}catch{return!1}}function Rm(n,r,o){return n===1?i.jsx("h1",{children:r},o):n===2?i.jsx("h2",{children:r},o):n===3?i.jsx("h3",{children:r},o):n===4?i.jsx("h4",{children:r},o):n===5?i.jsx("h5",{children:r},o):i.jsx("h6",{children:r},o)}function Tm({language:n,content:r}){const[o,a]=m.useState("idle"),d=async()=>{try{await navigator.clipboard.writeText(r),a("copied"),window.setTimeout(()=>a("idle"),1400)}catch{a("failed")}};return i.jsxs("figure",{className:"code-block",children:[i.jsxs("figcaption",{children:[i.jsx("span",{children:n||"text"}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:d,"aria-label":"复制代码",children:[i.jsx(Q,{name:o==="copied"?"check":"copy",size:15}),o==="copied"?"已复制":o==="failed"?"复制失败":"复制"]})]}),i.jsx("pre",{tabIndex:0,"aria-label":`${n||"文本"}代码块`,children:i.jsx("code",{children:r})})]})}function Rn(n){return n.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function Ka(n,r=8e3){const o=/api.?key|authorization|cookie|password|secret|token/i;let a;try{a=JSON.stringify(n,(f,h)=>f&&o.test(f)?"[REDACTED]":h,2)}catch{a=String(n)}const d=Rn(a);return d.length<=r?d:`${d.slice(0,r)}
14
+ …已截断`}const Mm=.02,Om=.1;function rs(n,r,o){const a=Number.isFinite(n)?Math.round(n):r;return Math.min(o,Math.max(r,a))}function Am({side:n,clientX:r,bounds:o,minWidth:a,maxWidth:d}){const f=n==="left"?r-o.left:o.right-r;return rs(f,a,d)}function $m(n,r,o){const a=o-r;if(a<=0)return 0;const d=(rs(n,r,o)-r)/a;return Math.round(d*100)}function Lm(n){const{key:r,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:f,side:h}=n,g=C=>rs(C,o,a);if(r==="Home")return g(o);if(r==="End")return g(a);if(r==="Enter"||r===" ")return g(d);if(r!=="ArrowLeft"&&r!=="ArrowRight")return null;const w=n.shiftKey?Om:Mm,j=Math.max(1,Math.round((a-o)*w)),P=(r==="ArrowRight"?1:-1)*(h==="left"?1:-1);return g(f+P*j)}function Wf({side:n,className:r,minWidth:o,maxWidth:a,defaultWidth:d,label:f,width:h,controls:g,boundsRef:w,resizingScope:j="workbench",onPreview:P,onCommit:C}){const O=m.useRef(rs(h??d,o,a)),R=m.useRef(null),z=m.useRef(null),L=m.useRef(null),q=()=>{L.current!==null&&cancelAnimationFrame(L.current),L.current=null},X=()=>{R.current=null,z.current=null,q(),delete document.documentElement.dataset.panelResizing};m.useEffect(()=>X,[]),m.useEffect(()=>{h===void 0||R.current!==null||(O.current=rs(h,o,a))},[h,o,a]);const W=Y=>{O.current=Y,z.current=Y,L.current===null&&(L.current=requestAnimationFrame(()=>{L.current=null;const pe=z.current;z.current=null,pe!==null&&P(pe)}))},he=Y=>{let pe;if(w?.current){const te=w.current.getBoundingClientRect();pe={left:te.left,right:te.right}}else pe=Y.currentTarget.closest(".workbench-shell")?.getBoundingClientRect()??{left:0,right:window.innerWidth};return Am({side:n,clientX:Y.clientX,bounds:pe,minWidth:o,maxWidth:a})},Z=Y=>{if(Y.button!==0||R.current!==null)return;Y.preventDefault(),R.current=Y.pointerId,Y.currentTarget.setPointerCapture(Y.pointerId);const pe=j==="resource-split"?"resource-split":n;document.documentElement.dataset.panelResizing=pe,W(he(Y))},ee=Y=>{R.current===Y.pointerId&&W(he(Y))},N=Y=>{if(R.current!==Y.pointerId)return;Y.currentTarget.hasPointerCapture(Y.pointerId)&&Y.currentTarget.releasePointerCapture(Y.pointerId);const pe=z.current??O.current;X(),P(pe),C(pe)},F=Y=>{if(R.current!==Y.pointerId)return;const pe=z.current??O.current;X(),P(pe),C(pe)},re=Y=>{O.current=Y,P(Y),C(Y)},je=Y=>{const pe=Lm({key:Y.key,shiftKey:Y.shiftKey,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:O.current,side:n});pe!==null&&(Y.preventDefault(),re(pe))},xe=$m(O.current,o,a);return i.jsx("div",{className:`panel-resize-handle panel-resize-handle-${n}${r?` ${r}`:""}`,role:"separator","aria-orientation":"vertical","aria-label":f,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":xe,"aria-valuetext":`${O.current} 像素`,"aria-controls":g,tabIndex:0,title:`${f};方向键调整,Shift 加速,Enter 恢复默认,双击亦可恢复`,onPointerDown:Z,onPointerMove:ee,onPointerUp:N,onPointerCancel:N,onLostPointerCapture:F,onKeyDown:je,onDoubleClick:()=>re(rs(d,o,a)),children:i.jsx("span",{})})}const Dm=["ArrowDown","ArrowUp","Home","End","Escape"];function zm({label:n,items:r,disabled:o=!1}){const[a,d]=m.useState(!1),f=m.useRef(null),h=m.useRef(null),g=m.useRef([]),w=m.useId(),j=()=>{d(!1),h.current?.focus()};m.useEffect(()=>{if(!a)return;const C=O=>{f.current?.contains(O.target)||d(!1)};return document.addEventListener("pointerdown",C),()=>document.removeEventListener("pointerdown",C)},[a]),m.useEffect(()=>{if(!a)return;const C=r.findIndex(O=>!O.disabled);g.current[C>=0?C:0]?.focus()},[a]);const P=C=>{if(!Dm.includes(C.key))return;if(C.preventDefault(),C.key==="Escape"){j();return}const O=r.map((L,q)=>({item:L,index:q})).filter(L=>!L.item.disabled);if(!O.length)return;const R=O.findIndex(L=>g.current[L.index]===document.activeElement);let z=0;if(C.key==="Home")z=0;else if(C.key==="End")z=O.length-1;else{const L=C.key==="ArrowDown"?1:-1;z=R<0?0:(R+L+O.length)%O.length}g.current[O[z].index]?.focus()};return i.jsxs("div",{className:"session-row-menu",ref:f,children:[i.jsx("button",{ref:h,type:"button",className:"icon-button session-row-menu-trigger","aria-label":n,"aria-haspopup":"menu","aria-expanded":a,disabled:o,onClick:()=>d(C=>!C),onKeyDown:C=>{if(C.key==="ArrowDown"||C.key==="Enter"||C.key===" "){if(a)return;C.preventDefault(),d(!0)}},children:i.jsx(Q,{name:"more",size:15})}),a?i.jsx("div",{className:"session-menu",role:"menu","aria-label":n,onKeyDown:P,children:r.map((C,O)=>i.jsxs("button",{ref:R=>{g.current[O]=R},type:"button",role:"menuitem",className:`session-menu-item${C.danger?" danger":""}`,tabIndex:-1,disabled:C.disabled,"aria-describedby":C.hint?`${w}-${C.id}`:void 0,onClick:()=>{d(!1),C.onSelect()},children:[C.label,C.hint?i.jsx("span",{id:`${w}-${C.id}`,className:"session-menu-hint",children:C.hint}):null]},C.id))}):null]})}const Ga=240,Oo=280,Ff=480,qd=48,Qa=320,Ya=420,Bf=3200,Je=48,Ud=560,qf="orion.web.workbench-layout.v2",Wm="orion.web.work-panel.v1",Oa=["agent","review","terminal","files","git"],kr=Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({expanded:!0,widthPx:Oo}),workPanel:Object.freeze({expanded:!0,widthPx:Ya,activePanel:"agent",agentPanel:"goal"})});function uo(n,r){const o=Hm(n),a=Uf(r.projectNavigation.widthPx),d=Zs(r.workPanel.widthPx);if(o<=760)return Object.freeze({projectNavigation:Object.freeze({mode:"drawer",widthPx:0}),conversationWidthPx:o,workPanel:Object.freeze({mode:"drawer",widthPx:0})});if(o<=1180){const j=o-Ud,C=r.projectNavigation.expanded&&j>=Ga?"dock":r.projectNavigation.expanded?"drawer":"rail",O=C==="dock"?Math.min(a,j):C==="rail"?qd:0;return Object.freeze({projectNavigation:Object.freeze({mode:C,widthPx:O}),conversationWidthPx:Math.max(0,o-O),workPanel:Object.freeze({mode:"drawer",widthPx:0})})}const f=r.projectNavigation.expanded?a:qd,h=o-f-Ud,g=r.workPanel.expanded&&h>=Qa,w=g?Math.min(d,h):Je;return Object.freeze({projectNavigation:Object.freeze({mode:r.projectNavigation.expanded?"dock":"rail",widthPx:f}),conversationWidthPx:Math.max(0,o-f-w),workPanel:Object.freeze({mode:g?"dock":"rail",widthPx:w})})}function Uf(n){const r=Number.isFinite(n)?Math.round(n):Oo;return Math.min(Ff,Math.max(Ga,r))}function Zs(n){const r=Number.isFinite(n)?Math.round(n):Ya;return Math.min(Bf,Math.max(Qa,r))}function Fm(n,r=null){if(!n)return Um(r);try{const o=JSON.parse(n);if(!ko(o)||o.schemaVersion!==2)return kr;const a=ko(o.projectNavigation)?o.projectNavigation:{},d=ko(o.workPanel)?o.workPanel:{};return Hf({schemaVersion:2,projectNavigation:{expanded:typeof a.expanded=="boolean"?a.expanded:!0,widthPx:Uf(Number(a.widthPx))},workPanel:{expanded:typeof d.expanded=="boolean"?d.expanded:!0,widthPx:Zs(Number(d.widthPx)),activePanel:ei(d.activePanel)?d.activePanel:"agent",agentPanel:Kf(d.agentPanel)?d.agentPanel:"goal",order:Vm(d.order)}})}catch{return kr}}function Bm(){const n=Vf();if(!n)return kr;try{return Fm(n.localStorage.getItem(qf),n.localStorage.getItem(Wm))}catch{return kr}}function qm(n){const r=Vf();if(r)try{r.localStorage.setItem(qf,JSON.stringify(n))}catch{}}function Um(n){if(!n)return kr;try{const r=JSON.parse(n);return!ko(r)||r.schemaVersion!==1?kr:Hf({schemaVersion:2,projectNavigation:{expanded:!0,widthPx:Oo},workPanel:{expanded:typeof r.expanded=="boolean"?r.expanded:!0,widthPx:Zs(Number(r.widthPx)),activePanel:ei(r.activePanel)?r.activePanel:"agent",agentPanel:Kf(r.agentPanel)?r.agentPanel:"goal"}})}catch{return kr}}function Hf(n){return Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({...n.projectNavigation}),workPanel:Object.freeze({...n.workPanel})})}function Hm(n){return!Number.isFinite(n)||n<=0?1440:Math.max(320,Math.round(n))}function Vf(){return globalThis.window??null}function Vm(n){if(!Array.isArray(n)||n.length!==Oa.length)return;const r=new Set;for(const o of n){if(!ei(o)||r.has(o))return;r.add(o)}return Object.freeze([...n])}function ei(n){return["agent","review","terminal","files","git"].includes(String(n))}function Kf(n){return["goal","activity","integrations","diagnostics"].includes(String(n))}function ko(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Aa({size:n=20,className:r}){const o=m.useId(),a=`orion-bar-a-${o}`,d=`orion-bar-b-${o}`,f=`orion-bar-c-${o}`;return i.jsx("span",{className:r?`orion-brand-mark ${r}`:"orion-brand-mark","aria-hidden":"true",style:{width:n,height:n},children:i.jsxs("svg",{viewBox:"0 0 20 20",width:n,height:n,focusable:"false",role:"presentation",children:[i.jsxs("defs",{children:[i.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]}),i.jsxs("linearGradient",{id:d,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]}),i.jsxs("linearGradient",{id:f,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0",className:"orion-mark-stop orion-mark-stop-primary"}),i.jsx("stop",{offset:"1",className:"orion-mark-stop orion-mark-stop-secondary"})]})]}),i.jsx("rect",{className:"orion-mark-bar",x:"2",y:"9",width:"4",height:"9",rx:"2",fill:`url(#${a})`}),i.jsx("rect",{className:"orion-mark-bar",x:"8",y:"4",width:"4",height:"14",rx:"2",fill:`url(#${d})`}),i.jsx("rect",{className:"orion-mark-bar",x:"14",y:"7",width:"4",height:"11",rx:"2",fill:`url(#${f})`})]})})}const gr=40;function Km({state:n,drawerOpen:r,dockVisible:o,collapsed:a,resizable:d,width:f,onCloseDrawer:h,onExpand:g,onCollapse:w,onOpenWorkspaceDialog:j,onOpenSettings:P,onLoadMoreWorkspaces:C,onCreateSession:O,onLoadWorkspaceSessions:R,onActivateContext:z,onSetPinned:L,onRemoveWorkspace:q,onRefreshSummary:X,onRenameSession:W,onSessionTags:he,onArchiveSession:Z,onDeleteSession:ee,onRestoreSession:N,onWidthPreview:F,onWidthCommit:re}){const[je,xe]=m.useState(""),[Y,pe]=m.useState(0),[te,Ce]=m.useState(new Set(n.workspaceId?[n.workspaceId]:[])),D=m.useDeferredValue(je.trim().toLocaleLowerCase()),ue=m.useRef(null),de=!!n.pendingAction,E=de||n.processing;m.useEffect(()=>{r&&ue.current?.focus()},[r]),m.useEffect(()=>{n.workspaceId&&Ce(A=>new Set([...A,n.workspaceId]))},[n.workspaceId]),m.useEffect(()=>pe(0),[D]);const K=m.useMemo(()=>{const A=[...n.workspaces].sort(Gm);return D?A.filter(ne=>Vd(ne,D)?!0:(n.workspaceSessions[ne.id]?.items??[]).some(ye=>[ye.name,ye.taskSummary,ye.id].filter(we=>!!we).some(we=>we.toLocaleLowerCase().includes(D)))):A},[D,n.workspaceSessions,n.workspaces]);m.useEffect(()=>{const A=K.findIndex(ne=>ne.id===n.workspaceId);A<0||pe(ne=>A<ne||A>=ne+gr?Math.floor(A/gr)*gr:ne)},[K,n.workspaceId]);const T=K.slice(Y,Y+gr),y=!!(D&&(n.workspaceNextCursor||Object.values(n.workspaceSessions).some(A=>!!A.nextCursor))),$=A=>{const ne=new Set(te);ne.has(A.id)?ne.delete(A.id):(ne.add(A.id),n.workspaceSessions[A.id]?X(A.id):R(A.id)),Ce(ne)};if(a&&!r){const A=n.workspaces.find(ne=>ne.id===n.workspaceId);return i.jsxs("aside",{id:"workspace-rail",className:"workspace-rail project-navigator project-navigator-collapsed","aria-label":"项目与会话",hidden:!o,children:[i.jsx("div",{className:"project-rail-brand","aria-hidden":"true",children:i.jsx(Aa,{size:22})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"展开项目导航",title:"展开项目导航(⌘/Ctrl+B)",onClick:g,children:i.jsx(Q,{name:"sidebar",size:17})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"新建会话",title:"新建会话",onClick:O,disabled:de||!n.workspaceId,children:i.jsx(Q,{name:"add",size:18})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action project-rail-workspace","aria-label":A?`打开项目 ${A.label}`:"打开项目导航",title:A?.label??"打开项目导航",onClick:g,children:i.jsx(Q,{name:"workspace",size:17})}),i.jsx("span",{className:"project-rail-spacer"}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"打开设置",title:"设置",onClick:P,children:i.jsx(Q,{name:"settings",size:17})}),i.jsx("span",{className:`connection-dot project-rail-connection ${n.connection}`,"aria-label":Ia(n.connection),title:Ia(n.connection)})]})}return i.jsxs("aside",{id:"project-navigation",className:`workspace-rail project-navigator ${r?"drawer-open":""}`,"aria-label":"项目与会话",hidden:!o,children:[i.jsxs("div",{className:"brand-row",children:[i.jsx(Aa,{className:"brand-mark",size:20}),i.jsxs("div",{className:"brand-copy",children:[i.jsx("strong",{children:"ORION"}),i.jsx("span",{children:"CODE WORKBENCH"})]}),i.jsx("button",{ref:ue,type:"button",className:"icon-button drawer-close","aria-label":"关闭项目导航",onClick:h,children:i.jsx(Q,{name:"close"})}),i.jsx("button",{type:"button",className:"icon-button project-navigation-collapse","aria-label":"折叠项目导航",title:"折叠项目导航(⌘/Ctrl+B)",onClick:w,children:i.jsx(Q,{name:"sidebar"})})]}),i.jsxs("div",{className:"project-toolbar",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"LOCAL PROJECTS"}),i.jsx("h2",{children:"项目"})]}),i.jsx("button",{type:"button",className:"icon-button","aria-label":"选择其他工作区",title:"打开其他项目",onClick:j,disabled:E,children:i.jsx(Q,{name:"add"})})]}),i.jsxs("label",{className:"project-search",children:[i.jsx("span",{className:"sr-only",children:"搜索项目和会话"}),i.jsx(Q,{name:"search",size:15}),i.jsx("input",{type:"search",value:je,onChange:A=>xe(A.target.value),placeholder:"搜索项目和会话"}),je?i.jsx("button",{type:"button","aria-label":"清除搜索",onClick:()=>xe(""),children:i.jsx(Q,{name:"close",size:13})}):null]}),y?i.jsx("p",{className:"project-search-scope",role:"status",children:"搜索仅覆盖已加载的项目和会话;仍有分页内容未加载。"}):null,i.jsxs("nav",{className:"project-tree","aria-label":"已知项目",children:[T.map((A,ne)=>{const ye=Y+ne,we=K[ye-1],be=te.has(A.id)||!!D,Se=n.workspaceSessions[A.id],_e=n.workspaceProjectSummaries[A.id],Le=Vd(A,D)?Se?.items??[]:Qm(Se?.items??[],D);return i.jsxs(m.Fragment,{children:[ye===0||we?.pinnedOrder!==void 0&&A.pinnedOrder===void 0?i.jsx("h3",{className:"project-group-heading",role:"presentation",children:A.pinnedOrder===void 0?"RECENT":"PINNED"}):null,i.jsxs("section",{className:`project-node ${A.active?"active":""} ${A.available?"":"unavailable"}`,children:[i.jsxs("div",{className:"project-row",children:[i.jsxs("button",{id:`project-${A.id}`,type:"button",className:"project-toggle","aria-expanded":be,"aria-controls":`project-${A.id}-sessions`,"aria-current":A.active?"page":void 0,onClick:()=>$(A),onKeyDown:Re=>{if(Re.key==="ArrowRight"){Re.preventDefault(),be?Re.currentTarget.closest(".project-node")?.querySelector(".project-session-main")?.focus():$(A);return}if(Re.key==="ArrowLeft"&&be){Re.preventDefault(),$(A);return}Hd(Re)},children:[i.jsx(Q,{name:"chevron",size:13}),i.jsx("span",{className:"workspace-icon",children:i.jsx(Q,{name:"workspace",size:15})}),i.jsxs("span",{className:"project-copy",children:[i.jsx("strong",{children:A.label}),i.jsx("span",{title:A.path,children:_e?`${_e.detached?_e.head||"detached":_e.branch||"Git"} · ${_e.dirtyCount?`M${_e.dirtyCount}`:"clean"}`:Ym(A.path)})]})]}),i.jsx("button",{type:"button",className:"icon-button project-pin","aria-label":`${A.pinnedOrder===void 0?"置顶":"取消置顶"}项目 ${A.label}`,"aria-pressed":A.pinnedOrder!==void 0,onClick:()=>L(A.id,A.pinnedOrder===void 0),disabled:de,children:i.jsx("span",{"aria-hidden":"true",children:A.pinnedOrder===void 0?"○":"●"})}),!A.available&&!A.active?i.jsx("button",{type:"button",className:"icon-button project-remove","aria-label":`移除不可用项目 ${A.label}`,onClick:()=>q(A.id),disabled:de,children:i.jsx(Q,{name:"close",size:13})}):i.jsx("button",{type:"button",className:"icon-button project-add-session","aria-label":`在 ${A.label} 新建会话`,disabled:de||!A.available||!A.active,onClick:O,title:A.active?"新建会话":"先激活项目后新建会话",children:i.jsx(Q,{name:"add",size:14})})]}),be?i.jsxs(m.Fragment,{children:[i.jsxs("div",{id:`project-${A.id}-sessions`,className:"project-sessions",role:"list","aria-label":`${A.label} 的会话`,children:[Se?.status==="loading"&&!Se.items.length?i.jsx("p",{className:"project-loading",role:"listitem",children:"正在加载会话…"}):null,Se?.status==="error"?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-load-error",onClick:()=>R(A.id),children:"加载失败,重试"})}):null,Le.map(Re=>{const mt=A.active&&Re.id===n.activeSessionId,Tt=n.sessionRuntimeById[Re.id],Mt=Jm(Tt),at=!A.active&&E,st=eg(Tt?.phase),Ye=Re.tags??[];return i.jsxs("div",{className:`project-session-row ${mt?"active":""}`,role:"listitem",children:[i.jsxs("button",{type:"button",className:"project-session-main","aria-current":mt?"page":void 0,"aria-disabled":mt||at||!A.available,onClick:()=>{mt||z(A.id,Re.id)},disabled:at||!A.available,onKeyDown:it=>{if(it.key==="ArrowLeft"){it.preventDefault(),document.getElementById(`project-${A.id}`)?.focus();return}Hd(it)},children:[i.jsx("span",{className:`session-state ${Mt.tone}`,"aria-hidden":"true"}),i.jsxs("span",{children:[i.jsx("strong",{children:jr(Re)}),i.jsxs("small",{children:[Kd(Re.updatedAt)," · ",Re.messageCount," 条"]}),Ye.length>0?i.jsxs("small",{className:"project-session-tags","aria-label":"会话标签",children:[Ye.slice(0,3).map(it=>i.jsx("span",{className:"session-tag-badge",children:it},it)),Ye.length>3?i.jsxs("span",{className:"session-tag-more",children:["+",Ye.length-3]}):null]}):null,Mt.label?i.jsx("small",{className:"project-session-status",children:Mt.label}):null]})]}),A.active?i.jsx(zm,{label:`会话 ${jr(Re)} 操作`,disabled:de,items:[{id:"rename",label:"重命名…",onSelect:()=>W(Re)},{id:"tags",label:"管理标签…",onSelect:()=>he(Re)},{id:"archive",label:"归档",disabled:st,hint:st?"会话运行中":void 0,onSelect:()=>Z(Re)},{id:"delete",label:"删除…",danger:!0,disabled:st,hint:st?"会话运行中":void 0,onSelect:()=>ee(Re)}]}):null]},Re.id)}),Se?.status==="ready"&&!Le.length?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-empty-session",disabled:E||!A.available,onClick:()=>z(A.id,null),children:D?"没有匹配会话":"打开项目"})}):null,Se?.nextCursor?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"text-button project-load-more",onClick:()=>R(A.id,!0),children:"加载更多会话"})}):null]}),A.active&&(n.archivedSessions.items.length>0||n.archivedSessions.status==="loading")?i.jsxs("details",{className:"archived-section",children:[i.jsxs("summary",{children:["已归档(",n.archivedSessions.items.length,n.archivedSessions.status==="loading"?"…":"",")"]}),i.jsx("div",{className:"archived-list",role:"list","aria-label":"已归档会话",children:n.archivedSessions.items.map(Re=>i.jsxs("div",{className:"archived-row",role:"listitem",children:[i.jsxs("span",{className:"archived-copy",children:[i.jsx("strong",{children:jr(Re)}),i.jsx("small",{children:Kd(Re.updatedAt)})]}),i.jsx("button",{type:"button",className:"text-button",disabled:de,onClick:()=>N(Re),children:"还原"}),i.jsx("button",{type:"button",className:"text-button archived-delete",disabled:de,onClick:()=>ee(Re),children:"删除"})]},Re.id))})]}):null]}):null]})]},A.id)}),K.length?null:i.jsxs("div",{className:"empty-rail",children:[i.jsx(Q,{name:"search"}),i.jsx("p",{children:"没有匹配的项目或会话"})]}),Y>0?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>pe(A=>Math.max(0,A-gr)),children:"上一批项目"}):null,Y+gr<K.length?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>pe(A=>A+gr),children:"下一批项目"}):n.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:C,children:"加载更多项目"}):null]}),i.jsxs("footer",{className:"rail-footer",children:[i.jsx("span",{className:`connection-dot ${n.connection}`,"aria-hidden":"true"}),i.jsx("span",{"data-testid":"runtime-connection-state","data-state":n.connection,title:Xm(n.connection),children:Ia(n.connection)}),i.jsx("button",{type:"button",className:"icon-button rail-settings","aria-label":"打开设置",onClick:P,children:i.jsx(Q,{name:"settings",size:14})}),n.bootstrap?.productVersion?i.jsxs("span",{className:"version",children:["v",n.bootstrap.productVersion]}):null]}),d?i.jsx(Wf,{side:"left",minWidth:Ga,maxWidth:Ff,defaultWidth:Oo,label:"拖动或按方向键调整项目导航宽度",width:f,controls:"workspace-rail",onPreview:F,onCommit:re}):null]})}function Hd(n){if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;const r=n.currentTarget.closest(".project-tree");if(!r)return;const o=Array.from(r.querySelectorAll(".project-toggle:not(:disabled), .project-session-main:not(:disabled)")).filter(f=>f.getClientRects().length>0),a=o.indexOf(n.currentTarget);if(a<0||o.length===0)return;const d=n.key==="Home"?0:n.key==="End"?o.length-1:Math.max(0,Math.min(o.length-1,a+(n.key==="ArrowDown"?1:-1)));n.preventDefault(),o[d]?.focus()}function Gm(n,r){return n.pinnedOrder!==void 0||r.pinnedOrder!==void 0?n.pinnedOrder===void 0?1:r.pinnedOrder===void 0?-1:n.pinnedOrder-r.pinnedOrder:Date.parse(r.lastActivatedAt)-Date.parse(n.lastActivatedAt)}function Vd(n,r){return!!(r&&(n.label.toLocaleLowerCase().includes(r)||n.path.toLocaleLowerCase().includes(r)))}function Qm(n,r){return r?n.filter(o=>[o.name,o.taskSummary,o.id,o.model].filter(a=>!!a).some(a=>a.toLocaleLowerCase().includes(r))):n}function jr(n){return n.name||n.taskSummary||`会话 ${n.id.slice(0,8)}`}function Gf(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function Ym(n){return n.length<=31?n:`…${n.slice(-30)}`}function Kd(n){const r=Date.parse(n);if(!Number.isFinite(r))return"未知";const o=Math.max(0,Math.floor((Date.now()-r)/6e4));if(o<1)return"刚刚";if(o<60)return`${o} 分钟前`;const a=Math.floor(o/60);if(a<24)return`${a} 小时前`;const d=Math.floor(a/24);return d<30?`${d} 天前`:new Date(r).toLocaleDateString("zh-CN")}function Ia(n){return n==="live"?"已连接":n==="offline"?"离线":n==="replay-required"?"事件流需恢复":n==="closed"?"已关闭":n==="connecting"?"正在连接…":"正在重连…"}function Xm(n){return n==="live"?"本地 Web Host 已连接":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重连本地 Web Host"}function Jm(n){return!n||n.phase==="cold"?{label:"",tone:""}:n.pendingApprovalCount>0||n.phase==="waiting_approval"?{label:"等待审批",tone:"approval"}:n.phase==="running"||n.phase==="starting"?{label:n.phase==="starting"?"正在启动":"运行中",tone:"running"}:n.phase==="queued"?{label:n.queuePosition?`排队 ${n.queuePosition}`:"排队中",tone:"queued"}:n.phase==="failed"?{label:"失败",tone:"failed"}:n.phase==="interrupted"?{label:"已中断",tone:"failed"}:n.phase==="stopping"?{label:"正在停止",tone:"running"}:{label:"已就绪",tone:"ready"}}const Zm=new Set(["starting","queued","running","waiting_approval","stopping"]);function eg(n){return n?Zm.has(n):!1}const tg=Object.freeze({activating:"running",closed:"danger",completed:"success",connected:"success",done:"success",draining:"warning",error:"danger",failed:"danger",live:"running",offline:"danger",passed:"success",pending:"running",queued:"running",ready:"success",rejected:"danger",replay:"warning","replay-required":"warning",running:"running",skipped:"warning",streaming:"running",success:"success",timedout:"warning",warning:"warning"}),Gd=Object.freeze({danger:"失败",idle:"空闲",running:"进行中",success:"已完成",warning:"部分完成"});function ng(n){return tg[n.trim().toLowerCase()]??"idle"}function rg(n){return Gd[n]??Gd.idle}function Xa({state:n,className:r="",label:o,describe:a=!0}){const d=ng(n);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`state-dot state-${n}${r?` ${r}`:""}`,"data-tone":d,"aria-hidden":"true"}),a?i.jsx("span",{className:"sr-only",children:o??rg(d)}):null]})}const os="orion.web.composer-drafts.v1",Qf=20,$a=256*1024,sg=5*1024*1024;function ig(n,r){return Ao().entries.find(o=>o.workspaceId===n&&o.sessionId===r)??null}function og(n){const r=$o();if(!r)return;const o=Object.freeze({...n,references:[...n.references],updatedAt:Date.now()});if(La(o)>$a)throw new Error(`Composer draft exceeds ${$a} bytes.`);const a=Ao().entries.filter(f=>!(f.workspaceId===n.workspaceId&&f.sessionId===n.sessionId)),d=[o,...a].slice(0,Qf);for(;d.length>0&&La({version:1,entries:d})>sg;)d.pop();r.setItem(os,JSON.stringify({version:1,entries:d}))}function Qd(n,r){const o=$o();if(!o)return;const a=Ao().entries.filter(d=>!(d.workspaceId===n&&d.sessionId===r));a.length===0?o.removeItem(os):o.setItem(os,JSON.stringify({version:1,entries:a}))}function lg(n){const r=$o();if(!r)return;const o=Ao().entries.filter(a=>a.workspaceId!==n);o.length===0?r.removeItem(os):r.setItem(os,JSON.stringify({version:1,entries:o}))}function Ao(){const n=$o();if(!n)return{version:1,entries:[]};try{const r=JSON.parse(n.getItem(os)??"");return r.version!==1||!Array.isArray(r.entries)?{version:1,entries:[]}:{version:1,entries:r.entries.filter(ag).slice(0,Qf)}}catch{return{version:1,entries:[]}}}function ag(n){if(!n||typeof n!="object")return!1;const r=n;return typeof r.workspaceId=="string"&&typeof r.sessionId=="string"&&typeof r.text=="string"&&Array.isArray(r.references)&&typeof r.updatedAt=="number"&&Number.isFinite(r.updatedAt)&&La(r)<=$a}function $o(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}function La(n){return new TextEncoder().encode(JSON.stringify(n)).byteLength}const Yf=/^hmac-sha256:[0-9a-f]{64}$/,cg=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ug=/^(?:api[-_]?key|authorization|cookie|password|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|credential[-_]?value|headers?|env(?:ironment)?[-_]?name)$/i,dg=["ready","invalid","read-only","unavailable"],fg=["internal","model","global","project","session"],pg=["global","project","session"],hg=["live","next-logical-request","new-session","restart"],mg=["runtime_busy","read_only","invalid_document"],gg=["system","light","dark"],vg=["system","reduced"],yg=["classic","orion-blocksmith"],Xf=["auto","none","minimal","low","medium","high","xhigh","max"],xg=["ask","allow","deny"],wg=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function Da(n){No(n);const r=qt(n,"Settings document");if(Ut(r,["schemaVersion","revision","state","writable","hasDocument","workspace","sections","models","credentials","currentSession","diagnostic"]),r.schemaVersion!==1&&r.schemaVersion!==2)throw new Error("Settings schemaVersion is not supported.");const o=r.schemaVersion,a=_t(r.revision,"Settings revision");if(!Yf.test(a))throw new Error("Settings revision is invalid.");const d=nn(r.state,"Settings state",dg),f=qt(r.sections,"Settings sections");Ut(f,["appearance","defaults","permissions"]);const h=qt(f.appearance,"Appearance settings");Ut(h,o===1?["theme","motion"]:["style","theme","motion"]);const g=qt(f.defaults,"Default settings");Ut(g,["model","effort"]);const w=qt(f.permissions,"Permission settings");Ut(w,["toolConfirmation"]);const j=za(r.models,"Settings models").map(Sg),P=za(r.credentials,"Credential status").map(Cg),C=r.currentSession===void 0?void 0:Ng(r.currentSession),O=r.diagnostic===void 0?void 0:bg(r.diagnostic);return{schemaVersion:2,revision:a,state:d,writable:ss(r.writable,"Settings writable"),hasDocument:ss(r.hasDocument,"Settings document availability"),workspace:_t(r.workspace,"Settings workspace"),sections:{appearance:{style:o===1?Pg(d,ss(r.writable,"Settings writable")):Jr(h.style,"Visual style",Eg),theme:Jr(h.theme,"Theme",Ig),motion:Jr(h.motion,"Motion",Rg)},defaults:{model:Jr(g.model,"Default model",Og),effort:Jr(g.effort,"Default effort",Tg)},permissions:{toolConfirmation:Jr(w.toolConfirmation,"Tool confirmation",Mg)}},models:j,credentials:P,...C?{currentSession:C}:{},...O?{diagnostic:O}:{}}}function kg(n){No(n);const r=qt(n,"Settings mutation result");Ut(r,["requestId","revision","appliedKeys","settings"]);const o=_t(r.requestId,"Settings requestId");if(!cg.test(o))throw new Error("Settings requestId is invalid.");const a=Da(r.settings),d=_t(r.revision,"Settings mutation revision");if(d!==a.revision)throw new Error("Settings mutation revisions do not match.");const f=za(r.appliedKeys,"Applied setting keys").map((h,g)=>nn(h,`Applied setting key ${g+1}`,wg));if(new Set(f).size!==f.length)throw new Error("Settings mutation contains duplicate applied keys.");return{requestId:o,revision:d,appliedKeys:f,settings:a}}function jg(n){const r=qt(n.payload,"Settings invalidation payload");Ut(r,["revision","reason","state"]);const o=_t(r.revision,"Settings invalidation revision");if(!Yf.test(o))throw new Error("Settings invalidation revision is invalid.");return{apiVersion:1,eventId:_t(n.eventId,"Settings invalidation eventId"),cursor:_g(n.cursor,"Settings invalidation cursor"),sessionId:null,threadId:null,durable:!1,timestamp:_t(n.timestamp,"Settings invalidation timestamp"),type:"settings_invalidated",payload:{revision:o,reason:nn(r.reason,"Settings invalidation reason",["local-write","external-edit","workspace-change"]),state:nn(r.state,"Settings invalidation state",["ready","invalid"])}}}function Jr(n,r,o){const a=qt(n,`${r} field`);if(Ut(a,["effectiveValue","explicitValue","inheritedValue","source","scope","applies","overridden","writable","blockedReason"]),!o(a.effectiveValue))throw new Error(`${r} effective value is invalid.`);if(a.explicitValue!==void 0&&!o(a.explicitValue))throw new Error(`${r} explicit value is invalid.`);if(a.inheritedValue!==void 0&&!o(a.inheritedValue))throw new Error(`${r} inherited value is invalid.`);const d=a.explicitValue,f=a.inheritedValue;return{effectiveValue:a.effectiveValue,...d===void 0?{}:{explicitValue:d},...f===void 0?{}:{inheritedValue:f},source:nn(a.source,`${r} source`,fg),scope:nn(a.scope,`${r} scope`,pg),applies:nn(a.applies,`${r} application timing`,hg),overridden:ss(a.overridden,`${r} override state`),writable:ss(a.writable,`${r} writable state`),...a.blockedReason===void 0?{}:{blockedReason:nn(a.blockedReason,`${r} blocked reason`,mg)}}}function Sg(n,r){const o=qt(n,`Model ${r+1}`);return Ut(o,["id","label","provider"]),{id:_t(o.id,`Model ${r+1} id`),label:_t(o.label,`Model ${r+1} label`),...o.provider===void 0?{}:{provider:_t(o.provider,`Model ${r+1} provider`)}}}function Cg(n,r){const o=qt(n,`Credential ${r+1}`);if(Ut(o,["providerId","state","source","writable"]),o.writable!==!1)throw new Error("Browser credential status must be read-only.");return{providerId:_t(o.providerId,`Credential ${r+1} provider`),state:nn(o.state,`Credential ${r+1} state`,["ready","missing","unavailable"]),source:nn(o.source,`Credential ${r+1} source`,["environment","legacy","none"]),writable:!1}}function Ng(n){const r=qt(n,"Current session settings");return Ut(r,["model","effort","overridesProjectEffort"]),{model:_t(r.model,"Current session model"),effort:nn(r.effort,"Current session effort",Xf),overridesProjectEffort:ss(r.overridesProjectEffort,"Current session effort override state")}}function bg(n){const r=qt(n,"Settings diagnostic");return Ut(r,["code","message"]),{code:_t(r.code,"Settings diagnostic code"),message:_t(r.message,"Settings diagnostic message")}}function No(n,r=new Set){if(!(!n||typeof n!="object")){if(r.has(n))throw new Error("Settings response contains a cycle.");r.add(n);try{if(Array.isArray(n)){for(const o of n)No(o,r);return}for(const[o,a]of Object.entries(n)){if(ug.test(o))throw new Error("Settings response contains a forbidden secret-bearing field.");No(a,r)}}finally{r.delete(n)}}}function qt(n,r){if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${r} must be an object.`);return n}function za(n,r){if(!Array.isArray(n))throw new Error(`${r} must be an array.`);return n}function _t(n,r){if(typeof n!="string"||!n.trim())throw new Error(`${r} must be text.`);return n}function ss(n,r){if(typeof n!="boolean")throw new Error(`${r} must be boolean.`);return n}function _g(n,r){if(!Number.isSafeInteger(n)||n<0)throw new Error(`${r} must be a non-negative safe integer.`);return n}function nn(n,r,o){if(typeof n!="string"||!o.includes(n))throw new Error(`${r} is invalid.`);return n}function Ut(n,r){const o=new Set(r),a=Object.keys(n).find(d=>!o.has(d));if(a)throw new Error(`Settings response contains an unknown field: ${a}.`)}function Ig(n){return typeof n=="string"&&gg.includes(n)}function Eg(n){return typeof n=="string"&&yg.includes(n)}function Pg(n,r){const o=n==="invalid"?"invalid_document":n==="ready"&&r?void 0:"read_only";return{effectiveValue:"orion-blocksmith",inheritedValue:"orion-blocksmith",source:"internal",scope:"global",applies:"live",overridden:!1,writable:n==="ready"&&r,...o?{blockedReason:o}:{}}}function Rg(n){return typeof n=="string"&&vg.includes(n)}function Tg(n){return typeof n=="string"&&Xf.includes(n)}function Mg(n){return typeof n=="string"&&xg.includes(n)}function Og(n){return typeof n=="string"&&!!n.trim()}const fo="/api/v1",Ag="x-orion-web-nonce",Wa=100,$g=50,fn=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;class Ie extends Error{constructor(o,a,d,f){super(o);Bt(this,"status");Bt(this,"code");Bt(this,"type");this.status=a,this.code=d,this.type=f,this.name="WebApiError"}}class Lg{constructor(){Bt(this,"nonce","")}async bootstrap(){const r=await this.query("/bootstrap");if(!In(r)||r.apiVersion!==1||typeof r.nonce!="string")throw new Ie("Web Host 返回了不兼容的启动协议。",502);return this.nonce=r.nonce,{...r,settings:Da(r.settings)}}async listWorkspaces(r,o){const a=await this.collectionPage(Ct("/workspaces",r),o),d=a.items.find(f=>f.active);return{activeId:d?.id??"",activePath:d?.path??"",workspaces:a.items,nextCursor:a.nextCursor}}async listWorkspaceSessions(r,o,a){const d=await this.collectionPage(Ct(`/workspaces/${encodeURIComponent(r)}/sessions`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}workspaceProjectSummary(r,o){return this.query(Ct(`/workspaces/${encodeURIComponent(r)}/summary`,o))}async listSessions(r,o){const a=await this.collectionPage(Ct("/sessions",r),o);return{sessions:a.items,nextCursor:a.nextCursor}}diagnostics(r){return this.query(Ct("/diagnostics",r))}async settings(){return Da(await this.query("/settings"))}async sessionSnapshot(r,o,a){const d=`/sessions/${encodeURIComponent(r)}/snapshot`;return this.query(Ea(Ct(d,o),a??null,!0,$g))}composerState(r,o){return this.query(Ct(`/sessions/${encodeURIComponent(r)}/composer-state`,o))}modelCatalog(r,o,a){return this.query(Ea(Ct(`/sessions/${encodeURIComponent(r)}/model-catalog`,o),a??null,!1,Wa))}composerAction(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/composer-actions`,"POST",{...o,requestId:We()})}async skills(r,o){const a=await this.collectionPage(Ct("/skills",r),o);return{skills:a.items,nextCursor:a.nextCursor}}async mcp(r,o){const a=await this.collectionPage(Ct("/mcp",r),o);return{servers:a.items,nextCursor:a.nextCursor}}async toolDetails(r,o){const a=await this.collectionPage(Ct("/tool-details",r),o);return{details:a.items,nextCursor:a.nextCursor}}readToolDetail(r,o,a=0,d=64*1024){const f=new URLSearchParams({offsetBytes:String(a),limitBytes:String(d)});return Zn(f,o),this.query(`/tool-details/${encodeURIComponent(r)}?${f.toString()}`)}listFiles(r,o,a){const d=new URLSearchParams({pageSize:"100"});return Zn(d,r),o&&d.set("parentId",o),a&&d.set("cursor",a),this.query(`/files?${d.toString()}`)}readFileContent(r,o,a){const d=new URLSearchParams({limitBytes:String(65536)});return Zn(d,o),a&&d.set("cursor",a),this.query(`/files/${encodeURIComponent(r)}/content?${d.toString()}`)}writeFileContent(r,o,a,d){return this.mutate("/files/write","POST",{...r,fileId:o,content:a,expectedRevision:d,requestId:We()},{"X-Orion-User-Gesture":"file-mutation-v1"})}gitStatus(r,o){const a=new URLSearchParams({pageSize:"200"});return Zn(a,r),o&&a.set("cursor",o),this.query(`/git/status?${a.toString()}`)}gitLog(r,o){const a=new URLSearchParams({pageSize:"30"});return Zn(a,r),o&&a.set("cursor",o),this.query(`/git/log?${a.toString()}`)}gitDiff(r,o,a){const d=new URLSearchParams({lineLimit:"240",byteLimit:String(262144)});return Zn(d,o),a&&d.set("cursor",a),this.query(`/git/diff/${encodeURIComponent(r)}?${d.toString()}`)}review(r){return this.query(Ct("/review",r))}async terminals(r,o){const a=await this.collectionPage(Ct("/terminals",r),o);return{terminals:a.items,nextCursor:a.nextCursor}}createTerminal(r){return this.mutate("/terminals","POST",{...r,requestId:We()},{"X-Orion-User-Gesture":"terminal-create-v1"})}terminalAttachTicket(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}/attach-ticket`,"POST",{...o,requestId:We()})}closeTerminal(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}`,"DELETE",{...o,requestId:We()})}terminalSocket(r){const o=location.protocol==="https:"?"wss:":"ws:";return new WebSocket(`${o}//${location.host}${fo}/terminals/${encodeURIComponent(r)}/stream`,"orion-terminal-v1")}async searchFiles(r,o,a,d=50){const f=new URLSearchParams({q:o.slice(0,200),scope:a,limit:String(d)});return Zn(f,r),this.query(`/files/search?${f.toString()}`)}gitStage(r,o,a){return this.mutate("/git/stage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:We()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitUnstage(r,o,a){return this.mutate("/git/unstage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:We()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitCommit(r,o,a){return this.mutate("/git/commit","POST",{...r,message:o,expectedRepositoryRevision:a,requestId:We()},{"X-Orion-User-Gesture":"git-mutation-v1"})}activateContext(r){return this.mutate("/context/activate","POST",{...r,requestId:We()})}async setWorkspacePinned(r,o,a){return(await this.mutate(`/workspaces/${encodeURIComponent(r)}/pin`,"POST",{requestId:We(),pinned:o,...a})).workspace}removeWorkspace(r,o){return this.mutate(`/workspaces/${encodeURIComponent(r)}`,"DELETE",{requestId:We(),...o})}async activateWorkspace(r,o){const a=await this.mutate("/workspaces/activate","POST",{requestId:We(),path:r,...o});return{requestId:a.requestId,activeId:a.page.items.find(d=>d.active)?.id??"",activePath:a.active,workspaces:a.page.items,nextCursor:a.page.nextCursor}}async createSession(r){return(await this.mutate("/sessions","POST",{requestId:We(),...r})).session}activateSession(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/activate`,"POST",{requestId:We(),...o})}async renameSession(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}`,"PATCH",{requestId:We(),name:o,...a})).session}async updateSessionTags(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/tags`,"POST",{requestId:We(),tags:[...o],...a})).session}async archiveSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/archive`,"POST",{requestId:We(),...o})).session}async restoreSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/restore`,"POST",{requestId:We(),...o})).session}async deleteSession(r,o){await this.mutate(`/sessions/${encodeURIComponent(r)}`,"DELETE",{requestId:We(),...o})}async listArchivedWorkspaceSessions(r,o,a){const d=await this.collectionPage(Ct(`/workspaces/${encodeURIComponent(r)}/sessions/archived`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}command(r){return this.mutate("/commands","POST",{...r,requestId:We()})}async updateSettings(r,o,a,d=We()){const f=await this.mutate("/settings","PATCH",{operations:o,expectedRevision:r,...a,requestId:d}),h=kg(f);if(h.requestId!==d)throw new Ie("Host 返回了其他设置请求的结果。",502,"settings_response_invalid");const g=o.map(w=>w.key);if(h.appliedKeys.length!==g.length||g.some(w=>!h.appliedKeys.includes(w)))throw new Ie("Host 返回的设置字段与提交内容不一致。",502,"settings_response_invalid");return h}openSettingsDocument(){return this.mutate("/settings/open-document","POST",{requestId:We()})}connectEvents(r){let o=Math.max(0,r.cursor??0),a=null,d,f=0,h=!1,g=!1;const w=()=>{if(!(h||g)){if(!navigator.onLine){r.onStatus("offline",f);return}r.onStatus(f===0?"connecting":"reconnecting",f),a=new EventSource(`${fo}/events?cursor=${o}`),a.onopen=()=>{f=0,r.onStatus("live",f)},a.addEventListener("orion",C=>{if(!(h||g))try{const O=Dg(C.data);if(O.type==="replay_reset"){o=O.cursor,r.onEvent(O),g=!0,a?.close(),a=null,window.clearTimeout(d);return}if(O.cursor<=o)return;o=O.cursor,r.onEvent(O)}catch(O){r.onProtocolError?.(O instanceof Error?O.message:"无法解析 Web Host 事件流消息。")}}),a.onerror=()=>{if(a?.close(),a=null,h||g)return;f+=1,r.onStatus(navigator.onLine?"reconnecting":"offline",f);const C=Math.min(1e4,500*2**Math.min(f,5));window.clearTimeout(d),d=window.setTimeout(w,C)}}},j=()=>{h||g||a||(window.clearTimeout(d),w())},P=()=>{window.clearTimeout(d),a?.close(),a=null,!g&&r.onStatus("offline",f)};return window.addEventListener("online",j),window.addEventListener("offline",P),w(),{close(){h=!0,window.clearTimeout(d),a?.close(),a=null,window.removeEventListener("online",j),window.removeEventListener("offline",P)},cursor:()=>o}}collectionPage(r,o){return this.query(Ea(r,o??null,!1,Wa))}async query(r){const o=await fetch(`${fo}${r}`,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",cache:"no-store"});return Yd(o)}async mutate(r,o,a,d={}){if(!this.nonce)throw new Ie("Web Workbench 尚未完成安全握手。",503);const f=await fetch(`${fo}${r}`,{method:o,headers:{Accept:"application/json","Content-Type":"application/json",[Ag]:this.nonce,...d},credentials:"same-origin",cache:"no-store",body:JSON.stringify(a)});return Yd(f)}}async function Yd(n){const o=(n.headers.get("content-type")??"").includes("json")?await n.json().catch(()=>null):null;if(!n.ok){const a=In(o)?o:{},d=typeof a.detail=="string"?a.detail:`请求失败 (${n.status})`;throw new Ie(d,n.status,typeof a.code=="string"?a.code:void 0,typeof a.type=="string"?a.type:void 0)}return o}function Dg(n){const r=JSON.parse(n);if(!In(r)||r.apiVersion!==1||typeof r.eventId!="string"||!fn.test(r.eventId)||!Number.isSafeInteger(r.cursor)||r.cursor<0||r.sessionId!==null&&typeof r.sessionId!="string"||r.threadId!==null&&typeof r.threadId!="string"||typeof r.durable!="boolean"||typeof r.timestamp!="string"||!["runtime_event","thread_event","workbench_state","replay_reset","settings_invalidated","workspace_resource_invalidated","composer_state_changed","session_runtime_changed","workspace_mutation_changed"].includes(String(r.type))||!In(r.payload))throw new Error("Web Host 事件流消息不符合 Web protocol v1。");if(r.type==="runtime_event"){const o=r.payload.value;if(!In(o)||typeof r.payload.eventType!="string"||o.type!==r.payload.eventType)throw new Error("Web Host 事件流消息判别字段不一致。")}if(r.type==="thread_event"&&(!In(r.payload.value)||typeof r.payload.eventType!="string"||!Number.isSafeInteger(r.payload.sequence)||typeof r.sessionId!="string"||typeof r.threadId!="string"))throw new Error("Thread 事件身份或序列无效。");if(r.type==="workbench_state"&&(typeof r.payload.contextRevision!="string"||!fn.test(r.payload.contextRevision)||typeof r.payload.workspaceId!="string"||!fn.test(r.payload.workspaceId)||typeof r.payload.workspace!="string"||r.payload.activeSessionId!==null&&typeof r.payload.activeSessionId!="string"))throw new Error("Workbench 状态事件无效。");if(r.type==="settings_invalidated"&&(r.sessionId!==null||r.threadId!==null||r.durable!==!1))throw new Error("Settings invalidation 事件身份无效。");if(r.type==="settings_invalidated")return jg(r);if(r.type==="session_runtime_changed"&&(!In(r.payload.runtime)||r.sessionId!==r.payload.runtime.sessionId||!zg(r.payload.runtime)))throw new Error("Session Runtime 状态事件无效。");if(r.type==="workspace_mutation_changed"){const o=r.payload.state;if(typeof r.sessionId!="string"||r.durable!==!1||!In(o)||typeof o.callId!="string"||o.callId.length<1||!["queued","running","completed","failed","cancelled"].includes(String(o.phase))||(o.phase==="queued"?!Number.isSafeInteger(o.queuePosition)||o.queuePosition<1:o.queuePosition!==void 0))throw new Error("Workspace mutation 状态事件无效。")}if(r.type==="workspace_resource_invalidated"&&(r.sessionId!==null||r.threadId!==null||r.durable!==!1||typeof r.payload.workspaceId!="string"||!fn.test(r.payload.workspaceId)||!Array.isArray(r.payload.resources)||r.payload.resources.length<1||r.payload.resources.some(o=>!["files","git","review"].includes(String(o)))||!["context-change","filesystem-change","terminal-command","tool-finished"].includes(String(r.payload.reason))))throw new Error("Workspace resource invalidation 事件无效。");if(r.type==="composer_state_changed"&&(typeof r.sessionId!="string"||r.durable!==!0||!In(r.payload.state)||r.payload.state.apiVersion!==1||r.payload.state.sessionId!==r.sessionId||typeof r.payload.state.controlRevision!="string"||!fn.test(r.payload.state.controlRevision)||typeof r.payload.state.contextRevision!="string"||!fn.test(r.payload.state.contextRevision)))throw new Error("Composer state 事件身份无效。");if(r.type==="replay_reset"&&(typeof r.payload.reason!="string"||r.payload.snapshotRequired!==!0))throw new Error("Replay reset 事件无效。");return r}function zg(n){const r=n.phase==="queued";return typeof n.workspaceId=="string"&&fn.test(n.workspaceId)&&typeof n.sessionId=="string"&&fn.test(n.sessionId)&&typeof n.runtimeRevision=="string"&&fn.test(n.runtimeRevision)&&["cold","starting","idle","queued","running","waiting_approval","stopping","interrupted","failed"].includes(String(n.phase))&&Number.isSafeInteger(n.pendingApprovalCount)&&n.pendingApprovalCount>=0&&typeof n.resident=="boolean"&&Number.isSafeInteger(n.estimatedBytes)&&n.estimatedBytes>=0&&typeof n.updatedAt=="string"&&(r?typeof n.queueId=="string"&&fn.test(n.queueId)&&Number.isSafeInteger(n.queuePosition)&&n.queuePosition>=1:n.queueId===void 0&&n.queuePosition===void 0)}function Ea(n,r=null,o=!1,a=Wa){const d=new URLSearchParams({pageSize:String(a)});return r&&d.set("cursor",r),o&&d.set("tail","1"),`${n}${n.includes("?")?"&":"?"}${d.toString()}`}function Zn(n,r){n.set("expectedContextRevision",r.expectedContextRevision),n.set("workspaceId",r.workspaceId)}function Ct(n,r){const o=new URLSearchParams;return Zn(o,r),`${n}${n.includes("?")?"&":"?"}${o.toString()}`}function In(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function We(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const n=crypto.getRandomValues(new Uint8Array(16));n[6]=n[6]&15|64,n[8]=n[8]&63|128;const r=[...n].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Wg({state:n,actions:r,insertion:o}){const a=n.workspaceId,d=n.activeSessionId??"",[f,h]=m.useState({workspaceId:a,sessionId:d,text:"",references:[]}),[g,w]=m.useState(null),[j,P]=m.useState(""),[C,O]=m.useState(new Set),R=m.useRef(null),z=`${a}:${d}`,L=m.useRef(z);L.current=z;const q=`${f.workspaceId}:${f.sessionId}`,X=!d||!n.bootstrap?.configured||n.connection!=="live"||!Sr(n),W=!!n.pendingAction,he=n.sessionSnapshot?.sessionRuntime.phase==="queued",Z=!X&&!W,ee=Z&&!he;m.useEffect(()=>{if(!a||!d){h({workspaceId:a,sessionId:d,text:"",references:[]});return}const te=ig(a,d);h({workspaceId:a,sessionId:d,text:te?.text??"",references:te?.references??[]}),P(""),O(new Set)},[a,d]),m.useEffect(()=>{if(!(!f.workspaceId||!f.sessionId))try{f.text||f.references.length>0?og(f):Qd(f.workspaceId,f.sessionId),P("")}catch(te){P(te instanceof Error?te.message:"草稿无法保存。")}},[f]),m.useEffect(()=>{!o||!d||q!==z||(h(te=>({...te,text:te.text.trim()?`${te.text.trimEnd()}
15
+
16
+ ${o.text}`:o.text})),requestAnimationFrame(()=>R.current?.focus()))},[z,q,o,d]);const N=q===z?f.text:"",F=q===z?f.references:[],re=te=>h(Ce=>({...Ce,workspaceId:a,sessionId:d,text:te})),je=te=>{const Ce=new Set(te.map(Ys));O(D=>new Set([...D].filter(ue=>Ce.has(ue)))),h(D=>({...D,workspaceId:a,sessionId:d,references:te}))},xe=async te=>{const Ce=N.trim();if(!Ce||!ee)return;const D=z;try{te==="queue"?await r.queue(Ce,F):await r.submit(Ce,F),Qd(a,d),O(new Set),L.current===D&&h({workspaceId:a,sessionId:d,text:"",references:[]}),R.current?.focus()}catch(ue){ue instanceof Ie&&["context_reference_stale","context_reference_forbidden"].includes(ue.code??"")&&O(new Set(F.map(Ys))),P(ue instanceof Error?ue.message:"发送失败,草稿已保留。"),R.current?.focus()}},Y=te=>{te.preventDefault(),xe(n.processing?"queue":"submit")},pe=te=>{te.key!=="Enter"||te.shiftKey||te.nativeEvent.isComposing||(te.preventDefault(),n.processing&&(te.metaKey||te.ctrlKey)?xe("submit"):xe(n.processing?"queue":"submit"))};return i.jsxs("div",{className:"composer-control-center",children:[n.composer?.planReview?.status==="awaiting_review"?i.jsx(Vg,{state:n,actions:r}):null,F.length>0?i.jsx(Hg,{references:F,invalidReferenceKeys:C,onChange:je}):null,i.jsxs("form",{className:"composer composer-v032",onSubmit:Y,children:[i.jsx("label",{htmlFor:"orion-composer",className:"sr-only",children:"发送给 Orion"}),i.jsx("textarea",{ref:R,id:"orion-composer",rows:3,maxLength:1e6,value:N,onChange:te=>re(te.target.value),onKeyDown:pe,placeholder:W?"正在同步会话控制状态…":he?`任务正在排队${n.sessionSnapshot?.sessionRuntime.queuePosition?`(第 ${n.sessionSnapshot.sessionRuntime.queuePosition} 位)`:""}`:X?"选择会话并配置模型后开始":n.processing?"输入后续消息;Enter 排队,⌘/Ctrl+Enter Steer":"描述任务,或输入 / 查看命令…",disabled:!ee}),i.jsxs("div",{className:"composer-toolbar composer-control-toolbar",children:[i.jsxs("div",{className:"composer-controls composer-control-row",children:[i.jsx(Ug,{state:n,actions:r,disabled:!ee,references:F,onChange:je,onInsertCommand:()=>re(N.trim()?`${N.trimEnd()}
17
+ /`:"/")}),i.jsx(Fa,{label:Yg(n),accessibleLabel:"工作模式",disabled:!ee,value:n.composer?.mode.baseMode??n.mode.baseMode,options:[{value:"interactive",label:"BUILD",detail:"执行、修改并验证当前任务"},{value:"plan",label:"PLAN",detail:"生成计划并等待你的审核"},{value:"auto",label:"AUTO",detail:"自主执行,仍受权限与沙箱约束"}],onSelect:te=>{te==="auto"?w("auto"):bt(r.setMode(te))}}),i.jsx(Fa,{label:Xg(n),accessibleLabel:"会话权限",disabled:!ee,value:n.composer?.permission.override??"inherit",options:[{value:"inherit",label:"继承项目",detail:`当前 ${n.composer?.permission.projectDefault??"ask"}`},{value:"ask",label:"ASK",detail:"高风险工具逐次请求批准"},{value:"allow",label:"ALLOW",detail:"允许策略许可的工具,不绕过沙箱"},{value:"deny",label:"DENY",detail:"拒绝需要授权的工具"}],onSelect:te=>{te==="allow"?w("allow"):bt(r.setPermissionOverride(te==="inherit"?null:te))}})]}),i.jsxs("div",{className:"composer-actions composer-control-actions",children:[i.jsx(Fg,{state:n,actions:r,disabled:!ee}),i.jsx(qg,{state:n,actions:r,disabled:!ee}),n.processing?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"icon-text-button stop-button",onClick:()=>bt(r.interrupt()),disabled:!ee,children:[i.jsx(Q,{name:"stop",size:14}),"停止"]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{xe("submit")},disabled:!N.trim()||!ee,children:"Steer"})]}):null,he?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>bt(r.cancelQueuedTurn()),disabled:!Z,children:"取消排队"}):null,i.jsx("button",{type:"submit",className:"send-button composer-send-icon","aria-label":n.processing?"加入消息队列":"发送消息",disabled:!ee||!N.trim(),children:i.jsx(Q,{name:"arrow-up",size:17})})]})]}),F.length>0||j||n.composer?.lastError?i.jsxs("div",{className:"composer-footline",children:[F.length>0?i.jsxs("span",{children:[F.length," 个 Context 引用"]}):null,j?i.jsx("span",{role:"alert",children:j}):n.composer?.lastError?i.jsx("span",{role:"alert",children:n.composer.lastError.message}):null]}):null]}),g?i.jsx(Kg,{kind:g,onCancel:()=>w(null),onConfirm:()=>{const te=g;w(null),bt(te==="auto"?r.setMode("auto"):r.setPermissionOverride("allow"))}}):null]})}function Fg({state:n,actions:r,disabled:o}){const a=n.composer?.model,d=["auto",...a?.effort.supportedLevels??[]];return i.jsxs("div",{className:"model-control-cluster",children:[i.jsx(Bg,{state:n,actions:r,disabled:o}),a?.effort.supported?i.jsx(Fa,{label:n.composer?.pending.model?`${po(a.effort.requested)} → ${po(n.composer.pending.model.effort)}`:po(a.effort.requested),accessibleLabel:"推理强度",disabled:o,value:a.effort.requested,options:d.map(f=>({value:f,label:po(f),detail:f==="auto"?"采用模型或项目默认值":`请求 ${f} reasoning effort`})),onSelect:f=>bt(r.selectModel(a.modelId,f))}):null]})}function Bg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),[f,h]=m.useState(""),g=m.useRef(null),w=m.useRef(null),j=m.useRef(null),P=n.composer?.model,C=n.modelCatalog,O=n.composer?.pending.model?`${P?.modelId??"模型"} → ${n.composer.pending.model.modelId}`:P?.modelId??"模型",R=f.trim().toLowerCase(),z=new Set((C?.unavailableProviders??[]).map(W=>W.id)),L=(C?.items??[]).filter(W=>!z.has(W.providerId)).filter(W=>[W.id,W.label,W.providerId,W.providerLabel].some(he=>he.toLowerCase().includes(R))).slice(0,80),q=new Map;for(const W of L){const he=W.providerLabel||W.providerId;q.set(he,[...q.get(he)??[],W])}const X=()=>{d(!1),h(""),w.current?.focus()};return Lo(a,g,X),i.jsxs("div",{className:"control-menu",ref:g,children:[i.jsxs("button",{ref:w,type:"button",className:"composer-control-trigger","aria-label":"会话模型","aria-haspopup":"menu","aria-expanded":a,disabled:o,onClick:()=>{a?X():(d(!0),C||bt(r.loadModelCatalog()))},children:[i.jsx("span",{children:O}),i.jsx(Q,{name:"chevron",size:12})]}),a?i.jsxs("div",{className:"control-menu-popover model-catalog-popover",role:"menu","aria-label":"会话模型",ref:j,onKeyDown:W=>Za(W,X),children:[(C?.items.length??0)>8?i.jsxs("label",{className:"model-catalog-search",children:[i.jsx("span",{className:"sr-only",children:"筛选模型"}),i.jsx("input",{type:"search",value:f,placeholder:"筛选模型…",onChange:W=>h(W.target.value),onKeyDown:W=>{W.key==="ArrowDown"?(W.preventDefault(),Jf(j.current)):W.key==="Escape"&&(W.stopPropagation(),X())}})]}):null,C===null?i.jsx("p",{role:"status",children:"正在加载模型…"}):null,C&&L.length===0?i.jsx("p",{children:"没有匹配的可用模型"}):null,[...q.entries()].map(([W,he])=>i.jsxs("section",{role:"group","aria-label":W,children:[i.jsx("div",{className:"model-provider-heading",children:W}),he.map(Z=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":Z.id===P?.modelId,onClick:()=>{X(),bt(r.selectModel(Z.id))},children:[i.jsxs("span",{children:[i.jsx("strong",{children:Z.label}),i.jsxs("small",{children:[ts(Z.contextWindow)," context",Z.reasoning?" · reasoning":""]})]}),Z.id===P?.modelId?i.jsx(Q,{name:"check",size:14}):null]},Z.id))]},W)),C?.unavailableProviders.map(W=>i.jsxs("section",{role:"group","aria-label":`${W.id} 不可用`,children:[i.jsxs("div",{className:"model-provider-heading state-error",children:[W.id," · 不可用"]}),i.jsx("p",{children:W.reason}),i.jsx("button",{type:"button",role:"menuitem",onClick:()=>bt(r.loadModelCatalog()),children:"Retry"})]},W.id)),(C?.items.length??0)>80&&!R?i.jsx("p",{children:"显示前 80 项;输入关键词继续筛选。"}):null]}):null]})}function qg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),f=m.useRef(null),h=m.useRef(null),g=n.composer?.contextUsage,w=g?Math.max(0,Math.min(100,g.percent)):null,j=g?.source==="estimated",P=!!(g&&g.percent>=g.warningThresholdPercent);return Lo(a,f,()=>{d(!1),h.current?.focus()}),i.jsxs("div",{className:"context-meter-wrap",ref:f,children:[i.jsxs("button",{ref:h,type:"button",className:"context-meter-button","aria-label":g?`Context ${j?"估算 ":""}${g.usedTokens} / ${g.safeInputBudget??g.contextWindow} tokens,${g.percent}%${P?",接近压缩阈值":""}`:"Context 用量不可用","aria-haspopup":"dialog","aria-expanded":a,disabled:o,onClick:()=>d(C=>!C),children:[i.jsx("span",{className:"context-meter-ring",style:{"--context-percent":`${w??0}%`},"aria-hidden":"true"}),i.jsx("span",{children:g?`${j?"~":""}${g.percent}%${P?" !":""}`:"Context"})]}),a?i.jsxs("section",{className:"context-popover",role:"dialog","aria-label":"Context 用量详情",children:[i.jsxs("header",{children:[i.jsx("strong",{children:"Context"}),i.jsx("button",{type:"button",className:"icon-button",onClick:()=>d(!1),"aria-label":"关闭 Context 详情",children:i.jsx(Q,{name:"close",size:14})})]}),g?i.jsxs("dl",{children:[i.jsxs("div",{children:[i.jsx("dt",{children:"当前模型"}),i.jsx("dd",{children:g.modelId})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"已使用"}),i.jsx("dd",{children:ts(g.usedTokens)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全输入预算"}),i.jsx("dd",{children:ts(g.safeInputBudget??g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"原始窗口"}),i.jsx("dd",{children:ts(g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"输出预留"}),i.jsx("dd",{children:ts(g.reservedOutputTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全余量"}),i.jsx("dd",{children:ts(g.safetyMarginTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"来源"}),i.jsx("dd",{children:g.source==="estimated"?"估算 ~":g.source})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"警告阈值"}),i.jsxs("dd",{children:[g.warningThresholdPercent,"%"]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"自动压缩"}),i.jsx("dd",{children:g.autoCompactEnabled?`${g.autoCompactThresholdPercent}%`:"关闭"})]})]}):i.jsx("p",{children:"Runtime 尚未提供当前模型的 Context 计数。"}),n.composer?.compactAvailable?i.jsx("button",{type:"button",className:"secondary-button",disabled:!g||n.processing,onClick:()=>bt(r.compactContext()),children:"立即压缩"}):null]}):null]})}function Ug({state:n,actions:r,disabled:o,references:a,onChange:d,onInsertCommand:f}){const[h,g]=m.useState(!1),[w,j]=m.useState("root"),[P,C]=m.useState([]),[O,R]=m.useState(!1),[z,L]=m.useState(""),q=m.useRef(null),X=m.useRef(null);Lo(h,q,()=>g(!1));const W=N=>{a.some(F=>F.kind===N.kind&&F.id===N.id)||d([...a,N]),g(!1),j("root")},he=async()=>{j("files"),R(!0),L("");try{const N=await r.listFiles();C(N.items.filter(F=>F.readable&&!F.sensitive))}catch(N){L(N instanceof Error?N.message:"文件列表加载失败。")}finally{R(!1)}},Z=async N=>{R(!0),L("");try{if(Jd(N)){const F=await r.listFiles(N.id);W({kind:"folder",id:N.id,label:N.name,revision:F.revision})}else if(Jg(N)){const F=await r.readFileContent(N.id);if(F.binary||F.sensitive)throw new Error("该文件不能加入模型 Context。");W({kind:"file",id:N.id,label:N.name,revision:F.revision})}}catch(F){L(F instanceof Error?F.message:"Context 引用加载失败。")}finally{R(!1)}},ee=async()=>{R(!0);try{const N=await r.review();W({kind:"review",id:"working-tree",label:N.truncated?`Review · ${N.totalChangedFiles} files · ${N.changedFiles.length} visible`:`Review · ${N.totalChangedFiles} files`,gitRevision:N.repositoryRevision})}catch(N){L(N instanceof Error?N.message:"Review Context 加载失败。")}finally{R(!1)}};return i.jsxs("div",{className:"control-menu context-launcher",ref:q,children:[i.jsx("button",{type:"button",className:"context-add-button","aria-label":"添加 Context","aria-haspopup":"menu","aria-expanded":h,disabled:o,onClick:()=>{const N=!h;g(N),N&&requestAnimationFrame(()=>Jf(X.current))},children:i.jsx(Q,{name:"add",size:17})}),h?i.jsxs("div",{className:"control-menu-popover context-launcher-menu",role:"menu","aria-label":"添加 Context",ref:X,onKeyDown:N=>Za(N,()=>g(!1)),children:[w!=="root"?i.jsx("button",{type:"button",role:"menuitem",onClick:()=>j("root"),children:"← 返回"}):null,w==="root"?i.jsxs(i.Fragment,{children:[i.jsx(_n,{label:"文件或目录",detail:"Workspace 内受控读取",onClick:()=>{he()}}),i.jsx(_n,{label:"当前 Review",detail:"绑定 exact Git revision",onClick:()=>{ee()}}),i.jsx(_n,{label:"历史 Session",detail:"引用受控摘要",onClick:()=>j("sessions")}),i.jsx(_n,{label:"Skill",detail:"绑定已加载能力 digest",onClick:()=>j("skills")}),i.jsx(_n,{label:"命令",detail:"插入 / 命令入口",onClick:()=>{f(),g(!1)}}),a.length>0?i.jsx(_n,{label:"清除 Context",detail:"移除当前草稿全部引用",onClick:()=>{d([]),g(!1)}}):null]}):null,w==="files"?P.map(N=>i.jsx(_n,{label:N.name,detail:Jd(N)?"目录":`${N.sizeBytes??0} bytes`,onClick:()=>{Z(N)}},N.id)):null,w==="sessions"?n.sessions.filter(N=>N.id!==n.activeSessionId).map(N=>i.jsx(_n,{label:N.name||`Session ${N.id.slice(0,8)}`,detail:`${N.messageCount} 条消息`,onClick:()=>W({kind:"session",id:N.id,label:N.name||`Session ${N.id.slice(0,8)}`,digest:N.contextDigest})},N.id)):null,w==="skills"?n.skills.filter(N=>N.userInvocable).map(N=>i.jsx(_n,{label:N.name,detail:N.description,onClick:()=>W({kind:"skill",id:N.id,label:N.name,digest:N.digest})},N.id)):null,O?i.jsx("p",{role:"status",children:"正在加载…"}):null,z?i.jsx("p",{role:"alert",children:z}):null]}):null]})}function Hg({references:n,invalidReferenceKeys:r,onChange:o}){return i.jsx("div",{className:"context-tray","aria-label":"当前 Context 引用",children:n.map(a=>i.jsxs("span",{className:`context-chip${r.has(Ys(a))?" state-stale":""}`,children:[i.jsx("small",{children:Zg(a.kind)}),i.jsx("span",{children:a.label}),r.has(Ys(a))?i.jsx("span",{className:"context-chip-state",children:"已失效,请移除后重新添加"}):null,i.jsx("button",{type:"button","aria-label":`移除 Context ${a.label}`,onClick:()=>o(n.filter(d=>d!==a)),children:i.jsx(Q,{name:"close",size:12})})]},Ys(a)))})}function Vg({state:n,actions:r}){const o=n.composer.planReview,[a,d]=m.useState(!1),[f,h]=m.useState(""),g=!!n.pendingAction||n.connection!=="live"||!Sr(n);return i.jsxs("section",{className:"plan-review-card","aria-labelledby":"plan-review-title",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"PLAN REVIEW"}),i.jsx("h2",{id:"plan-review-title",children:"计划已保存,尚未执行"}),i.jsxs("p",{children:["由 ",o.createdModel," 创建 · digest ",o.planDigest.slice(0,12)]})]}),a?i.jsxs("label",{children:["继续规划反馈",i.jsx("textarea",{rows:2,value:f,onChange:w=>h(w.target.value)})]}):null,i.jsxs("div",{className:"plan-review-actions",children:[i.jsx("button",{type:"button",className:"danger-ghost-button",disabled:g,onClick:()=>bt(r.reviewPlan(o.planDigest,"cancel")),children:"取消计划"}),a?i.jsx("button",{type:"button",className:"secondary-button",disabled:g||!f.trim(),onClick:()=>bt(r.reviewPlan(o.planDigest,"continue",f.trim())),children:"提交反馈"}):i.jsx("button",{type:"button",className:"secondary-button",disabled:g,onClick:()=>d(!0),children:"继续规划"}),i.jsx("button",{type:"button",className:"primary-button",disabled:g,onClick:()=>bt(r.reviewPlan(o.planDigest,"approve")),children:"批准并进入 BUILD"})]})]})}function Fa({label:n,accessibleLabel:r,value:o,options:a,disabled:d,emptyLabel:f,onOpen:h,onSelect:g}){const[w,j]=m.useState(!1),P=m.useRef(null),C=m.useRef(null),O=m.useRef(null),R=m.useId(),z=()=>{j(!1),C.current?.focus()},L=()=>{j(!0),h?.(),requestAnimationFrame(()=>Gg(O.current))};return Lo(w,P,z),i.jsxs("div",{className:"control-menu",ref:P,children:[i.jsxs("button",{ref:C,type:"button",className:"composer-control-trigger","aria-label":r,"aria-haspopup":"menu","aria-expanded":w,"aria-controls":w?R:void 0,disabled:d,onClick:()=>{w?z():L()},onKeyDown:q=>{q.key==="ArrowDown"&&(q.preventDefault(),L())},children:[i.jsx("span",{children:n}),i.jsx(Q,{name:"chevron",size:12})]}),w?i.jsx("div",{id:R,ref:O,className:"control-menu-popover",role:"menu","aria-label":r,onKeyDown:q=>Za(q,z),children:a.length===0?i.jsx("p",{children:f??"没有选项"}):a.map(q=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":q.value===o,onClick:()=>{z(),g(q.value)},children:[i.jsxs("span",{children:[i.jsx("strong",{children:q.label}),i.jsx("small",{children:q.detail})]}),q.value===o?i.jsx(Q,{name:"check",size:14}):null]},q.value))}):null]})}function _n({label:n,detail:r,onClick:o}){return i.jsx("button",{type:"button",role:"menuitem",onClick:o,children:i.jsxs("span",{children:[i.jsx("strong",{children:n}),i.jsx("small",{children:r})]})})}function Kg({kind:n,onCancel:r,onConfirm:o}){const[a,d]=m.useState(!1),f=m.useRef(null),h=m.useRef(null);return m.useEffect(()=>{const g=document.querySelector(n==="auto"?'[aria-label="工作模式"]':'[aria-label="会话权限"]');return h.current?.focus(),()=>g?.focus()},[n]),i.jsx("div",{className:"modal-backdrop",onPointerDown:g=>{g.target===g.currentTarget&&r()},children:i.jsxs("section",{ref:f,className:"risk-confirmation",role:"alertdialog","aria-modal":"true","aria-labelledby":"risk-title","aria-describedby":"risk-description",onKeyDown:g=>Qg(g,f.current,r),children:[i.jsx("h2",{id:"risk-title",children:n==="auto"?"启用 AUTO 模式?":"启用会话 ALLOW?"}),i.jsx("p",{id:"risk-description",children:n==="auto"?"Orion 会自主执行多个步骤,但仍受 ToolGateway、沙箱与 Workspace containment 约束。":"策略允许的工具将不再逐次询问;硬拒绝、沙箱和 Workspace 边界仍然生效。"}),i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:a,onChange:g=>d(g.target.checked)}),"我理解这会扩大本会话的默认执行范围"]}),i.jsxs("div",{children:[i.jsx("button",{ref:h,type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!a,onClick:o,children:"确认启用"})]})]})})}function Ja(n){return n?[...n.querySelectorAll('[role="menuitem"], [role="menuitemradio"]')].filter(r=>!r.disabled):[]}function Jf(n){Ja(n)[0]?.focus()}function Gg(n){const r=Ja(n);(r.find(o=>o.getAttribute("aria-checked")==="true")??r[0])?.focus()}function Za(n,r){if(n.key==="Escape"){n.preventDefault(),r();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();const o=Ja(n.currentTarget);if(o.length===0)return;const a=o.indexOf(document.activeElement),d=n.key==="Home"?0:n.key==="End"?o.length-1:n.key==="ArrowDown"?(Math.max(0,a)+1)%o.length:(a<=0?o.length:a)-1;o[d]?.focus()}function Qg(n,r,o){if(n.key==="Escape"){n.preventDefault(),o();return}if(n.key!=="Tab"||!r)return;const a=[...r.querySelectorAll('button:not(:disabled), input:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')];if(a.length===0)return;const d=a[0],f=a.at(-1);n.shiftKey&&document.activeElement===d?(n.preventDefault(),f.focus()):!n.shiftKey&&document.activeElement===f&&(n.preventDefault(),d.focus())}function Lo(n,r,o){m.useEffect(()=>{if(!n)return;const a=f=>{r.current?.contains(f.target)||o()},d=f=>{f.key==="Escape"&&o()};return document.addEventListener("pointerdown",a),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",a),document.removeEventListener("keydown",d)}},[o,n,r])}function Xd(n){return n==="plan"?"PLAN":n==="auto"?"AUTO":"BUILD"}function Yg(n){const r=n.composer?.mode??n.mode,o=Xd(r.baseMode);return r.pendingBaseMode?`${o} → ${Xd(r.pendingBaseMode)}`:o}function Xg(n){const r=n.composer?.permission,o=r?.source==="session"?"Session":"Project",a=`${r?.effective.toUpperCase()??"ASK"} · ${o}`;if((n.composer?.mode.baseMode??n.mode.baseMode)==="auto"&&r?.effective!=="deny")return"AUTO · hard policy";const d=n.composer?.pending.permission;return d?`${a} → ${(d.override??r?.projectDefault??"ask").toUpperCase()} · Session`:a}function po(n){return n==="auto"?"Effort 自动":`Effort ${n}`}function Jd(n){return n.kind==="directory"||n.kind==="symlink"&&n.targetKind==="directory"}function Jg(n){return n.kind==="file"||n.kind==="symlink"&&n.targetKind==="file"}function Zg(n){return n==="file"?"FILE":n==="folder"?"FOLDER":n==="review"?"REVIEW":n==="session"?"SESSION":"SKILL"}function Ys(n){return`${n.kind}:${n.id}`}function bt(n){n.catch(()=>{})}function ts(n){return n>=1e3?`${Math.round(n/1e3)}k`:String(n)}const ev=48,tv=64,nv=new Set(["user","assistant"]);function rv(n,r={}){const o=iv(r.maxBuckets),a=[...n].filter(g=>Number.isFinite(g.order)).sort((g,w)=>g.order-w.order);if(a.length===0)return Object.freeze({anchors:Object.freeze([]),buckets:Object.freeze([]),minOrder:0,maxOrder:0});const d=Math.min(a.length,o),f=Math.ceil(a.length/d),h=[];for(let g=0;g<d;g+=1){const w=a.slice(g*f,(g+1)*f);if(w.length===0)break;h.push(sv(g,w))}return Object.freeze({anchors:Object.freeze(a),buckets:Object.freeze(h),minOrder:h[0]?.startOrder??0,maxOrder:h.at(-1)?.endOrder??0})}function sv(n,r){const o=[],a=new Set;let d=!1,f=null;for(const h of r)a.has(h.kind)||(a.add(h.kind),o.push(h.kind)),h.priority==="error"&&(d=!0,(!f||h.priority==="error")&&(f=h));if(!f){let h=null;for(const g of r)nv.has(g.kind)&&(h=g);f=h??r[Math.floor((r.length-1)/2)]}return Object.freeze({index:n,startOrder:r[0].order,endOrder:r.at(-1).order,orders:Object.freeze(r.map(h=>h.order)),kinds:Object.freeze(o),hasError:d,jumpOrder:f.order})}function iv(n){return typeof n!="number"||!Number.isFinite(n)?ev:Math.min(tv,Math.max(1,Math.round(n)))}function ov(n){switch(n){case"user":return"用户任务";case"assistant":return"Orion 回复";case"tool":return"工具活动";case"edit":return"文件修改";case"subtask":return"子任务";case"research":return"研究";case"system":return"系统/错误"}}function lv(n,r){const o=n.buckets.findIndex(f=>r>=f.startOrder&&r<=f.endOrder),a=o>=0?n.buckets[o]:void 0,d=a?.kinds.includes("assistant")?"assistant":a?.kinds.includes("user")?"user":a?.kinds[0]??"system";return{bucketIndex:o>=0?o+1:0,bucketCount:n.buckets.length,kindLabel:d?ov(d):"未知"}}function Zd(n,r){return r<=0?0:r===1?.5:Math.max(0,Math.min(r-1,n))/(r-1)}function ho(n,r){const o=n.buckets.findIndex(a=>r>=a.startOrder&&r<=a.endOrder);return o>=0?o:null}function av(n){const r=n.kind==="tool"||n.kind==="edit"||n.kind==="subtask"||n.kind==="research"?160:240,o=n.label.length,a=.35+Math.log2(1+o/r)*.55;return Math.max(.15,Math.min(1,a))}const cv=220,uv=400;function dv(n,r={}){const o=typeof r.maxTicks=="number"&&Number.isFinite(r.maxTicks)?Math.max(1,Math.min(uv,Math.round(r.maxTicks))):cv,a=[...n].filter(h=>Number.isFinite(h.order)).sort((h,g)=>h.order-g.order);if(a.length===0)return Object.freeze([]);const d=[];if(a.length<=o)for(const h of a)d.push([h]);else{const h=Math.ceil(a.length/o);for(let g=0;g<a.length;g+=h)d.push(a.slice(g,g+h))}const f=d.map((h,g)=>{const w=h.some(R=>R.priority==="error");let P=h.reduce((R,z)=>z.order>R.order?z:R,h[0]),C=-1;for(const R of h){const z=R.priority==="error"?2:R.priority==="turn"?1:0;z>=C&&(C=z,P=R)}const O=Math.max(.15,Math.min(1,h.reduce((R,z)=>R+av(z),0)/h.length+(w?.1:0)));return{index:g,orders:Object.freeze(h.map(R=>R.order)),jumpOrder:P.order,weight:O,hasError:w}});return Object.freeze(f)}function fv(n){return n>=.72?"history-tick-l":n>=.45?"history-tick-m":"history-tick-s"}function ef(n){const{clientY:r,railTop:o,railHeight:a,tickCount:d}=n;if(!Number.isFinite(a)||a<=0||d<=0)return 0;const f=(r-o)/a;return Math.max(0,Math.min(d-1,Math.round(f*(d-1))))}function pv(n,r){let o=null;for(const a of n)a.topInViewport<r-1||(!o||a.topInViewport<o.topInViewport)&&(o=a);return o?.order??null}function hv(n,r){if(n.anchors.length===0)return null;let o=n.anchors[0].order,a=Number.POSITIVE_INFINITY;for(const d of n.anchors){const f=Math.abs(d.order-r);(f<a||f===a&&d.order>o)&&(o=d.order,a=f)}return o}function mv(n){const{key:r,currentIndex:o,bucketCount:a,model:d}=n;if(a<=0)return null;const f=n.shiftKey?5:1;if(r==="Home")return d.buckets[0]?.jumpOrder??null;if(r==="End")return d.buckets.at(-1)?.jumpOrder??null;let h;if(r==="ArrowUp"||r==="ArrowLeft")h=o-f;else if(r==="ArrowDown"||r==="ArrowRight")h=o+f;else if(r==="PageUp")h=o-5;else if(r==="PageDown")h=o+5;else return null;const g=Math.max(0,Math.min(a-1,h));return d.buckets[g]?.jumpOrder??null}function gv({model:n,activeOrder:r,span:o,hasEarlierHistory:a,processing:d,reduceMotion:f,onJumpToOrder:h,onJumpToLatest:g}){const w=m.useRef(null),j=m.useRef(null),P=m.useRef(!1),C=m.useRef(null),O=m.useRef(null),[R,z]=m.useState(!1),[L,q]=m.useState(null),X=m.useMemo(()=>dv(n.anchors),[n.anchors]),W=X.length,he=m.useMemo(()=>{if(r===null||W===0)return 0;const D=ho(n,r);return D!==null?D+1:0},[r,n,W]),Z=m.useMemo(()=>r===null?null:lv(n,r),[r,n]),ee=o!==null?ho(n,o.firstOrder)??0:null,N=o!==null?ho(n,o.lastOrder)??n.buckets.length-1:null,F=m.useMemo(()=>X.map(D=>ho(n,D.jumpOrder)),[n,X]),re=m.useCallback(()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null),q(null)},[]),je=m.useCallback(D=>{const ue=w.current;if(!ue)return;const de=ue.getBoundingClientRect(),E=ef({clientY:D,railTop:de.top,railHeight:de.height,tickCount:W}),K=X[E];if(!K)return;const T=n.anchors.find(A=>A.order===K.jumpOrder);let y=T?.preview;if(T?.kind==="user"){const ne=n.anchors.find(ye=>ye.order>T.order&&ye.kind==="assistant")?.preview;ne&&(y=y?`${y}
18
+
19
+ ${ne}`:ne)}const $=Zd(E,W)*de.height;q({title:Rn(T?.label??""),preview:y?Rn(y):null,top:Math.max(8,Math.min(de.height-140,$))})},[n,W,X]),xe=m.useCallback(D=>{O.current=D,C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{C.current=null;const ue=O.current;ue===null||j.current!==null||P.current||je(ue)},120)},[je]);m.useEffect(()=>{const D=()=>{P.current||re()};return window.addEventListener("scroll",D,!0),()=>window.removeEventListener("scroll",D,!0)},[re]),m.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]);const Y=m.useCallback((D,ue)=>{const de=w.current;if(!de)return;const E=de.getBoundingClientRect(),K=ef({clientY:D,railTop:E.top,railHeight:E.height,tickCount:W}),T=X[K];T&&h(T.jumpOrder,ue)},[h,W,X]),pe=D=>{D.button!==0||j.current!==null||(D.preventDefault(),j.current=D.pointerId,D.currentTarget.setPointerCapture(D.pointerId),document.documentElement.dataset.historyScrubbing="1",P.current=!0,z(!0),re(),Y(D.clientY,"auto"))},te=D=>{j.current===D.pointerId&&(D.currentTarget.hasPointerCapture(D.pointerId)&&D.currentTarget.releasePointerCapture(D.pointerId),j.current=null,P.current=!1,delete document.documentElement.dataset.historyScrubbing,z(!1),re())},Ce=D=>{const ue=mv({key:D.key,shiftKey:D.shiftKey,currentIndex:he-1,bucketCount:n.buckets.length,model:n});ue!==null&&(D.preventDefault(),h(ue,f?"auto":"smooth"))};return W===0?null:i.jsx("nav",{className:"history-rail","aria-label":"会话历史定位",children:i.jsxs("div",{className:"history-rail-inner",ref:w,children:[i.jsxs("div",{className:"history-slider",role:"slider","aria-label":"已加载会话历史位置","aria-valuemin":0,"aria-valuemax":Math.max(0,n.buckets.length-1),"aria-valuenow":Math.max(0,he-1),"aria-valuetext":Z?`已加载 ${Z.bucketIndex}/${Z.bucketCount} 个关键节点,当前为${Z.kindLabel}${a?";更早历史可在正文顶部加载":""}`:`已加载 ${n.buckets.length} 个关键节点${a?";更早历史可在正文顶部加载":""}`,tabIndex:0,onKeyDown:Ce,onPointerDown:pe,onPointerMove:D=>{if(j.current===D.pointerId){Y(D.clientY,"auto");return}xe(D.clientY)},onPointerLeave:re,onPointerUp:te,onPointerCancel:te,onLostPointerCapture:te,onDoubleClick:g,children:[i.jsx("div",{className:"history-ticks","aria-hidden":"true",children:X.map((D,ue)=>{const de=F[ue],E=de!==null&&ee!==null&&N!==null&&de>=ee&&de<=N;return i.jsx("span",{className:["history-tick",fv(D.weight),E?"is-viewport":"",D.hasError?"is-error":"",R?"is-scrubbing":""].filter(Boolean).join(" "),style:{top:`${Zd(D.index,W)*100}%`}},D.index)})}),d?i.jsx("span",{className:"history-live-bar","aria-hidden":"true"}):null]}),L?i.jsxs("div",{className:"history-preview-card",style:{top:L.top},"aria-hidden":"true",children:[i.jsx("strong",{children:L.title}),L.preview?i.jsx("p",{children:L.preview}):null]}):null]})})}const vv=10;function yv(n){const{viewportRef:r,model:o,activeSessionId:a,onUserNavigate:d}=n,f=m.useRef(new Map),h=m.useRef(null),g=m.useRef([]),w=m.useRef(null),[j,P]=m.useState(null),[C,O]=m.useState(null),R=m.useRef(d);R.current=d;const z=m.useRef(a),L=m.useRef(o);L.current=o;const q=()=>{if(w.current=null,g.current.length===0)return;const ee=g.current;if(g.current=[],ee.length===0)return;const F=r.current?.getBoundingClientRect().top??0,re=pv(ee,F);let je=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY;for(const Y of ee)Y.topInViewport>=F-1&&(Y.order<je&&(je=Y.order),Y.order>xe&&(xe=Y.order));P(Y=>Y===re?Y:re),O(Y=>{if(!Number.isFinite(je)||!Number.isFinite(xe))return Y;const pe={firstOrder:je,lastOrder:xe};return Y?.firstOrder===pe.firstOrder&&Y?.lastOrder===pe.lastOrder?Y:pe})},X=()=>{w.current===null&&(w.current=requestAnimationFrame(q))},W=()=>{h.current&&(h.current.disconnect(),h.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),g.current=[],f.current.clear(),P(null),O(null)};m.useEffect(()=>{if(z.current===a&&h.current)return;z.current=a,W();const ee=r.current;if(!ee||!o.anchors.length||typeof IntersectionObserver>"u")return;const N=new IntersectionObserver(F=>{const je=r.current?.getBoundingClientRect().top??0;for(const xe of F){const Y=Number(xe.target.dataset.order);Number.isFinite(Y)&&xe.isIntersecting&&g.current.push({order:Y,topInViewport:xe.boundingClientRect.top-je})}X()},{root:ee,threshold:[0,.2,.6]});return h.current=N,f.current.clear(),ee.querySelectorAll("li[data-order]").forEach(F=>{const re=Number(F.dataset.order);Number.isFinite(re)&&(f.current.set(re,F),N.observe(F))}),()=>W()},[r,a,o.anchors.length,o.anchors[o.anchors.length-1]?.order]);const he=m.useCallback((ee,N)=>{if(N){if(f.current.get(ee)===N)return;f.current.set(ee,N),h.current?.observe(N);return}const F=f.current.get(ee);F&&(h.current?.unobserve(F),f.current.delete(ee))},[]);return{activeOrder:j,span:C,registerItem:he,scrollToOrder:(ee,N="smooth")=>{const F=r.current,re=hv(L.current,ee),je=re!==null?f.current.get(re):void 0;if(!F||!je){if(!F||L.current.anchors.length===0)return;const Y=(ee-L.current.minOrder)/(L.current.maxOrder-L.current.minOrder||1);F.scrollTo({top:Math.max(0,Math.min(1,Y))*(F.scrollHeight-F.clientHeight),behavior:N}),R.current?.();return}const xe=je.getBoundingClientRect().top-F.getBoundingClientRect().top+F.scrollTop-vv;F.scrollTo({top:Math.max(0,xe),behavior:N}),R.current?.()}}}const Pa=40;function vr(n){if(n.length===0)return 0;let r=1;for(let o=0;o<n.length;o+=1)n.charCodeAt(o)===10&&(r+=1);return r}function xv(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function wv(n){if(n==null)return null;const r=n.trim();if(r.length===0)return{format:"plain",displayText:n,isEnvelope:!1,lineCount:0,isLong:!1};let o;try{o=JSON.parse(r)}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:vr(n),isLong:vr(n)>Pa}}if(xv(o)&&typeof o.output=="string"){const a=o.output;return{format:"envelope",displayText:a,isEnvelope:!0,lineCount:vr(a),isLong:vr(a)>Pa}}try{const a=JSON.stringify(o,null,2);return{format:"json",displayText:a,isEnvelope:!1,lineCount:vr(a),isLong:vr(a)>Pa}}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:vr(n),isLong:!1}}}function Zf({text:n,defaultOpen:r=!1,note:o=null}){const a=wv(n),d=r||!a?.isLong,[f,h]=m.useState(d),[g,w]=m.useState(!1),j=m.useRef(null);if(m.useEffect(()=>()=>{j.current!==null&&window.clearTimeout(j.current)},[]),a===null)return null;const P=Rn(a.displayText),C=async()=>{try{await navigator.clipboard.writeText(a.displayText),w(!0),j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>w(!1),1400)}catch{}},O=i.jsx("pre",{className:"tool-output-text",tabIndex:0,children:P});if(!a.isLong||r)return i.jsxs("div",{className:"tool-output-preview tool-output-preview-open",children:[O,o?i.jsx("p",{className:"truncation-note",children:o}):null]});const R=`${a.lineCount} 行 · ${a.format==="envelope"?"已解包":"文本"}`;return i.jsx("div",{className:"tool-output-preview",children:i.jsxs("details",{className:"tool-output-fold",open:f,onToggle:z=>h(z.target.open),children:[i.jsxs("summary",{children:[i.jsxs("span",{children:[R,a.isEnvelope?" · 输出已安全还原换行":""]}),i.jsx("button",{type:"button",className:"text-button",onClick:z=>{z.preventDefault(),C()},children:g?"已复制":"复制原始响应"})]}),O,o?i.jsx("p",{className:"truncation-note",children:o}):null]})})}const tf=320,kv=300,Ra=["system","light","dark"],jv={system:"monitor",light:"sun",dark:"moon"},nf={system:"跟随系统",light:"浅色",dark:"深色"};function Sv(n){const r=n??"system",o=Ra.indexOf(r),a=Ra[(o+1)%Ra.length];return{current:r,next:a}}function Cv({state:n,actions:r,navigationOpen:o,inspectorExpanded:a,onOpenNavigation:d,onToggleInspector:f,onRevealSettings:h,onCreateSession:g,themePreference:w,onCycleTheme:j,onShowShortcuts:P,composerInsertion:C}){const O=n.sessions.find(E=>E.id===n.activeSessionId),R=Mo(n),z=m.useMemo(()=>Nv(n),[n.edits,n.research,n.subtasks,n.tools,n.transcript]),[L,q]=m.useState(tf),X=z.slice(-L),W=m.useRef(null),he=m.useRef(null),Z=m.useRef(!0),ee=m.useRef(null),[N,F]=m.useState(!0),[re,je]=m.useState(!1),xe=m.useMemo(()=>X.map(bv).filter(E=>E!==null),[X]),Y=m.useMemo(()=>rv(xe),[xe]),pe=yv({viewportRef:W,model:Y,activeSessionId:n.activeSessionId,onUserNavigate:()=>{Z.current=!1,F(!1)}});m.useEffect(()=>{const E=window.matchMedia("(prefers-reduced-motion: reduce)");je(E.matches);const K=T=>je(T.matches);return E.addEventListener("change",K),()=>E.removeEventListener("change",K)},[]),m.useEffect(()=>{q(tf),Z.current=!0,F(!0)},[n.activeSessionId]),m.useLayoutEffect(()=>{const E=W.current;if(E){if(ee.current){const K=ee.current;E.scrollTop=K.top+(E.scrollHeight-K.height),ee.current=null;return}Z.current&&(E.scrollTop=E.scrollHeight)}},[X.length,n.processing]),m.useLayoutEffect(()=>{const E=W.current,K=he.current;if(!E||!K||typeof ResizeObserver>"u")return;const T=new ResizeObserver(()=>{Z.current&&(E.scrollTop=E.scrollHeight)});return T.observe(K),()=>T.disconnect()},[n.activeSessionId]);const te=()=>{const E=W.current;if(!E)return;const K=E.scrollHeight-E.scrollTop-E.clientHeight<72;Z.current=K,F(K)},Ce=!!n.sessionSnapshot?.transcript.nextCursor,D=async()=>{const E=W.current;if(E&&(ee.current={height:E.scrollHeight,top:E.scrollTop}),z.length>X.length){q(K=>K+kv);return}if(Ce)try{await r.loadOlderTranscript(),q(K=>K+100)}catch{ee.current=null}},ue=()=>{const E=W.current;E&&(Z.current=!0,F(!0),E.scrollTo({top:E.scrollHeight,behavior:"smooth"}))},de=Sv(w);return i.jsxs("main",{className:"conversation-column",id:"main-content",children:[i.jsxs("header",{className:"conversation-header",children:[i.jsx("button",{type:"button",className:"icon-button mobile-nav-toggle",onClick:d,"aria-label":"打开会话导航","aria-controls":"workspace-rail","aria-expanded":o,children:i.jsx(Q,{name:"menu"})}),i.jsxs("div",{className:"conversation-identity",children:[i.jsxs("div",{className:"title-line",children:[i.jsx("h1",{tabIndex:-1,children:O?jr(O):"Orion Code"}),n.processing?i.jsx("span",{className:"running-pulse",children:"运行中"}):null]}),i.jsxs("p",{title:n.workspace,children:[O?.model??n.settings?.sections.defaults.model.effectiveValue??"本地工作台"," ","· ",Wv(n.workspace)]})]}),i.jsxs("div",{className:"header-actions",children:[i.jsx("button",{type:"button",className:"icon-button theme-cycle-button",onClick:j,"aria-label":`主题:${nf[de.current]},点击切换为${nf[de.next]}`,children:i.jsx(Q,{name:jv[de.current]})}),i.jsx("button",{type:"button",className:"icon-button shortcut-help-button",onClick:P,"aria-label":"键盘快捷键帮助",children:i.jsx(Q,{name:"keyboard"})}),i.jsx("button",{type:"button",className:"icon-button inspector-toggle",onClick:f,"aria-label":a?"关闭工作面板":"打开工作面板","aria-controls":"work-panel","aria-expanded":a,children:i.jsx(Q,{name:"sidebar"})})]})]}),n.bootstrap?.configured?null:i.jsxs("div",{className:"configuration-banner",role:"status",children:[i.jsx(Q,{name:"warning"}),i.jsxs("div",{children:[i.jsx("strong",{children:"模型尚未配置"}),i.jsx("span",{children:"请在 Orion 配置文件或环境变量中设置凭证。API Key 不会进入浏览器。"})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:h,children:"转到设置"})]}),i.jsxs("div",{className:"transcript-stage",children:[i.jsx("div",{className:"transcript-viewport",ref:W,role:"region","aria-label":"会话记录",tabIndex:0,onScroll:te,"aria-busy":n.processing,children:i.jsxs("div",{className:"transcript-content",ref:he,children:[z.length>X.length||Ce?i.jsx("button",{type:"button",className:"load-history",onClick:()=>{D()},disabled:!!n.pendingAction,children:z.length>X.length?`加载更早内容 · 还剩 ${z.length-X.length} 项`:"从持久记录加载更早内容"}):null,n.activeSessionId?R.status==="failed"&&X.length===0?i.jsx(mo,{icon:"warning",title:"会话快照加载失败",detail:R.error??"请重试当前会话快照。"}):(R.status==="loading"||R.status==="refreshing")&&X.length===0?i.jsx(mo,{icon:"refresh",title:"正在同步会话",detail:"本地 Web Host 正在读取最近的会话快照。"}):X.length===0?i.jsx(mo,{icon:"spark",title:"准备好开始了",detail:"描述要构建、修复或调查的任务。Orion 会实时展示工具、文件变化与验证结果。"}):i.jsx("ol",{className:"timeline","aria-label":"会话记录",children:X.map(E=>i.jsx("li",{id:`conversation-item-${n.activeSessionId??"none"}-${Ba(E)}`,"data-event-id":E.order,"data-order":E.order,ref:K=>pe.registerItem(E.order,K),children:Iv(E,n)},Ba(E)))}):i.jsx(mo,{icon:"workspace",title:"选择或创建一个会话",detail:"Orion 会在当前工作区运行,并沿用 CLI/TUI 的权限与持久化状态。",action:"创建会话",onAction:g}),n.processing?i.jsxs("div",{className:"thinking-indicator",role:"status",children:[i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{children:n.statusMessage||"Orion 正在处理…"})]}):null]})}),i.jsx(gv,{model:Y,activeOrder:pe.activeOrder,span:pe.span,hasEarlierHistory:z.length>X.length||Ce,processing:n.processing,reduceMotion:re,onJumpToOrder:(E,K)=>pe.scrollToOrder(E,K),onJumpToLatest:ue})]}),!N&&X.length>0?i.jsxs("button",{type:"button",className:"jump-latest",onClick:ue,children:[i.jsx(Q,{name:"arrow-up",size:15}),"回到最新"]}):null,i.jsxs("div",{className:"input-dock",children:[n.permission||n.queue.items.length>0?i.jsxs("div",{className:"input-transients",children:[n.permission?i.jsx(Av,{state:n,actions:r}):null,n.queue.items.length>0?i.jsx($v,{state:n,actions:r}):null]}):null,i.jsx(Wg,{state:n,actions:r,insertion:C})]})]})}function Nv(n){const r=new Set(n.tools.map(a=>a.callId));return[...n.transcript.filter(a=>!a.toolActivity?.callId||!r.has(a.toolActivity.callId)).map(a=>({kind:"transcript",order:a.order,value:a})),...n.tools.map(a=>({kind:"tool",order:a.order,value:a})),...n.edits.map(a=>({kind:"edit",order:a.order,value:a})),...n.subtasks.map(a=>({kind:"subtask",order:a.order,value:a})),...n.research.map(a=>({kind:"research",order:a.order,value:a}))].sort((a,d)=>a.order-d.order)}function Ba(n){return n.kind==="transcript"?`entry-${n.value.id}`:n.kind==="tool"?`tool-${n.value.callId}`:n.kind==="edit"?`edit-${n.order}`:n.kind==="subtask"?`subtask-${n.value.taskId}`:`research-${n.value.packetId}`}function bv(n){const r=n.order,o=Ba(n);if(n.kind==="tool")return{order:r,key:o,kind:"tool",label:Hs(n.value.summary)||n.value.name,preview:Zr(n.value.summary),priority:n.value.state==="error"?"error":"activity"};if(n.kind==="edit")return{order:r,key:o,kind:"edit",label:n.value.request.path,preview:Zr(`${n.value.request.path}
20
+ ${n.value.request.newString??""}`),priority:"activity"};if(n.kind==="subtask")return{order:r,key:o,kind:"subtask",label:Hs(n.value.objective)||n.value.role,preview:Zr(n.value.summary||n.value.objective),priority:_v.has(n.value.state)?"error":"activity"};if(n.kind==="research")return{order:r,key:o,kind:"research",label:Hs(n.value.objective)||"Research",preview:Zr(n.value.conclusion||n.value.objective),priority:n.value.stage==="failed"?"error":"activity"};const a=n.value;if(a.toolActivity){const g=a.toolActivity;return{order:r,key:o,kind:"tool",label:Hs(g.summary)||g.name||g.detail||"工具活动",preview:Zr(g.summary||g.body),priority:g.state==="error"?"error":"activity"}}const d=a.role;let f;return d==="user"||d==="assistant"?f="turn":f=d==="error"||d==="command"&&a.command?.success===!1?"error":"activity",(a.errorLayer||a.budgetStop)&&(f="error"),{order:r,key:o,kind:d==="user"?"user":d==="assistant"?"assistant":"system",priority:f,label:Hs(a.content)||a.title||(d==="user"?"用户任务":d==="assistant"?"Orion 回复":qa(d)),preview:Zr(a.content)}}const _v=new Set(["failed","timed_out","rejected","cancelled"]);function Hs(n){if(!n)return null;const r=n.replace(/\s+/gu," ").trim();return r.length>80?`${r.slice(0,80)}…`:r}function Zr(n){if(!n)return;const r=n.trim();if(r)return r.length<=280?r:`${r.slice(0,280)}…`}function Iv(n,r){if(n.kind==="transcript")return i.jsx(Ev,{entry:n.value});if(n.kind==="tool"){const o=r.transcript.find(a=>a.toolActivity?.callId===n.value.callId)?.toolActivity;return i.jsx(Pv,{tool:n.value,activity:o})}return n.kind==="edit"?i.jsx(Tv,{edit:n.value}):n.kind==="subtask"?i.jsx(Mv,{subtask:n.value}):i.jsx(Ov,{research:n.value})}function Ev({entry:n}){if(n.toolActivity)return i.jsx(Rv,{entry:n});if(Dv(n))return i.jsxs("details",{className:"reasoning-card",children:[i.jsxs("summary",{children:[i.jsx(Xa,{state:n.live?"running":"ready",describe:!1}),i.jsx("span",{children:n.live?"正在分析":n.title||"推理摘要"}),i.jsx("span",{className:"reasoning-hint",children:"展开查看 Runtime 提供的摘要"})]}),i.jsx(Xs,{children:n.content})]});const r=n.role;return i.jsxs("article",{className:`message-card role-${r}`,"aria-label":qa(r),children:[i.jsxs("header",{children:[i.jsx("span",{className:"message-avatar","aria-hidden":"true",children:zv(r)}),i.jsx("span",{children:n.title||qa(r)}),n.live?i.jsx("span",{className:"streaming-label",children:"生成中"}):null,n.command?i.jsx("span",{className:`command-state ${n.command.success?"success":"error"}`,children:n.command.success?"成功":"失败"}):null]}),i.jsx("div",{className:"message-body",children:r==="user"?i.jsx("p",{className:"literal-message",children:n.content}):i.jsx(Xs,{children:n.content})}),n.budgetStop?i.jsxs("div",{className:"budget-stop",role:"status",children:[i.jsx(Q,{name:"pause",size:15}),i.jsxs("span",{children:[n.budgetStop.reason," · 状态已保留"]})]}):null]})}function Pv({tool:n,activity:r}){const o=n.workspaceMutation?.phase==="queued"?`等待工作树写入${n.workspaceMutation.queuePosition?`(第 ${n.workspaceMutation.queuePosition} 位)`:""}`:n.workspaceMutation?.phase==="running"?"正在写入工作树":n.state==="running"?"运行中":n.state==="success"?"完成":n.state==="skipped"?"跳过":"失败",a=r?.outputView?.preview||r?.body||n.error||n.summary;return i.jsxs("article",{className:`tool-card tool-${n.state}`,"aria-label":`工具 ${n.name}:${o}`,children:[i.jsxs("div",{className:"tool-card-header",children:[i.jsx("span",{className:`tool-state-icon ${n.state}`,"aria-hidden":"true",children:n.state==="running"?i.jsx("span",{className:"spinner"}):i.jsx(Q,{name:n.state==="success"?"check":n.state==="skipped"?"pause":"warning",size:15})}),i.jsxs("div",{className:"tool-title",children:[i.jsx("strong",{children:n.name}),i.jsxs("span",{children:["#",n.sequence," · ",o,n.duration!==void 0?` · ${ep(n.duration)}`:""]})]}),n.outputBytes!==void 0?i.jsx("span",{className:"byte-pill",children:Ua(n.outputBytes)}):null]}),n.summary||n.error?i.jsx("p",{className:n.error?"tool-error-copy":"tool-summary",children:Rn(n.error||n.summary||"")}):null,i.jsxs("details",{className:"tool-details",open:n.state==="error",children:[i.jsx("summary",{children:"输入与详情"}),i.jsxs("dl",{className:"tool-meta-grid",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"授权"}),i.jsx("dd",{children:n.authorization?`${n.authorization.approved?"允许":"拒绝"} · ${n.authorization.source}`:"等待 Runtime 记录"})]}),n.artifactId?i.jsxs("div",{children:[i.jsx("dt",{children:"产物"}),i.jsx("dd",{children:i.jsx("code",{children:n.artifactId})})]}):null]}),i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"参数(已脱敏)"}),i.jsx("pre",{tabIndex:0,children:Ka(n.args)})]}),a?i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"输出预览"}),i.jsx(Zf,{text:a,defaultOpen:n.state==="error",note:r?.outputView?.omittedBytes?`另有 ${Ua(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})]})}function Rv({entry:n}){const r=n.toolActivity;return i.jsxs("article",{className:`tool-card tool-${r.state}`,children:[i.jsxs("div",{className:"tool-card-header",children:[i.jsx("span",{className:`tool-state-icon ${r.state}`,"aria-hidden":"true",children:i.jsx(Q,{name:"terminal",size:15})}),i.jsxs("div",{className:"tool-title",children:[i.jsx("strong",{children:r.name}),i.jsx("span",{children:r.detail})]})]}),r.summary?i.jsx("p",{className:"tool-summary",children:r.summary}):null,r.outputView?.preview||r.body?i.jsxs("div",{className:"tool-detail-section tool-output-section",children:[i.jsx("span",{className:"micro-label",children:"输出"}),i.jsx(Zf,{text:r.outputView?.preview||r.body,defaultOpen:r.state==="error",note:r.outputView?.omittedBytes?`另有 ${Ua(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})}function Tv({edit:n}){const r=n.request;return i.jsxs("article",{className:"edit-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"edit-icon",children:i.jsx(Q,{name:"edit",size:15})}),i.jsxs("div",{children:[i.jsx("strong",{children:"文件修改预览"}),i.jsxs("span",{children:[r.kind," · ",r.candidates.length," 个候选"]})]})]}),i.jsx("code",{className:"path-chip",title:r.path,children:r.path}),i.jsxs("details",{children:[i.jsx("summary",{children:"查看替换内容"}),i.jsx("pre",{tabIndex:0,children:Rn(r.newString)})]})]})}function Mv({subtask:n}){return i.jsxs("details",{className:`activity-card subtask-card state-${n.state}`,children:[i.jsxs("summary",{children:[i.jsx(Q,{name:"branch",size:16}),i.jsxs("span",{children:[i.jsx("strong",{children:n.role}),i.jsx("small",{children:n.state})]}),n.durationMs!==void 0?i.jsx("time",{children:ep(n.durationMs)}):null]}),i.jsx("p",{children:n.objective}),n.summary?i.jsx(Xs,{children:n.summary}):null]})}function Ov({research:n}){return i.jsxs("details",{className:`activity-card research-card state-${n.stage}`,children:[i.jsxs("summary",{children:[i.jsx(Q,{name:"search",size:16}),i.jsxs("span",{children:[i.jsx("strong",{children:"Research"}),i.jsxs("small",{children:[n.stage," · ",n.sources.length," sources"]})]})]}),n.objective?i.jsx("p",{children:n.objective}):null,n.conclusion?i.jsx(Xs,{children:n.conclusion}):null,n.sources.length>0?i.jsx("ul",{className:"source-list",children:n.sources.map(r=>i.jsxs("li",{children:[i.jsx(Xa,{state:r.status}),i.jsx("span",{children:r.title||r.location||r.id}),i.jsxs("small",{children:[r.provider," · ",r.status]})]},r.id))}):null]})}function Av({state:n,actions:r}){const o=n.permission,a=m.useRef(null),d=m.useRef("");m.useEffect(()=>{d.current!==o.id&&(d.current=o.id,a.current?.focus())},[o.id]);const f=!!n.pendingAction||n.connection!=="live"||!Sr(n);return i.jsxs("section",{ref:a,className:"approval-card",role:"region","aria-live":"assertive","aria-labelledby":"approval-title","aria-describedby":"approval-reason",tabIndex:-1,children:[i.jsxs("div",{className:"approval-heading",children:[i.jsx("span",{className:"approval-icon",children:i.jsx(Q,{name:"warning",size:17})}),i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"需要你的确认"}),i.jsxs("h2",{id:"approval-title",children:["允许 ",o.name,"?"]})]})]}),i.jsx("p",{id:"approval-reason",children:o.reason||"该工具需要在当前权限策略下获得明确授权。"}),i.jsxs("details",{className:"approval-args",children:[i.jsx("summary",{children:"查看脱敏参数"}),i.jsx("pre",{tabIndex:0,children:Ka(o.args,6e3)})]}),i.jsxs("div",{className:"approval-actions",children:[i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>Pn(r.answerPermission(!1)),disabled:f,children:"拒绝"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Pn(r.answerPermission(!0,"once")),disabled:f,children:"仅本次"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Pn(r.answerPermission(!0,"project")),disabled:f,children:"允许此项目"}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>Pn(r.answerPermission(!0,"global")),disabled:f,children:"始终允许"})]}),i.jsx("p",{className:"approval-footnote",children:"项目与全局授权会写入 Orion 配置;拒绝不会丢失当前会话。"})]})}function $v({state:n,actions:r}){const o=!!n.pendingAction||n.connection!=="live"||!Sr(n);return i.jsxs("details",{className:"queue-dock",children:[i.jsxs("summary",{children:[i.jsxs("span",{children:[n.queue.items.length," 条排队消息"]}),i.jsx("span",{children:"执行时采用最新 Composer 控制"})]}),i.jsxs("div",{className:"queue-list",children:[n.queue.items.map((a,d)=>i.jsx(Lv,{item:a,index:d,count:n.queue.items.length,disabled:o,actions:r},a.id)),i.jsx("button",{type:"button",className:"text-button queue-clear",onClick:()=>Pn(r.clearQueue()),disabled:o,children:"清空队列"})]})]})}function Lv({item:n,index:r,count:o,disabled:a,actions:d}){const[f,h]=m.useState(!1),[g,w]=m.useState(n.text);m.useEffect(()=>w(n.text),[n.text]);const j=async()=>{const P=g.trim();P&&(await d.editQueued(n.id,n.revision,P),h(!1))};return i.jsxs("div",{className:"queue-row",children:[i.jsx("span",{className:"queue-index",children:r+1}),f?i.jsx("textarea",{rows:2,value:g,"aria-label":`编辑排队消息 ${r+1}`,onChange:P=>w(P.target.value)}):i.jsx("p",{children:n.text}),i.jsxs("div",{className:"queue-row-actions",children:[i.jsx("button",{type:"button",className:"icon-button","aria-label":`上移排队消息 ${r+1}`,onClick:()=>Pn(d.moveQueued(n.id,n.revision,r-1)),disabled:a||r===0,children:i.jsx(Q,{name:"arrow-up",size:13})}),i.jsx("button",{type:"button",className:"icon-button queue-move-down","aria-label":`下移排队消息 ${r+1}`,onClick:()=>Pn(d.moveQueued(n.id,n.revision,r+1)),disabled:a||r===o-1,children:i.jsx(Q,{name:"arrow-up",size:13})}),f?i.jsx("button",{type:"button",className:"text-button",onClick:()=>Pn(j()),disabled:a||!g.trim(),children:"保存"}):i.jsx("button",{type:"button",className:"text-button",onClick:()=>h(!0),disabled:a,children:"编辑"}),i.jsx("button",{type:"button",className:"icon-button","aria-label":`移除排队消息 ${r+1}`,onClick:()=>Pn(d.removeQueued(n.id,n.revision)),disabled:a,children:i.jsx(Q,{name:"trash",size:14})})]})]})}function mo({icon:n,title:r,detail:o,action:a,onAction:d}){return i.jsxs("section",{className:"empty-conversation",children:[i.jsx("div",{className:"empty-orbit",children:i.jsx(Q,{name:n,size:26})}),i.jsx("h2",{children:r}),i.jsx("p",{children:o}),a&&d?i.jsx("button",{type:"button",className:"primary-button",onClick:d,children:a}):null]})}function Dv(n){const r=`${n.title??""}`.toLocaleLowerCase();return r.includes("reason")||r.includes("think")||r.includes("analysis")||r.includes("推理")||r.includes("思考")}function qa(n){return n==="user"?"你":n==="assistant"?"Orion":n==="command"?"命令":n==="error"?"错误":n==="system"?"系统":n==="status"?"状态":"工具"}function zv(n){return n==="user"?"Y":n==="assistant"?"O":n==="error"?"!":n==="command"?"›":"·"}function Pn(n){n.catch(()=>{})}function ep(n){return n<1e3?`${Math.round(n)}ms`:n<6e4?`${(n/1e3).toFixed(n<1e4?1:0)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function Ua(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function Wv(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function Do({open:n,onClose:r,labelledBy:o,describedBy:a,className:d="",children:f}){const h=m.useRef(null);m.useEffect(()=>{const w=h.current;w&&(n&&!w.open&&w.showModal(),!n&&w.open&&w.close())},[n]);const g=w=>{w.target===w.currentTarget&&r()};return i.jsx("dialog",{ref:h,className:`modal ${d}`.trim(),"aria-labelledby":o,"aria-describedby":a,onCancel:w=>{w.preventDefault(),r()},onClose:r,onClick:g,children:f})}function Fv({open:n,onClose:r,state:o,onSelect:a,onLoadMore:d}){const[f,h]=m.useState(""),[g,w]=m.useState(""),[j,P]=m.useState(!1),[C,O]=m.useState(!1);m.useEffect(()=>{n&&(h(""),w(""),P(!1),O(!1))},[n]);const R=!!o.pendingAction||j,z=o.workspaces.slice(0,3),L=o.workspaces.slice(3),q=async W=>{const he=W.trim();if(he){if(he===o.workspace){w("该目录已经是当前工作区。");return}w(""),P(!0);try{await a(he),r()}catch(Z){w(Z instanceof Error?Z.message:"工作区切换失败。")}finally{P(!1)}}},X=W=>{W.preventDefault(),q(f)};return i.jsxs(Do,{open:n,onClose:r,labelledBy:"workspace-dialog-title",describedBy:"workspace-dialog-description",className:"workspace-modal",children:[i.jsxs("div",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"LOCAL WORKSPACE"}),i.jsx("h2",{id:"workspace-dialog-title",children:"打开或新增项目"}),i.jsx("p",{id:"workspace-dialog-description",children:"选择一个本地目录作为项目;Host 会解析真实路径并拒绝无效目录。"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭工作区选择",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"workspace-options",role:"group","aria-label":"常用工作区",children:[z.map(W=>i.jsx(rf,{workspace:W,locked:R,onSelect:q},W.id)),L.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"text-button workspace-toggle-all","aria-expanded":C,onClick:()=>O(W=>!W),children:C?"收起其他工作区":`其他工作区(${L.length})`}),C?L.map(W=>i.jsx(rf,{workspace:W,locked:R,onSelect:q},W.id)):null]}):null,o.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{d()},disabled:R,children:"加载更多工作区"}):null]}),i.jsxs("form",{className:"workspace-path-form",onSubmit:X,children:[i.jsx("label",{htmlFor:"workspace-path-input",children:"打开其他本地目录"}),i.jsxs("div",{className:"path-input-row",children:[i.jsx("input",{id:"workspace-path-input",value:f,onChange:W=>{h(W.target.value),g&&w("")},placeholder:"/Users/name/project",spellCheck:!1,autoComplete:"off"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!f.trim()||R,children:j?"打开中…":"打开"})]}),g?i.jsx("p",{className:"field-error",role:"alert",children:g}):null]})]})}function rf({workspace:n,locked:r,onSelect:o}){return i.jsxs("button",{type:"button",className:`workspace-option ${n.active?"active":""}`,disabled:n.active||!n.available||r,onClick:()=>{o(n.path)},children:[i.jsx("span",{className:"workspace-icon",children:i.jsx(Q,{name:"workspace",size:17})}),i.jsxs("span",{children:[i.jsx("strong",{children:n.label||Gf(n.path)}),i.jsx("small",{title:n.path,children:n.path})]}),n.active?i.jsx("span",{className:"current-pill",children:"当前"}):n.available?i.jsx(Q,{name:"chevron",size:15}):i.jsx("span",{className:"current-pill",children:"不可用"})]})}function Bv({open:n,onClose:r,session:o,pending:a,onRename:d}){const[f,h]=m.useState(""),[g,w]=m.useState(""),j=o?.id;m.useEffect(()=>{n&&o&&(h(jr(o)),w(""))},[n,j]);const P=async C=>{if(C.preventDefault(),!(!o||!f.trim())){w("");try{await d(o.id,f.trim()),r()}catch(O){w(O instanceof Error?O.message:"重命名失败,请重试。")}}};return i.jsx(Do,{open:n,onClose:r,labelledBy:"rename-title",className:"rename-modal",children:i.jsxs("form",{onSubmit:P,children:[i.jsxs("header",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"rename-title",children:"重命名会话"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭重命名窗口",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"rename-body",children:[i.jsx("label",{htmlFor:"session-name",children:"会话名称"}),i.jsx("input",{id:"session-name",value:f,onChange:C=>{h(C.target.value),g&&w("")},maxLength:120,autoFocus:!0}),g?i.jsx("p",{className:"field-error",role:"alert",children:g}):null]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:a||!f.trim(),children:a?"保存中…":"保存"})]})]})})}const sf=8;function qv({open:n,onClose:r,session:o,pending:a,onSave:d}){const[f,h]=m.useState(()=>o?.tags?[...o.tags]:[]),[g,w]=m.useState(""),[j,P]=m.useState(""),C=o?.id;m.useEffect(()=>{n&&o&&(h(o.tags??[]),w(""),P(""))},[n,C]);const O=()=>{const L=g.trim().slice(0,32);if(w(""),!!L&&!f.includes(L)){if(f.length>=sf){P(`最多 ${sf} 个标签。`);return}h([...f,L]),P("")}},R=L=>h(f.filter(q=>q!==L)),z=async L=>{if(L.preventDefault(),!!o){P("");try{await d(o.id,f),r()}catch(q){P(q instanceof Error?q.message:"保存标签失败,请重试。")}}};return i.jsx(Do,{open:n,onClose:r,labelledBy:"session-tags-title",className:"tags-modal",children:i.jsxs("form",{onSubmit:z,children:[i.jsxs("header",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"session-tags-title",children:"管理会话标签"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭标签窗口",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"session-tags-body",children:[o?i.jsx("p",{className:"modal-description",children:jr(o)}):null,i.jsx("div",{className:"session-tags-chips",role:"list","aria-label":"当前标签",children:f.length===0?i.jsx("span",{className:"session-tags-empty",children:"还没有标签,输入后回车添加。"}):f.map(L=>i.jsxs("span",{className:"session-tag-chip",role:"listitem",children:[L,i.jsx("button",{type:"button",className:"icon-button session-tag-remove","aria-label":`移除标签 ${L}`,onClick:()=>R(L),children:i.jsx(Q,{name:"close",size:11})})]},L))}),i.jsx("label",{htmlFor:"session-tag-input",children:"新标签"}),i.jsx("input",{id:"session-tag-input",value:g,onChange:L=>{w(L.target.value),j&&P("")},onKeyDown:L=>{(L.key==="Enter"||L.key===","||L.key===",")&&(L.preventDefault(),O())},placeholder:"回车或逗号添加",maxLength:32,autoFocus:!0}),j?i.jsx("p",{className:"field-error",role:"alert",children:j}):null]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:a?"保存中…":"保存"})]})]})})}function Uv({open:n,onClose:r,session:o,pending:a,onConfirm:d}){const f=async()=>{if(o)try{await d(o.id),r()}catch{}};return i.jsxs(Do,{open:n,onClose:r,labelledBy:"confirm-delete-title",describedBy:"confirm-delete-description",className:"delete-modal",children:[i.jsxs("div",{className:"modal-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"SESSION"}),i.jsx("h2",{id:"confirm-delete-title",children:"删除会话"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭删除确认",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("p",{id:"confirm-delete-description",className:"confirm-delete-body",children:["将永久删除会话",i.jsx("strong",{children:o?`「${jr(o)}」`:""}),"及其全部记录(消息、文件变更、目标与检查点)。此操作不可恢复。"]}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:"danger-button",disabled:a,onClick:()=>{f()},children:a?"删除中…":"永久删除"})]})]})}const Hv=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function bo(n,r){return r==="appearance.style"?n.sections.appearance.style:r==="appearance.theme"?n.sections.appearance.theme:r==="appearance.motion"?n.sections.appearance.motion:r==="defaults.model"?n.sections.defaults.model:r==="defaults.effort"?n.sections.defaults.effort:n.sections.permissions.toolConfirmation}function Vv(n){return{"appearance.style":n.sections.appearance.style.effectiveValue,"appearance.theme":n.sections.appearance.theme.effectiveValue,"appearance.motion":n.sections.appearance.motion.effectiveValue,"defaults.model":n.sections.defaults.model.effectiveValue,"defaults.effort":n.sections.defaults.effort.effectiveValue,"permissions.toolConfirmation":n.sections.permissions.toolConfirmation.effectiveValue}}function xr(n){return{openedAtRevision:n.revision,workspace:n.workspace,base:n,values:Yv(n),intents:{},serverLatest:null}}function tp(n,r,o){const a=En(n.base,r),d={...n.values,[r]:o},f={...n.intents};return Object.is(o,a)?delete f[r]:f[r]={op:"set",value:o},{...n,values:d,intents:f,serverLatest:null}}function np(n,r){const o=bo(n.base,r),a={...n.intents};return o.explicitValue===void 0?(delete a[r],{...n,values:{...n.values,[r]:En(n.base,r)},intents:a,serverLatest:null}):(a[r]={op:"unset"},{...n,values:{...n.values,[r]:o.inheritedValue??o.effectiveValue},intents:a,serverLatest:null})}function of(n,r){return{...n,serverLatest:r}}function Kv(n){const r=n.serverLatest;if(!r)return n;let o=xr(r);for(const a of Cr(n)){const d=n.intents[a];if(d){if(d.op==="unset"){o=np(o,a);continue}o=tp(o,a,d.value)}}return o}function Cr(n){return Hv.filter(r=>n.intents[r]!==void 0)}function Gv(n){return Cr(n).map(r=>{const o=n.intents[r];return o.op==="unset"?{op:"unset",key:r}:{op:"set",key:r,value:o.value}})}function Qv(n){return n.serverLatest?Cr(n).filter(r=>{const o=bo(n.base,r),a=bo(n.serverLatest,r);return!Object.is(o.effectiveValue,a.effectiveValue)||!Object.is(o.explicitValue,a.explicitValue)||o.overridden!==a.overridden||o.source!==a.source}):[]}function En(n,r){const o=bo(n,r);return o.explicitValue??o.effectiveValue}function Yv(n){const r=Vv(n);return{"appearance.style":En(n,"appearance.style")??r["appearance.style"],"appearance.theme":En(n,"appearance.theme")??r["appearance.theme"],"appearance.motion":En(n,"appearance.motion")??r["appearance.motion"],"defaults.model":En(n,"defaults.model")??r["defaults.model"],"defaults.effort":En(n,"defaults.effort")??r["defaults.effort"],"permissions.toolConfirmation":En(n,"permissions.toolConfirmation")??r["permissions.toolConfirmation"]}}const _o={phase:"closed",section:"general",draft:null,message:null,problemCode:null,confirmDiscard:!1};function Xv(n,r){switch(r.type){case"open":return{..._o,phase:"ready",draft:xr(r.document)};case"close":return _o;case"select_section":return{...n,section:r.section,confirmDiscard:!1};case"set_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:tp(n.draft,r.key,r.value),message:null,problemCode:null,confirmDiscard:!1};case"reset_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:np(n.draft,r.key),message:null,problemCode:null,confirmDiscard:!1};case"save_started":return{...n,phase:"saving",message:"正在原子应用设置…",problemCode:null,confirmDiscard:!1};case"save_succeeded":return{...n,phase:"success",draft:xr(r.document),message:"设置已安全保存并应用。",problemCode:null,confirmDiscard:!1};case"save_failed":{if(!n.draft)return n;const o=r.code==="settings_revision_conflict";return{...n,phase:o?"conflict":"rejected",draft:r.latest?of(n.draft,r.latest):n.draft,message:r.message,problemCode:r.code,confirmDiscard:!1}}case"server_updated":{if(!n.draft)return{...n,phase:"ready",draft:xr(r.document)};if(n.phase==="saving")return n;if(n.draft.base.revision===r.document.revision){const o=Cr(n.draft).length>0;return{...n,draft:o?{...n.draft,base:r.document}:xr(r.document)}}return n.draft.workspace!==r.document.workspace||Cr(n.draft).length===0?{...n,phase:"ready",draft:xr(r.document),message:"已采用 Host 的最新设置。",problemCode:null,confirmDiscard:!1}:{...n,phase:"conflict",draft:of(n.draft,r.document),message:"Host 设置已更新。你的草稿仍被保留,请选择如何继续。",problemCode:"settings_revision_conflict",confirmDiscard:!1}}case"adopt_server":return n.draft?.serverLatest?{...n,phase:"ready",draft:xr(n.draft.serverLatest),message:"已采用服务器最新值。",problemCode:null}:n;case"rebase":return n.draft?.serverLatest?{...n,phase:"ready",draft:Kv(n.draft),message:"草稿已基于服务器最新值重放;请确认后再次应用。",problemCode:null}:n;case"request_discard":return{...n,confirmDiscard:!0};case"cancel_discard":return{...n,confirmDiscard:!1};case"clear_status":return{...n,phase:"ready",message:null,problemCode:null}}}const Jv=["auto","none","minimal","low","medium","high","xhigh","max"],Zv=[{id:"general",label:"General",icon:"settings"},{id:"models",label:"Models & Reasoning",icon:"spark"},{id:"permissions",label:"Permissions",icon:"warning"},{id:"advanced",label:"Advanced",icon:"diagnostics"}];function ey({open:n,onClose:r,state:o,actions:a,onGoToSessionControls:d}){const f=m.useRef(null),h=m.useRef(null),g=m.useRef(null),w=m.useRef(null),j=m.useRef(null),P=m.useRef(!1),C=m.useRef(null),O=m.useRef(_o.phase),[R,z]=m.useReducer(Xv,_o),[L,q]=m.useState(!1),[X,W]=m.useState(!1),[he,Z]=m.useState(null),ee=o.settings??o.settingsMirror.lastGood,N=ee&&(!o.workspace||ee.workspace===o.workspace)?ee:null;m.useEffect(()=>{const D=f.current;D&&(n&&!D.open&&D.showModal(),!n&&D.open&&D.close())},[n]),m.useEffect(()=>{if(n&&!P.current)N&&(z({type:"open",document:N}),j.current=N),q(!1),W(!1),Z(null);else if(n&&N&&j.current===null)z({type:"open",document:N}),j.current=N;else if(n&&N&&j.current!==null&&j.current!==N){if(R.phase==="saving")return;j.current=N,z({type:"server_updated",document:N})}else!n&&P.current&&(z({type:"close"}),j.current=null,C.current=null);P.current=n},[N,R.phase,n]),m.useEffect(()=>{R.confirmDiscard&&g.current?.focus()},[R.confirmDiscard]),m.useEffect(()=>{const D=O.current;if(O.current=R.phase,!n||D!=="saving"||R.phase!=="success")return;const ue=uf();f.current?.contains(ue)||h.current?.focus()},[R.phase,n]),m.useEffect(()=>{!n||N||o.settingsMirror.status==="loading"||a.refreshSettings().catch(()=>{})},[a,N,n,o.settingsMirror.status]),m.useEffect(()=>{!n||!R.draft||!o.workspace||R.draft.workspace!==o.workspace&&(z({type:"close"}),j.current=null)},[R.draft,n,o.workspace]);const F=R.draft,re=F?Cr(F):[],je=re.length>0,xe=o.processing&&re.some(D=>["defaults.effort","permissions.toolConfirmation"].includes(D)),Y=()=>{if(R.phase!=="saving"){if(je){const D=uf();w.current=D instanceof HTMLElement?D:null,z({type:"request_discard"});return}z({type:"close"}),r()}},pe=()=>{z({type:"close"}),r()},te=async D=>{if(D.preventDefault(),!F||!je||R.phase==="saving"||R.phase==="conflict")return;const ue=Gv(F),de=C.current??We();C.current=de,z({type:"save_started"});try{const E=await a.updateSettings(F.base.revision,ue,de);C.current=null,j.current=E.settings,z({type:"save_succeeded",document:E.settings})}catch(E){const K=E instanceof Ie?E.code??"settings_rejected":"network";let T;K==="settings_revision_conflict"?(C.current=null,T=await a.refreshSettings().catch(()=>{}),T&&(j.current=T)):E instanceof Ie&&E.status<500&&(C.current=null);const y=K==="settings_revision_conflict"&&!T?"settings_recovery_required":K;z({type:"save_failed",code:y,message:ay(y,E),...T?{latest:T}:{}})}},Ce=D=>{D.target===D.currentTarget&&Y()};return i.jsx("dialog",{id:"settings-dialog",ref:f,className:"modal settings-modal","aria-modal":"true","aria-labelledby":"settings-title","aria-describedby":"settings-description",onCancel:D=>{D.preventDefault(),Y()},onClick:Ce,children:i.jsxs("form",{onSubmit:te,children:[i.jsxs("header",{className:"modal-header settings-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"HOST SETTINGS"}),i.jsx("h2",{id:"settings-title",children:"设置"}),i.jsx("p",{id:"settings-description",children:"由本地 Host 读取、校验并原子保存。"})]}),i.jsx("button",{ref:h,type:"button",className:"icon-button",onClick:Y,"aria-label":"关闭设置",disabled:R.phase==="saving",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"settings-layout",children:[i.jsx("nav",{className:"settings-navigation","aria-label":"设置类别",children:Zv.map(D=>i.jsxs("button",{type:"button",className:R.section===D.id?"active":"","aria-current":R.section===D.id?"page":void 0,onClick:()=>z({type:"select_section",section:D.id}),children:[i.jsx(Q,{name:D.icon,size:16}),i.jsx("span",{children:D.label})]},D.id))}),i.jsxs("div",{className:"settings-content",children:[i.jsx(oy,{state:o}),F?i.jsxs(i.Fragment,{children:[R.phase==="conflict"?i.jsx(ly,{draft:F,onAdopt:()=>{C.current=null,z({type:"adopt_server"})},onRebase:()=>{C.current=null,z({type:"rebase"})}}):null,R.message&&R.phase!=="conflict"?i.jsxs("div",{className:`settings-inline-message settings-message-${R.phase}`,role:R.phase==="rejected"?"alert":"status","aria-live":R.phase==="rejected"?"assertive":"polite",children:[i.jsx(Q,{name:R.phase==="success"?"check":"info",size:16}),i.jsx("span",{children:R.message})]}):null,R.section==="general"?i.jsx(ty,{document:F.base,draft:F.values,dirtyKeys:re,saving:R.phase==="saving",onSet:(D,ue)=>z({type:"set_value",key:D,value:ue}),onReset:D=>z({type:"reset_value",key:D})}):null,R.section==="models"?i.jsx(ry,{document:F.base,draft:F.values,dirtyKeys:re,runtimeBusy:o.processing,saving:R.phase==="saving",onGoToSessionControls:d,onSet:(D,ue)=>z({type:"set_value",key:D,value:ue}),onReset:D=>z({type:"reset_value",key:D})}):null,R.section==="permissions"?i.jsx(sy,{document:F.base,value:F.values["permissions.toolConfirmation"],dirtyKeys:re,runtimeBusy:o.processing,saving:R.phase==="saving",confirmAllow:L,allowAcknowledged:X,onAllowRequested:()=>{W(!1),q(!0)},onAllowAcknowledged:W,onConfirmAllow:()=>{z({type:"set_value",key:"permissions.toolConfirmation",value:"allow"}),q(!1),W(!1)},onCancelAllow:()=>{q(!1),W(!1)},onSet:D=>z({type:"set_value",key:"permissions.toolConfirmation",value:D}),onReset:()=>z({type:"reset_value",key:"permissions.toolConfirmation"})}):null,R.section==="advanced"?i.jsx(iy,{state:o,document:F.base,documentAction:he,onOpenDocument:()=>{Z({tone:"status",message:"正在请求 Host 打开设置文件…"}),a.openSettingsDocument().then(()=>Z({tone:"status",message:"已交给系统默认编辑器打开。"})).catch(D=>Z({tone:"error",message:D instanceof Error?D.message:"无法打开设置文件。"}))},onRefresh:()=>{Z({tone:"status",message:"正在重新载入 Host 设置…"}),a.refreshSettings().then(()=>Z({tone:"status",message:"已载入最新设置。"})).catch(D=>Z({tone:"error",message:D instanceof Error?D.message:"重新载入失败。"}))}}):null]}):i.jsxs("section",{className:"settings-empty","aria-live":"polite",children:[i.jsx(Q,{name:"refresh"}),i.jsx("h3",{children:"正在读取设置"}),i.jsx("p",{children:"等待本地 Host 返回可验证的设置快照。"})]})]})]}),R.confirmDiscard?i.jsxs("div",{className:"settings-discard-confirm",role:"alertdialog","aria-labelledby":"settings-discard-title","aria-describedby":"settings-discard-description",children:[i.jsxs("div",{children:[i.jsx("strong",{id:"settings-discard-title",children:"放弃未应用的更改?"}),i.jsxs("p",{id:"settings-discard-description",children:["你的 ",re.length," 项草稿尚未写入 Host。"]})]}),i.jsxs("div",{children:[i.jsx("button",{ref:g,type:"button",className:"secondary-button",onClick:()=>{z({type:"cancel_discard"});const D=w.current;requestAnimationFrame(()=>D?.focus())},children:"继续编辑"}),i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:pe,children:"放弃更改"})]})]}):null,i.jsxs("footer",{className:"modal-footer settings-footer",children:[i.jsx("span",{className:"settings-dirty-summary","aria-live":"polite",children:je?`${re.length} 项未应用`:"没有未应用的更改"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:Y,disabled:R.phase==="saving",children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!F||!je||R.phase==="saving"||R.phase==="conflict"||xe||F.base.state!=="ready"||!F.base.writable,children:R.phase==="saving"?"应用中…":`应用 ${re.length} 项`})]})]})})}function ty({document:n,draft:r,dirtyKeys:o,saving:a,onSet:d,onReset:f}){const h=n.sections.appearance.style,g=n.sections.appearance.theme,w=n.sections.appearance.motion;return i.jsxs(zo,{heading:"通用",detail:"外观偏好由 Host 保存,并在所有 Workbench 窗口保持一致。",children:[i.jsx(is,{id:"settings-style",label:"视觉风格",description:"选择内置的方块工坊外观,或切回经典工作台。",field:h,dirty:o.includes("appearance.style"),onReset:()=>f("appearance.style"),disabled:a||!tn(n,h),children:i.jsxs("select",{id:"settings-style",value:r["appearance.style"],disabled:a||!tn(n,h),onChange:j=>d("appearance.style",j.target.value),children:[i.jsx("option",{value:"orion-blocksmith",children:"方块工坊(内置,默认)"}),i.jsx("option",{value:"classic",children:"经典"})]})}),i.jsx(is,{id:"settings-theme",label:"主题",description:"跟随系统或固定使用浅色、深色。",field:g,dirty:o.includes("appearance.theme"),onReset:()=>f("appearance.theme"),disabled:a||!tn(n,g),children:i.jsxs("select",{id:"settings-theme",value:r["appearance.theme"],disabled:a||!tn(n,g),onChange:j=>d("appearance.theme",j.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"dark",children:"深色"}),i.jsx("option",{value:"light",children:"浅色"})]})}),i.jsxs("figure",{className:"appearance-preview","data-preview-style":r["appearance.style"],"data-preview-theme":r["appearance.theme"],"aria-label":`外观预览:${r["appearance.style"]==="orion-blocksmith"?"方块工坊":"经典工作台"},${ny(r["appearance.theme"])}`,children:[i.jsxs("div",{className:"appearance-preview-frame","aria-hidden":"true",children:[i.jsx("span",{className:"appearance-preview-rail"}),i.jsxs("span",{className:"appearance-preview-main",children:[i.jsx("i",{}),i.jsx("i",{})]}),i.jsx("span",{className:"appearance-preview-panel"})]}),i.jsx("figcaption",{children:"纯 CSS 预览 · 均为内置外观,不支持安装或卸载。"})]}),i.jsx(is,{id:"settings-motion",label:"动效",description:"减少非必要动画,保留状态变化。",field:w,dirty:o.includes("appearance.motion"),onReset:()=>f("appearance.motion"),disabled:a||!tn(n,w),children:i.jsxs("select",{id:"settings-motion",value:r["appearance.motion"],disabled:a||!tn(n,w),onChange:j=>d("appearance.motion",j.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"reduced",children:"减少动效"})]})})]})}function ny(n){return n==="light"?"浅色":n==="dark"?"深色":"跟随系统"}function ry({document:n,draft:r,dirtyKeys:o,saving:a,runtimeBusy:d,onSet:f,onReset:h,onGoToSessionControls:g}){const w=n.sections.defaults.model,j=n.sections.defaults.effort,P=n.models.some(C=>C.id===r["defaults.model"])?n.models:[{id:r["defaults.model"],label:r["defaults.model"]},...n.models];return i.jsxs(zo,{heading:"模型与推理",detail:"项目默认值通常从下一逻辑请求开始生效;当前会话覆盖保持可见。",children:[d?i.jsx(rp,{detail:"当前回合正在运行;项目推理强度暂时锁定,默认模型仍可用于新会话。"}):null,i.jsx(is,{id:"settings-model",label:"默认模型",description:"仅展示 Host 提供的可用模型标识。",field:w,dirty:o.includes("defaults.model"),onReset:()=>h("defaults.model"),disabled:a||!tn(n,w),children:i.jsx("select",{id:"settings-model",value:r["defaults.model"],disabled:a||!tn(n,w),onChange:C=>f("defaults.model",C.target.value),children:P.map(C=>i.jsxs("option",{value:C.id,children:[C.label,C.provider?` · ${C.provider}`:""]},C.id))})}),i.jsx(is,{id:"settings-effort",label:"默认推理强度",description:"模型不支持的强度会由 Host 拒绝,不会静默降级。",field:j,dirty:o.includes("defaults.effort"),onReset:()=>h("defaults.effort"),disabled:a||d||!tn(n,j),children:i.jsx("select",{id:"settings-effort",value:r["defaults.effort"],disabled:a||d||!tn(n,j),onChange:C=>f("defaults.effort",C.target.value),children:Jv.map(C=>i.jsx("option",{value:C,children:C==="auto"?"Auto":C},C))})}),n.currentSession?i.jsxs("div",{className:"settings-readonly-card","aria-label":"当前会话设置",children:[i.jsxs("div",{children:[i.jsx("span",{children:"当前会话"}),i.jsx("strong",{children:n.currentSession.model})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Effort"}),i.jsx("strong",{children:n.currentSession.effort})]}),i.jsx("p",{children:n.currentSession.overridesProjectEffort?"当前会话覆盖了项目推理强度。":"当前会话沿用项目默认值。"}),i.jsx("small",{children:"可在会话输入框使用 /model 或 /effort 调整当前会话。"}),i.jsx("button",{type:"button",className:"text-button",onClick:g,"aria-controls":"orion-composer",children:"转到会话控制"})]}):null,i.jsxs("div",{className:"credential-note",children:[i.jsx(Q,{name:"check",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:"凭证始终留在 Host"}),i.jsx("p",{children:"浏览器只接收 ready / missing / unavailable 状态,不提供 API Key 输入框。"})]})]})]})}function sy({document:n,value:r,dirtyKeys:o,runtimeBusy:a,saving:d,confirmAllow:f,allowAcknowledged:h,onAllowRequested:g,onAllowAcknowledged:w,onConfirmAllow:j,onCancelAllow:P,onSet:C,onReset:O}){const R=m.useRef(null),z=m.useRef(null),L=n.sections.permissions.toolConfirmation,q=d||a||!tn(n,L);return m.useEffect(()=>{f&&z.current?.focus()},[f]),i.jsxs(zo,{heading:"权限",detail:"默认确认策略不改变工作区边界、硬拒绝和高风险保护。",children:[a?i.jsx(rp,{}):null,i.jsx(is,{id:"settings-tool-confirmation",label:"工具确认",description:"Ask 逐次询问;Deny 默认拒绝;Allow 仍受 Host 安全策略约束。",field:L,labelControl:!1,dirty:o.includes("permissions.toolConfirmation"),onReset:O,disabled:q,children:i.jsxs("fieldset",{id:"settings-tool-confirmation",className:"segmented-field",disabled:q,children:[i.jsx("legend",{className:"sr-only",children:"默认工具确认策略"}),["ask","allow","deny"].map(X=>i.jsxs("label",{children:[i.jsx("input",{ref:X==="allow"?R:void 0,type:"radio",name:"settings-permission",value:X,checked:r===X,onChange:()=>X==="allow"?g():C(X)}),i.jsx("span",{children:X==="ask"?"Ask":X==="allow"?"Allow":"Deny"})]},X))]})}),f?i.jsxs("div",{className:"settings-risk-confirm",role:"alertdialog","aria-labelledby":"allow-confirm-title","aria-describedby":"allow-confirm-description",children:[i.jsx("strong",{id:"allow-confirm-title",children:"确认启用 Allow"}),i.jsx("p",{id:"allow-confirm-description",children:"Orion 会减少常规工具询问,但硬拒绝、工作区边界和风险检查仍然生效。"}),i.jsxs("label",{children:[i.jsx("input",{ref:z,type:"checkbox",checked:h,onChange:X=>w(X.target.checked)}),i.jsx("span",{children:"我理解这会扩大默认授权范围"})]}),i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{P(),requestAnimationFrame(()=>R.current?.focus())},children:"保持当前策略"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!h,onClick:j,children:"启用 Allow"})]})]}):null,i.jsx("p",{className:"settings-help",children:"Agent 的 BUILD / PLAN / AUTO 模式与工具确认策略互相独立。"})]})}function iy({state:n,document:r,documentAction:o,onOpenDocument:a,onRefresh:d}){return i.jsxs(zo,{heading:"高级",detail:"配置状态、凭证可用性和集成清单均为只读摘要。",children:[r.diagnostic?i.jsxs("div",{className:"settings-diagnostic",role:"alert",children:[i.jsx(Q,{name:"warning",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:Rn(r.diagnostic.code)}),i.jsx("p",{children:Rn(r.diagnostic.message)})]})]}):null,i.jsxs("dl",{className:"settings-facts",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"状态"}),i.jsx("dd",{children:my(r.state)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"工作区"}),i.jsx("dd",{title:"仅显示目录名",children:Gf(r.workspace)||"—"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"文档"}),i.jsx("dd",{children:r.hasDocument?"已创建":"尚未创建"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"版本"}),i.jsx("dd",{title:r.revision,children:af(r.revision)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Last good"}),i.jsx("dd",{children:n.settingsMirror.lastGood?af(n.settingsMirror.lastGood.revision):"无"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Mirror"}),i.jsxs("dd",{children:[n.settingsMirror.status," · g",n.settingsMirror.generation]})]})]}),i.jsxs("div",{className:"settings-advanced-actions",children:[i.jsxs("button",{type:"button",className:"secondary-button",onClick:d,children:[i.jsx(Q,{name:"refresh",size:15}),"重新载入设置"]}),i.jsxs("button",{type:"button",className:"secondary-button",onClick:a,children:[i.jsx(Q,{name:"edit",size:15}),"打开配置文件"]})]}),o?i.jsx("div",{className:`settings-document-action ${o.tone}`,role:o.tone==="error"?"alert":"status",children:o.message}):null,i.jsxs("section",{className:"settings-subsection","aria-labelledby":"credential-status-heading",children:[i.jsx("h4",{id:"credential-status-heading",children:"凭证状态"}),i.jsx("p",{children:"仅显示来源类别与可用性;密钥值、环境变量名和认证头不会进入浏览器。"}),r.credentials.length?i.jsx("ul",{className:"settings-readonly-list",children:r.credentials.map(f=>i.jsxs("li",{children:[i.jsx("span",{children:f.providerId}),i.jsx("span",{className:`settings-state-badge state-${f.state}`,children:f.state}),i.jsx("small",{children:hy(f.source)})]},f.providerId))}):i.jsx("p",{className:"settings-empty-line",children:"Host 未报告凭证槽位。"})]}),i.jsxs("section",{className:"settings-subsection","aria-labelledby":"integration-status-heading",children:[i.jsx("h4",{id:"integration-status-heading",children:"只读能力"}),i.jsx("p",{children:"Skills 与 MCP 在专用配置中管理,此处用于确认 Host 实际加载结果。"}),i.jsxs("div",{className:"settings-capability-grid",children:[i.jsx(lf,{title:"Skills",count:n.skills.length,names:n.skills.map(f=>f.name)}),i.jsx(lf,{title:"MCP",count:n.mcpServers.length,names:n.mcpServers.map(f=>f.name)})]})]})]})}function oy({state:n}){const{settingsMirror:r}=n;return r.status==="loading"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"refresh",size:15})," 正在与 Host 同步设置…"]}):r.error?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," 设置同步失败:",r.error," 当前显示上一次可用值。"]}):r.stale?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"refresh",size:15})," Host 已更新设置,正在载入;当前显示上一次可用值。"]}):r.document?.state==="invalid"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," 设置文档无效。控件已锁定,并保留上一次可用值供参考。"]}):r.document?.state==="read-only"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(Q,{name:"info",size:15})," 设置当前为只读状态。"]}):r.document?.state==="unavailable"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(Q,{name:"warning",size:15})," Host 设置暂不可用;当前显示上一次可用值。"]}):null}function zo({heading:n,detail:r,children:o}){return i.jsxs("section",{className:"settings-section","aria-labelledby":`settings-${cf(n)}-heading`,children:[i.jsxs("header",{className:"settings-section-heading",children:[i.jsx("h3",{id:`settings-${cf(n)}-heading`,children:n}),i.jsx("p",{children:r})]}),i.jsx("div",{className:"settings-section-fields",children:o})]})}function is({id:n,label:r,description:o,field:a,labelControl:d=!0,dirty:f,disabled:h,onReset:g,children:w}){return i.jsxs("div",{className:`settings-field-card ${f?"dirty":""}`,children:[i.jsxs("div",{className:"settings-field-copy",children:[d?i.jsx("label",{htmlFor:n,children:r}):i.jsx("strong",{children:r}),i.jsx("p",{children:o}),i.jsxs("div",{className:"settings-field-meta","aria-label":`${r} 设置来源`,children:[i.jsx("span",{children:cy(a.source)}),i.jsx("span",{children:uy(a.scope)}),i.jsx("span",{children:dy(a.applies)}),f?i.jsx("strong",{children:"草稿"}):null]}),a.blockedReason?i.jsx("small",{className:"settings-blocked-reason",children:fy(a.blockedReason)}):null]}),i.jsxs("div",{className:"settings-field-control",children:[w,i.jsx("button",{type:"button",className:"text-button",onClick:g,disabled:h||a.explicitValue===void 0&&!f,"aria-label":`重置${r}为继承值`,children:"重置"})]})]})}function ly({draft:n,onAdopt:r,onRebase:o}){const a=Qv(n),d=Cr(n),f=n.serverLatest;return i.jsxs("div",{className:"settings-conflict",role:"alert",children:[i.jsx(Q,{name:"warning",size:17}),i.jsxs("div",{children:[i.jsx("strong",{children:"Host 设置已在其他位置更新"}),i.jsxs("p",{children:["草稿仍被保留",a.length?`;${a.length} 个草稿字段的服务器值发生变化`:"","。"]}),f?i.jsxs("div",{className:"settings-conflict-values","aria-label":"服务器值与我的草稿",children:[i.jsxs("div",{className:"settings-conflict-value-heading","aria-hidden":"true",children:[i.jsx("span",{children:"字段"}),i.jsx("span",{children:"服务器最新值"}),i.jsx("span",{children:"我的草稿"})]}),d.map(h=>i.jsxs("div",{children:[i.jsx("strong",{children:py(h)}),i.jsx("span",{"data-label":"服务器最新值",children:String(En(f,h))}),i.jsxs("span",{"data-label":"我的草稿",children:[String(n.values[h]),n.intents[h]?.op==="unset"?"(重置)":""]})]},h))]}):null,i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:r,children:"采用服务器值"}),i.jsx("button",{type:"button",className:"primary-button",onClick:o,children:"基于最新值重试"})]})]})]})}function rp({detail:n="当前回合正在运行;相关设置会在 Runtime 空闲后解锁。"}={}){return i.jsxs("div",{className:"settings-busy",role:"status",children:[i.jsx(Q,{name:"activity",size:15})," ",n]})}function lf({title:n,count:r,names:o}){return i.jsxs("div",{className:"settings-capability-card",children:[i.jsx("span",{children:n}),i.jsx("strong",{children:r}),i.jsx("small",{children:o.slice(0,3).join(" · ")||"未加载"})]})}function tn(n,r){return n.state==="ready"&&n.writable&&r.writable&&!r.blockedReason}function ay(n,r){const o=r instanceof Error?r.message:"Host 拒绝了设置变更。";switch(n){case"settings_revision_conflict":return"设置已在其他位置更新。你的草稿没有丢失。";case"runtime_busy":return"Runtime 正在处理任务。请等待当前回合结束后再次应用。";case"settings_document_invalid":return"配置文件无效。请在高级页查看 Host 提供的安全诊断。";case"settings_write_forbidden":return"当前设置来源为只读,Host 未执行任何变更。";case"request_id_conflict":return"保存请求标识与先前内容冲突,请重新应用。";case"settings_recovery_required":return"Host 报告设置冲突,但最新设置暂时无法载入。草稿已保留,请重新载入后再试。";case"network":return"未能确认 Host 是否收到请求;保留草稿,可安全重试。";default:return o}}function cy(n){return`来源:${n==="internal"?"内置":n==="model"?"模型":n==="global"?"全局":n==="project"?"项目":"会话"}`}function uy(n){return`作用域:${n==="global"?"全局":n==="project"?"项目":"会话"}`}function dy(n){return`生效:${n==="live"?"立即":n==="next-logical-request"?"下次请求":n==="new-session"?"新会话":"重启后"}`}function fy(n){return n==="runtime_busy"?"Runtime 正在运行,暂不可修改。":n==="read_only"?"此字段来自只读配置。":"设置文档无效,修复前不可修改。"}function py(n){return n==="appearance.style"?"视觉风格":n==="appearance.theme"?"主题":n==="appearance.motion"?"动效":n==="defaults.model"?"默认模型":n==="defaults.effort"?"默认推理强度":"工具确认"}function hy(n){return n==="environment"?"环境提供":n==="legacy"?"Host 旧配置":"未配置"}function my(n){return n==="ready"?"可用":n==="invalid"?"无效":n==="read-only"?"只读":"不可用"}function af(n){return n.length>24?`${n.slice(0,20)}…`:n}function cf(n){return n.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").toLowerCase()||"section"}function uf(){return typeof document>"u"?null:document.activeElement}const gy=["导航","面板","编辑","浮层"],sp=Object.freeze([{id:"toggle-project-navigation",tokens:["Mod","B"],group:"导航",description:"展开或折叠项目导航"},{id:"toggle-work-panel",tokens:["Mod","Shift","B"],group:"导航",description:"展开或折叠右侧工作面板"},{id:"focus-work-panel-1",tokens:["Mod","Shift","1"],group:"面板",description:"切换到 Agent 面板"},{id:"focus-work-panel-2",tokens:["Mod","Shift","2"],group:"面板",description:"切换到审阅面板"},{id:"focus-work-panel-3",tokens:["Mod","Shift","3"],group:"面板",description:"切换到终端面板"},{id:"focus-work-panel-4",tokens:["Mod","Shift","4"],group:"面板",description:"切换到文件面板"},{id:"focus-work-panel-5",tokens:["Mod","Shift","5"],group:"面板",description:"切换到 Git 面板"},{id:"work-panel-tab-nav",tokens:["←","→"],group:"面板",description:"在面板标签之间移动(Home / End 跳到首尾)"},{id:"resize-panel",tokens:["←","→"],group:"面板",description:"聚焦分隔条后按 2% 步长调整宽度,配合 Shift 为 10%"},{id:"resize-panel-reset",tokens:["Enter"],group:"面板",description:"分隔条聚焦时恢复默认宽度(Home 最窄,End 最宽)"},{id:"submit-composer",tokens:["Enter"],group:"编辑",description:"在输入框中发送当前内容"},{id:"newline-composer",tokens:["Shift","Enter"],group:"编辑",description:"在输入框中插入换行而不发送"},{id:"force-submit-composer",tokens:["Mod","Enter"],group:"编辑",description:"Agent 运行中时立即提交(否则进入队列)"},{id:"project-tree-nav",tokens:["↑","↓"],group:"面板",description:"在项目与会话树中移动焦点"},{id:"close-overlay",tokens:["Esc"],group:"浮层",description:"关闭抽屉、对话框或快捷键面板"},{id:"open-shortcut-help",tokens:["Mod","/"],group:"浮层",description:"打开或关闭本快捷键面板"}]);function vy(){if(typeof navigator>"u")return!1;const n=navigator.platform??"";return/mac|iphone|ipad|ipod/i.test(n)||/Mac/i.test(navigator.userAgent??"")}function yy(n,r=vy()){return n.map(a=>a==="Mod"?r?"⌘":"Ctrl":a==="Shift"?r?"⇧":"Shift":a==="Alt"?r?"⌥":"Alt":a.toUpperCase()).join(r?" ":"+")}function Io(n,r){let o=!1,a=!1,d=!1,f=null;for(const j of r)j==="Mod"?o=!0:j==="Shift"?a=!0:j==="Alt"?d=!0:f=j;if(o!==(n.metaKey||n.ctrlKey)||a!==n.shiftKey||d!==n.altKey||f===null)return!1;const h=n.code??"";if(/^[a-z]$/i.test(f))return h===`Key${f.toUpperCase()}`;if(/^[0-9]$/.test(f))return h===`Digit${f}`;const w=Object.freeze({esc:"escape"})[f.toLowerCase()]??f.toLowerCase();return n.key.toLowerCase()===w}function Eo(n){return sp.find(r=>r.id===n)}function xy(){return gy.map(n=>({group:n,items:sp.filter(r=>r.group===n)})).filter(n=>n.items.length>0)}function wy({open:n,onClose:r}){const o=m.useRef(null),a="shortcut-help-title";m.useEffect(()=>{const h=o.current;h&&(n&&!h.open&&h.showModal(),!n&&h.open&&h.close())},[n]);const d=h=>{h.target===h.currentTarget&&r()},f=xy();return i.jsxs("dialog",{ref:o,id:"shortcut-help",className:"modal shortcut-help","aria-labelledby":a,onCancel:h=>{h.preventDefault(),r()},onClose:r,onClick:d,children:[i.jsxs("header",{className:"shortcut-help-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"KEYBOARD"}),i.jsx("h2",{id:a,children:"键盘快捷键"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭快捷键面板",children:i.jsx(Q,{name:"close",size:15})})]}),i.jsx("div",{className:"shortcut-help-body",children:f.map(({group:h,items:g})=>i.jsxs("section",{className:"shortcut-help-group",children:[i.jsx("h3",{children:h}),i.jsx("dl",{children:g.map(w=>i.jsxs("div",{className:"shortcut-row",children:[i.jsx("dt",{children:w.description}),i.jsx("dd",{children:i.jsx("kbd",{children:yy(w.tokens)})})]},w.id))})]},h))}),i.jsx("footer",{className:"shortcut-help-footer",children:i.jsxs("p",{children:["按 ",i.jsx("kbd",{children:"Esc"})," 关闭本面板,焦点会回到打开它的位置。"]})})]})}const ky="modulepreload",jy=function(n){return"/"+n},df={},Wo=function(r,o,a){let d=Promise.resolve();if(o&&o.length>0){let w=function(j){return Promise.all(j.map(P=>Promise.resolve(P).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),g=h?.nonce||h?.getAttribute("nonce");d=w(o.map(j=>{if(j=jy(j),j in df)return;df[j]=!0;const P=j.endsWith(".css"),C=P?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${j}"]${C}`))return;const O=document.createElement("link");if(O.rel=P?"stylesheet":ky,P||(O.as="script"),O.crossOrigin="",O.href=j,g&&O.setAttribute("nonce",g),document.head.appendChild(O),P)return new Promise((R,z)=>{O.addEventListener("load",R),O.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${j}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return d.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return r().catch(f)})},yr=[{id:"goal",label:"Goal",icon:"goal"},{id:"activity",label:"活动",icon:"activity"},{id:"integrations",label:"能力",icon:"branch"},{id:"diagnostics",label:"诊断",icon:"diagnostics"}];function Sy({state:n,actions:r,tab:o,onTabChange:a}){const d=m.useId(),f=h=>{if(h.key!=="ArrowLeft"&&h.key!=="ArrowRight"&&h.key!=="Home"&&h.key!=="End")return;h.preventDefault();const g=yr.findIndex(j=>j.id===o),w=h.key==="Home"?0:h.key==="End"?yr.length-1:(g+(h.key==="ArrowRight"?1:-1)+yr.length)%yr.length;a(yr[w].id),requestAnimationFrame(()=>document.getElementById(`${d}-tab-${yr[w].id}`)?.focus())};return i.jsxs("div",{className:"agent-panel",children:[i.jsx("div",{className:"inspector-tabs",role:"tablist","aria-label":"详情类别",onKeyDown:f,children:yr.map(h=>i.jsxs("button",{id:`${d}-tab-${h.id}`,type:"button",role:"tab","aria-selected":o===h.id,"aria-controls":`${d}-panel`,tabIndex:o===h.id?0:-1,onClick:()=>a(h.id),children:[i.jsx(Q,{name:h.icon,size:15}),i.jsx("span",{children:h.label})]},h.id))}),i.jsxs("div",{id:`${d}-panel`,className:"inspector-body",role:"tabpanel","aria-labelledby":`${d}-tab-${o}`,tabIndex:0,children:[o==="goal"?i.jsx(Cy,{state:n,actions:r}):null,o==="activity"?i.jsx(by,{state:n,actions:r}):null,o==="integrations"?i.jsx(Ey,{state:n,actions:r}):null,o==="diagnostics"?i.jsx(Py,{state:n,actions:r}):null]})]})}function Cy({state:n,actions:r}){const o=n.goal,a=n.plan?.body??(typeof n.diagnostics?.plan=="string"?n.diagnostics.plan:""),f=!!n.pendingAction||n.connection!=="live"||!Sr(n);if(!o)return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"inspector-empty-card",children:[i.jsx("div",{className:"empty-mini-icon",children:i.jsx(Q,{name:"goal"})}),i.jsx("h3",{children:"没有活动 Goal"}),i.jsx("p",{children:"Goal 会跨回合保存目标、计划、证据和预算状态。"})]}),i.jsx(Ny,{onCreate:g=>r.controlGoal("create",g),disabled:f||!n.activeSessionId}),i.jsx(ff,{mode:n.mode.baseMode,plan:a})]});const h=o.criteria?.total?Math.round(o.criteria.passed/o.criteria.total*100):0;return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"goal-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:`goal-status status-${o.status}`,children:o.status.replace(/_/g," ")}),i.jsxs("span",{children:["rev ",o.revision]})]}),i.jsx("h3",{children:o.objective}),o.criteria?i.jsxs("div",{className:"goal-progress",children:[i.jsxs("div",{children:[i.jsx("span",{children:"成功条件"}),i.jsxs("strong",{children:[o.criteria.passed," / ",o.criteria.total]})]}),i.jsx("progress",{value:o.criteria.passed,max:Math.max(1,o.criteria.total),"aria-label":`Goal 条件完成 ${h}%`}),i.jsxs("div",{className:"goal-breakdown",children:[i.jsxs("span",{children:[h,"% 完成"]}),i.jsxs("span",{children:[o.criteria.failed," 失败 · ",o.criteria.stale," 过期"]})]})]}):null,i.jsxs("dl",{className:"metric-grid",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"Tokens"}),i.jsxs("dd",{children:[pf(o.tokensUsed),o.tokenBudget?` / ${pf(o.tokenBudget)}`:""]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"用时"}),i.jsx("dd",{children:Ty(o.timeUsedMs)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"续跑"}),i.jsx("dd",{children:o.continuationCount})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Plan"}),i.jsx("dd",{children:o.planRevision?`r${o.planRevision}`:"—"})]})]}),o.nextAction?i.jsxs("div",{className:"next-action",children:[i.jsx("span",{children:"下一步"}),i.jsx("p",{children:o.nextAction})]}):null,o.auditRemaining?.length?i.jsxs("details",{className:"remaining-audit",children:[i.jsxs("summary",{children:["仍需验证 ",o.auditRemaining.length," 项"]}),i.jsx("ul",{children:o.auditRemaining.map((g,w)=>i.jsx("li",{children:g},`${g}-${w}`))})]}):null,i.jsxs("div",{className:"goal-actions",children:[o.status==="active"?i.jsxs("button",{type:"button",className:"secondary-button",onClick:()=>{r.controlGoal("pause")},disabled:f,children:[i.jsx(Q,{name:"pause",size:14}),"暂停"]}):o.status!=="complete"?i.jsxs("button",{type:"button",className:"secondary-button",onClick:()=>{r.controlGoal("resume")},disabled:f,children:[i.jsx(Q,{name:"refresh",size:14}),"恢复"]}):null,i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>{window.confirm("清除此 Goal?会话记录仍会保留。")&&r.controlGoal("clear")},disabled:f,children:"清除"})]})]}),n.goalEvidence.length>0?i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"最近证据"}),i.jsx("span",{children:n.goalEvidence.length})]}),i.jsx("ul",{className:"evidence-list",children:n.goalEvidence.slice(-8).reverse().map(g=>i.jsxs("li",{children:[i.jsx("span",{className:`evidence-state ${g.result}`,"aria-hidden":"true",children:i.jsx(Q,{name:g.result==="passed"?"check":g.result==="failed"?"close":"more",size:12})}),i.jsxs("div",{children:[i.jsx("strong",{children:g.subject}),i.jsxs("span",{children:[g.kind," · ",g.result]})]})]},g.id))})]}):null,i.jsx(ff,{mode:n.mode.baseMode,plan:a,goalPhase:o.planPhase}),n.goalActivity.length>0?i.jsxs("section",{className:"inspector-section",children:[i.jsx("div",{className:"inspector-section-heading",children:i.jsx("h3",{children:"Goal 轨迹"})}),i.jsx("ol",{className:"compact-timeline",children:n.goalActivity.slice(-10).reverse().map((g,w)=>i.jsxs("li",{children:[i.jsx("span",{className:"timeline-pin","aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:g.type.replace(/_/g," ")}),i.jsx("p",{children:g.message}),i.jsx("time",{children:My(g.timestamp)})]})]},`${g.timestamp}-${w}`))})]}):null]})}function Ny({onCreate:n,disabled:r}){const[o,a]=m.useState(""),d=async f=>{if(f.preventDefault(),!!o.trim())try{await n(o.trim()),a("")}catch{}};return i.jsxs("form",{className:"goal-create",onSubmit:d,children:[i.jsx("label",{htmlFor:"goal-objective",children:"创建 Goal"}),i.jsx("textarea",{id:"goal-objective",rows:3,value:o,onChange:f=>a(f.target.value),placeholder:"输入一个可验证、可持续执行的目标…",disabled:r}),i.jsxs("button",{type:"submit",className:"primary-button",disabled:r||!o.trim(),children:[i.jsx(Q,{name:"goal",size:15}),"开始 Goal"]})]})}function ff({mode:n,plan:r,goalPhase:o}){return i.jsxs("section",{className:"inspector-section plan-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"Plan"}),i.jsx("span",{className:`mode-badge mode-${n}`,children:n==="plan"?"PLAN MODE":o||"READ ONLY"})]}),r?i.jsx(Xs,{children:r}):i.jsx("p",{className:"muted-copy",children:"还没有保存的计划。切换到 PLAN 模式后提交任务,Runtime 会生成并保存计划。"})]})}function by({state:n,actions:r}){const o=m.useMemo(()=>n.tools.filter(a=>Ry(a)),[n.tools]);return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"工具调用"}),i.jsx("span",{children:n.tools.length})]}),n.tools.length?i.jsx("ul",{className:"activity-list",children:n.tools.slice(-20).reverse().map(a=>i.jsx(_y,{tool:a},a.callId))}):i.jsx(jo,{text:"还没有工具活动"})]}),i.jsx(Iy,{state:n,actions:r}),i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"文件变化"}),i.jsx("span",{children:o.length+n.edits.length})]}),o.length||n.edits.length?i.jsxs("ul",{className:"change-list",children:[n.edits.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx(Q,{name:"edit",size:14}),i.jsxs("div",{children:[i.jsx("strong",{children:ip(a.request.path)}),i.jsxs("span",{children:[a.request.kind," · ",a.request.candidates.length," candidates"]})]})]},a.eventId)),o.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx(Q,{name:"code",size:14}),i.jsxs("div",{children:[i.jsx("strong",{children:a.name}),i.jsx("span",{children:a.summary||a.state})]})]},a.callId))]}):i.jsx(jo,{text:"还没有文件变化"})]}),i.jsxs("section",{className:"inspector-section",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"子代理与研究"}),i.jsx("span",{children:n.subtasks.length+n.research.length})]}),n.subtasks.length?i.jsx("ul",{className:"activity-list",children:n.subtasks.slice(-8).reverse().map(a=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${a.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:a.role}),i.jsx("span",{children:a.objective})]}),i.jsx("small",{children:a.state})]},a.taskId))}):null,n.research.length?i.jsx("ul",{className:"activity-list",children:n.research.slice(-6).reverse().map(a=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${a.stage}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:"Research"}),i.jsx("span",{children:a.objective||a.packetId})]}),i.jsx("small",{children:a.stage})]},a.packetId))}):null,!n.subtasks.length&&!n.research.length?i.jsx(jo,{text:"还没有子代理或研究活动"}):null]})]})}function _y({tool:n}){return i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${n.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:n.name}),i.jsx("span",{children:n.summary||`调用 #${n.sequence}`})]}),i.jsx("small",{children:n.duration!==void 0?`${Math.round(n.duration)}ms`:n.state})]})}function Iy({state:n,actions:r}){const[o,a]=m.useState(""),[d,f]=m.useState(""),[h,g]=m.useState(),[w,j]=m.useState(0),[P,C]=m.useState(!1),[O,R]=m.useState("");m.useEffect(()=>{a(""),f(""),g(void 0),R("")},[n.activeSessionId]);const z=async(L,q=0)=>{C(!0),R("");try{const X=await r.readToolDetail(L,q);a(L),f(W=>q===0?X.content:`${W}${X.content}`),g(X.nextOffsetBytes),j(X.totalBytes)}catch(X){R(X instanceof Error?X.message:"工具详情读取失败。")}finally{C(!1)}};return i.jsxs("section",{className:"inspector-section tool-detail-browser",children:[i.jsxs("div",{className:"inspector-section-heading",children:[i.jsx("h3",{children:"持久化输出"}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:()=>{r.refreshToolDetails()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:13}),"刷新"]})]}),n.toolDetails.length?i.jsx("div",{className:"detail-selector",role:"group","aria-label":"工具输出详情",children:n.toolDetails.slice(-20).reverse().map(L=>i.jsxs("button",{type:"button",className:o&&L.artifactId===o?"active":"",disabled:!L.artifactId||P,onClick:()=>L.artifactId&&void z(L.artifactId),children:[i.jsxs("span",{children:[i.jsx("strong",{children:L.toolName}),i.jsxs("small",{children:["#",L.sequence," · ",hf(L.outputBytes)]})]}),i.jsx(Q,{name:"chevron",size:13})]},`${L.callId}:${L.sequence}`))}):i.jsx(jo,{text:"没有可读取的持久化输出"}),n.toolDetailNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{r.loadMoreToolDetails()},disabled:!!n.pendingAction,children:"加载更多输出记录"}):null,O?i.jsx("p",{className:"field-error",role:"alert",children:O}):null,o?i.jsxs("div",{className:"detail-output",children:[i.jsxs("div",{children:[i.jsxs("span",{children:[hf(w)," · 已脱敏"]}),i.jsx("code",{children:o})]}),i.jsx("pre",{tabIndex:0,children:Rn(d)}),h!==void 0?i.jsx("button",{type:"button",className:"secondary-button",disabled:P,onClick:()=>{z(o,h)},children:P?"读取中…":"加载更多"}):null]}):null]})}function Ey({state:n,actions:r}){const o=n.skills,a=n.mcpServers;return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("section",{className:"capability-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"capability-icon",children:i.jsx(Q,{name:"spark",size:17})}),i.jsxs("div",{children:[i.jsx("h3",{children:"Skills"}),i.jsx("p",{children:"安全描述符,只读"})]}),i.jsx("span",{className:`readiness-pill ${o.length?"ready":""}`,children:o.length?`${o.length} 可用`:"未发现"})]}),o.length?i.jsx("ul",{className:"skill-list",children:o.map(d=>i.jsxs("li",{children:[i.jsxs("div",{children:[i.jsx("strong",{children:d.name}),i.jsxs("span",{children:[d.sourceScope," · ",d.providerId]})]}),i.jsx("p",{children:d.description}),d.requestedCapabilities.length?i.jsx("small",{children:d.requestedCapabilities.join(" · ")}):null]},d.id))}):i.jsx("p",{className:"muted-copy",children:"当前 Runtime 没有公开可用的 Skill 描述符。"})]}),i.jsxs("section",{className:"capability-card",children:[i.jsxs("header",{children:[i.jsx("span",{className:"capability-icon mcp",children:i.jsx(Q,{name:"branch",size:17})}),i.jsxs("div",{children:[i.jsx("h3",{children:"MCP Servers"}),i.jsx("p",{children:"只读配置与运行状态"})]}),i.jsx("span",{className:`readiness-pill ${a.length?"ready":""}`,children:a.length?`${a.length} 已配置`:"未配置"})]}),a.length?i.jsx("ul",{className:"server-list",children:a.map(d=>i.jsxs("li",{children:[i.jsx("span",{className:`state-dot state-${d.state}`,"aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("code",{children:d.name}),i.jsxs("small",{children:[d.transport," · ",d.toolCount," tools"]})]}),i.jsx("span",{children:d.disabled?"Disabled":d.state})]},d.id))}):i.jsx("p",{className:"muted-copy",children:"没有可用的 MCP Server。浏览器不会接收环境变量或认证 Header。"})]}),n.skillNextCursor||n.mcpNextCursor?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{r.loadMoreCapabilities()},disabled:!!n.pendingAction,children:"加载更多能力"}):null,i.jsxs("section",{className:"security-note",children:[i.jsx(Q,{name:"info",size:16}),i.jsxs("p",{children:[i.jsx("strong",{children:"能力边界由 Runtime 管理。"})," Web 端只展示描述符和状态,不加载外部插件代码,也不会绕过 ToolGateway。"]})]})]})}function Py({state:n,actions:r}){const o=n.diagnostics,a=Mo(n);return i.jsxs("div",{className:"inspector-stack",children:[i.jsxs("div",{className:"diagnostics-toolbar",children:[i.jsxs("div",{children:[i.jsx("span",{className:`connection-dot ${n.connection}`,"aria-hidden":"true"}),i.jsx("strong",{children:Oy(n.connection)})]}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:()=>{r.refreshDiagnostics()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:14}),"刷新"]})]}),i.jsxs("section",{className:"inspector-section",children:[i.jsx("div",{className:"inspector-section-heading",children:i.jsx("h3",{children:"Runtime"})}),i.jsxs("dl",{className:"diagnostic-list",children:[i.jsx(Nt,{label:"版本",value:n.bootstrap?.productVersion??"—"}),i.jsx(Nt,{label:"工作区",value:ip(n.workspace)||"—"}),i.jsx(Nt,{label:"会话",value:n.activeSessionId?.slice(0,12)??"未选择"}),i.jsx(Nt,{label:"模式",value:String(o?.agentMode??n.mode.baseMode)}),i.jsx(Nt,{label:"权限",value:String(o?.permissionMode??n.settings?.sections.permissions.toolConfirmation.effectiveValue??"—")}),i.jsx(Nt,{label:"事件游标",value:`${n.lastCursor}`}),i.jsx(Nt,{label:"事件 UUID",value:n.lastEventId?.slice(0,12)??"—"}),i.jsx(Nt,{label:"会话快照",value:a.status}),i.jsx(Nt,{label:"保留事件",value:`${o?.eventStream?.retained??"—"}`}),i.jsx(Nt,{label:"快照请求",value:o?.session?`${o.session.snapshotRequests} 次 / 失败 ${o.session.snapshotFailures}`:"—"}),i.jsx(Nt,{label:"快照时延",value:o?.session?`${o.session.snapshotLastMs} ms(累计 ${o.session.snapshotTotalMs} ms)`:"—"}),i.jsx(Nt,{label:"Session actor",value:o?.session?`${o.session.actors.actorsCreated} 分配 / ${o.session.actors.actorsEvicted} LRU 驱逐`:"—"}),i.jsx(Nt,{label:"control plane",value:o?.session?`${o.session.controlPlaneInstalls} 次装载 / ${o.session.controlPlaneShutdowns} 次关闭`:"—"}),i.jsx(Nt,{label:"浏览器切换",value:`${n.clientTelemetry.sessionSwitches} 次 / 缓存命中 ${n.clientTelemetry.snapshotCacheHits} / 加载 ${n.clientTelemetry.snapshotLoads}`})]})]}),o?.contextUsage?i.jsx(go,{title:"Context usage",value:o.contextUsage}):null,o?.tokenUsage?i.jsx(go,{title:"Token usage",value:o.tokenUsage}):null,o?.harness?i.jsx(go,{title:"Harness",value:o.harness}):null,n.loopStats?i.jsx(go,{title:"Loop statistics",value:n.loopStats}):null,i.jsxs("section",{className:"security-note",children:[i.jsx(Q,{name:"check",size:16}),i.jsx("p",{children:"诊断载荷由 Host 脱敏。API Key、认证 Header 和环境值不会返回浏览器。"})]})]})}function Nt({label:n,value:r}){return i.jsxs("div",{children:[i.jsx("dt",{children:n}),i.jsx("dd",{title:r,children:r})]})}function go({title:n,value:r}){return i.jsxs("details",{className:"json-section",children:[i.jsx("summary",{children:n}),i.jsx("pre",{tabIndex:0,children:Ka(r,12e3)})]})}function jo({text:n}){return i.jsxs("div",{className:"empty-small",children:[i.jsx("span",{className:"empty-line","aria-hidden":"true"}),i.jsx("p",{children:n})]})}function Ry(n){return/write|edit|patch|delete|move|rename|mkdir|create/i.test(n.name)}function ip(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function pf(n){return new Intl.NumberFormat("zh-CN",{notation:n>99999?"compact":"standard"}).format(n)}function Ty(n){return n<1e3?`${Math.round(n)}ms`:n<6e4?`${Math.round(n/1e3)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function hf(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function My(n){const r=Date.parse(n);return Number.isFinite(r)?new Date(r).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""}function Oy(n){return n==="live"?"本地 Web Host 连接正常":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重新连接本地 Web Host"}function Ay({width:n,onPreview:r,onCommit:o,maxWidth:a=Bf}){return i.jsx(Wf,{side:"right",className:"work-panel-resize-handle",minWidth:Qa,maxWidth:a,defaultWidth:Ya,label:"拖动或按方向键调整工作面板宽度",width:n,controls:"work-panel-detail",onPreview:r,onCommit:o})}const $y=["agent","review","terminal","files","git"],Ly=Object.freeze({agent:{label:"Agent",icon:"spark",kind:"task"},review:{label:"审阅",icon:"edit",kind:"resource"},terminal:{label:"终端",icon:"terminal",kind:"resource"},files:{label:"文件",icon:"workspace",kind:"resource"},git:{label:"Git",icon:"branch",kind:"resource"}}),Dy=new Map($y.map(n=>{const r=Ly[n];return[n,Object.freeze({id:n,label:r.label,icon:r.icon,kind:r.kind})]})),zy=m.lazy(()=>Wo(()=>import("./TerminalPanel-IkCttxgw.js"),__vite__mapDeps([0,1])).then(n=>({default:n.TerminalPanel}))),Wy=m.lazy(()=>Wo(()=>import("./FilesPanel-BcFY6L1a.js"),__vite__mapDeps([2,3])).then(n=>({default:n.FilesPanel}))),Fy=m.lazy(()=>Wo(()=>import("./GitPanel-B6E5IEXm.js"),__vite__mapDeps([4,3,5])).then(n=>({default:n.GitPanel}))),By=m.lazy(()=>Wo(()=>import("./ReviewPanel-5ecTVmhT.js"),__vite__mapDeps([6,3,5])).then(n=>({default:n.ReviewPanel}))),qy=["focus-work-panel-1","focus-work-panel-2","focus-work-panel-3","focus-work-panel-4","focus-work-panel-5"],vo=Object.freeze(Object.fromEntries([...Dy].map(([n,r])=>[n,{label:r.label,icon:r.icon}]))),Uy=new Set(["starting","running","stopping","queued","waiting_approval","interrupted","failed"]);function Hy(n,r){return n?Uy.has(n)?n==="failed"||n==="interrupted"?"failed":n==="queued"||n==="waiting_approval"?"queued":"running":null:r?"running":null}function Vy({state:n,actions:r,mode:o,expanded:a,activePanel:d,panelOrder:f,agentPanel:h,onExpand:g,onCollapse:w,onPanelChange:j,onAgentPanelChange:P,onWidthPreview:C,onWidthCommit:O,width:R,maxWidthPx:z,onSendToComposer:L,resourceNavigatorWidths:q,onResourceNavigatorWidthCommit:X}){const W=m.useRef(null),he=m.useRef(null),Z=m.useRef(null),ee=m.useRef(a),N=m.useId(),F=m.useRef(new Set([d]));F.current.add(d);const re=m.useRef(d==="terminal"||F.current.has("terminal"));d==="terminal"&&(re.current=!0);const[je,xe]=m.useState(!1),Y=f&&f.length===Oa.length?f:Oa,pe=n.workspaceResourceEpochs[n.workspaceId]??{files:0,git:0,review:0},te=n.sessionRuntimeById[n.activeSessionId??""]?.phase,Ce=Hy(te,n.processing);m.useEffect(()=>{if(o!=="overlay"||!a)return;let T=0,y=0;const $=()=>{T+=1,he.current?.focus(),(document.activeElement===he.current||T>=10)&&window.clearInterval(y)};return y=window.setInterval($,16),$(),()=>window.clearInterval(y)},[a,o]),m.useEffect(()=>{const T=ee.current;if(ee.current=a,!(o!=="dock"||T===a)){if(!a){requestAnimationFrame(()=>W.current?.querySelector(`[data-work-panel-id="${d}"]`)?.focus());return}je&&(xe(!1),requestAnimationFrame(()=>Z.current?.focus()))}},[d,a,o,je]),m.useEffect(()=>{const T=Eo("toggle-work-panel"),y=$=>{if(T&&Io($,T.tokens)){$.preventDefault(),a?w():(xe(!0),g());return}const A=qy.findIndex(ye=>{const we=Eo(ye);return we?Io($,we.tokens):!1}),ne=Y[A];ne&&($.preventDefault(),!(a&&d===ne)&&(j(ne),a||g()))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,o,w,g,j]);const D=T=>{if(T.key==="Escape"&&a&&!T.target.closest('[role="alertdialog"], .terminal-host, input, textarea, [contenteditable]')){T.preventDefault(),w();return}if(o!=="overlay"||!a||T.key!=="Tab")return;const y=Ky(W.current);if(!y.length){T.preventDefault(),W.current?.focus();return}const $=y.indexOf(document.activeElement);T.shiftKey&&$<=0?(T.preventDefault(),y.at(-1)?.focus()):!T.shiftKey&&($<0||$===y.length-1)&&(T.preventDefault(),y[0].focus())},ue=T=>{if(o==="overlay"){j(T),a||(xe(!0),g());return}if(a&&d===T){w();return}a||xe(!0),j(T),g()},de=(T=!1)=>i.jsx("nav",{className:T?"work-panel-rail work-panel-rail-overlay":"work-panel-rail","aria-label":"工作面板快捷入口","aria-orientation":T?"horizontal":"vertical",children:Y.map((y,$)=>{const A=vo[y],ne=d===y;return i.jsxs("button",{type:"button",className:"work-panel-rail-button","data-work-panel-id":y,"aria-label":`打开${A.label}面板`,"aria-current":ne?"page":void 0,title:`${A.label} · ⌘⇧${$+1}`,onClick:()=>ue(y),children:[i.jsx(Q,{name:A.icon,size:17}),y==="terminal"&&Ce?i.jsx(Xa,{state:Ce,className:"rail-status-dot",describe:!1}):null]},y)})}),E=T=>i.jsxs("div",{id:`${N}-${T}`,className:"work-panel-pane",role:"tabpanel","aria-label":vo[T].label,hidden:T!==d,children:[T==="agent"?i.jsx(Sy,{state:n,actions:r,tab:h,onTabChange:P}):null,T==="review"?i.jsx(By,{workspaceId:n.workspaceId,refreshEpoch:pe.review,actions:r,onSendToComposer:L,navigatorWidthPx:q.review,onNavigatorWidthCommit:y=>X("review",y)}):null,T==="terminal"?i.jsx(zy,{workspaceId:n.workspaceId,workspacePath:n.workspace,styleNonce:n.bootstrap?.nonce??"",available:!!n.bootstrap?.capabilities.terminal,actions:r}):null,T==="files"?i.jsx(Wy,{workspaceId:n.workspaceId,refreshEpoch:pe.files,actions:r,navigatorWidthPx:q.files,onNavigatorWidthCommit:y=>X("files",y)}):null,T==="git"?i.jsx(Fy,{workspaceId:n.workspaceId,refreshEpoch:pe.git,actions:r,onSendToComposer:L,navigatorWidthPx:q.git,onNavigatorWidthCommit:y=>X("git",y)}):null]},T),K=d==="terminal"||!re.current?[d]:[d,"terminal"];return i.jsxs("aside",{ref:W,id:"work-panel",className:`work-panel work-panel-${o} ${a?"drawer-open work-panel-expanded":"work-panel-collapsed"}`,role:o==="overlay"?"dialog":void 0,"aria-modal":o==="overlay"&&a?!0:void 0,"aria-label":"工作面板","data-mode":o,"data-state":a?"expanded":"collapsed",tabIndex:o==="overlay"&&a?-1:void 0,onKeyDownCapture:D,children:[o==="dock"?i.jsxs("div",{className:"work-panel-dock-body",children:[a?i.jsxs("section",{ref:Z,id:"work-panel-detail",className:"work-panel-detail","aria-label":"工作面板内容",tabIndex:-1,children:[i.jsxs("header",{className:"work-panel-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"PROJECT WORKSPACE"}),i.jsx("h2",{children:vo[d].label})]}),i.jsx("div",{className:"work-panel-header-actions",children:i.jsx("button",{type:"button",className:"icon-button",onClick:w,"aria-label":"收起工作面板","aria-controls":"work-panel-detail","aria-expanded":"true",title:"收起(Esc)",children:i.jsx(Q,{name:"sidebar"})})})]}),i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:K.map(T=>E(T))})})]}):null,de()]}):i.jsxs("div",{id:"work-panel-detail",className:"work-panel-detail",hidden:!a,children:[i.jsxs("header",{className:"work-panel-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"PROJECT WORKSPACE"}),i.jsx("h2",{children:vo[d].label})]}),i.jsx("div",{className:"work-panel-header-actions",children:i.jsx("button",{ref:he,type:"button",className:"icon-button",onClick:w,"aria-label":"关闭工作面板","aria-controls":"work-panel-detail","aria-expanded":"true",children:i.jsx(Q,{name:"close"})})})]}),de(!0),i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:K.map(T=>E(T))})})]}),o==="dock"&&a?i.jsx(Ay,{width:R,maxWidth:z,onPreview:C,onCommit:O}):null]})}function Ky(n){return n?Array.from(n.querySelectorAll('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled")&&!r.closest("[inert]")&&!r.closest("[hidden]")&&r.getClientRects().length>0):[]}const op="orion.web.right-workspace.v3",Po=4,So=300,lp=160,ap=420,Gy=280,Qy=["files","git","review"],Ro=Object.freeze({files:So,git:So,review:So});function cp(n){return Number.isFinite(n)?Math.min(ap,Math.max(lp,Math.round(n))):So}function Xx(n){const r=Number.isFinite(n)?n:0,o=Math.min(ap,r*.48,r-Gy);return Math.max(lp,Math.floor(o))}const up=Object.freeze({expanded:!0,activePanel:"agent",detailWidthPx:560,taskSubview:"overview",resourceNavigatorWidthPx:Ro}),Yy=up;function mf(){return Object.freeze({schemaVersion:Po,projectNavigation:Object.freeze({expanded:!0,widthPx:280}),workPanel:Object.freeze({byWorkspace:Object.freeze({}),fallback:Yy})})}function Xy(n){const r=ec(n.agentPanel);return Object.freeze({expanded:n.expanded!==!1,activePanel:ei(n.activePanel)?n.activePanel:"agent",detailWidthPx:Math.max(320,Zs(Number.isFinite(n.widthPx)?Number(n.widthPx)-Je:560)),taskSubview:r,resourceNavigatorWidthPx:Ro})}function Jy(n,r){return n.workPanel.byWorkspace[r]??n.workPanel.fallback}function dp(n,r,o){const a=n.workPanel.byWorkspace[r]??n.workPanel.fallback,d=Object.freeze({...a,...o,resourceNavigatorWidthPx:o.resourceNavigatorWidthPx??a.resourceNavigatorWidthPx}),f={schemaVersion:Po,projectNavigation:n.projectNavigation,workPanel:{...n.workPanel,byWorkspace:Object.freeze({...n.workPanel.byWorkspace,[r]:d})}};return Object.freeze(f)}function Zy(n,r,o,a){const d=Jy(n,r);return dp(n,r,{...d,resourceNavigatorWidthPx:Object.freeze({...d.resourceNavigatorWidthPx,[o]:cp(a)})})}function ex(n){if(!n)return null;try{const r=JSON.parse(n);if(!wr(r))return null;const o=r.schemaVersion;if(o!==3&&o!==Po)return null;const a=wr(r.projectNavigation)?r.projectNavigation:{},d=wr(r.workPanel)?r.workPanel:{},f=wr(d.byWorkspace)?d.byWorkspace:{},h=wr(d.fallback)?d.fallback:{},g={};for(const[w,j]of Object.entries(f))wr(j)&&(g[w]=gf(j));return Object.freeze({schemaVersion:Po,projectNavigation:Object.freeze({expanded:a.expanded!==!1,widthPx:Zs(Number(a.widthPx)||280)}),workPanel:Object.freeze({byWorkspace:Object.freeze(g),fallback:gf(h)})})}catch{return null}}function gf(n){return Object.freeze({expanded:n.expanded!==!1,activePanel:ei(n.activePanel)?n.activePanel:"agent",detailWidthPx:fp(Number(n.detailWidthPx)),taskSubview:ec(n.taskSubview),resourceNavigatorWidthPx:tx(n.resourceNavigatorWidthPx)})}function tx(n){if(!wr(n))return Ro;const r={...Ro};for(const o of Qy){const a=Number(n[o]);Number.isFinite(a)&&(r[o]=cp(a))}return Object.freeze(r)}function fp(n){return Number.isFinite(n)?Math.min(3200,Math.max(360,Math.round(n))):up.detailWidthPx}function ec(n){const r=String(n);return r==="goal"||r==="overview"?"overview":r==="activity"?"activity":r==="integrations"||r==="capabilities"?"capabilities":r==="diagnostics"?"diagnostics":"overview"}function nx(n){switch(n){case"overview":return"goal";case"activity":return"activity";case"capabilities":return"integrations";case"diagnostics":return"diagnostics"}}function wr(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function rx(n){return["agent","review","terminal","files","git"].includes(n)}function sx(){const n=globalThis;try{return ex(n.window?.localStorage.getItem(op)??null)}catch{return null}}function vf(n){const r=globalThis;try{r.window?.localStorage.setItem(op,JSON.stringify(n))}catch{}}function ix(n,r){const[o,a]=m.useState(sx),d=n??"__fallback__",f=m.useMemo(()=>Xy(r),[]),h=m.useMemo(()=>{const j=o?.workPanel.byWorkspace[d]??o?.workPanel.fallback??f;return{workspaceId:d,expanded:j.expanded,activePanel:rx(j.activePanel)?j.activePanel:"agent",agentPanel:nx(j.taskSubview),detailWidthPx:j.detailWidthPx,resourceNavigatorWidthPx:j.resourceNavigatorWidthPx}},[o,d,f]),g=m.useCallback(j=>{a(P=>{const C=P??mf(),O=C.workPanel.byWorkspace[d]??C.workPanel.fallback??f,R={expanded:j.expanded??O.expanded,activePanel:j.activePanel??O.activePanel,detailWidthPx:j.detailWidthPx??O.detailWidthPx,taskSubview:j.agentPanel?ec(j.agentPanel):O.taskSubview,resourceNavigatorWidthPx:O.resourceNavigatorWidthPx},z=dp(C,d,R);return vf(z),z})},[d,f]),w=m.useCallback((j,P)=>{a(C=>{const O=C??mf(),R=Zy(O,d,j,P);return vf(R),R})},[d]);return{value:h,update:g,setResourceNavigatorWidth:w}}const tc=320,yf=360,ox=1024,lx=768,ax=.8;function pp(n){return Number.isFinite(n)&&n>0?Math.round(n):1440}function hp(n){const r=Math.floor(n*ax),o=n-tc-Je;return Math.max(0,Math.min(r,o))}function xf(n){const r=pp(n.containerWidth),o=Math.max(0,Math.round(n.leftWidthPx)),a=Math.max(0,r-o);if(r<lx)return Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(r<ox)return n.expanded?Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!0}):Object.freeze({mode:"rail",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(!n.expanded)return Object.freeze({mode:"rail",detailWidthPx:Je,conversationWidthPx:a-Je,canResize:!1});const d=hp(a);if(d<yf)return Object.freeze({mode:"rail",detailWidthPx:Je,conversationWidthPx:a-Je,canResize:!1});const f=Math.max(yf,Math.min(fp(n.storedDetailWidthPx),d)),h=a-f-Je;return h<tc?Object.freeze({mode:"rail",detailWidthPx:Je,conversationWidthPx:a-Je,canResize:!1}):Object.freeze({mode:"dock",detailWidthPx:f,conversationWidthPx:h,canResize:d>f})}function wf(n){const r=pp(n.containerWidth),o=n.navigationExpanded?Math.max(240,Math.min(480,Math.round(n.navigationWidthPx))):Je;let a=xf({containerWidth:r,leftWidthPx:o,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});const d=xf({containerWidth:r,leftWidthPx:Je,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});return n.navigationExpanded&&(a.mode==="dock"&&a.conversationWidthPx<tc||a.mode!=="dock"&&d.mode==="dock")?(a=d,Object.freeze({projectNavigation:Object.freeze({mode:"rail",widthPx:Je}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Je:a.detailWidthPx})})):Object.freeze({projectNavigation:Object.freeze({mode:n.navigationExpanded?"dock":"rail",widthPx:o}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Je:a.detailWidthPx})})}function cx(n,r,o){const a=r==="light"||r==="system"&&o;return n==="orion-blocksmith"?a?"#d7d0c1":"#15191b":a?"#f4f5f8":"#090b10"}function er(n,r){return n.some(o=>o.id===r.id)?n.map(o=>o.id===r.id?r:o):[r,...n]}const To=1e4,ux=256,dx=256,fx=128,px=8,mp=8*1024*1024,hx=64;function mx(n=Df,r){switch(r.type){case"baseline_loaded":{const o=n.workspaceId!==r.bootstrap.workspaceId||n.activeSessionId!==r.bootstrap.activeSessionId?Js(n):n,a=Ef(r.diagnostics,o.mode);return{...o,boot:"ready",bootError:void 0,bootstrap:r.bootstrap,contextRevision:r.bootstrap.contextRevision,workspaceId:r.bootstrap.workspaceId,workspace:r.workspaces.activePath||r.bootstrap.workspace,workspaces:r.workspaces.workspaces,sessions:r.sessions,workspaceSessions:{...o.workspaceSessions,[r.bootstrap.workspaceId]:{status:"ready",items:r.sessions,nextCursor:r.sessionNextCursor}},workspaceNextCursor:r.workspaces.nextCursor,sessionNextCursor:r.sessionNextCursor,activeSessionId:r.bootstrap.activeSessionId,sessionSync:r.bootstrap.activeSessionId?{...o.sessionSync,[r.bootstrap.activeSessionId]:{status:o.sessionProjectionById[r.bootstrap.activeSessionId]?"refreshing":"loading",requestId:null}}:o.sessionSync,settings:r.settings,diagnostics:r.diagnostics,skills:r.skills,skillNextCursor:r.skillNextCursor,mcpServers:r.mcpServers,mcpNextCursor:r.mcpNextCursor,toolDetails:r.toolDetails,toolDetailNextCursor:r.toolDetailNextCursor,notice:o.notice?.domain==="session-snapshot"?null:o.notice,processing:!!r.diagnostics.processing,mode:a,statusMessage:r.bootstrap.configured?"本地 Web Host 已就绪":"模型尚未配置,任务提交已停用",announcement:r.bootstrap.configured?"本地 Web Host 已就绪":"Orion 尚未配置模型"}}case"boot_failed":return{...n,boot:"error",bootError:r.message,connection:Cx()?"reconnecting":"offline",announcement:`启动失败:${r.message}`};case"connection_changed":return n.connection==="replay-required"?n:{...n,connection:r.phase,connectionAttempt:r.attempt,announcement:Nx(r.phase,r.attempt)};case"event_received":return gx(n,r.envelope);case"session_snapshot_started":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:yo(Gs(n,r.sessionId,{status:r.cached?"refreshing":"loading",requestId:r.requestId}),{snapshotLoads:1});case"session_snapshot_loaded":{const o=r.snapshot.session.id;return!If(n,r.contextRevision,r.workspaceId)||!_f(n,o,r.requestId)?n:n.activeSessionId!==o?r.requestId===void 0?n:bf(jf(n,r.snapshot),o):bf(kf(n,r.snapshot,r.advanceEventCursor!==!1),o)}case"composer_loaded":return r.composer.sessionId!==n.activeSessionId||r.composer.workspaceId!==n.workspaceId||r.composer.contextRevision!==n.contextRevision?n:gp(n,r.composer);case"model_catalog_loaded":return{...n,modelCatalog:r.catalog};case"durable_session_metadata_loaded":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:n.activeSessionId!==r.snapshot.session.id?jf(n,r.snapshot):r.snapshot.runtime.active!==!0?n:xx(n,r.snapshot);case"older_transcript_loaded":{if(n.activeSessionId!==r.snapshot.session.id||!n.sessionSnapshot)return n;const o=new Set(n.transcript.map(d=>d.id)),a=vp(r.snapshot).filter(d=>!o.has(d.id));return{...n,transcript:[...a,...n.transcript].sort((d,f)=>d.order-f.order).slice(-To),sessionSnapshot:{...n.sessionSnapshot,transcript:{items:n.sessionSnapshot.transcript.items,nextCursor:r.snapshot.transcript.nextCursor}},announcement:`已加载 ${a.length} 条更早记录`}}case"sessions_loaded":return{...n,sessions:r.append?Jn(n.sessions,r.sessions,o=>o.id):r.sessions,sessionNextCursor:r.nextCursor,workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:r.append?Jn(n.sessions,r.sessions,o=>o.id):r.sessions,nextCursor:r.nextCursor}}:n.workspaceSessions};case"workspaces_loaded":return{...n,workspaceId:r.value.activeId||n.workspaceId,workspace:r.value.activePath||n.workspace,workspaces:r.append?Jn(n.workspaces,r.value.workspaces,o=>o.id):r.value.workspaces,workspaceNextCursor:r.value.nextCursor};case"workspace_sessions_loading":return{...n,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"loading",items:n.workspaceSessions[r.workspaceId]?.items??[],nextCursor:n.workspaceSessions[r.workspaceId]?.nextCursor??null}}};case"workspace_sessions_loaded":{const o=n.workspaceSessions[r.workspaceId],a=r.append?Jn(o?.items??[],r.sessions,d=>d.id):r.sessions;return{...n,sessions:r.workspaceId===n.workspaceId?a:n.sessions,sessionNextCursor:r.workspaceId===n.workspaceId?r.nextCursor:n.sessionNextCursor,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"ready",items:a,nextCursor:r.nextCursor}}}}case"workspace_sessions_failed":return{...n,workspaceSessions:{...n.workspaceSessions,[r.workspaceId]:{status:"error",items:n.workspaceSessions[r.workspaceId]?.items??[],nextCursor:n.workspaceSessions[r.workspaceId]?.nextCursor??null,error:r.detail}}};case"session_updated":return Cf(n,a=>wx(a,r.session));case"session_archived":{const o=Sf(n,r.session.id),a=n.archivedSessions.items.some(d=>d.id===r.session.id);return{...o,archivedSessions:a?o.archivedSessions:{...o.archivedSessions,status:"ready",items:[r.session,...o.archivedSessions.items]}}}case"session_restored":{const o=Cf(n,a=>[r.session,...a.filter(d=>d.id!==r.session.id)]);return{...o,archivedSessions:{...o.archivedSessions,items:o.archivedSessions.items.filter(a=>a.id!==r.session.id)}}}case"session_deleted":{const o={...n.sessionRuntimeById};return delete o[r.sessionId],{...Sf(n,r.sessionId),sessionRuntimeById:o,archivedSessions:{...n.archivedSessions,items:n.archivedSessions.items.filter(a=>a.id!==r.sessionId)}}}case"archived_sessions_loading":return r.workspaceId!==n.workspaceId?n:{...n,archivedSessions:{status:"loading",items:n.archivedSessions.ownerWorkspaceId===r.workspaceId?n.archivedSessions.items:[],nextCursor:n.archivedSessions.nextCursor,ownerWorkspaceId:n.archivedSessions.ownerWorkspaceId}};case"archived_sessions_loaded":{if(r.workspaceId!==n.workspaceId)return n;const o=r.append?Jn(n.archivedSessions.items,r.sessions,a=>a.id):r.sessions;return{...n,archivedSessions:{status:"ready",items:o,nextCursor:r.nextCursor,ownerWorkspaceId:r.workspaceId}}}case"archived_sessions_failed":return r.workspaceId!==n.workspaceId?n:{...n,archivedSessions:{...n.archivedSessions,status:"error",error:r.detail}};case"workspace_project_summary_loaded":return{...n,workspaceProjectSummaries:{...n.workspaceProjectSummaries,[r.summary.workspaceId]:r.summary}};case"settings_loaded":return{...n,settings:r.settings};case"settings_mirror_changed":return{...n,settings:r.snapshot.document??r.snapshot.lastGood,settingsMirror:r.snapshot};case"diagnostics_loaded":return{...n,diagnostics:r.diagnostics,processing:!!(r.diagnostics.processing??n.processing),mode:Ef(r.diagnostics,n.mode)};case"capabilities_loaded":return{...n,skills:r.append?Jn(n.skills,r.skills,o=>o.id):r.skills,skillNextCursor:r.skillNextCursor,mcpServers:r.append?Jn(n.mcpServers,r.mcpServers,o=>o.id):r.mcpServers,mcpNextCursor:r.mcpNextCursor};case"tool_details_loaded":return{...n,toolDetails:r.append?Jn(n.toolDetails,r.details,o=>`${o.sequence}:${o.callId}`):r.details,toolDetailNextCursor:r.nextCursor};case"pending_action":return{...n,pendingAction:r.label};case"notice":return{...n,notice:r.notice};case"approval_resolved":return n.permission?.id!==r.requestId?n:{...n,permission:null,announcement:r.approved?"工具权限已授予":"工具请求已拒绝"};case"snapshot_failed":{if(!If(n,r.contextRevision,r.workspaceId))return n;if(!r.sessionId)return n.connection==="replay-required"?n:{...n,notice:{id:r.requestId??n.lastCursor,tone:"warning",title:"会话状态尚未同步",detail:r.detail},announcement:"会话状态尚未同步"};if(!_f(n,r.sessionId,r.requestId)||r.sessionId!==n.activeSessionId&&r.requestId===void 0)return n;const o=yo(Gs(n,r.sessionId,{status:"failed",requestId:r.requestId??n.sessionSync[r.sessionId]?.requestId??null,error:r.detail}),{snapshotFailures:1});return r.sessionId!==n.activeSessionId||n.connection==="replay-required"?o:{...o,statusMessage:n.sessionSnapshot?.session.id===r.sessionId?"会话刷新失败,当前显示最近状态":"会话快照加载失败",notice:{id:r.requestId??n.lastCursor,tone:"warning",title:"会话快照尚未同步",detail:r.detail,domain:"session-snapshot",sessionId:r.sessionId},announcement:"当前会话快照尚未同步,写操作已暂停"}}case"reset_session_view":{const o=!!r.activeSessionId&&r.activeSessionId!==n.activeSessionId,a=!!(r.activeSessionId&&n.sessionProjectionById[r.activeSessionId]),d={...o?{sessionSwitches:1}:{},...a?{snapshotCacheHits:1}:{}};if(r.activeSessionId&&n.sessionProjectionById[r.activeSessionId]){const g=r.activeSessionId,w=kf({...n,activeSessionId:g},n.sessionProjectionById[g],!1);return yo({...Gs(w,g,{status:"refreshing",requestId:n.sessionSync[g]?.requestId??null}),notice:n.notice?.domain==="session-snapshot"&&n.notice.sessionId!==g?null:n.notice,statusMessage:"已显示最近会话状态,正在同步…",announcement:"已切换到缓存会话,正在同步最新状态"},d)}const f={...Js(n),activeSessionId:r.activeSessionId,notice:n.notice?.domain==="session-snapshot"&&n.notice.sessionId!==r.activeSessionId?null:n.notice,statusMessage:r.activeSessionId?"正在加载会话快照…":"请选择会话",announcement:r.activeSessionId?"正在加载会话快照":"会话已清除"},h=r.activeSessionId?Gs(f,r.activeSessionId,{status:"loading",requestId:n.sessionSync[r.activeSessionId]?.requestId??null}):f;return yo(h,d)}case"recovering":return{...n,connection:"connecting",replayReason:void 0,notice:null,announcement:"正在重新加载会话状态"}}}function gx(n,r){if(r.type==="replay_reset")return{...n,lastCursor:r.cursor,lastEventId:r.eventId,connection:"replay-required",replayReason:r.payload.reason,notice:{id:r.cursor,tone:"warning",title:"需要重新载入会话",detail:r.payload.reason,domain:"transport"},announcement:"事件历史已超出保留窗口,需要重新载入会话"};if(n.connection==="replay-required"||r.cursor<=n.lastCursor)return n;const o={...n,lastCursor:r.cursor,lastEventId:r.eventId};if(r.type==="settings_invalidated")return{...o,announcement:r.payload.revision===n.settings?.revision?"Host 设置已同步":r.payload.state==="invalid"?"设置文档无效,仍保留上一次可用值":"Host 设置已更新,正在刷新"};if(r.type==="workspace_resource_invalidated"){const d={...n.workspaceResourceEpochs[r.payload.workspaceId]??{files:0,git:0,review:0}};for(const f of r.payload.resources)d[f]=r.cursor;return{...o,workspaceResourceEpochs:{...n.workspaceResourceEpochs,[r.payload.workspaceId]:d},announcement:"项目资源已变化,可用面板正在刷新"}}if(r.type==="workbench_state"){const a=n.workspaceId!==""&&n.workspaceId!==r.payload.workspaceId||n.workspace!==""&&n.workspace!==r.payload.workspace;return{...a?Js(o):o,contextRevision:r.payload.contextRevision,workspaceId:r.payload.workspaceId,workspace:r.payload.workspace,activeSessionId:a?null:n.activeSessionId}}if(r.type==="composer_state_changed"){const a=r.payload.state;return a.sessionId!==o.activeSessionId||a.workspaceId!==o.workspaceId||a.contextRevision!==o.contextRevision?o:gp(o,a)}if(r.type==="session_runtime_changed"){const a=r.payload.runtime,d=o.sessionProjectionById[a.sessionId],f=Bo(o.sessionRuntimeById,a),h=d?Fo(o.sessionProjectionById,{...d,sessionRuntime:a}):o.sessionProjectionById;return a.sessionId!==o.activeSessionId?{...o,sessionProjectionById:h,sessionRuntimeById:f}:{...o,sessionProjectionById:h,sessionRuntimeById:f,processing:["running","waiting_approval","stopping"].includes(a.phase),sessionSnapshot:o.sessionSnapshot?.session.id===a.sessionId?{...o.sessionSnapshot,sessionRuntime:a}:o.sessionSnapshot,composer:o.composer?.sessionId===a.sessionId?{...o.composer,sessionRuntime:a}:o.composer}}if(r.type==="workspace_mutation_changed"){if(r.sessionId!==o.activeSessionId)return o;const a=o.tools.find(f=>f.callId===r.payload.state.callId);if(!a)return o;const d={phase:r.payload.state.phase,...r.payload.state.queuePosition===void 0?{}:{queuePosition:r.payload.state.queuePosition}};return{...o,tools:Ha(o.tools,{...a,workspaceMutation:d}),announcement:d.phase==="queued"?`工具 ${a.name} 正在等待工作树写入`:d.phase==="running"?`工具 ${a.name} 已获得工作树写入权限`:o.announcement}}return r.sessionId!==null&&r.sessionId!==o.activeSessionId?o:r.type==="thread_event"?vx(o,r.payload.value):yx(o,r.payload.value,r.eventId,r.cursor,r.timestamp)}function vx(n,r){const o=r.payload;switch(o.type){case"thread.started":case"thread.resumed":return{...n,statusMessage:"会话线程已就绪"};case"thread.forked":return{...n,statusMessage:"分支线程已就绪"};case"turn.started":return{...n,processing:!0,statusMessage:o.data.mode==="plan"?"正在制定计划…":"Orion 正在处理…",announcement:"新回合已开始"};case"turn.queued":return{...n,statusMessage:"消息已进入 Runtime 队列"};case"turn.queue_expired":return{...n,notice:{id:n.lastCursor,tone:"warning",title:"一条排队消息已过期",detail:`队列项 ${o.data.queueId} 未在时限内开始。`}};case"turn.steered":return{...n,statusMessage:"已将补充指令送入当前回合"};case"turn.interrupt_requested":return{...n,statusMessage:"正在中断当前回合…"};case"turn.committed":return{...n,statusMessage:"回合结果已持久化"};case"plan.review_requested":return{...n,processing:!1,statusMessage:"计划已保存,等待审核",announcement:"计划已准备好,请审核后再执行"};case"plan.review_resolved":return{...n,statusMessage:o.data.action==="approve"?"计划已批准,正在进入 BUILD":o.data.action==="continue"?"已提交继续规划反馈":"计划已取消"};case"turn.completed":return{...n,processing:!1,permission:null,statusMessage:"任务已完成",announcement:"当前回合已完成"};case"turn.failed":return{...n,processing:!1,permission:null,statusMessage:"当前回合失败",notice:{id:n.lastCursor,tone:"error",title:"当前回合失败",detail:o.data.error},announcement:"当前回合失败"};case"turn.interrupted":return{...n,processing:!1,permission:null,statusMessage:"当前回合已中断",announcement:"当前回合已中断"};case"compact.started":return{...n,statusMessage:"正在压缩上下文…"};case"compact.completed":return{...n,statusMessage:"上下文压缩完成"};case"compact.failed":return{...n,statusMessage:"上下文压缩失败",notice:{id:n.lastCursor,tone:"warning",title:"上下文压缩失败",detail:o.data.error}};case"approval.requested":return{...n,statusMessage:`等待确认:${o.data.toolName}`};case"item.started":case"item.delta":case"item.completed":case"item.failed":case"item.interrupted":case"item.indeterminate":case"step.snapshot":case"capability.receipt":case"tool.receipt":return n}}function yx(n,r,o,a,d){switch(r.type){case"transcript_append":{const f={...r.entry,id:`web-entry-${a}`,eventId:o,order:a,receivedAt:d};return{...n,transcript:Co(n.transcript,f,To)}}case"transcript_update":if(r.contentDelta!==void 0){const f=n.transcript.find(h=>h.id===r.id);if(!f||r.contentStart===void 0||(f.content??"").length!==r.contentStart){const h="流式回复基线已变化,需要重新载入会话。";return{...n,connection:"replay-required",replayReason:h,notice:{id:a,tone:"warning",title:"需要重新载入会话",detail:h},announcement:h}}}return{...n,transcript:n.transcript.map(f=>f.id===r.id?{...f,...r.patch,...r.contentDelta===void 0?{}:{content:`${f.content??""}${r.contentDelta}`}}:f)};case"transcript_finalize":return{...n,transcript:n.transcript.map(f=>f.id===r.id?{...f,...r.patch,live:!1}:f)};case"transcript_remove":return{...n,transcript:n.transcript.filter(f=>f.id!==r.id)};case"transcript_replace":{const f=Math.max(1,r.entries.length);return{...n,transcript:r.entries.slice(-To).map((h,g)=>({...h,eventId:`${o}:${g}`,order:a-1+(g+1)/(f+1),receivedAt:d,live:!1}))}}case"transcript_clear":return{...Js(n),activeSessionId:n.activeSessionId,statusMessage:"新会话已就绪"};case"status_changed":return{...n,statusMessage:r.message};case"permission_requested":return{...n,permission:{...r.request,eventId:o},announcement:`需要确认工具权限:${r.request.name}`};case"tool_started":{const f={callId:r.event.callId,eventId:o,order:a,name:r.event.name,args:r.event.args,sequence:r.event.sequence,state:"running",startedAt:d};return{...n,tools:Ha(n.tools,f),announcement:`工具 ${f.name} 已开始`}}case"tool_finished":{const f=n.tools.find(g=>g.callId===r.event.callId),h={callId:r.event.callId,eventId:f?.eventId??o,order:f?.order??a,name:r.event.name,args:r.event.args,sequence:r.event.sequence,state:r.event.skipped?"skipped":r.event.success?"success":"error",startedAt:f?.startedAt,finishedAt:d,duration:r.event.duration,summary:r.event.summary,error:r.event.error,outputBytes:r.event.outputBytes,artifactId:r.event.artifactRef?.id,authorization:r.event.authorization};return{...n,tools:Ha(n.tools,h),announcement:`工具 ${h.name} ${h.state==="success"?"已完成":h.state==="skipped"?"已跳过":"失败"}`}}case"edit_preview_requested":{const f={eventId:o,order:a,receivedAt:d,request:r.request};return{...n,edits:Co(n.edits,f,ux)}}case"session_restored":return{...n,activeSessionId:r.event.sessionId,statusMessage:`已恢复 ${r.event.restoredMessages} 条消息`,announcement:"会话恢复完成",notice:r.event.warnings&&r.event.warnings.length>0?{id:a,tone:"warning",title:"会话已恢复,但有注意事项",detail:r.event.warnings.join(" ")}:n.notice};case"loop_stats_updated":return{...n,loopStats:r.stats};case"trace_event_recorded":return{...n,traces:Co(n.traces,r.event,dx)};case"harness_diagnostics_updated":return{...n,diagnostics:{...n.diagnostics??{},harness:r.diagnostics}};case"subtask_event":{const f={...r.event,eventId:o,order:a,updatedAt:d},h=[...n.subtasks.filter(g=>g.taskId!==f.taskId),f].slice(-256);return{...n,subtasks:h}}case"research_event":return{...n,research:jx(n.research,r.event,o,a,d)};case"goal_event":return kx(n,r.event,d);case"effort_event":return{...n,effort:r.event};case"followup_queue_changed":return{...n,queue:r.snapshot};case"processing_changed":return{...n,processing:r.processing,permission:r.processing?n.permission:null,announcement:r.processing?"Orion 开始处理任务":"Orion 已完成当前处理"};case"agent_mode_changed":return{...n,mode:r.snapshot};case"clear_view":return{...n,transcript:[],tools:[],edits:[]};case"shutdown_requested":return{...n,connection:"closed",processing:!1,permission:null,statusMessage:r.reason??"Web Host 已关闭",announcement:"Orion Web Host 已关闭"};case"session_picker_requested":case"model_picker_requested":return n}}function kf(n,r,o=!0){const a=vp(r).slice(-To),d=xp(r.runtime.agentMode)?r.runtime.agentMode:n.mode.baseMode,f=r.pendingApprovals[0],h=yp(r.goal);return{...Js(n),lastCursor:o?Math.max(n.lastCursor,r.eventCursor):n.lastCursor,activeSessionId:r.session.id,sessionProjectionById:Fo(n.sessionProjectionById,r),sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),sessions:er(n.sessions,r.session),workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(n.workspaceSessions[n.workspaceId]?.items??n.sessions,r.session),nextCursor:n.workspaceSessions[n.workspaceId]?.nextCursor??n.sessionNextCursor}}:n.workspaceSessions,transcript:a,permission:f?{id:f.id,name:f.toolName,reason:f.reason,args:{...f.sanitizedArguments},eventId:`snapshot:${f.id}`}:null,processing:r.runtime.processing,statusMessage:r.runtime.status,mode:r.composer.mode??{baseMode:d,pendingBaseMode:null},queue:{items:r.composer.queue.items.map(g=>({...g})),limit:r.composer.queue.limit},goal:h,plan:r.plan??null,composer:r.composer,sessionSnapshot:r,diagnostics:{...n.diagnostics??{},activeSessionId:r.session.id,processing:r.runtime.processing,agentMode:d,permissionMode:r.runtime.permissionMode,contextUsage:r.runtime.contextUsage,tokenUsage:r.runtime.tokenUsage,plan:r.plan?.body??null,recoveryDiagnostics:r.recoveryDiagnostics},announcement:"会话快照已同步"}}function jf(n,r){const o=n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(n.workspaceSessions[n.workspaceId]?.items??n.sessions,r.session),nextCursor:n.workspaceSessions[n.workspaceId]?.nextCursor??n.sessionNextCursor}}:n.workspaceSessions;return{...n,sessionProjectionById:Fo(n.sessionProjectionById,r),sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),sessions:er(n.sessions,r.session),workspaceSessions:o}}function gp(n,r){const o=n.sessionProjectionById[r.sessionId],a=o?Fo(n.sessionProjectionById,{...o,sessionRuntime:r.sessionRuntime,composer:r}):n.sessionProjectionById;return{...n,composer:r,sessionSnapshot:n.sessionSnapshot?.session.id===r.sessionId?{...n.sessionSnapshot,sessionRuntime:r.sessionRuntime,composer:r}:n.sessionSnapshot,sessionProjectionById:a,sessionRuntimeById:Bo(n.sessionRuntimeById,r.sessionRuntime),processing:r.processing,mode:r.mode,queue:{items:r.queue.items.map(d=>({...d})),limit:r.queue.limit},diagnostics:{...n.diagnostics??{},contextUsage:r.contextUsage,agentMode:r.mode.baseMode}}}function xx(n,r){const o=er(n.sessions,r.session),a=n.workspaceSessions[n.workspaceId],d=!n.composer||n.composer.controlRevision===r.composer.controlRevision?r.composer:n.composer;return{...n,sessions:o,workspaceSessions:{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:er(a?.items??n.sessions,r.session),nextCursor:a?.nextCursor??n.sessionNextCursor}},goal:yp(r.goal),plan:r.plan,composer:d,sessionSnapshot:n.sessionSnapshot?.session.id===r.session.id?{...n.sessionSnapshot,session:r.session,goal:r.goal,plan:r.plan,composer:d,recoveryDiagnostics:r.recoveryDiagnostics}:n.sessionSnapshot,diagnostics:{...n.diagnostics??{},plan:r.plan?.body??null,recoveryDiagnostics:r.recoveryDiagnostics}}}function vp(n){return n.transcript.items.map((r,o)=>{const a=Number.parseInt(r.id.split(":").at(-1)??"",10);return{id:r.id,role:r.role,content:r.content,eventId:`snapshot:${r.id}`,order:-1e9+(Number.isSafeInteger(a)?a:o),receivedAt:Sx(r.timestamp),live:!1}})}function yp(n){if(!n||!Vs(n.state))return null;const r=n.state;if(typeof r.goalId!="string"||typeof r.objective!="string"||typeof r.status!="string")return null;const o=Vs(r.budget)?r.budget:null,a=Vs(r.lastStopDecision)?r.lastStopDecision:null,d=a&&Vs(a.reason)?xo(a.reason.message):xo(r.stopReason),f=Vs(r.criteria)?{passed:en(r.criteria.passed),total:en(r.criteria.total),failed:en(r.criteria.failed),stale:en(r.criteria.stale)}:void 0;return{goalId:r.goalId,revision:en(r.revision,en(r.generation,1)),objective:r.objective,status:r.status,tokenBudget:Ta(r.tokenBudget)??Ta(o?.maxTokens),tokensUsed:en(r.tokensUsed),timeUsedMs:en(r.timeUsedMs,en(r.elapsedMs)),continuationCount:en(r.continuationCount),updatedAt:en(r.updatedAt),stopReason:d,criteria:f,planRevision:Ta(r.planRevision),planPhase:xo(r.planPhase),nextAction:xo(r.nextAction),auditRemaining:Array.isArray(r.auditRemaining)?r.auditRemaining.filter(h=>typeof h=="string"):void 0}}function Jn(n,r,o){const a=new Map(n.map(d=>[o(d),d]));for(const d of r)a.set(o(d),d);return[...a.values()]}function wx(n,r){const o=n.findIndex(d=>d.id===r.id);if(o<0)return[r,...n];const a=[...n];return a[o]=r,a}function Sf(n,r){const o=n.workspaceId,a=o?n.workspaceSessions[o]:void 0,d=(a?.items??n.sessions).filter(f=>f.id!==r);return{...n,sessions:o?d:n.sessions,workspaceSessions:o?{...n.workspaceSessions,[o]:{status:(a?.status??"ready")==="error"?"error":"ready",items:d,nextCursor:a?.nextCursor??null,error:a?.error}}:n.workspaceSessions}}function Cf(n,r){const o=n.workspaceId,a=o?n.workspaceSessions[o]:void 0,d=a?.items??n.sessions,f=r(d),h=a?.status==="error"?"error":a?.status==="loading"?"loading":"ready";return{...n,sessions:o?f:n.sessions,workspaceSessions:o?{...n.workspaceSessions,[o]:{status:h,items:f,nextCursor:a?.nextCursor??null,error:a?.error}}:n.workspaceSessions}}function kx(n,r,o){switch(r.type){case"goal_updated":case"goal_restored":return{...n,goal:r.goal,goalActivity:es(n.goalActivity,r.type,"Goal 状态已更新",o)};case"goal_completed":return{...n,goal:r.goal,goalActivity:es(n.goalActivity,r.type,r.audit.verificationSummary,o),announcement:"Goal 已完成并通过运行时审计"};case"goal_cleared":return{...n,goal:null,goalEvidence:[],goalActivity:es(n.goalActivity,r.type,r.reason,o)};case"goal_plan_updated":return{...n,goal:n.goal?{...n.goal,planRevision:r.planRevision,planPhase:r.phase,nextAction:r.nextAction}:n.goal,goalActivity:es(n.goalActivity,r.type,r.nextAction??`Plan phase: ${r.phase}`,o)};case"goal_evidence_recorded":{const a=r.evidence;return{...n,goalEvidence:[...n.goalEvidence.filter(d=>d.id!==a.id),a].slice(-256)}}case"goal_continuation":return{...n,goalActivity:es(n.goalActivity,`${r.type}:${r.phase}`,r.reason,o)};case"goal_audit_failed":return{...n,goalActivity:es(n.goalActivity,r.type,r.summary,o),notice:{id:Date.parse(o),tone:"warning",title:"Goal 审计尚未通过",detail:r.summary}}}}function jx(n,r,o,a,d){const h=n.find(w=>w.packetId===r.packetId)??{packetId:r.packetId,eventId:o,order:a,updatedAt:d,stage:"running",sources:[],conflicts:[]};let g;switch(r.type){case"research_started":g={...h,eventId:o,order:a,updatedAt:d,objective:r.objective,mode:r.mode,stage:"running"};break;case"research_source":{const w={id:r.sourceId,provider:r.provider,status:r.status,title:r.title,location:r.displayUrl??r.canonicalUrl??r.projectPath,failureReason:r.failureReason};g={...h,eventId:o,order:a,updatedAt:d,sources:[...h.sources.filter(j=>j.id!==w.id),w].slice(-64)};break}case"research_conflict":g={...h,eventId:o,order:a,updatedAt:d,conflicts:[...h.conflicts.filter(w=>w!==r.claimId),r.claimId].slice(-64)};break;case"research_completed":g={...h,eventId:o,order:a,updatedAt:d,stage:r.stage,auditStatus:r.auditStatus,conclusion:r.conclusion,summary:r.summary};break}return[...n.filter(w=>w.packetId!==r.packetId),g].slice(-128)}function Ha(n,r){return[...n.filter(o=>o.callId!==r.callId),r].sort((o,a)=>o.order-a.order).slice(-1e3)}function Fo(n,r){const o=Object.entries(n).filter(([d])=>d!==r.session.id);o.push([r.session.id,r]);let a=o.reduce((d,[,f])=>d+Nf(f),0);for(;o.length>1&&(o.length>px||a>mp);){const d=o.shift();d&&(a-=Nf(d[1]))}return Object.freeze(Object.fromEntries(o))}function Bo(n,r){const o=Object.entries(n).filter(([a])=>a!==r.sessionId);return o.push([r.sessionId,r]),Object.freeze(Object.fromEntries(o.slice(-64)))}function Nf(n){try{return JSON.stringify(n).length*2}catch{return mp}}function Js(n){return{...n,transcript:[],tools:[],edits:[],subtasks:[],research:[],permission:null,processing:!1,statusMessage:"",queue:{items:[],limit:16},goal:null,goalEvidence:[],goalActivity:[],sessionSnapshot:null,composer:null,modelCatalog:null,plan:null,loopStats:null,traces:[]}}function Gs(n,r,o){const a={...n.sessionSync};delete a[r],a[r]=o;const d=Object.keys(a).length-hx;return d>0&&Object.keys(a).filter(f=>f!==n.activeSessionId&&f!==r).slice(0,d).forEach(f=>delete a[f]),{...n,sessionSync:a}}function yo(n,r){const o={sessionSwitches:n.clientTelemetry.sessionSwitches+(r.sessionSwitches??0),snapshotCacheHits:n.clientTelemetry.snapshotCacheHits+(r.snapshotCacheHits??0),snapshotLoads:n.clientTelemetry.snapshotLoads+(r.snapshotLoads??0),snapshotFailures:n.clientTelemetry.snapshotFailures+(r.snapshotFailures??0)};return{...n,clientTelemetry:o}}function bf(n,r){const o=Gs(n,r,{status:"ready",requestId:n.sessionSync[r]?.requestId??null});return o.notice?.domain!=="session-snapshot"||o.notice.sessionId!==r?o:{...o,notice:null}}function _f(n,r,o){return o===void 0||n.sessionSync[r]?.requestId===o}function If(n,r,o){return(r===void 0||n.contextRevision===r)&&(o===void 0||n.workspaceId===o)}function es(n,r,o,a){return Co(n,{type:r,message:o,timestamp:a},fx)}function Co(n,r,o){const a=[...n,r];return a.length<=o?a:a.slice(a.length-o)}function Ef(n,r){const o=n.agentMode;return xp(o)?{baseMode:o,pendingBaseMode:null}:r}function xp(n){return n==="interactive"||n==="plan"||n==="auto"}function Sx(n){const r=new Date(n);return Number.isFinite(r.getTime())?r.toISOString():new Date(0).toISOString()}function Vs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function en(n,r=0){return typeof n=="number"&&Number.isFinite(n)?n:r}function Ta(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function xo(n){return typeof n=="string"&&n?n:void 0}function Cx(){return typeof navigator>"u"||navigator.onLine}function Nx(n,r){return n==="live"?"本地 Web Host 事件流已连接":n==="offline"?"浏览器已离线,本地 Web Host 将在网络恢复后重连":n==="reconnecting"?`正在重新连接本地 Web Host,第 ${Math.max(1,r)} 次尝试`:n==="connecting"?"正在连接本地 Web Host":n==="replay-required"?"本地 Web Host 事件历史需要重新载入":"本地 Web Host 已关闭"}const Pf="orion.web.theme",Rf="orion.web.motion";function bx(n){const r=Mf(Pf),o=Mf(Rf),a=_x(r),d=Ix(o),f=[],h=[];return r!==null&&h.push(Pf),o!==null&&h.push(Rf),n.sections.appearance.theme.explicitValue===void 0&&a&&f.push({op:"set",key:"appearance.theme",value:a}),n.sections.appearance.motion.explicitValue===void 0&&d&&f.push({op:"set",key:"appearance.motion",value:d}),{operations:f,keysToClear:h}}function Tf(n){if(!(typeof window>"u"))for(const r of n)try{window.localStorage.removeItem(r)}catch{}}function Mf(n){if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}}function _x(n){return n==="system"||n==="light"||n==="dark"?n:null}function Ix(n){return n==="system"||n==="reduced"?n:null}class Ex{constructor(r){Bt(this,"read");Bt(this,"snapshot",Object.freeze({status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:0}));Bt(this,"listeners",new Set);Bt(this,"inFlight",null);Bt(this,"rerun",!1);Bt(this,"generation",0);Bt(this,"disposed",!1);this.read=r}getSnapshot(){return this.snapshot}subscribe(r){return this.listeners.add(r),()=>this.listeners.delete(r)}ensure(){return this.snapshot.document||this.inFlight?this.inFlight??Promise.resolve(this.snapshot):this.refresh()}refresh(){if(this.disposed)return Promise.resolve(this.snapshot);if(this.inFlight)return this.rerun=!0,this.inFlight;const r=Promise.resolve().then(()=>this.run());return this.inFlight=r,r}accept(r){return this.disposed?this.snapshot:(this.generation+=1,this.inFlight&&(this.rerun=!0),this.publishDocument(r))}invalidate(r,o){return this.snapshot.document?.revision===r&&(o==="ready"?this.snapshot.document.state==="ready":this.snapshot.document.state==="invalid")?Promise.resolve(this.snapshot):(this.setSnapshot({...this.snapshot,stale:!0}),this.refresh())}reset(){this.disposed||(this.generation+=1,this.rerun=!1,this.setSnapshot({status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:this.generation}))}dispose(){this.disposed=!0,this.generation+=1,this.listeners.clear()}async run(){try{do{this.rerun=!1;const r=++this.generation;this.setSnapshot({...this.snapshot,status:this.snapshot.document?"ready":"loading",error:null,generation:r});try{const o=await this.read();if(this.disposed)return this.snapshot;if(r!==this.generation)continue;this.publishDocument(o)}catch(o){if(this.disposed)return this.snapshot;if(r!==this.generation)continue;this.setSnapshot({...this.snapshot,status:this.snapshot.document?"ready":"unavailable",stale:!0,error:o instanceof Error?o.message:"设置读取失败。",generation:r})}}while(this.rerun&&!this.disposed);return this.snapshot}finally{if(this.inFlight=null,this.rerun&&!this.disposed)return this.refresh()}}publishDocument(r){const o=r.state==="ready"?r:this.snapshot.lastGood;return this.setSnapshot({status:"ready",document:r,lastGood:o,stale:!1,error:null,generation:this.generation}),this.snapshot}setSnapshot(r){this.snapshot=Object.freeze(r);for(const o of this.listeners)o()}}function Px(n,r,o){if(n)return n;const a=new Set(r.map(d=>d.id));return o&&a.has(o)?o:r[0]?.id??null}const Rx=7,Tx=2;function Mx(){const n=m.useMemo(()=>new Lg,[]),r=m.useMemo(()=>new Ex(()=>n.settings()),[n]),[o,a]=m.useReducer(mx,Df),[d,f]=m.useState(0),h=m.useRef(o),g=m.useRef(null),w=m.useRef(0),j=m.useRef(0),P=m.useRef(new Map),C=m.useRef(0),O=m.useRef(0),R=m.useRef(new Map),z=m.useRef(()=>{}),L=m.useRef(!1);h.current=o,m.useEffect(()=>r.subscribe(()=>{a({type:"settings_mirror_changed",snapshot:r.getSnapshot()})}),[r]);const q=m.useCallback((S,b=Pe(h.current),B={})=>{const ie=`${b.workspaceId}:${b.expectedContextRevision}:${S}`,ae=R.current.get(ie);if(ae&&!B.force)return ae.promise;const Oe=++O.current;a({type:"session_snapshot_started",sessionId:S,requestId:Oe,cached:!!h.current.sessionProjectionById[S],contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId});const Ke=n.sessionSnapshot(S,b).then(He=>(Of(He,S,b),a({type:"session_snapshot_loaded",snapshot:He,requestId:Oe,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId,advanceEventCursor:g.current===null}),He)).catch(He=>{const At=ns(He);throw a({type:"snapshot_failed",sessionId:S,detail:At,requestId:Oe,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId}),new Ie(At,He instanceof Ie?He.status:503,"session_snapshot_sync_failed",He instanceof Ie?He.type:void 0)}).finally(()=>{R.current.get(ie)?.requestId===Oe&&R.current.delete(ie)});return R.current.set(ie,{requestId:Oe,promise:Ke}),Ke},[n]),X=m.useCallback(async()=>{const S=++j.current;try{const b=await n.bootstrap(),B={expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId};r.reset(),r.accept(b.settings);const[ie,ae,Oe]=await Promise.all([n.listWorkspaces(B),n.listSessions(B),r.refresh()]),Ke=Ax(b.workspaceId,ae.sessions,b.activeSessionId);Ks(b.workspaceId,Ke);const He=Object.freeze({...b,activeSessionId:Ke}),At=Ke?await n.sessionSnapshot(Ke,B).then(ut=>(Of(ut,Ke,B),{snapshot:ut,error:void 0})).catch(ut=>({snapshot:null,error:ut})):{snapshot:null,error:void 0},Er=await Ox(n,r,Oe.document??Oe.lastGood??b.settings,B);if(S!==j.current)return;a({type:"baseline_loaded",bootstrap:He,workspaces:ie,sessions:ae.sessions,sessionNextCursor:ae.nextCursor,diagnostics:{},settings:Er,skills:[],skillNextCursor:null,mcpServers:[],mcpNextCursor:null,toolDetails:[],toolDetailNextCursor:null}),At.snapshot&&a({type:"session_snapshot_loaded",snapshot:At.snapshot,contextRevision:B.expectedContextRevision,workspaceId:B.workspaceId}),At.error&&a({type:"snapshot_failed",sessionId:Ke,detail:ns(At.error),contextRevision:B.expectedContextRevision,workspaceId:B.workspaceId}),z.current();const us=ae.sessions.map(ut=>ut.id).filter(ut=>ut!==Ke).slice(0,Rx);z.current=Bx(()=>{S===j.current&&qx(us,Tx,async ut=>{S===j.current&&await q(ut,B).catch(()=>{})})}),n.workspaceProjectSummary(b.workspaceId,B).then(ut=>{S===j.current&&a({type:"workspace_project_summary_loaded",summary:ut})}).catch(()=>{}),Promise.all([n.diagnostics(B).catch(()=>({})),n.skills(B).catch(()=>({skills:[],nextCursor:null})),n.mcp(B).catch(()=>({servers:[],nextCursor:null})),n.toolDetails(B).catch(()=>({details:[],nextCursor:null}))]).then(([ut,ni,ri,on])=>{S===j.current&&(a({type:"diagnostics_loaded",diagnostics:ut}),a({type:"capabilities_loaded",skills:ni.skills,skillNextCursor:ni.nextCursor,mcpServers:ri.servers,mcpNextCursor:ri.nextCursor}),a({type:"tool_details_loaded",details:on.details,nextCursor:on.nextCursor}))})}catch(b){throw b}},[n,q,r]),W=m.useCallback(async()=>{let S;for(let b=0;b<3;b+=1)try{await X();return}catch(B){if(S=B,!Wx(B)||b===2)break;await Fx(100*3**b)}throw a({type:"boot_failed",message:ns(S)}),S},[X]);m.useEffect(()=>{if(L.current)return;L.current=!0;let S=!0;return W().catch(()=>{}),()=>{S=!1}},[W]),m.useEffect(()=>()=>{z.current()},[]);const he=o.bootstrap!==null;m.useEffect(()=>{if(!he)return;const S=n.connectEvents({cursor:h.current.lastCursor,onEvent:b=>{if(a({type:"event_received",envelope:b}),Ux(b)){const B=h.current;if(b.sessionId&&B.contextRevision&&B.workspaceId){const ie=b.sessionId,ae=++C.current;P.current.set(ie,ae);const Oe=B.contextRevision,Ke=B.workspaceId;n.sessionSnapshot(ie,{expectedContextRevision:Oe,workspaceId:Ke}).then(He=>{P.current.get(ie)===ae&&a({type:"durable_session_metadata_loaded",snapshot:He,contextRevision:Oe,workspaceId:Ke})}).catch(()=>{}).finally(()=>{P.current.get(ie)===ae&&P.current.delete(ie)})}}b.type==="settings_invalidated"&&r.invalidate(b.payload.revision,b.payload.state)},onStatus:(b,B)=>a({type:"connection_changed",phase:b,attempt:B}),onProtocolError:b=>a({type:"notice",notice:{id:Date.now(),tone:"error",title:"收到无法识别的 Web Host 事件流消息",detail:b}})});return g.current=S,()=>{S.close(),g.current===S&&(g.current=null)}},[n,he,r,d]);const Z=m.useCallback(()=>{g.current?.close(),g.current=null},[]),ee=m.useCallback(()=>{f(S=>S+1)},[]);m.useEffect(()=>{!o.workspace||o.boot!=="ready"||o.pendingAction||o.bootstrap?.workspace!==o.workspace&&(Z(),W().catch(S=>$f(a,"工作区刷新失败",S)).finally(ee))},[W,Z,ee,o.boot,o.bootstrap?.workspace,o.pendingAction,o.workspace]),m.useEffect(()=>{o.boot==="ready"&&(o.pendingAction||!o.activeSessionId||o.bootstrap?.workspace===o.workspace&&o.sessionSnapshot?.session.id!==o.activeSessionId&&q(o.activeSessionId).catch(()=>{}))},[q,o.activeSessionId,o.boot,o.bootstrap?.workspace,o.pendingAction,o.sessionSnapshot,o.workspace]);const N=m.useCallback(async(S,b)=>{const B=++w.current;a({type:"pending_action",label:S});try{return await b()}catch(ie){throw zx(ie)||$f(a,`${S}失败`,ie),ie}finally{w.current===B&&a({type:"pending_action",label:null})}},[]),F=m.useCallback(async(S,b)=>N(S,async()=>{if(h.current.connection!=="live")throw new Ie("本地 Web Host 连接尚未就绪,请在连接恢复后重试。",409,"session_not_synchronized");const B=h.current.activeSessionId;if(!B)throw new Ie("当前没有可接收命令的活动会话。",409,"active_session_changed");const ie=h.current.sessionSnapshot;if(!ie||!Sr(h.current))throw new Ie("当前会话快照尚未同步,请刷新后重试。",409,"session_runtime_revision_conflict");try{const ae=await n.command({...b,workspaceId:h.current.workspaceId,expectedContextRevision:h.current.contextRevision,expectedSessionId:B,expectedSessionRuntimeRevision:ie.sessionRuntime.runtimeRevision});return Lx(ae),ae}catch(ae){throw ae instanceof Ie&&["context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(ae.code??"")?(a({type:"snapshot_failed",sessionId:B,detail:ae.message,contextRevision:h.current.contextRevision,workspaceId:h.current.workspaceId}),new Ie(ae.message,ae.status,"session_runtime_revision_conflict",ae.type)):ae}}),[n,N]),re=m.useCallback(async(S,b)=>N(S,async()=>{const B=h.current,ie=B.composer;if(B.connection!=="live"||!B.activeSessionId||!Sr(B)||!ie||ie.sessionId!==B.activeSessionId)throw new Ie("Composer 控制状态尚未与活动会话同步。",409,"composer_control_conflict");try{const ae=await n.composerAction(B.activeSessionId,{...b,workspaceId:B.workspaceId,expectedContextRevision:B.contextRevision,expectedSessionId:B.activeSessionId,expectedSessionRuntimeRevision:ie.sessionRuntime.runtimeRevision,expectedControlRevision:ie.controlRevision});return a({type:"composer_loaded",composer:ae.state}),ae}catch(ae){throw ae instanceof Ie&&["composer_control_conflict","context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(ae.code??"")?(a({type:"snapshot_failed",sessionId:B.activeSessionId,detail:ae.message,contextRevision:B.contextRevision,workspaceId:B.workspaceId}),new Ie(ae.message,ae.status,"composer_control_conflict",ae.type)):ae}}),[n,N]),je=m.useCallback(()=>N("重新连接",W),[W,N]),xe=m.useCallback(()=>N("刷新诊断",async()=>{const S=++j.current,b=await n.diagnostics(Pe(h.current));S===j.current&&a({type:"diagnostics_loaded",diagnostics:b})}),[n,N]),Y=m.useCallback(()=>N("刷新工具详情",async()=>{const S=++j.current,b=await n.toolDetails(Pe(h.current));S===j.current&&a({type:"tool_details_loaded",details:b.details,nextCursor:b.nextCursor})}),[n,N]),pe=m.useCallback(()=>N("加载更多工作区",async()=>{const S=Pe(h.current),b=h.current.workspaceNextCursor;if(b)try{const B=await n.listWorkspaces(S,b);a({type:"workspaces_loaded",value:B,append:!0})}catch(B){if(!wo(B))throw B;a({type:"workspaces_loaded",value:await n.listWorkspaces(S)})}}),[n,N]),te=m.useCallback(()=>N("加载更多会话",async()=>{const S=h.current.sessionNextCursor;if(!S)return;const b=Pe(h.current);try{const B=await n.listSessions(b,S);a({type:"sessions_loaded",sessions:B.sessions,nextCursor:B.nextCursor,append:!0})}catch(B){if(!wo(B))throw B;const ie=await n.listSessions(b);a({type:"sessions_loaded",sessions:ie.sessions,nextCursor:ie.nextCursor})}}),[n,N]),Ce=m.useCallback(async(S,b=!1)=>{const B=Pe(h.current),ie=h.current.workspaceSessions[S],ae=b?ie?.nextCursor:void 0;if(b&&!ae)return;a({type:"workspace_sessions_loading",workspaceId:S});const Oe=n.workspaceProjectSummary(S,B).catch(()=>null);try{const Ke=await n.listWorkspaceSessions(S,B,ae??void 0);a({type:"workspace_sessions_loaded",workspaceId:S,sessions:Ke.sessions,nextCursor:Ke.nextCursor,append:b});const He=await Oe;He&&a({type:"workspace_project_summary_loaded",summary:He})}catch(Ke){throw a({type:"workspace_sessions_failed",workspaceId:S,detail:ns(Ke)}),Ke}},[n]),D=m.useCallback(async S=>{const b=await n.workspaceProjectSummary(S,Pe(h.current));a({type:"workspace_project_summary_loaded",summary:b})},[n]),ue=m.useCallback(()=>N("加载更多能力",async()=>{const S=Pe(h.current),b=h.current.skillNextCursor,B=h.current.mcpNextCursor;if(!(!b&&!B))try{const[ie,ae]=await Promise.all([b?n.skills(S,b):Promise.resolve({skills:[],nextCursor:null}),B?n.mcp(S,B):Promise.resolve({servers:[],nextCursor:null})]);a({type:"capabilities_loaded",skills:ie.skills,skillNextCursor:ie.nextCursor,mcpServers:ae.servers,mcpNextCursor:ae.nextCursor,append:!0})}catch(ie){if(!wo(ie))throw ie;const[ae,Oe]=await Promise.all([n.skills(S),n.mcp(S)]);a({type:"capabilities_loaded",skills:ae.skills,skillNextCursor:ae.nextCursor,mcpServers:Oe.servers,mcpNextCursor:Oe.nextCursor})}}),[n,N]),de=m.useCallback(()=>N("加载更多工具详情",async()=>{const S=Pe(h.current),b=h.current.toolDetailNextCursor;if(b)try{const B=await n.toolDetails(S,b);a({type:"tool_details_loaded",details:B.details,nextCursor:B.nextCursor,append:!0})}catch(B){if(!wo(B))throw B;const ie=await n.toolDetails(S);a({type:"tool_details_loaded",details:ie.details,nextCursor:ie.nextCursor})}}),[n,N]),E=m.useCallback(async()=>{const S=h.current;if(S.connection!=="replay-required"){if(!S.activeSessionId)return;await q(S.activeSessionId,Pe(S),{force:!0});return}await N("恢复本地 Web Host 事件流",async()=>{Z(),a({type:"recovering"});try{await W()}finally{ee()}})},[W,q,Z,ee,N]),K=m.useCallback(S=>N("切换工作区",async()=>{Z();try{const b=await n.activateWorkspace(S,Pe(h.current));a({type:"workspaces_loaded",value:b}),a({type:"reset_session_view",activeSessionId:null}),await W()}finally{ee()}}),[n,W,Z,ee,N]),T=m.useCallback(S=>{const b=h.current;if(b.activeSessionId===S&&b.sessionSnapshot&&b.sessionSync[S]?.status==="ready")return Promise.resolve();const B=Pe(b);return(async()=>{Ks(B.workspaceId,S),a({type:"reset_session_view",activeSessionId:S}),await q(S,B)})()},[q]),y=m.useCallback((S,b)=>S===h.current.workspaceId&&b?T(b):N("切换项目上下文",async()=>{const B=h.current,ie=B.contextRevision;if(!ie)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");if(S===B.workspaceId){Ks(S,b),a({type:"reset_session_view",activeSessionId:b}),b&&await q(b,Pe(B));return}Ks(S,b),Z(),++j.current;try{const ae=await n.activateContext({expectedContextRevision:ie,workspaceId:S,sessionId:b});if(ae.contextRevision!==ae.bootstrap.contextRevision||ae.bootstrap.workspaceId!==S)throw new Ie("Host 返回的项目上下文不一致。",502,"context_response_invalid");a({type:"reset_session_view",activeSessionId:b}),await W()}catch(ae){throw ae instanceof Ie&&(ae.code==="context_revision_conflict"||ae.code==="active_session_changed")&&a({type:"snapshot_failed",sessionId:null,detail:ae.message}),ae}finally{ee()}}),[n,W,q,Z,ee,N,T]),$=m.useCallback((S,b)=>N(b?"置顶项目":"取消置顶",async()=>{await n.setWorkspacePinned(S,b,Pe(h.current)),a({type:"workspaces_loaded",value:await n.listWorkspaces(Pe(h.current))})}),[n,N]),A=m.useCallback(S=>N("移除项目",async()=>{const b=h.current;if(!b.contextRevision)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.removeWorkspace(S,Pe(b)),lg(S),a({type:"workspaces_loaded",value:await n.listWorkspaces(Pe(h.current))})}),[n,N]),ne=m.useCallback(()=>N("创建会话",async()=>{const S=Pe(h.current),b=await n.createSession(S);Ks(S.workspaceId,b.id),a({type:"sessions_loaded",sessions:er(h.current.sessions,b),nextCursor:h.current.sessionNextCursor}),a({type:"reset_session_view",activeSessionId:b.id}),await q(b.id,S)}),[n,q,N]),ye=T,we=m.useCallback(()=>N("加载更早记录",async()=>{const S=h.current.sessionSnapshot,b=h.current.activeSessionId,B=S?.transcript.nextCursor;if(!(!S||!b||!B))try{const ie=await n.sessionSnapshot(b,Pe(h.current),B);if(ie.session.id!==S.session.id||ie.threadId!==S.threadId||ie.threadCursor!==S.threadCursor||ie.projectionDigest!==S.projectionDigest)throw new Ie("加载历史记录时会话快照发生变化,正在恢复最新快照。",409,"transcript_cursor_stale");a({type:"older_transcript_loaded",snapshot:ie})}catch(ie){if(!(ie instanceof Ie)||ie.code!=="transcript_cursor_stale")throw ie;Z(),a({type:"recovering"});try{await q(b,Pe(h.current),{force:!0})}finally{ee()}}}),[n,q,Z,ee,N]),be=m.useCallback((S,b)=>N("重命名会话",async()=>{const B=await n.renameSession(S,b,Pe(h.current)),ie=er(h.current.sessions,B);a({type:"sessions_loaded",sessions:ie,nextCursor:h.current.sessionNextCursor})}),[n,N]),Se=m.useCallback((S,b)=>N("更新会话标签",async()=>{const B=await n.updateSessionTags(S,b,Pe(h.current));a({type:"session_updated",session:B})}),[n,N]),_e=m.useCallback(S=>N("归档会话",async()=>{const b=await n.archiveSession(S,Pe(h.current));a({type:"session_archived",session:b})}),[n,N]),Le=m.useCallback(S=>N("还原会话",async()=>{const b=await n.restoreSession(S,Pe(h.current));a({type:"session_restored",session:b})}),[n,N]),Re=m.useCallback(S=>N("删除会话",async()=>{await n.deleteSession(S,Pe(h.current)),a({type:"session_deleted",sessionId:S})}),[n,N]),mt=m.useCallback(async(S,b=!1)=>{const B=Pe(h.current),ie=h.current.archivedSessions,ae=b?ie?.nextCursor:void 0;if(!(b&&!ae)){a({type:"archived_sessions_loading",workspaceId:S});try{const Oe=await n.listArchivedWorkspaceSessions(S,B,ae??void 0);a({type:"archived_sessions_loaded",workspaceId:S,sessions:Oe.sessions,nextCursor:Oe.nextCursor,append:b})}catch(Oe){throw a({type:"archived_sessions_failed",workspaceId:S,detail:ns(Oe)}),Oe}}},[n]),Tt=m.useCallback((S,b)=>F("提交任务",{type:"submit",text:S,contextReferences:b}),[F]),Mt=m.useCallback((S,b)=>F("加入队列",{type:"queue_followup",text:S,contextReferences:b}),[F]),at=m.useCallback(async(S,b)=>{await re("移除排队消息",{type:"remove_queue_item",itemId:S,expectedItemRevision:b})},[re]),st=m.useCallback(async(S,b,B)=>{await re("编辑排队消息",{type:"edit_queue_item",itemId:S,expectedItemRevision:b,text:B})},[re]),Ye=m.useCallback(async(S,b,B)=>{await re("移动排队消息",{type:"move_queue_item",itemId:S,expectedItemRevision:b,targetIndex:B})},[re]),it=m.useCallback(async()=>{await F("清空队列",{type:"clear_followups"})},[F]),pn=m.useCallback(async()=>{const S=h.current.sessionSnapshot?.sessionRuntime;if(!S||S.phase!=="queued"||!S.queueId)throw new Ie("排队任务已变化,请等待状态同步后重试。",409,"session_queue_conflict");await F("取消排队任务",{type:"cancel_queued_turn",queueId:S.queueId})},[F]),rn=m.useCallback(async()=>{await F("中断任务",{type:"interrupt"})},[F]),Ht=m.useCallback(async S=>{h.current.mode.baseMode===S&&!h.current.mode.pendingBaseMode||await re("切换模式",{type:"set_agent_mode",mode:S})},[re]),Tn=m.useCallback(async S=>{await re(S===null?"继承项目权限":"切换会话权限",S===null?{type:"clear_permission_override"}:{type:"set_permission_override",value:S})},[re]),ct=m.useCallback(()=>N("加载模型目录",async()=>{const S=h.current;if(!S.activeSessionId)return;const b=await n.modelCatalog(S.activeSessionId,Pe(S));a({type:"model_catalog_loaded",catalog:b})}),[n,N]),tr=m.useCallback(async(S,b)=>{await re("切换会话模型",{type:"select_model",modelId:S,...b?{effort:b}:{}})},[re]),nr=m.useCallback(async()=>{await re("压缩上下文",{type:"compact_context"})},[re]),sn=m.useCallback(async(S,b,B)=>{await re("审核计划",{type:"review_plan",planDigest:S,action:b,...B?{feedback:B}:{}})},[re]),hn=m.useCallback(async(S,b="once")=>{const B=h.current.permission;B&&(await F(S?"确认工具权限":"拒绝工具权限",{type:"permission_decision",requestPermissionId:B.id,approved:S,scope:b}),a({type:"approval_resolved",requestId:B.id,approved:S}))},[F]),mn=m.useCallback(async(S,b)=>{await F("更新 Goal",{type:"goal_control",goalAction:S,objective:b});const B=++j.current;Z();try{const ie=h.current.activeSessionId,ae=Pe(h.current),[Oe]=await Promise.all([n.diagnostics(ae),ie?q(ie,ae,{force:!0}):Promise.resolve()]);if(B!==j.current)return;a({type:"diagnostics_loaded",diagnostics:Oe})}finally{ee()}},[n,q,Z,ee,F]),J=m.useCallback(async()=>{const S=await r.refresh(),b=S.document??S.lastGood;if(!b)throw new Ie(S.error??"设置尚不可用。",503);return b},[r]),me=m.useCallback(async(S,b,B)=>{if(b.length<1||b.length>20)throw new Ie("设置变更必须包含 1 到 20 个字段。",400,"settings_invalid_operation");const ie=await n.updateSettings(S,b,Pe(h.current),B);return r.accept(ie.settings),ie},[n,r]),Ne=m.useCallback(async()=>{await n.openSettingsDocument()},[n]),Fe=m.useCallback((S,b=0)=>n.readToolDetail(S,Pe(h.current),b),[n]),Ot=m.useCallback((S,b)=>n.listFiles(Pe(h.current),S,b),[n]),gn=m.useCallback((S,b)=>n.readFileContent(S,Pe(h.current),b),[n]),rr=m.useCallback((S,b,B)=>n.writeFileContent(Pe(h.current),S,b,B),[n]),Vt=m.useCallback(S=>n.gitStatus(Pe(h.current),S),[n]),Nr=m.useCallback(S=>n.gitLog(Pe(h.current),S),[n]),br=m.useCallback((S,b)=>n.gitDiff(S,Pe(h.current),b),[n]),_r=m.useCallback(()=>n.review(Pe(h.current)),[n]),Ir=m.useCallback(async()=>(await n.terminals(Pe(h.current))).terminals,[n]),vn=m.useCallback(async(S,b)=>{const B=h.current;if(!B.contextRevision||!B.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.createTerminal({expectedContextRevision:B.contextRevision,workspaceId:B.workspaceId,cols:S,rows:b})},[n]),yn=m.useCallback(async S=>{const b=h.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.terminalAttachTicket(S,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),ls=m.useCallback(async S=>{const b=h.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.closeTerminal(S,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),as=m.useCallback(S=>n.terminalSocket(S),[n]),cs=m.useCallback(()=>a({type:"notice",notice:null}),[]),ti=m.useMemo(()=>({retryBoot:je,refreshDiagnostics:xe,refreshToolDetails:Y,loadMoreWorkspaces:pe,loadMoreSessions:te,loadWorkspaceSessions:Ce,refreshWorkspaceProjectSummary:D,loadMoreCapabilities:ue,loadMoreToolDetails:de,recoverSession:E,switchWorkspace:K,activateContext:y,setWorkspacePinned:$,removeWorkspace:A,createSession:ne,activateSession:ye,loadOlderTranscript:we,renameSession:be,updateSessionTags:Se,archiveSession:_e,restoreSession:Le,deleteSession:Re,loadArchivedWorkspaceSessions:mt,submit:Tt,queue:Mt,removeQueued:at,editQueued:st,moveQueued:Ye,clearQueue:it,cancelQueuedTurn:pn,interrupt:rn,setMode:Ht,setPermissionOverride:Tn,loadModelCatalog:ct,selectModel:tr,compactContext:nr,reviewPlan:sn,answerPermission:hn,controlGoal:mn,refreshSettings:J,updateSettings:me,openSettingsDocument:Ne,readToolDetail:Fe,listFiles:Ot,readFileContent:gn,writeFileContent:rr,gitStatus:Vt,gitLog:Nr,gitDiff:br,review:_r,terminals:Ir,createTerminal:vn,terminalAttachTicket:yn,closeTerminal:ls,terminalSocket:as,dismissNotice:cs}),[ye,y,ls,vn,br,Nr,Vt,Ot,we,ue,te,de,pe,ct,Ce,hn,it,pn,nr,sn,mn,ne,cs,st,rn,Mt,gn,Fe,_r,E,xe,J,Y,D,at,A,be,Le,Se,_e,Re,mt,je,Ht,Tn,tr,$,Tt,K,Ye,yn,as,Ir,me,Ne]);return{state:o,actions:ti}}async function Ox(n,r,o,a){let d=o;for(let f=0;f<2;f+=1){const h=bx(d);if(h.keysToClear.length===0||d.state!=="ready"||!d.writable)return d;if(h.operations.length===0)return Tf(h.keysToClear),d;try{const g=await n.updateSettings(d.revision,h.operations,a,We());return r.accept(g.settings),Tf(h.keysToClear),g.settings}catch(g){if(f===0&&g instanceof Ie&&g.code==="settings_revision_conflict"){const w=await r.refresh(),j=w.document??w.lastGood;if(j){d=j;continue}}return d}}return d}function Pe(n){if(!n.contextRevision||!n.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return{expectedContextRevision:n.contextRevision,workspaceId:n.workspaceId}}function Of(n,r,o){if(!(n.session.id===r&&n.sessionRuntime.sessionId===r&&n.sessionRuntime.workspaceId===o.workspaceId&&n.composer.sessionId===r&&n.composer.workspaceId===o.workspaceId&&n.composer.contextRevision===o.expectedContextRevision))throw new Ie("Host 返回的会话快照身份与当前项目上下文不一致。",502,"session_snapshot_identity_mismatch")}const Af="orion.web.view-id.v1",wp="orion.web.foreground-session.v1:";function Ax(n,r,o){const a=kp(`${wp}${n}`);return Px(a,r,o)}function Ks(n,r){$x();const o=`${wp}${n}`;try{r?globalThis.sessionStorage?.setItem(o,r):globalThis.sessionStorage?.removeItem(o)}catch{}}function $x(){const n=kp(Af);if(n)return n;const r=globalThis.crypto?.randomUUID?.()??`view-${Date.now().toString(36)}`;try{globalThis.sessionStorage?.setItem(Af,r)}catch{}return r}function kp(n){try{return globalThis.sessionStorage?.getItem(n)??null}catch{return null}}function Lx(n){if(n.result.includes("failed")||n.result.includes("invalid")||n.result.includes("rejected")||n.result.includes("ignored")||n.result.includes("full")||n.result==="empty")throw new Ie(Dx(n),409)}function Dx(n){if(n.detail)try{const r=JSON.parse(n.detail);if(typeof r.reason=="string")return r.reason}catch{}return`Runtime 未接受操作:${n.result}`}function $f(n,r,o,a="error"){n({type:"notice",notice:{id:Date.now(),tone:a,title:r,detail:ns(o)}})}function ns(n){return n instanceof Ie||n instanceof Error?n.message:"发生未知错误。"}function wo(n){return n instanceof Ie&&n.code==="collection_cursor_stale"}function zx(n){return n instanceof Ie&&["composer_control_conflict","session_runtime_revision_conflict","session_snapshot_sync_failed"].includes(n.code??"")}function Wx(n){return n instanceof Ie&&["context_revision_conflict","runtime_busy","active_session_changed"].includes(n.code??"")}function Fx(n){return new Promise(r=>{globalThis.setTimeout(r,n)})}function Bx(n){if(typeof window<"u"&&"requestIdleCallback"in window){const o=window.requestIdleCallback(n,{timeout:1500});return()=>window.cancelIdleCallback(o)}const r=globalThis.setTimeout(n,150);return()=>globalThis.clearTimeout(r)}async function qx(n,r,o){let a=0;const d=Array.from({length:Math.min(Math.max(1,r),n.length)},async()=>{for(;a<n.length;){const f=n[a];a+=1,f!==void 0&&await o(f)}});await Promise.all(d)}function Ux(n){return n.sessionId?n.type==="runtime_event"?n.payload.value.type==="permission_requested":n.type!=="thread_event"?!1:["approval.requested","plan.review_requested","turn.completed","turn.failed","turn.interrupted"].includes(n.payload.value.payload.type):!1}const Hx=5e3;function Vx(n,r){return r||n.tone==="error"?null:Hx}function Kx({uid:n,notice:r,reconnectNeeded:o,snapshotRetryNeeded:a,pendingAction:d,onDismiss:f,onRecover:h}){const g=o||a,w=!g,j=m.useRef(f);m.useEffect(()=>{j.current=f},[f]);const P=Vx(r,g);m.useEffect(()=>{if(P===null)return;const R=window.setTimeout(()=>j.current(n),P);return()=>window.clearTimeout(R)},[P,n]);const C=`notice-${n}`,O=r.tone==="success"?"check":r.tone==="info"?"info":"warning";return i.jsxs("aside",{className:`workbench-notice notice-${r.tone}`,role:r.tone==="error"?"alert":"status","aria-labelledby":C,children:[i.jsx("span",{className:"notice-icon","aria-hidden":"true",children:i.jsx(Q,{name:O,size:17})}),i.jsxs("div",{children:[i.jsx("strong",{id:C,children:r.title}),r.detail?i.jsx("p",{children:r.detail}):null]}),o?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>h(n),disabled:d,children:"重建连接"}):null,a?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>h(n),disabled:d,children:"重试同步"}):null,w?i.jsx("button",{type:"button",className:"icon-button",onClick:()=>f(n),"aria-label":"关闭通知",children:i.jsx(Q,{name:"close",size:15})}):null]})}function Gx(){const{state:n,actions:r}=Mx(),[o,a]=m.useState(!1),[d,f]=m.useState(Bm),{value:h,update:g,setResourceNavigatorWidth:w}=ix(n.workspaceId,d.workPanel),[j,P]=m.useState(!1),[C,O]=m.useState(!1),[R,z]=m.useState(!1),[L,q]=m.useState(null),[X,W]=m.useState(null),[he,Z]=m.useState(null),[ee,N]=m.useState(!1),[F,re]=m.useState([]),je=m.useRef(0),xe=m.useRef(n.notice),Y=m.useRef(null),[pe,te]=m.useState(null),Ce=m.useRef(null),D=m.useRef(!1),ue=m.useRef(!1),de=m.useRef(null),E=Qx(de),K=E>1180,T=K?wf({containerWidth:E,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:h.expanded,workDetailWidthPx:h.detailWidthPx}):uo(E,d),y=T.projectNavigation.mode==="drawer",$=T.workPanel.mode==="drawer",A=T.workPanel.mode==="rail"&&h.expanded,ne=$||A&&j,ye=$||A?j:T.workPanel.mode==="dock",we=ne&&j,be=y&&o,Se=be||we,_e=n.settings?.state==="ready"?n.settings:n.settingsMirror.lastGood??n.settings,Le=_e?.sections.appearance.theme.effectiveValue,Re=_e?.sections.appearance.motion.effectiveValue,mt=_e?.sections.appearance.style.effectiveValue??"orion-blocksmith",Tt=Mo(n),Mt=m.useCallback(()=>{if(!n.workspace)return;const J=_e?.revision;if(!J)return;const me=_e?.sections.appearance.theme.effectiveValue??"system",Ne=me==="system"?"light":me==="light"?"dark":"system";r.updateSettings(J,[{op:"set",key:"appearance.theme",value:Ne}],We()).catch(Fe=>{console.warn("[theme] 主题切换写入失败",Fe)})},[r,_e,n.workspace]),at=m.useCallback(J=>{f(me=>{const Ne={...me,projectNavigation:{...me.projectNavigation,...J}};return qm(Ne),Ne})},[]),st=m.useCallback(J=>{g({...J,detailWidthPx:J.widthPx===void 0?void 0:Math.max(360,J.widthPx-Je)})},[g]),Ye=m.useCallback(()=>{Ce.current=document.activeElement instanceof HTMLElement?document.activeElement:null},[]),it=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector(".project-search input")?.focus())},[]),pn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector('.workspace-rail [aria-label="打开设置"]')?.focus())},[]),rn=m.useCallback(()=>{y&&(Ye(),P(!1),a(!0)),pn()},[pn,y,Ye]),Ht=m.useCallback(()=>{D.current=be,be&&(a(!1),P(!1),Ce.current=null),O(!0)},[be]),Tn=m.useCallback(()=>{O(!1),D.current&&(D.current=!1,ue.current=!0,a(!0))},[]),ct=m.useCallback(()=>{a(!1),P(!1),ue.current=!1;const J=Ce.current;Ce.current=null,J&&requestAnimationFrame(()=>J.focus())},[]);m.useLayoutEffect(()=>{document.documentElement.dataset.theme=Le??"system",document.documentElement.dataset.motion=Re??"system",document.documentElement.dataset.uiStyle=mt},[Re,Le,mt]),m.useEffect(()=>{xe.current=n.notice;const J=n.notice;J&&Y.current!==J.id&&(Y.current=J.id,re(me=>me.some(Ne=>Ne.notice.id===J.id)?me:[...me,{uid:++je.current,notice:J}].slice(-4)))},[n.notice]),m.useEffect(()=>{const J=n.workspaceId;if(!J)return;const me=n.workspaceSessions[J],Ne=n.archivedSessions;me?.status==="ready"&&(Ne.ownerWorkspaceId===J&&Ne.status!=="idle"||r.loadArchivedWorkspaceSessions(J))},[r,n.archivedSessions,n.workspaceId,n.workspaceSessions]);const tr=m.useCallback(J=>{const me=F.find(Ne=>Ne.uid===J);me&&(xe.current?.id===me.notice.id&&r.dismissNotice(),re(Ne=>Ne.filter(Fe=>Fe.uid!==J)))},[r,F]),nr=m.useCallback(J=>{const me=F.find(Ne=>Ne.uid===J);me&&(xe.current?.id===me.notice.id&&r.dismissNotice(),re(Ne=>Ne.filter(Fe=>Fe.uid!==J)),r.recoverSession())},[r,F]);m.useEffect(()=>{const J=window.matchMedia("(prefers-color-scheme: light)"),me=document.querySelector('meta[name="theme-color"]'),Ne=()=>{me&&(me.content=cx(mt,Le??"system",J.matches))};return Ne(),J.addEventListener("change",Ne),()=>J.removeEventListener("change",Ne)},[Le,mt]),m.useEffect(()=>{a(!1),P(!1),Ce.current=null,D.current=!1,ue.current=!1},[n.activeSessionId,n.workspace]),m.useLayoutEffect(()=>{a(!1),P(!1),Ce.current=null,ue.current=!1},[T.projectNavigation.mode,T.workPanel.mode,y,$]),m.useEffect(()=>{const J=me=>{const Ne=Eo("toggle-project-navigation");if(Ne&&Io(me,Ne.tokens)){if(me.preventDefault(),y){if(o){ct();return}Ye(),P(!1),a(!0);return}const Fe=!d.projectNavigation.expanded,Ot=!!(!Fe&&document.activeElement?.closest(".workspace-rail")),gn=uo(E,{...d,projectNavigation:{...d.projectNavigation,expanded:Fe}});if(Fe&&gn.projectNavigation.mode==="drawer"){at({expanded:Fe}),Ye(),P(!1),a(!0);return}at({expanded:Fe}),Fe?it():Ot&&requestAnimationFrame(()=>{(document.querySelector('.project-navigator-collapsed [aria-label="展开项目导航"]')??document.querySelector(".mobile-nav-toggle"))?.focus()})}};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[ct,it,o,y,d.projectNavigation,Ye,E,at]),m.useEffect(()=>{const J=Eo("open-shortcut-help");if(!J)return;const me=Ne=>{Io(Ne,J.tokens)&&(Ne.preventDefault(),N(Fe=>!Fe))};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[]),m.useEffect(()=>{if(!Se)return;const J=document.querySelector(".conversation-column"),me=document.querySelector(".workspace-rail"),Ne=document.querySelector(".work-panel"),Fe=document.querySelector(".workbench-notice-stack"),Ot=document.querySelector(".skip-link");J&&(J.inert=!0),me&&(me.inert=we),Ne&&(Ne.inert=o),Fe&&(Fe.inert=!0),Ot&&(Ot.inert=!0);const gn=window.setTimeout(()=>{const Vt=we?Ne?.querySelector('[aria-label="关闭工作面板"]'):ue.current?me?.querySelector('[aria-label="打开设置"]'):me?.querySelector(".drawer-close");ue.current=!1,Vt?.focus()},0),rr=Vt=>{Vt.key==="Escape"&&!Vt.target?.closest?.('[role="alertdialog"]')&&ct()};return window.addEventListener("keydown",rr),()=>{J&&(J.inert=!1),me&&(me.inert=!1),Ne&&(Ne.inert=!1),Fe&&(Fe.inert=!1),Ot&&(Ot.inert=!1),window.clearTimeout(gn),window.removeEventListener("keydown",rr)}},[ct,Se,o,we,n.notice]);const sn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector("#main-content h1")?.focus())},[]),hn=()=>{a(!1),r.createSession().then(sn,sn)},mn=()=>{D.current=!1,ue.current=!1,O(!1),requestAnimationFrame(()=>document.querySelector("#orion-composer")?.focus())};return i.jsxs(i.Fragment,{children:[i.jsx("a",{className:"skip-link",href:"#main-content",children:"跳到主要内容"}),i.jsxs("div",{ref:de,className:`workbench-shell project-navigation-${T.projectNavigation.mode} work-panel-mode-${T.workPanel.mode} ${A&&j?"work-panel-transient-overlay":""}`,style:{"--project-navigation-width":`${T.projectNavigation.widthPx}px`,"--project-navigation-preferred-width":`${d.projectNavigation.widthPx}px`,"--work-panel-width":`${T.workPanel.widthPx}px`,"--work-panel-preferred-width":`${h.detailWidthPx+Je}px`},"aria-busy":n.boot==="loading",children:[i.jsx(Km,{state:n,drawerOpen:be,dockVisible:!0,collapsed:T.projectNavigation.mode==="rail",resizable:T.projectNavigation.mode==="dock",width:T.projectNavigation.widthPx,onCloseDrawer:ct,onExpand:()=>{y?(Ye(),P(!1),a(!0)):(at({expanded:!0}),it())},onCollapse:()=>{y?ct():at({expanded:!1})},onOpenWorkspaceDialog:()=>z(!0),onOpenSettings:Ht,onLoadMoreWorkspaces:()=>{r.loadMoreWorkspaces()},onCreateSession:hn,onLoadWorkspaceSessions:(J,me)=>{r.loadWorkspaceSessions(J,me)},onActivateContext:(J,me)=>{a(!1),r.activateContext(J,me).then(sn,sn)},onSetPinned:(J,me)=>{r.setWorkspacePinned(J,me)},onRemoveWorkspace:J=>{r.removeWorkspace(J)},onRefreshSummary:J=>{r.refreshWorkspaceProjectSummary(J)},onRenameSession:q,onSessionTags:W,onArchiveSession:J=>{r.archiveSession(J.id)},onDeleteSession:Z,onRestoreSession:J=>{r.restoreSession(J.id)},onWidthPreview:J=>{const me=uo(E,{...d,projectNavigation:{...d.projectNavigation,widthPx:J}});de.current?.style.setProperty("--project-navigation-width",`${me.projectNavigation.widthPx}px`)},onWidthCommit:J=>at({widthPx:J})}),i.jsx(Cv,{state:n,actions:r,navigationOpen:y?be:T.projectNavigation.mode==="dock",inspectorExpanded:ye,onOpenNavigation:()=>{if(!y){at({expanded:!0}),it();return}Ye(),P(!1),a(!0)},onToggleInspector:()=>{if($||A){if(j){ct();return}Ye(),a(!1),P(!0);return}st({expanded:!h.expanded})},onRevealSettings:rn,onCreateSession:hn,themePreference:Le,onCycleTheme:Mt,onShowShortcuts:()=>N(!0),composerInsertion:pe}),i.jsx(Vy,{state:n,actions:r,mode:ne?"overlay":"dock",expanded:ye,activePanel:h.activePanel,panelOrder:d.workPanel.order,agentPanel:h.agentPanel,onExpand:()=>{$||A?P(!0):st({expanded:!0})},onCollapse:()=>{ne?ct():st({expanded:!1})},onPanelChange:J=>st({activePanel:J}),onAgentPanelChange:J=>st({agentPanel:J}),onWidthPreview:J=>{const me=K?wf({containerWidth:E,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:!0,workDetailWidthPx:Math.max(360,J-Je)}):uo(E,{...d,workPanel:{...d.workPanel,widthPx:J}});de.current?.style.setProperty("--work-panel-width",`${me.workPanel.widthPx}px`)},onWidthCommit:J=>st({widthPx:J}),width:T.workPanel.widthPx,maxWidthPx:K?hp(E-(d.projectNavigation.expanded?d.projectNavigation.widthPx:Je))+Je:void 0,onSendToComposer:J=>{te({id:Date.now(),text:J}),$&&ct(),requestAnimationFrame(()=>document.querySelector("#orion-composer")?.focus())},resourceNavigatorWidths:h.resourceNavigatorWidthPx,onResourceNavigatorWidthCommit:w}),Se?i.jsx("button",{type:"button",className:"drawer-scrim","aria-label":"关闭侧边面板",tabIndex:-1,onClick:ct}):null,F.length>0?i.jsx("div",{className:"workbench-notice-stack","aria-live":"polite",children:F.map(J=>i.jsx(Kx,{uid:J.uid,notice:J.notice,reconnectNeeded:n.connection==="replay-required",snapshotRetryNeeded:J.notice.domain==="session-snapshot"&&Tt.status==="failed",pendingAction:!!n.pendingAction,onDismiss:tr,onRecover:nr},J.uid))}):null,n.boot!=="ready"?i.jsxs("section",{className:"boot-screen",role:n.boot==="error"?"alert":"status",children:[i.jsx(Aa,{className:"boot-mark",size:34}),n.boot==="loading"?i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"正在启动 Orion Workbench"}),i.jsx("p",{children:"建立本地安全握手并恢复工作区状态…"}),i.jsx("span",{className:"boot-loader","aria-hidden":"true"})]}):i.jsxs(i.Fragment,{children:[i.jsx("h1",{children:"无法连接本地 Web Host"}),i.jsx("p",{children:n.bootError||"请确认 Orion Web Host 仍在运行。"}),i.jsxs("button",{type:"button",className:"primary-button",onClick:()=>{r.retryBoot()},disabled:!!n.pendingAction,children:[i.jsx(Q,{name:"refresh",size:15}),"重新连接"]})]})]}):null,i.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.announcement})]}),i.jsx(ey,{open:C,onClose:Tn,state:n,actions:r,onGoToSessionControls:mn}),i.jsx(Fv,{open:R,onClose:()=>z(!1),state:n,onSelect:r.switchWorkspace,onLoadMore:r.loadMoreWorkspaces}),i.jsx(Bv,{open:!!L,onClose:()=>q(null),session:L,pending:!!n.pendingAction,onRename:r.renameSession}),i.jsx(qv,{open:!!X,onClose:()=>W(null),session:X,pending:!!n.pendingAction,onSave:r.updateSessionTags}),i.jsx(Uv,{open:!!he,onClose:()=>Z(null),session:he,pending:!!n.pendingAction,onConfirm:r.deleteSession}),i.jsx(wy,{open:ee,onClose:()=>N(!1)})]})}function Qx(n){const[r,o]=m.useState(()=>typeof window>"u"?1440:Math.max(320,Math.round(window.innerWidth)));return m.useEffect(()=>{const a=n.current;if(!a)return;const d=()=>{const f=Math.max(320,Math.round(a.getBoundingClientRect().width));o(h=>h===f?h:f)};if(d(),typeof ResizeObserver<"u"){const f=new ResizeObserver(d);return f.observe(a),()=>f.disconnect()}return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[n]),r}const jp=document.getElementById("root");if(!jp)throw new Error("Orion Web root element was not found.");Nm.createRoot(jp).render(i.jsx(ym.StrictMode,{children:i.jsx(Gx,{})}));export{Q as I,Wf as P,So as R,Ie as W,lp as a,Xx as b,cp as c,i as j,m as r,Rn as s};