@orion-agents/orion-code 0.3.11 → 0.3.12
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.
- package/CHANGELOG.md +47 -2
- package/README.md +8 -5
- package/README.zh-CN.md +5 -4
- package/dist/cli.js +14 -1
- package/dist/web/context-text.d.ts +17 -0
- package/dist/web/context-text.js +40 -0
- package/dist/web/file-read-service.d.ts +23 -0
- package/dist/web/file-read-service.js +134 -0
- package/dist/web/git-read-model-service.d.ts +14 -0
- package/dist/web/git-read-model-service.js +64 -0
- package/dist/web/host-daemon.d.ts +9 -0
- package/dist/web/host-daemon.js +45 -1
- package/dist/web/protocol.d.ts +7 -0
- package/dist/web/protocol.js +26 -0
- package/dist/web/review-service.d.ts +14 -0
- package/dist/web/review-service.js +34 -14
- package/dist/web/server.js +82 -0
- package/dist/web/workbench-controller.d.ts +45 -0
- package/dist/web/workbench-controller.js +84 -0
- package/dist/web-client/assets/{DiffViewer-BrE5tfZc.js → DiffViewer-Bs1C5uRM.js} +1 -1
- package/dist/web-client/assets/FilesPanel-dW61EHHn.js +2 -0
- package/dist/web-client/assets/GitPanel-ykbaVNlo.js +1 -0
- package/dist/web-client/assets/ResourceSplitLayout-B0Zs9aMC.js +1 -0
- package/dist/web-client/assets/ReviewPanel-1oqfaqoh.js +1 -0
- package/dist/web-client/assets/{TerminalPanel-CMLU7j08.js → TerminalPanel-Cz0ohyPm.js} +1 -1
- package/dist/web-client/assets/index-B11PjVU2.css +1 -0
- package/dist/web-client/assets/index-DiNz6Qhw.js +17 -0
- package/dist/web-client/index.html +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/web-client/assets/FilesPanel-ZwlVgxJi.js +0 -2
- package/dist/web-client/assets/GitPanel-Cnz52VRO.js +0 -1
- package/dist/web-client/assets/ReviewPanel-D_xxkVG_.js +0 -1
- package/dist/web-client/assets/index-BlFUf8dG.js +0 -17
- package/dist/web-client/assets/index-CUG6w669.css +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-Cz0ohyPm.js","assets/TerminalPanel-DLuoa74B.css","assets/FilesPanel-dW61EHHn.js","assets/ResourceSplitLayout-B0Zs9aMC.js","assets/GitPanel-ykbaVNlo.js","assets/DiffViewer-Bs1C5uRM.js","assets/ReviewPanel-1oqfaqoh.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var um=Object.defineProperty;var dm=(n,r,o)=>r in n?um(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var Bt=(n,r,o)=>dm(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 Mf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ka={exports:{}},Fs={},ja={exports:{}},Ee={};var Ed;function fm(){if(Ed)return Ee;Ed=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"),S=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),C=Symbol.iterator;function M(y){return y===null||typeof y!="object"?null:(y=C&&y[C]||y["@@iterator"],typeof y=="function"?y:null)}var $={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F=Object.assign,D={};function W(y,O,A){this.props=y,this.context=O,this.refs=D,this.updater=A||$}W.prototype.isReactComponent={},W.prototype.setState=function(y,O){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,O,"setState")},W.prototype.forceUpdate=function(y){this.updater.enqueueForceUpdate(this,y,"forceUpdate")};function Z(){}Z.prototype=W.prototype;function L(y,O,A){this.props=y,this.context=O,this.refs=D,this.updater=A||$}var pe=L.prototype=new Z;pe.constructor=L,F(pe,W.prototype),pe.isPureReactComponent=!0;var te=Array.isArray,ee=Object.prototype.hasOwnProperty,N={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function re(y,O,A){var ne,we={},xe=null,be=null;if(O!=null)for(ne in O.ref!==void 0&&(be=O.ref),O.key!==void 0&&(xe=""+O.key),O)ee.call(O,ne)&&!z.hasOwnProperty(ne)&&(we[ne]=O[ne]);var Se=arguments.length-2;if(Se===1)we.children=A;else if(1<Se){for(var _e=Array(Se),De=0;De<Se;De++)_e[De]=arguments[De+2];we.children=_e}if(y&&y.defaultProps)for(ne in Se=y.defaultProps,Se)we[ne]===void 0&&(we[ne]=Se[ne]);return{$$typeof:n,type:y,key:xe,ref:be,props:we,_owner:N.current}}function je(y,O){return{$$typeof:n,type:y.type,key:O,ref:y.ref,props:y.props,_owner:y._owner}}function ye(y){return typeof y=="object"&&y!==null&&y.$$typeof===n}function Y(y){var O={"=":"=0",":":"=2"};return"$"+y.replace(/[=:]/g,function(A){return O[A]})}var fe=/\/+/g;function se(y,O){return typeof y=="object"&&y!==null&&y.key!=null?Y(""+y.key):O.toString(36)}function Ce(y,O,A,ne,we){var xe=typeof y;(xe==="undefined"||xe==="boolean")&&(y=null);var be=!1;if(y===null)be=!0;else switch(xe){case"string":case"number":be=!0;break;case"object":switch(y.$$typeof){case n:case r:be=!0}}if(be)return be=y,we=we(be),y=ne===""?"."+se(be,0):ne,te(we)?(A="",y!=null&&(A=y.replace(fe,"$&/")+"/"),Ce(we,O,A,"",function(De){return De})):we!=null&&(ye(we)&&(we=je(we,A+(!we.key||be&&be.key===we.key?"":(""+we.key).replace(fe,"$&/")+"/")+y)),O.push(we)),1;if(be=0,ne=ne===""?".":ne+":",te(y))for(var Se=0;Se<y.length;Se++){xe=y[Se];var _e=ne+se(xe,Se);be+=Ce(xe,O,A,_e,we)}else if(_e=M(y),typeof _e=="function")for(y=_e.call(y),Se=0;!(xe=y.next()).done;)xe=xe.value,_e=ne+se(xe,Se++),be+=Ce(xe,O,A,_e,we);else if(xe==="object")throw O=String(y),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(y).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return be}function G(y,O,A){if(y==null)return y;var ne=[],we=0;return Ce(y,ne,"","",function(xe){return O.call(A,xe,we++)}),ne}function ve(y){if(y._status===-1){var O=y._result;O=O(),O.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=O)}if(y._status===1)return y._result.default;throw y._result}var X={current:null},E={transition:null},H={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:E,ReactCurrentOwner:N};function R(){throw Error("act(...) is not supported in production builds of React.")}return Ee.Children={map:G,forEach:function(y,O,A){G(y,function(){O.apply(this,arguments)},A)},count:function(y){var O=0;return G(y,function(){O++}),O},toArray:function(y){return G(y,function(O){return O})||[]},only:function(y){if(!ye(y))throw Error("React.Children.only expected to receive a single React element child.");return y}},Ee.Component=W,Ee.Fragment=o,Ee.Profiler=d,Ee.PureComponent=L,Ee.StrictMode=a,Ee.Suspense=w,Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Ee.act=R,Ee.cloneElement=function(y,O,A){if(y==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+y+".");var ne=F({},y.props),we=y.key,xe=y.ref,be=y._owner;if(O!=null){if(O.ref!==void 0&&(xe=O.ref,be=N.current),O.key!==void 0&&(we=""+O.key),y.type&&y.type.defaultProps)var Se=y.type.defaultProps;for(_e in O)ee.call(O,_e)&&!z.hasOwnProperty(_e)&&(ne[_e]=O[_e]===void 0&&Se!==void 0?Se[_e]:O[_e])}var _e=arguments.length-2;if(_e===1)ne.children=A;else if(1<_e){Se=Array(_e);for(var De=0;De<_e;De++)Se[De]=arguments[De+2];ne.children=Se}return{$$typeof:n,type:y.type,key:we,ref:xe,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 O=re.bind(null,y);return O.type=y,O},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(y){return{$$typeof:g,render:y}},Ee.isValidElement=ye,Ee.lazy=function(y){return{$$typeof:T,_payload:{_status:-1,_result:y},_init:ve}},Ee.memo=function(y,O){return{$$typeof:S,type:y,compare:O===void 0?null:O}},Ee.startTransition=function(y){var O=E.transition;E.transition={};try{y()}finally{E.transition=O}},Ee.unstable_act=R,Ee.useCallback=function(y,O){return X.current.useCallback(y,O)},Ee.useContext=function(y){return X.current.useContext(y)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(y){return X.current.useDeferredValue(y)},Ee.useEffect=function(y,O){return X.current.useEffect(y,O)},Ee.useId=function(){return X.current.useId()},Ee.useImperativeHandle=function(y,O,A){return X.current.useImperativeHandle(y,O,A)},Ee.useInsertionEffect=function(y,O){return X.current.useInsertionEffect(y,O)},Ee.useLayoutEffect=function(y,O){return X.current.useLayoutEffect(y,O)},Ee.useMemo=function(y,O){return X.current.useMemo(y,O)},Ee.useReducer=function(y,O,A){return X.current.useReducer(y,O,A)},Ee.useRef=function(y){return X.current.useRef(y)},Ee.useState=function(y){return X.current.useState(y)},Ee.useSyncExternalStore=function(y,O,A){return X.current.useSyncExternalStore(y,O,A)},Ee.useTransition=function(){return X.current.useTransition()},Ee.version="18.3.1",Ee}var Pd;function Ba(){return Pd||(Pd=1,ja.exports=fm()),ja.exports}var Rd;function pm(){if(Rd)return Fs;Rd=1;var n=Ba(),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,S){var T,C={},M=null,$=null;S!==void 0&&(M=""+S),w.key!==void 0&&(M=""+w.key),w.ref!==void 0&&($=w.ref);for(T in w)a.call(w,T)&&!f.hasOwnProperty(T)&&(C[T]=w[T]);if(g&&g.defaultProps)for(T in w=g.defaultProps,w)C[T]===void 0&&(C[T]=w[T]);return{$$typeof:r,type:g,key:M,ref:$,props:C,_owner:d.current}}return Fs.Fragment=o,Fs.jsx=h,Fs.jsxs=h,Fs}var Td;function hm(){return Td||(Td=1,ka.exports=pm()),ka.exports}var i=hm(),m=Ba();const mm=Mf(m);var lo={},Sa={exports:{}},St={},Ca={exports:{}},Na={};var Md;function gm(){return Md||(Md=1,(function(n){function r(E,H){var R=E.length;E.push(H);e:for(;0<R;){var y=R-1>>>1,O=E[y];if(0<d(O,H))E[y]=H,E[R]=O,R=y;else break e}}function o(E){return E.length===0?null:E[0]}function a(E){if(E.length===0)return null;var H=E[0],R=E.pop();if(R!==H){E[0]=R;e:for(var y=0,O=E.length,A=O>>>1;y<A;){var ne=2*(y+1)-1,we=E[ne],xe=ne+1,be=E[xe];if(0>d(we,R))xe<O&&0>d(be,we)?(E[y]=be,E[xe]=R,y=xe):(E[y]=we,E[ne]=R,y=ne);else if(xe<O&&0>d(be,R))E[y]=be,E[xe]=R,y=xe;else break e}}return H}function d(E,H){var R=E.sortIndex-H.sortIndex;return R!==0?R:E.id-H.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=[],S=[],T=1,C=null,M=3,$=!1,F=!1,D=!1,W=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function pe(E){for(var H=o(S);H!==null;){if(H.callback===null)a(S);else if(H.startTime<=E)a(S),H.sortIndex=H.expirationTime,r(w,H);else break;H=o(S)}}function te(E){if(D=!1,pe(E),!F)if(o(w)!==null)F=!0,ve(ee);else{var H=o(S);H!==null&&X(te,H.startTime-E)}}function ee(E,H){F=!1,D&&(D=!1,Z(re),re=-1),$=!0;var R=M;try{for(pe(H),C=o(w);C!==null&&(!(C.expirationTime>H)||E&&!Y());){var y=C.callback;if(typeof y=="function"){C.callback=null,M=C.priorityLevel;var O=y(C.expirationTime<=H);H=n.unstable_now(),typeof O=="function"?C.callback=O:C===o(w)&&a(w),pe(H)}else a(w);C=o(w)}if(C!==null)var A=!0;else{var ne=o(S);ne!==null&&X(te,ne.startTime-H),A=!1}return A}finally{C=null,M=R,$=!1}}var N=!1,z=null,re=-1,je=5,ye=-1;function Y(){return!(n.unstable_now()-ye<je)}function fe(){if(z!==null){var E=n.unstable_now();ye=E;var H=!0;try{H=z(!0,E)}finally{H?se():(N=!1,z=null)}}else N=!1}var se;if(typeof L=="function")se=function(){L(fe)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,G=Ce.port2;Ce.port1.onmessage=fe,se=function(){G.postMessage(null)}}else se=function(){W(fe,0)};function ve(E){z=E,N||(N=!0,se())}function X(E,H){re=W(function(){E(n.unstable_now())},H)}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(){F||$||(F=!0,ve(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 M},n.unstable_getFirstCallbackNode=function(){return o(w)},n.unstable_next=function(E){switch(M){case 1:case 2:case 3:var H=3;break;default:H=M}var R=M;M=H;try{return E()}finally{M=R}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(E,H){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var R=M;M=E;try{return H()}finally{M=R}},n.unstable_scheduleCallback=function(E,H,R){var y=n.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?y+R:y):R=y,E){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=R+O,E={id:T++,callback:H,priorityLevel:E,startTime:R,expirationTime:O,sortIndex:-1},R>y?(E.sortIndex=R,r(S,E),o(w)===null&&E===o(S)&&(D?(Z(re),re=-1):D=!0,X(te,R-y))):(E.sortIndex=O,r(w,E),F||$||(F=!0,ve(ee))),E},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(E){var H=M;return function(){var R=M;M=H;try{return E.apply(this,arguments)}finally{M=R}}}})(Na)),Na}var Od;function vm(){return Od||(Od=1,Ca.exports=gm()),Ca.exports}var Ad;function ym(){if(Ad)return St;Ad=1;var n=Ba(),r=vm();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,S=/^[: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]*$/,T={},C={};function M(e){return w.call(C,e)?!0:w.call(T,e)?!1:S.test(e)?C[e]=!0:(T[e]=!0,!1)}function $(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 F(e,t,s,l){if(t===null||typeof t>"u"||$(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 D(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 W={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){W[e]=new D(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];W[t]=new D(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){W[e]=new D(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){W[e]=new D(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){W[e]=new D(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){W[e]=new D(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){W[e]=new D(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){W[e]=new D(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){W[e]=new D(e,5,!1,e.toLowerCase(),null,!1,!1)});var Z=/[\-:]([a-z])/g;function L(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(Z,L);W[t]=new D(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(Z,L);W[t]=new D(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(Z,L);W[t]=new D(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){W[e]=new D(e,1,!1,e.toLowerCase(),null,!1,!1)}),W.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){W[e]=new D(e,1,!1,e.toLowerCase(),null,!0,!0)});function pe(e,t,s,l){var c=W.hasOwnProperty(t)?W[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(F(t,s,c,l)&&(s=null),l||c===null?M(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 te=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ee=Symbol.for("react.element"),N=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),re=Symbol.for("react.strict_mode"),je=Symbol.for("react.profiler"),ye=Symbol.for("react.provider"),Y=Symbol.for("react.context"),fe=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),Ce=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ve=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),E=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=E&&e[E]||e["@@iterator"],typeof e=="function"?e:null)}var R=Object.assign,y;function O(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(P){var l=P}Reflect.construct(e,[],t)}else{try{t.call()}catch(P){l=P}e.call(t.prototype)}else{try{throw Error()}catch(P){l=P}e()}}catch(P){if(P&&l&&typeof P.stack=="string"){for(var c=P.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:"")?O(e):""}function we(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("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 xe(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 z:return"Fragment";case N:return"Portal";case je:return"Profiler";case re:return"StrictMode";case se:return"Suspense";case Ce:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case ye:return(e._context.displayName||"Context")+".Provider";case fe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:xe(e.type)||"Memo";case ve:t=e._payload,e=e._init;try{return xe(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 xe(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 De(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 Pe(e){e._valueTracker||(e._valueTracker=De(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 Mt(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 Ot(e,t){var s=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function ct(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 it(e,t){t=t.checked,t!=null&&pe(e,"checked",t,!1)}function Qe(e,t){it(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")?fn(e,t.type,s):t.hasOwnProperty("defaultValue")&&fn(e,t.type,Se(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ot(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 fn(e,t,s){(t!=="number"||Mt(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 Rn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(o(91));return R({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ut(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 pn(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 hn,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(hn=hn||document.createElement("div"),hn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=hn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function he(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 At(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 mn(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var l=s.indexOf("--")===0,c=At(s,t[s],l);s==="float"&&(s="cssFloat"),l?e.setProperty(s,c):e[s]=c}}var Tn=R({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(Tn[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 Cr(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 Nr=null;function br(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _r=null,gn=null,vn=null;function os(e){if(e=bs(e)){if(typeof _r!="function")throw Error(o(280));var t=e.stateNode;t&&(t=ji(t),_r(e.stateNode,e.type,t))}}function ls(e){gn?vn?vn.push(e):vn=[e]:gn=e}function Js(){if(gn){var e=gn,t=vn;if(vn=gn=null,os(e),t)for(e=0;e<t.length;e++)os(t[e])}}function j(e,t){return e(t)}function b(){}var B=!1;function le(e,t,s){if(B)return e(t,s);B=!0;try{return j(e,t,s)}finally{B=!1,(gn!==null||vn!==null)&&(b(),Js())}}function ae(e,t){var s=e.stateNode;if(s===null)return null;var l=ji(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 Le={};Object.defineProperty(Le,"passive",{get:function(){Ae=!0}}),window.addEventListener("test",Le,Le),window.removeEventListener("test",Le,Le)}catch{Ae=!1}function et(e,t,s,l,c,u,p,v,x){var P=Array.prototype.slice.call(arguments,3);try{t.apply(s,P)}catch(U){this.onError(U)}}var It=!1,Ir=null,Er=!1,tt=null,Zs={onError:function(e){It=!0,Ir=e}};function ei(e,t,s,l,c,u,p,v,x){It=!1,Ir=null,et.apply(Zs,arguments)}function ti(e,t,s,l,c,u,p,v,x){if(ei.apply(this,arguments),It){if(It){var P=Ir;It=!1,Ir=null}else throw Error(o(198));Er||(Er=!0,tt=P)}}function rr(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 Ja(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 Za(e){if(rr(e)!==e)throw Error(o(188))}function wp(e){var t=e.alternate;if(!t){if(t=rr(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 Za(c),e;if(u===l)return Za(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 ec(e){return e=wp(e),e!==null?tc(e):null}function tc(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=tc(e);if(t!==null)return t;e=e.sibling}return null}var nc=r.unstable_scheduleCallback,rc=r.unstable_cancelCallback,kp=r.unstable_shouldYield,jp=r.unstable_requestPaint,Ke=r.unstable_now,Sp=r.unstable_getCurrentPriorityLevel,Fo=r.unstable_ImmediatePriority,sc=r.unstable_UserBlockingPriority,ni=r.unstable_NormalPriority,Cp=r.unstable_LowPriority,ic=r.unstable_IdlePriority,ri=null,on=null;function Np(e){if(on&&typeof on.onCommitFiberRoot=="function")try{on.onCommitFiberRoot(ri,e,void 0,(e.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Ip,bp=Math.log,_p=Math.LN2;function Ip(e){return e>>>=0,e===0?32:31-(bp(e)/_p|0)|0}var si=64,ii=4194304;function as(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 oi(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=as(v):(u&=p,u!==0&&(l=as(u)))}else p=s&~c,p!==0?l=as(p):u!==0&&(l=as(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 Ep(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 Pp(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]=Ep(v,t)):x<=t&&(e.expiredLanes|=v),u&=~v}}function Bo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function oc(){var e=si;return si<<=1,(si&4194240)===0&&(si=64),e}function qo(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function cs(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 Rp(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 Uo(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 Oe=0;function lc(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var ac,Ho,cc,uc,dc,Vo=!1,li=[],Mn=null,On=null,An=null,us=new Map,ds=new Map,$n=[],Tp="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 fc(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":us.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ds.delete(t.pointerId)}}function fs(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=bs(t),t!==null&&Ho(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Mp(e,t,s,l,c){switch(t){case"focusin":return Mn=fs(Mn,e,t,s,l,c),!0;case"dragenter":return On=fs(On,e,t,s,l,c),!0;case"mouseover":return An=fs(An,e,t,s,l,c),!0;case"pointerover":var u=c.pointerId;return us.set(u,fs(us.get(u)||null,e,t,s,l,c)),!0;case"gotpointercapture":return u=c.pointerId,ds.set(u,fs(ds.get(u)||null,e,t,s,l,c)),!0}return!1}function pc(e){var t=sr(e.target);if(t!==null){var s=rr(t);if(s!==null){if(t=s.tag,t===13){if(t=Ja(s),t!==null){e.blockedOn=t,dc(e.priority,function(){cc(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 ai(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Go(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);Nr=l,s.target.dispatchEvent(l),Nr=null}else return t=bs(s),t!==null&&Ho(t),e.blockedOn=s,!1;t.shift()}return!0}function hc(e,t,s){ai(e)&&s.delete(t)}function Op(){Vo=!1,Mn!==null&&ai(Mn)&&(Mn=null),On!==null&&ai(On)&&(On=null),An!==null&&ai(An)&&(An=null),us.forEach(hc),ds.forEach(hc)}function ps(e,t){e.blockedOn===t&&(e.blockedOn=null,Vo||(Vo=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Op)))}function hs(e){function t(c){return ps(c,e)}if(0<li.length){ps(li[0],e);for(var s=1;s<li.length;s++){var l=li[s];l.blockedOn===e&&(l.blockedOn=null)}}for(Mn!==null&&ps(Mn,e),On!==null&&ps(On,e),An!==null&&ps(An,e),us.forEach(t),ds.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);)pc(s),s.blockedOn===null&&$n.shift()}var Pr=te.ReactCurrentBatchConfig,ci=!0;function Ap(e,t,s,l){var c=Oe,u=Pr.transition;Pr.transition=null;try{Oe=1,Ko(e,t,s,l)}finally{Oe=c,Pr.transition=u}}function $p(e,t,s,l){var c=Oe,u=Pr.transition;Pr.transition=null;try{Oe=4,Ko(e,t,s,l)}finally{Oe=c,Pr.transition=u}}function Ko(e,t,s,l){if(ci){var c=Go(e,t,s,l);if(c===null)dl(e,t,l,ui,s),fc(e,l);else if(Mp(c,e,t,s,l))l.stopPropagation();else if(fc(e,l),t&4&&-1<Tp.indexOf(e)){for(;c!==null;){var u=bs(c);if(u!==null&&ac(u),u=Go(e,t,s,l),u===null&&dl(e,t,l,ui,s),u===c)break;c=u}c!==null&&l.stopPropagation()}else dl(e,t,l,null,s)}}var ui=null;function Go(e,t,s,l){if(ui=null,e=br(l),e=sr(e),e!==null)if(t=rr(e),t===null)e=null;else if(s=t.tag,s===13){if(e=Ja(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 ui=e,null}function mc(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(Sp()){case Fo:return 1;case sc:return 4;case ni:case Cp:return 16;case ic:return 536870912;default:return 16}default:return 16}}var Dn=null,Qo=null,di=null;function gc(){if(di)return di;var e,t=Qo,s=t.length,l,c="value"in Dn?Dn.value:Dn.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 di=c.slice(e,1<l?1-l:void 0)}function fi(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 pi(){return!0}function vc(){return!1}function Et(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)?pi:vc,this.isPropagationStopped=vc,this}return R(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=pi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=pi)},persist:function(){},isPersistent:pi}),t}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yo=Et(Rr),ms=R({},Rr,{view:0,detail:0}),Dp=Et(ms),Xo,Jo,gs,hi=R({},ms,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:el,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!==gs&&(gs&&e.type==="mousemove"?(Xo=e.screenX-gs.screenX,Jo=e.screenY-gs.screenY):Jo=Xo=0,gs=e),Xo)},movementY:function(e){return"movementY"in e?e.movementY:Jo}}),yc=Et(hi),Lp=R({},hi,{dataTransfer:0}),zp=Et(Lp),Wp=R({},ms,{relatedTarget:0}),Zo=Et(Wp),Fp=R({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),Bp=Et(Fp),qp=R({},Rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Up=Et(qp),Hp=R({},Rr,{data:0}),xc=Et(Hp),Vp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kp={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"},Gp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gp[e])?!!t[e]:!1}function el(){return Qp}var Yp=R({},ms,{key:function(e){if(e.key){var t=Vp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:el,charCode:function(e){return e.type==="keypress"?fi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Xp=Et(Yp),Jp=R({},hi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wc=Et(Jp),Zp=R({},ms,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:el}),eh=Et(Zp),th=R({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),nh=Et(th),rh=R({},hi,{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}),sh=Et(rh),ih=[9,13,27,32],tl=g&&"CompositionEvent"in window,vs=null;g&&"documentMode"in document&&(vs=document.documentMode);var oh=g&&"TextEvent"in window&&!vs,kc=g&&(!tl||vs&&8<vs&&11>=vs),jc=" ",Sc=!1;function Cc(e,t){switch(e){case"keyup":return ih.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tr=!1;function lh(e,t){switch(e){case"compositionend":return Nc(t);case"keypress":return t.which!==32?null:(Sc=!0,jc);case"textInput":return e=t.data,e===jc&&Sc?null:e;default:return null}}function ah(e,t){if(Tr)return e==="compositionend"||!tl&&Cc(e,t)?(e=gc(),di=Qo=Dn=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 kc&&t.locale!=="ko"?null:t.data;default:return null}}var ch={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 bc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ch[e.type]:t==="textarea"}function _c(e,t,s,l){ls(l),t=xi(t,"onChange"),0<t.length&&(s=new Yo("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var ys=null,xs=null;function uh(e){Hc(e,0)}function mi(e){var t=Dr(e);if(mt(t))return e}function dh(e,t){if(e==="change")return t}var Ic=!1;if(g){var nl;if(g){var rl="oninput"in document;if(!rl){var Ec=document.createElement("div");Ec.setAttribute("oninput","return;"),rl=typeof Ec.oninput=="function"}nl=rl}else nl=!1;Ic=nl&&(!document.documentMode||9<document.documentMode)}function Pc(){ys&&(ys.detachEvent("onpropertychange",Rc),xs=ys=null)}function Rc(e){if(e.propertyName==="value"&&mi(xs)){var t=[];_c(t,xs,e,br(e)),le(uh,t)}}function fh(e,t,s){e==="focusin"?(Pc(),ys=t,xs=s,ys.attachEvent("onpropertychange",Rc)):e==="focusout"&&Pc()}function ph(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mi(xs)}function hh(e,t){if(e==="click")return mi(t)}function mh(e,t){if(e==="input"||e==="change")return mi(t)}function gh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:gh;function ws(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 Tc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mc(e,t){var s=Tc(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=Tc(s)}}function Oc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Oc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ac(){for(var e=window,t=Mt();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Mt(e.document)}return t}function sl(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 vh(e){var t=Ac(),s=e.focusedElem,l=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Oc(s.ownerDocument.documentElement,s)){if(l!==null&&sl(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=Mc(s,u);var p=Mc(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 yh=g&&"documentMode"in document&&11>=document.documentMode,Mr=null,il=null,ks=null,ol=!1;function $c(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ol||Mr==null||Mr!==Mt(l)||(l=Mr,"selectionStart"in l&&sl(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}),ks&&ws(ks,l)||(ks=l,l=xi(il,"onSelect"),0<l.length&&(t=new Yo("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=Mr)))}function gi(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Or={animationend:gi("Animation","AnimationEnd"),animationiteration:gi("Animation","AnimationIteration"),animationstart:gi("Animation","AnimationStart"),transitionend:gi("Transition","TransitionEnd")},ll={},Dc={};g&&(Dc=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 vi(e){if(ll[e])return ll[e];if(!Or[e])return e;var t=Or[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Dc)return ll[e]=t[s];return e}var Lc=vi("animationend"),zc=vi("animationiteration"),Wc=vi("animationstart"),Fc=vi("transitionend"),Bc=new Map,qc="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 Ln(e,t){Bc.set(e,t),f(t,[e])}for(var al=0;al<qc.length;al++){var cl=qc[al],xh=cl.toLowerCase(),wh=cl[0].toUpperCase()+cl.slice(1);Ln(xh,"on"+wh)}Ln(Lc,"onAnimationEnd"),Ln(zc,"onAnimationIteration"),Ln(Wc,"onAnimationStart"),Ln("dblclick","onDoubleClick"),Ln("focusin","onFocus"),Ln("focusout","onBlur"),Ln(Fc,"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 js="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(" "),kh=new Set("cancel close invalid load scroll toggle".split(" ").concat(js));function Uc(e,t,s){var l=e.type||"unknown-event";e.currentTarget=s,ti(l,t,void 0,e),e.currentTarget=null}function Hc(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,P=v.currentTarget;if(v=v.listener,x!==u&&c.isPropagationStopped())break e;Uc(c,v,P),u=x}else for(p=0;p<l.length;p++){if(v=l[p],x=v.instance,P=v.currentTarget,v=v.listener,x!==u&&c.isPropagationStopped())break e;Uc(c,v,P),u=x}}}if(Er)throw e=tt,Er=!1,tt=null,e}function ze(e,t){var s=t[vl];s===void 0&&(s=t[vl]=new Set);var l=e+"__bubble";s.has(l)||(Vc(t,e,2,!1),s.add(l))}function ul(e,t,s){var l=0;t&&(l|=4),Vc(s,e,l,t)}var yi="_reactListening"+Math.random().toString(36).slice(2);function Ss(e){if(!e[yi]){e[yi]=!0,a.forEach(function(s){s!=="selectionchange"&&(kh.has(s)||ul(s,!1,e),ul(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[yi]||(t[yi]=!0,ul("selectionchange",!1,t))}}function Vc(e,t,s,l){switch(mc(t)){case 1:var c=Ap;break;case 4:c=$p;break;default:c=Ko}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 dl(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}le(function(){var P=u,U=br(s),V=[];e:{var q=Bc.get(e);if(q!==void 0){var ie=Yo,ce=e;switch(e){case"keypress":if(fi(s)===0)break e;case"keydown":case"keyup":ie=Xp;break;case"focusin":ce="focus",ie=Zo;break;case"focusout":ce="blur",ie=Zo;break;case"beforeblur":case"afterblur":ie=Zo;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":ie=yc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=zp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=eh;break;case Lc:case zc:case Wc:ie=Bp;break;case Fc:ie=nh;break;case"scroll":ie=Dp;break;case"wheel":ie=sh;break;case"copy":case"cut":case"paste":ie=Up;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=wc}var ue=(t&4)!==0,Ge=!ue&&e==="scroll",_=ue?q!==null?q+"Capture":null:q;ue=[];for(var k=P,I;k!==null;){I=k;var K=I.stateNode;if(I.tag===5&&K!==null&&(I=K,_!==null&&(K=ae(k,_),K!=null&&ue.push(Cs(k,K,I)))),Ge)break;k=k.return}0<ue.length&&(q=new ie(q,ce,null,s,U),V.push({event:q,listeners:ue}))}}if((t&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",ie=e==="mouseout"||e==="pointerout",q&&s!==Nr&&(ce=s.relatedTarget||s.fromElement)&&(sr(ce)||ce[yn]))break e;if((ie||q)&&(q=U.window===U?U:(q=U.ownerDocument)?q.defaultView||q.parentWindow:window,ie?(ce=s.relatedTarget||s.toElement,ie=P,ce=ce?sr(ce):null,ce!==null&&(Ge=rr(ce),ce!==Ge||ce.tag!==5&&ce.tag!==6)&&(ce=null)):(ie=null,ce=P),ie!==ce)){if(ue=yc,K="onMouseLeave",_="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ue=wc,K="onPointerLeave",_="onPointerEnter",k="pointer"),Ge=ie==null?q:Dr(ie),I=ce==null?q:Dr(ce),q=new ue(K,k+"leave",ie,s,U),q.target=Ge,q.relatedTarget=I,K=null,sr(U)===P&&(ue=new ue(_,k+"enter",ce,s,U),ue.target=I,ue.relatedTarget=Ge,K=ue),Ge=K,ie&&ce)t:{for(ue=ie,_=ce,k=0,I=ue;I;I=Ar(I))k++;for(I=0,K=_;K;K=Ar(K))I++;for(;0<k-I;)ue=Ar(ue),k--;for(;0<I-k;)_=Ar(_),I--;for(;k--;){if(ue===_||_!==null&&ue===_.alternate)break t;ue=Ar(ue),_=Ar(_)}ue=null}else ue=null;ie!==null&&Kc(V,q,ie,ue,!1),ce!==null&&Ge!==null&&Kc(V,Ge,ce,ue,!0)}}e:{if(q=P?Dr(P):window,ie=q.nodeName&&q.nodeName.toLowerCase(),ie==="select"||ie==="input"&&q.type==="file")var de=dh;else if(bc(q))if(Ic)de=mh;else{de=ph;var me=fh}else(ie=q.nodeName)&&ie.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(de=hh);if(de&&(de=de(e,P))){_c(V,de,s,U);break e}me&&me(e,q,P),e==="focusout"&&(me=q._wrapperState)&&me.controlled&&q.type==="number"&&fn(q,"number",q.value)}switch(me=P?Dr(P):window,e){case"focusin":(bc(me)||me.contentEditable==="true")&&(Mr=me,il=P,ks=null);break;case"focusout":ks=il=Mr=null;break;case"mousedown":ol=!0;break;case"contextmenu":case"mouseup":case"dragend":ol=!1,$c(V,s,U);break;case"selectionchange":if(yh)break;case"keydown":case"keyup":$c(V,s,U)}var ge;if(tl)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?Cc(e,s)&&(ke="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(ke="onCompositionStart");ke&&(kc&&s.locale!=="ko"&&(Tr||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Tr&&(ge=gc()):(Dn=U,Qo="value"in Dn?Dn.value:Dn.textContent,Tr=!0)),me=xi(P,ke),0<me.length&&(ke=new xc(ke,e,null,s,U),V.push({event:ke,listeners:me}),ge?ke.data=ge:(ge=Nc(s),ge!==null&&(ke.data=ge)))),(ge=oh?lh(e,s):ah(e,s))&&(P=xi(P,"onBeforeInput"),0<P.length&&(U=new xc("onBeforeInput","beforeinput",null,s,U),V.push({event:U,listeners:P}),U.data=ge))}Hc(V,t)})}function Cs(e,t,s){return{instance:e,listener:t,currentTarget:s}}function xi(e,t){for(var s=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=ae(e,s),u!=null&&l.unshift(Cs(e,u,c)),u=ae(e,t),u!=null&&l.push(Cs(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 Kc(e,t,s,l,c){for(var u=t._reactName,p=[];s!==null&&s!==l;){var v=s,x=v.alternate,P=v.stateNode;if(x!==null&&x===l)break;v.tag===5&&P!==null&&(v=P,c?(x=ae(s,u),x!=null&&p.unshift(Cs(s,x,v))):c||(x=ae(s,u),x!=null&&p.push(Cs(s,x,v)))),s=s.return}p.length!==0&&e.push({event:t,listeners:p})}var jh=/\r\n?/g,Sh=/\u0000|\uFFFD/g;function Gc(e){return(typeof e=="string"?e:""+e).replace(jh,`
|
|
7
|
+
`).replace(Sh,"")}function wi(e,t,s){if(t=Gc(t),Gc(e)!==t&&s)throw Error(o(425))}function ki(){}var fl=null,pl=null;function hl(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 ml=typeof setTimeout=="function"?setTimeout:void 0,Ch=typeof clearTimeout=="function"?clearTimeout:void 0,Qc=typeof Promise=="function"?Promise:void 0,Nh=typeof queueMicrotask=="function"?queueMicrotask:typeof Qc<"u"?function(e){return Qc.resolve(null).then(e).catch(bh)}:ml;function bh(e){setTimeout(function(){throw e})}function gl(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),hs(t);return}l--}else s!=="$"&&s!=="$?"&&s!=="$!"||l++;s=c}while(s);hs(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 Yc(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),ln="__reactFiber$"+$r,Ns="__reactProps$"+$r,yn="__reactContainer$"+$r,vl="__reactEvents$"+$r,_h="__reactListeners$"+$r,Ih="__reactHandles$"+$r;function sr(e){var t=e[ln];if(t)return t;for(var s=e.parentNode;s;){if(t=s[yn]||s[ln]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Yc(e);e!==null;){if(s=e[ln])return s;e=Yc(e)}return t}e=s,s=e.parentNode}return null}function bs(e){return e=e[ln]||e[yn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Dr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function ji(e){return e[Ns]||null}var yl=[],Lr=-1;function Wn(e){return{current:e}}function We(e){0>Lr||(e.current=yl[Lr],yl[Lr]=null,Lr--)}function $e(e,t){Lr++,yl[Lr]=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 Si(){We(yt),We(dt)}function Xc(e,t,s){if(dt.current!==Fn)throw Error(o(168));$e(dt,t),$e(yt,s)}function Jc(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 R({},s,l)}function Ci(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fn,ir=dt.current,$e(dt,e),$e(yt,yt.current),!0}function Zc(e,t,s){var l=e.stateNode;if(!l)throw Error(o(169));s?(e=Jc(e,t,ir),l.__reactInternalMemoizedMergedChildContext=e,We(yt),We(dt),$e(dt,e)):We(yt),$e(yt,s)}var xn=null,Ni=!1,xl=!1;function eu(e){xn===null?xn=[e]:xn.push(e)}function Eh(e){Ni=!0,eu(e)}function Bn(){if(!xl&&xn!==null){xl=!0;var e=0,t=Oe;try{var s=xn;for(Oe=1;e<s.length;e++){var l=s[e];do l=l(!0);while(l!==null)}xn=null,Ni=!1}catch(c){throw xn!==null&&(xn=xn.slice(e+1)),nc(Fo,Bn),c}finally{Oe=t,xl=!1}}return null}var Wr=[],Fr=0,bi=null,_i=0,$t=[],Dt=0,or=null,wn=1,kn="";function lr(e,t){Wr[Fr++]=_i,Wr[Fr++]=bi,bi=e,_i=t}function tu(e,t,s){$t[Dt++]=wn,$t[Dt++]=kn,$t[Dt++]=or,or=e;var l=wn;e=kn;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,wn=1<<32-Kt(t)+c|s<<c|l,kn=u+e}else wn=1<<u|s<<c|l,kn=e}function wl(e){e.return!==null&&(lr(e,1),tu(e,1,0))}function kl(e){for(;e===bi;)bi=Wr[--Fr],Wr[Fr]=null,_i=Wr[--Fr],Wr[Fr]=null;for(;e===or;)or=$t[--Dt],$t[Dt]=null,kn=$t[--Dt],$t[Dt]=null,wn=$t[--Dt],$t[Dt]=null}var Pt=null,Rt=null,Be=!1,Qt=null;function nu(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 ru(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,Pt=e,Rt=zn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Pt=e,Rt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=or!==null?{id:wn,overflow:kn}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Ft(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,Pt=e,Rt=null,!0):!1;default:return!1}}function jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Sl(e){if(Be){var t=Rt;if(t){var s=t;if(!ru(e,t)){if(jl(e))throw Error(o(418));t=zn(s.nextSibling);var l=Pt;t&&ru(e,t)?nu(l,s):(e.flags=e.flags&-4097|2,Be=!1,Pt=e)}}else{if(jl(e))throw Error(o(418));e.flags=e.flags&-4097|2,Be=!1,Pt=e}}}function su(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Pt=e}function Ii(e){if(e!==Pt)return!1;if(!Be)return su(e),Be=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!hl(e.type,e.memoizedProps)),t&&(t=Rt)){if(jl(e))throw iu(),Error(o(418));for(;t;)nu(e,t),t=zn(t.nextSibling)}if(su(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){Rt=zn(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Rt=null}}else Rt=Pt?zn(e.stateNode.nextSibling):null;return!0}function iu(){for(var e=Rt;e;)e=zn(e.nextSibling)}function Br(){Rt=Pt=null,Be=!1}function Cl(e){Qt===null?Qt=[e]:Qt.push(e)}var Ph=te.ReactCurrentBatchConfig;function _s(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 Ei(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ou(e){var t=e._init;return t(e._payload)}function lu(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,K){return k===null||k.tag!==6?(k=ma(I,_.mode,K),k.return=_,k):(k=c(k,I),k.return=_,k)}function x(_,k,I,K){var de=I.type;return de===z?U(_,k,I.props.children,K,I.key):k!==null&&(k.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===ve&&ou(de)===k.type)?(K=c(k,I.props),K.ref=_s(_,k,I),K.return=_,K):(K=Zi(I.type,I.key,I.props,null,_.mode,K),K.ref=_s(_,k,I),K.return=_,K)}function P(_,k,I,K){return k===null||k.tag!==4||k.stateNode.containerInfo!==I.containerInfo||k.stateNode.implementation!==I.implementation?(k=ga(I,_.mode,K),k.return=_,k):(k=c(k,I.children||[]),k.return=_,k)}function U(_,k,I,K,de){return k===null||k.tag!==7?(k=mr(I,_.mode,K,de),k.return=_,k):(k=c(k,I),k.return=_,k)}function V(_,k,I){if(typeof k=="string"&&k!==""||typeof k=="number")return k=ma(""+k,_.mode,I),k.return=_,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ee:return I=Zi(k.type,k.key,k.props,null,_.mode,I),I.ref=_s(_,null,k),I.return=_,I;case N:return k=ga(k,_.mode,I),k.return=_,k;case ve:var K=k._init;return V(_,K(k._payload),I)}if(rn(k)||H(k))return k=mr(k,_.mode,I,null),k.return=_,k;Ei(_,k)}return null}function q(_,k,I,K){var de=k!==null?k.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return de!==null?null:v(_,k,""+I,K);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:return I.key===de?x(_,k,I,K):null;case N:return I.key===de?P(_,k,I,K):null;case ve:return de=I._init,q(_,k,de(I._payload),K)}if(rn(I)||H(I))return de!==null?null:U(_,k,I,K,null);Ei(_,I)}return null}function ie(_,k,I,K,de){if(typeof K=="string"&&K!==""||typeof K=="number")return _=_.get(I)||null,v(k,_,""+K,de);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case ee:return _=_.get(K.key===null?I:K.key)||null,x(k,_,K,de);case N:return _=_.get(K.key===null?I:K.key)||null,P(k,_,K,de);case ve:var me=K._init;return ie(_,k,I,me(K._payload),de)}if(rn(K)||H(K))return _=_.get(I)||null,U(k,_,K,de,null);Ei(k,K)}return null}function ce(_,k,I,K){for(var de=null,me=null,ge=k,ke=k=0,st=null;ge!==null&&ke<I.length;ke++){ge.index>ke?(st=ge,ge=null):st=ge.sibling;var Me=q(_,ge,I[ke],K);if(Me===null){ge===null&&(ge=st);break}e&&ge&&Me.alternate===null&&t(_,ge),k=u(Me,k,ke),me===null?de=Me:me.sibling=Me,me=Me,ge=st}if(ke===I.length)return s(_,ge),Be&&lr(_,ke),de;if(ge===null){for(;ke<I.length;ke++)ge=V(_,I[ke],K),ge!==null&&(k=u(ge,k,ke),me===null?de=ge:me.sibling=ge,me=ge);return Be&&lr(_,ke),de}for(ge=l(_,ge);ke<I.length;ke++)st=ie(ge,_,ke,I[ke],K),st!==null&&(e&&st.alternate!==null&&ge.delete(st.key===null?ke:st.key),k=u(st,k,ke),me===null?de=st:me.sibling=st,me=st);return e&&ge.forEach(function(Xn){return t(_,Xn)}),Be&&lr(_,ke),de}function ue(_,k,I,K){var de=H(I);if(typeof de!="function")throw Error(o(150));if(I=de.call(I),I==null)throw Error(o(151));for(var me=de=null,ge=k,ke=k=0,st=null,Me=I.next();ge!==null&&!Me.done;ke++,Me=I.next()){ge.index>ke?(st=ge,ge=null):st=ge.sibling;var Xn=q(_,ge,Me.value,K);if(Xn===null){ge===null&&(ge=st);break}e&&ge&&Xn.alternate===null&&t(_,ge),k=u(Xn,k,ke),me===null?de=Xn:me.sibling=Xn,me=Xn,ge=st}if(Me.done)return s(_,ge),Be&&lr(_,ke),de;if(ge===null){for(;!Me.done;ke++,Me=I.next())Me=V(_,Me.value,K),Me!==null&&(k=u(Me,k,ke),me===null?de=Me:me.sibling=Me,me=Me);return Be&&lr(_,ke),de}for(ge=l(_,ge);!Me.done;ke++,Me=I.next())Me=ie(ge,_,ke,Me.value,K),Me!==null&&(e&&Me.alternate!==null&&ge.delete(Me.key===null?ke:Me.key),k=u(Me,k,ke),me===null?de=Me:me.sibling=Me,me=Me);return e&&ge.forEach(function(cm){return t(_,cm)}),Be&&lr(_,ke),de}function Ge(_,k,I,K){if(typeof I=="object"&&I!==null&&I.type===z&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:e:{for(var de=I.key,me=k;me!==null;){if(me.key===de){if(de=I.type,de===z){if(me.tag===7){s(_,me.sibling),k=c(me,I.props.children),k.return=_,_=k;break e}}else if(me.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===ve&&ou(de)===me.type){s(_,me.sibling),k=c(me,I.props),k.ref=_s(_,me,I),k.return=_,_=k;break e}s(_,me);break}else t(_,me);me=me.sibling}I.type===z?(k=mr(I.props.children,_.mode,K,I.key),k.return=_,_=k):(K=Zi(I.type,I.key,I.props,null,_.mode,K),K.ref=_s(_,k,I),K.return=_,_=K)}return p(_);case N:e:{for(me=I.key;k!==null;){if(k.key===me)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=ga(I,_.mode,K),k.return=_,_=k}return p(_);case ve:return me=I._init,Ge(_,k,me(I._payload),K)}if(rn(I))return ce(_,k,I,K);if(H(I))return ue(_,k,I,K);Ei(_,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=ma(I,_.mode,K),k.return=_,_=k),p(_)):s(_,k)}return Ge}var qr=lu(!0),au=lu(!1),Pi=Wn(null),Ri=null,Ur=null,Nl=null;function bl(){Nl=Ur=Ri=null}function _l(e){var t=Pi.current;We(Pi),e._currentValue=t}function Il(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){Ri=e,Nl=Ur=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(wt=!0),e.firstContext=null)}function Lt(e){var t=e._currentValue;if(Nl!==e)if(e={context:e,memoizedValue:t,next:null},Ur===null){if(Ri===null)throw Error(o(308));Ur=e,Ri.dependencies={lanes:0,firstContext:e}}else Ur=Ur.next=e;return t}var ar=null;function El(e){ar===null?ar=[e]:ar.push(e)}function cu(e,t,s,l){var c=t.interleaved;return c===null?(s.next=s,El(t)):(s.next=c.next,c.next=s),t.interleaved=s,jn(e,l)}function jn(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 Pl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uu(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 Sn(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,jn(e,s)}return c=l.interleaved,c===null?(t.next=t,El(l)):(t.next=c.next,c.next=t),l.interleaved=t,jn(e,s)}function Ti(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,Uo(e,s)}}function du(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 Mi(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,P=x.next;x.next=null,p===null?u=P:p.next=P,p=x;var U=e.alternate;U!==null&&(U=U.updateQueue,v=U.lastBaseUpdate,v!==p&&(v===null?U.firstBaseUpdate=P:v.next=P,U.lastBaseUpdate=x))}if(u!==null){var V=c.baseState;p=0,U=P=x=null,v=u;do{var q=v.lane,ie=v.eventTime;if((l&q)===q){U!==null&&(U=U.next={eventTime:ie,lane:0,tag:v.tag,payload:v.payload,callback:v.callback,next:null});e:{var ce=e,ue=v;switch(q=t,ie=s,ue.tag){case 1:if(ce=ue.payload,typeof ce=="function"){V=ce.call(ie,V,q);break e}V=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ue.payload,q=typeof ce=="function"?ce.call(ie,V,q):ce,q==null)break e;V=R({},V,q);break e;case 2:qn=!0}}v.callback!==null&&v.lane!==0&&(e.flags|=64,q=c.effects,q===null?c.effects=[v]:q.push(v))}else ie={eventTime:ie,lane:q,tag:v.tag,payload:v.payload,callback:v.callback,next:null},U===null?(P=U=ie,x=V):U=U.next=ie,p|=q;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;q=v,v=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);if(U===null&&(x=V),c.baseState=x,c.firstBaseUpdate=P,c.lastBaseUpdate=U,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 fu(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 Is={},an=Wn(Is),Es=Wn(Is),Ps=Wn(Is);function cr(e){if(e===Is)throw Error(o(174));return e}function Rl(e,t){switch($e(Ps,t),$e(Es,e),$e(an,Is),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pn(t,e)}We(an),$e(an,t)}function Vr(){We(an),We(Es),We(Ps)}function pu(e){cr(Ps.current);var t=cr(an.current),s=pn(t,e.type);t!==s&&($e(Es,e),$e(an,s))}function Tl(e){Es.current===e&&(We(an),We(Es))}var Ue=Wn(0);function Oi(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 Ml=[];function Ol(){for(var e=0;e<Ml.length;e++)Ml[e]._workInProgressVersionPrimary=null;Ml.length=0}var Ai=te.ReactCurrentDispatcher,Al=te.ReactCurrentBatchConfig,ur=0,He=null,Je=null,nt=null,$i=!1,Rs=!1,Ts=0,Rh=0;function ft(){throw Error(o(321))}function $l(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 Dl(e,t,s,l,c,u){if(ur=u,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ai.current=e===null||e.memoizedState===null?Ah:$h,e=s(l,c),Rs){u=0;do{if(Rs=!1,Ts=0,25<=u)throw Error(o(301));u+=1,nt=Je=null,t.updateQueue=null,Ai.current=Dh,e=s(l,c)}while(Rs)}if(Ai.current=zi,t=Je!==null&&Je.next!==null,ur=0,nt=Je=He=null,$i=!1,t)throw Error(o(300));return e}function Ll(){var e=Ts!==0;return Ts=0,e}function cn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?He.memoizedState=nt=e:nt=nt.next=e,nt}function zt(){if(Je===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=nt===null?He.memoizedState:nt.next;if(t!==null)nt=t,Je=e;else{if(e===null)throw Error(o(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},nt===null?He.memoizedState=nt=e:nt=nt.next=e}return nt}function Ms(e,t){return typeof t=="function"?t(e):t}function zl(e){var t=zt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=Je,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,P=u;do{var U=P.lane;if((ur&U)===U)x!==null&&(x=x.next={lane:0,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),l=P.hasEagerState?P.eagerState:e(l,P.action);else{var V={lane:U,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null};x===null?(v=x=V,p=l):x=x.next=V,He.lanes|=U,dr|=U}P=P.next}while(P!==null&&P!==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,He.lanes|=u,dr|=u,c=c.next;while(c!==e)}else c===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function Wl(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 hu(){}function mu(e,t){var s=He,l=zt(),c=t(),u=!Gt(l.memoizedState,c);if(u&&(l.memoizedState=c,wt=!0),l=l.queue,Fl(yu.bind(null,s,l,e),[e]),l.getSnapshot!==t||u||nt!==null&&nt.memoizedState.tag&1){if(s.flags|=2048,Os(9,vu.bind(null,s,l,c,t),void 0,null),rt===null)throw Error(o(349));(ur&30)!==0||gu(s,t,c)}return c}function gu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=He.updateQueue,t===null?(t={lastEffect:null,stores:null},He.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function vu(e,t,s,l){t.value=s,t.getSnapshot=l,xu(t)&&wu(e)}function yu(e,t,s){return s(function(){xu(t)&&wu(e)})}function xu(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Gt(e,s)}catch{return!0}}function wu(e){var t=jn(e,1);t!==null&&Zt(t,e,1,-1)}function ku(e){var t=cn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:e},t.queue=e,e=e.dispatch=Oh.bind(null,He,e),[t.memoizedState,e]}function Os(e,t,s,l){return e={tag:e,create:t,destroy:s,deps:l,next:null},t=He.updateQueue,t===null?(t={lastEffect:null,stores:null},He.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 ju(){return zt().memoizedState}function Di(e,t,s,l){var c=cn();He.flags|=e,c.memoizedState=Os(1|t,s,void 0,l===void 0?null:l)}function Li(e,t,s,l){var c=zt();l=l===void 0?null:l;var u=void 0;if(Je!==null){var p=Je.memoizedState;if(u=p.destroy,l!==null&&$l(l,p.deps)){c.memoizedState=Os(t,s,u,l);return}}He.flags|=e,c.memoizedState=Os(1|t,s,u,l)}function Su(e,t){return Di(8390656,8,e,t)}function Fl(e,t){return Li(2048,8,e,t)}function Cu(e,t){return Li(4,2,e,t)}function Nu(e,t){return Li(4,4,e,t)}function bu(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 _u(e,t,s){return s=s!=null?s.concat([e]):null,Li(4,4,bu.bind(null,t,e),s)}function Bl(){}function Iu(e,t){var s=zt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&$l(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function Eu(e,t){var s=zt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&$l(t,l[1])?l[0]:(e=e(),s.memoizedState=[e,t],e)}function Pu(e,t,s){return(ur&21)===0?(e.baseState&&(e.baseState=!1,wt=!0),e.memoizedState=s):(Gt(s,t)||(s=oc(),He.lanes|=s,dr|=s,e.baseState=!0),t)}function Th(e,t){var s=Oe;Oe=s!==0&&4>s?s:4,e(!0);var l=Al.transition;Al.transition={};try{e(!1),t()}finally{Oe=s,Al.transition=l}}function Ru(){return zt().memoizedState}function Mh(e,t,s){var l=Gn(e);if(s={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null},Tu(e))Mu(t,s);else if(s=cu(e,t,s,l),s!==null){var c=vt();Zt(s,e,l,c),Ou(s,t,l)}}function Oh(e,t,s){var l=Gn(e),c={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null};if(Tu(e))Mu(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,El(t)):(c.next=x.next,x.next=c),t.interleaved=c;return}}catch{}s=cu(e,t,c,l),s!==null&&(c=vt(),Zt(s,e,l,c),Ou(s,t,l))}}function Tu(e){var t=e.alternate;return e===He||t!==null&&t===He}function Mu(e,t){Rs=$i=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Ou(e,t,s){if((s&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,Uo(e,s)}}var zi={readContext:Lt,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},Ah={readContext:Lt,useCallback:function(e,t){return cn().memoizedState=[e,t===void 0?null:t],e},useContext:Lt,useEffect:Su,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,Di(4194308,4,bu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Di(4194308,4,e,t)},useInsertionEffect:function(e,t){return Di(4,2,e,t)},useMemo:function(e,t){var s=cn();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var l=cn();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=Mh.bind(null,He,e),[l.memoizedState,e]},useRef:function(e){var t=cn();return e={current:e},t.memoizedState=e},useState:ku,useDebugValue:Bl,useDeferredValue:function(e){return cn().memoizedState=e},useTransition:function(){var e=ku(!1),t=e[0];return e=Th.bind(null,e[1]),cn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var l=He,c=cn();if(Be){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),rt===null)throw Error(o(349));(ur&30)!==0||gu(l,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,Su(yu.bind(null,l,u,e),[e]),l.flags|=2048,Os(9,vu.bind(null,l,u,s,t),void 0,null),s},useId:function(){var e=cn(),t=rt.identifierPrefix;if(Be){var s=kn,l=wn;s=(l&~(1<<32-Kt(l)-1)).toString(32)+s,t=":"+t+"R"+s,s=Ts++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=Rh++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},$h={readContext:Lt,useCallback:Iu,useContext:Lt,useEffect:Fl,useImperativeHandle:_u,useInsertionEffect:Cu,useLayoutEffect:Nu,useMemo:Eu,useReducer:zl,useRef:ju,useState:function(){return zl(Ms)},useDebugValue:Bl,useDeferredValue:function(e){var t=zt();return Pu(t,Je.memoizedState,e)},useTransition:function(){var e=zl(Ms)[0],t=zt().memoizedState;return[e,t]},useMutableSource:hu,useSyncExternalStore:mu,useId:Ru,unstable_isNewReconciler:!1},Dh={readContext:Lt,useCallback:Iu,useContext:Lt,useEffect:Fl,useImperativeHandle:_u,useInsertionEffect:Cu,useLayoutEffect:Nu,useMemo:Eu,useReducer:Wl,useRef:ju,useState:function(){return Wl(Ms)},useDebugValue:Bl,useDeferredValue:function(e){var t=zt();return Je===null?t.memoizedState=e:Pu(t,Je.memoizedState,e)},useTransition:function(){var e=Wl(Ms)[0],t=zt().memoizedState;return[e,t]},useMutableSource:hu,useSyncExternalStore:mu,useId:Ru,unstable_isNewReconciler:!1};function Yt(e,t){if(e&&e.defaultProps){t=R({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function ql(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:R({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Wi={isMounted:function(e){return(e=e._reactInternals)?rr(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var l=vt(),c=Gn(e),u=Sn(l,c);u.payload=t,s!=null&&(u.callback=s),t=Un(e,u,c),t!==null&&(Zt(t,e,c,l),Ti(t,e,c))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=vt(),c=Gn(e),u=Sn(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),Ti(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=vt(),l=Gn(e),c=Sn(s,l);c.tag=2,t!=null&&(c.callback=t),t=Un(e,c,l),t!==null&&(Zt(t,e,l,s),Ti(t,e,l))}};function Au(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?!ws(s,l)||!ws(c,u):!0}function $u(e,t,s){var l=!1,c=Fn,u=t.contextType;return typeof u=="object"&&u!==null?u=Lt(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=Wi,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Du(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&&Wi.enqueueReplaceState(t,t.state,null)}function Ul(e,t,s,l){var c=e.stateNode;c.props=s,c.state=e.memoizedState,c.refs={},Pl(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Lt(u):(u=xt(t)?ir:dt.current,c.context=zr(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(ql(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&&Wi.enqueueReplaceState(c,c.state,null),Mi(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+=we(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 Hl(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function Vl(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var Lh=typeof WeakMap=="function"?WeakMap:Map;function Lu(e,t,s){s=Sn(-1,s),s.tag=3,s.payload={element:null};var l=t.value;return s.callback=function(){Ki||(Ki=!0,la=l),Vl(e,t)},s}function zu(e,t,s){s=Sn(-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(){Vl(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(s.callback=function(){Vl(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 Wu(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new Lh;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=Jh.bind(null,e,t,s),t.then(e,e))}function Fu(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 Bu(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=Sn(-1,1),t.tag=2,Un(s,t,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=c,e)}var zh=te.ReactCurrentOwner,wt=!1;function gt(e,t,s,l){t.child=e===null?au(t,null,s,l):qr(t,e.child,s,l)}function qu(e,t,s,l,c){s=s.render;var u=t.ref;return Hr(t,c),l=Dl(e,t,s,l,u,c),s=Ll(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Cn(e,t,c)):(Be&&s&&wl(t),t.flags|=1,gt(e,t,l,c),t.child)}function Uu(e,t,s,l,c){if(e===null){var u=s.type;return typeof u=="function"&&!ha(u)&&u.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=u,Hu(e,t,u,l,c)):(e=Zi(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:ws,s(p,l)&&e.ref===t.ref)return Cn(e,t,c)}return t.flags|=1,e=Yn(u,l),e.ref=t.ref,e.return=t,t.child=e}function Hu(e,t,s,l,c){if(e!==null){var u=e.memoizedProps;if(ws(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,Cn(e,t,c)}return Kl(e,t,s,l,c)}function Vu(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,Tt),Tt|=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,Tt),Tt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=u!==null?u.baseLanes:s,$e(Qr,Tt),Tt|=l}else u!==null?(l=u.baseLanes|s,t.memoizedState=null):l=s,$e(Qr,Tt),Tt|=l;return gt(e,t,c,s),t.child}function Ku(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function Kl(e,t,s,l,c){var u=xt(s)?ir:dt.current;return u=zr(t,u),Hr(t,c),s=Dl(e,t,s,l,u,c),l=Ll(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Cn(e,t,c)):(Be&&l&&wl(t),t.flags|=1,gt(e,t,s,c),t.child)}function Gu(e,t,s,l,c){if(xt(s)){var u=!0;Ci(t)}else u=!1;if(Hr(t,c),t.stateNode===null)Bi(e,t),$u(t,s,l),Ul(t,s,l,c),l=!0;else if(e===null){var p=t.stateNode,v=t.memoizedProps;p.props=v;var x=p.context,P=s.contextType;typeof P=="object"&&P!==null?P=Lt(P):(P=xt(s)?ir:dt.current,P=zr(t,P));var U=s.getDerivedStateFromProps,V=typeof U=="function"||typeof p.getSnapshotBeforeUpdate=="function";V||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==l||x!==P)&&Du(t,p,l,P),qn=!1;var q=t.memoizedState;p.state=q,Mi(t,l,p,c),x=t.memoizedState,v!==l||q!==x||yt.current||qn?(typeof U=="function"&&(ql(t,s,U,l),x=t.memoizedState),(v=qn||Au(t,s,v,l,q,x,P))?(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=P,l=v):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{p=t.stateNode,uu(e,t),v=t.memoizedProps,P=t.type===t.elementType?v:Yt(t.type,v),p.props=P,V=t.pendingProps,q=p.context,x=s.contextType,typeof x=="object"&&x!==null?x=Lt(x):(x=xt(s)?ir:dt.current,x=zr(t,x));var ie=s.getDerivedStateFromProps;(U=typeof ie=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==V||q!==x)&&Du(t,p,l,x),qn=!1,q=t.memoizedState,p.state=q,Mi(t,l,p,c);var ce=t.memoizedState;v!==V||q!==ce||yt.current||qn?(typeof ie=="function"&&(ql(t,s,ie,l),ce=t.memoizedState),(P=qn||Au(t,s,P,l,q,ce,x)||!1)?(U||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,ce,x),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,ce,x)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ce),p.props=l,p.state=ce,p.context=x,l=P):(typeof p.componentDidUpdate!="function"||v===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),l=!1)}return Gl(e,t,s,l,u,c)}function Gl(e,t,s,l,c,u){Ku(e,t);var p=(t.flags&128)!==0;if(!l&&!p)return c&&Zc(t,s,!1),Cn(e,t,u);l=t.stateNode,zh.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&&Zc(t,s,!0),t.child}function Qu(e){var t=e.stateNode;t.pendingContext?Xc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xc(e,t.context,!1),Rl(e,t.containerInfo)}function Yu(e,t,s,l,c){return Br(),Cl(c),t.flags|=256,gt(e,t,s,l),t.child}var Ql={dehydrated:null,treeContext:null,retryLane:0};function Yl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Xu(e,t,s){var l=t.pendingProps,c=Ue.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(Ue,c&1),e===null)return Sl(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=eo(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=Yl(s),t.memoizedState=Ql,e):Xl(t,p));if(c=e.memoizedState,c!==null&&(v=c.dehydrated,v!==null))return Wh(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?Yl(s):{baseLanes:p.baseLanes|s,cachePool:null,transitions:p.transitions},u.memoizedState=p,u.childLanes=e.childLanes&~s,t.memoizedState=Ql,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 Xl(e,t){return t=eo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Fi(e,t,s,l){return l!==null&&Cl(l),qr(t,e.child,null,s),e=Xl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Wh(e,t,s,l,c,u,p){if(s)return t.flags&256?(t.flags&=-257,l=Hl(Error(o(422))),Fi(e,t,p,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=l.fallback,c=t.mode,l=eo({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=Yl(p),t.memoizedState=Ql,u);if((t.mode&1)===0)return Fi(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=Hl(u,l,void 0),Fi(e,t,p,l)}if(v=(p&e.childLanes)!==0,wt||v){if(l=rt,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,jn(e,c),Zt(l,e,c,-1))}return pa(),l=Hl(Error(o(421))),Fi(e,t,p,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=Zh.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,Rt=zn(c.nextSibling),Pt=t,Be=!0,Qt=null,e!==null&&($t[Dt++]=wn,$t[Dt++]=kn,$t[Dt++]=or,wn=e.id,kn=e.overflow,or=t),t=Xl(t,l.children),t.flags|=4096,t)}function Ju(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Il(e.return,t,s)}function Jl(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 Zu(e,t,s){var l=t.pendingProps,c=l.revealOrder,u=l.tail;if(gt(e,t,l.children,s),l=Ue.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&&Ju(e,s,t);else if(e.tag===19)Ju(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(Ue,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&&Oi(e)===null&&(c=s),s=s.sibling;s=c,s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),Jl(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&&Oi(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}Jl(t,!0,s,null,u);break;case"together":Jl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bi(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Cn(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 Fh(e,t,s){switch(t.tag){case 3:Qu(t),Br();break;case 5:pu(t);break;case 1:xt(t.type)&&Ci(t);break;case 4:Rl(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;$e(Pi,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?($e(Ue,Ue.current&1),t.flags|=128,null):(s&t.child.childLanes)!==0?Xu(e,t,s):($e(Ue,Ue.current&1),e=Cn(e,t,s),e!==null?e.sibling:null);$e(Ue,Ue.current&1);break;case 19:if(l=(s&t.childLanes)!==0,(e.flags&128)!==0){if(l)return Zu(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),$e(Ue,Ue.current),l)break;return null;case 22:case 23:return t.lanes=0,Vu(e,t,s)}return Cn(e,t,s)}var ed,Zl,td,nd;ed=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}},Zl=function(){},td=function(e,t,s,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,cr(an.current);var u=null;switch(s){case"input":c=Ot(e,c),l=Ot(e,l),u=[];break;case"select":c=R({},c,{value:void 0}),l=R({},l,{value:void 0}),u=[];break;case"textarea":c=Rn(e,c),l=Rn(e,l),u=[];break;default:typeof c.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=ki)}Vt(s,l);var p;s=null;for(P in c)if(!l.hasOwnProperty(P)&&c.hasOwnProperty(P)&&c[P]!=null)if(P==="style"){var v=c[P];for(p in v)v.hasOwnProperty(p)&&(s||(s={}),s[p]="")}else P!=="dangerouslySetInnerHTML"&&P!=="children"&&P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(d.hasOwnProperty(P)?u||(u=[]):(u=u||[]).push(P,null));for(P in l){var x=l[P];if(v=c?.[P],l.hasOwnProperty(P)&&x!==v&&(x!=null||v!=null))if(P==="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(P,s)),s=x;else P==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,v=v?v.__html:void 0,x!=null&&v!==x&&(u=u||[]).push(P,x)):P==="children"?typeof x!="string"&&typeof x!="number"||(u=u||[]).push(P,""+x):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&(d.hasOwnProperty(P)?(x!=null&&P==="onScroll"&&ze("scroll",e),u||v===x||(u=[])):(u=u||[]).push(P,x))}s&&(u=u||[]).push("style",s);var P=u;(t.updateQueue=P)&&(t.flags|=4)}},nd=function(e,t,s,l){s!==l&&(t.flags|=4)};function As(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 Bh(e,t,s){var l=t.pendingProps;switch(kl(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)&&Si(),pt(t),null;case 3:return l=t.stateNode,Vr(),We(yt),We(dt),Ol(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qt!==null&&(ua(Qt),Qt=null))),Zl(e,t),pt(t),null;case 5:Tl(t);var c=cr(Ps.current);if(s=t.type,e!==null&&t.stateNode!=null)td(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(an.current),Ii(t)){l=t.stateNode,s=t.type;var u=t.memoizedProps;switch(l[ln]=t,l[Ns]=u,e=(t.mode&1)!==0,s){case"dialog":ze("cancel",l),ze("close",l);break;case"iframe":case"object":case"embed":ze("load",l);break;case"video":case"audio":for(c=0;c<js.length;c++)ze(js[c],l);break;case"source":ze("error",l);break;case"img":case"image":case"link":ze("error",l),ze("load",l);break;case"details":ze("toggle",l);break;case"input":ct(l,u),ze("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!u.multiple},ze("invalid",l);break;case"textarea":ut(l,u),ze("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&&wi(l.textContent,v,e),c=["children",v]):typeof v=="number"&&l.textContent!==""+v&&(u.suppressHydrationWarning!==!0&&wi(l.textContent,v,e),c=["children",""+v]):d.hasOwnProperty(p)&&v!=null&&p==="onScroll"&&ze("scroll",l)}switch(s){case"input":Pe(l),ot(l,u,!0);break;case"textarea":Pe(l),nr(l);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(l.onclick=ki)}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[ln]=t,e[Ns]=l,ed(e,t,!1,!1),t.stateNode=e;e:{switch(p=Cr(s,l),s){case"dialog":ze("cancel",e),ze("close",e),c=l;break;case"iframe":case"object":case"embed":ze("load",e),c=l;break;case"video":case"audio":for(c=0;c<js.length;c++)ze(js[c],e);c=l;break;case"source":ze("error",e),c=l;break;case"img":case"image":case"link":ze("error",e),ze("load",e),c=l;break;case"details":ze("toggle",e),c=l;break;case"input":ct(e,l),c=Ot(e,l),ze("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=R({},l,{value:void 0}),ze("invalid",e);break;case"textarea":ut(e,l),c=Rn(e,l),ze("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"?mn(e,x):u==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,x!=null&&J(e,x)):u==="children"?typeof x=="string"?(s!=="textarea"||x!=="")&&he(e,x):typeof x=="number"&&he(e,""+x):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(d.hasOwnProperty(u)?x!=null&&u==="onScroll"&&ze("scroll",e):x!=null&&pe(e,u,x,p))}switch(s){case"input":Pe(e),ot(e,l,!1);break;case"textarea":Pe(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=ki)}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)nd(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(s=cr(Ps.current),cr(an.current),Ii(t)){if(l=t.stateNode,s=t.memoizedProps,l[ln]=t,(u=l.nodeValue!==s)&&(e=Pt,e!==null))switch(e.tag){case 3:wi(l.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&wi(l.nodeValue,s,(e.mode&1)!==0)}u&&(t.flags|=4)}else l=(s.nodeType===9?s:s.ownerDocument).createTextNode(l),l[ln]=t,t.stateNode=l}return pt(t),null;case 13:if(We(Ue),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Be&&Rt!==null&&(t.mode&1)!==0&&(t.flags&128)===0)iu(),Br(),t.flags|=98560,u=!1;else if(u=Ii(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[ln]=t}else Br(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),u=!1}else Qt!==null&&(ua(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||(Ue.current&1)!==0?Ze===0&&(Ze=3):pa())),t.updateQueue!==null&&(t.flags|=4),pt(t),null);case 4:return Vr(),Zl(e,t),e===null&&Ss(t.stateNode.containerInfo),pt(t),null;case 10:return _l(t.type._context),pt(t),null;case 17:return xt(t.type)&&Si(),pt(t),null;case 19:if(We(Ue),u=t.memoizedState,u===null)return pt(t),null;if(l=(t.flags&128)!==0,p=u.rendering,p===null)if(l)As(u,!1);else{if(Ze!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(p=Oi(e),p!==null){for(t.flags|=128,As(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(Ue,Ue.current&1|2),t.child}e=e.sibling}u.tail!==null&&Ke()>Yr&&(t.flags|=128,l=!0,As(u,!1),t.lanes=4194304)}else{if(!l)if(e=Oi(p),e!==null){if(t.flags|=128,l=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),As(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!Be)return pt(t),null}else 2*Ke()-u.renderingStartTime>Yr&&s!==1073741824&&(t.flags|=128,l=!0,As(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=Ke(),t.sibling=null,s=Ue.current,$e(Ue,l?s&1|2:s&1),t):(pt(t),null);case 22:case 23:return fa(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Tt&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 qh(e,t){switch(kl(t),t.tag){case 1:return xt(t.type)&&Si(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vr(),We(yt),We(dt),Ol(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Tl(t),null;case 13:if(We(Ue),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 We(Ue),null;case 4:return Vr(),null;case 10:return _l(t.type._context),null;case 22:case 23:return fa(),null;case 24:return null;default:return null}}var qi=!1,ht=!1,Uh=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 ea(e,t,s){try{s()}catch(l){Ve(e,t,l)}}var rd=!1;function Hh(e,t){if(fl=ci,e=Ac(),sl(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,P=0,U=0,V=e,q=null;t:for(;;){for(var ie;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),(ie=V.firstChild)!==null;)q=V,V=ie;for(;;){if(V===e)break t;if(q===s&&++P===c&&(v=p),q===u&&++U===l&&(x=p),(ie=V.nextSibling)!==null)break;V=q,q=V.parentNode}V=ie}s=v===-1||x===-1?null:{start:v,end:x}}else s=null}s=s||{start:0,end:0}}else s=null;for(pl={focusedElem:e,selectionRange:s},ci=!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 ce=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var ue=ce.memoizedProps,Ge=ce.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?ue:Yt(t.type,ue),Ge);_.__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(K){Ve(t,t.return,K)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return ce=rd,rd=!1,ce}function $s(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&&ea(t,s,u)}c=c.next}while(c!==l)}}function Ui(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 ta(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 sd(e){var t=e.alternate;t!==null&&(e.alternate=null,sd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ln],delete t[Ns],delete t[vl],delete t[_h],delete t[Ih])),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 id(e){return e.tag===5||e.tag===3||e.tag===4}function od(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||id(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 na(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=ki));else if(l!==4&&(e=e.child,e!==null))for(na(e,t,s),e=e.sibling;e!==null;)na(e,t,s),e=e.sibling}function ra(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(ra(e,t,s),e=e.sibling;e!==null;)ra(e,t,s),e=e.sibling}var lt=null,Xt=!1;function Hn(e,t,s){for(s=s.child;s!==null;)ld(e,t,s),s=s.sibling}function ld(e,t,s){if(on&&typeof on.onCommitFiberUnmount=="function")try{on.onCommitFiberUnmount(ri,s)}catch{}switch(s.tag){case 5:ht||Gr(s,t);case 6:var l=lt,c=Xt;lt=null,Hn(e,t,s),lt=l,Xt=c,lt!==null&&(Xt?(e=lt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):lt.removeChild(s.stateNode));break;case 18:lt!==null&&(Xt?(e=lt,s=s.stateNode,e.nodeType===8?gl(e.parentNode,s):e.nodeType===1&&gl(e,s),hs(e)):gl(lt,s.stateNode));break;case 4:l=lt,c=Xt,lt=s.stateNode.containerInfo,Xt=!0,Hn(e,t,s),lt=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)&&ea(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 ad(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Uh),t.forEach(function(l){var c=em.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:lt=v.stateNode,Xt=!1;break e;case 3:lt=v.stateNode.containerInfo,Xt=!0;break e;case 4:lt=v.stateNode.containerInfo,Xt=!0;break e}v=v.return}if(lt===null)throw Error(o(160));ld(u,p,c),lt=null,Xt=!1;var x=c.alternate;x!==null&&(x.return=null),c.return=null}catch(P){Ve(c,t,P)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)cd(t,e),t=t.sibling}function cd(e,t){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Jt(t,e),un(e),l&4){try{$s(3,e,e.return),Ui(3,e)}catch(ue){Ve(e,e.return,ue)}try{$s(5,e,e.return)}catch(ue){Ve(e,e.return,ue)}}break;case 1:Jt(t,e),un(e),l&512&&s!==null&&Gr(s,s.return);break;case 5:if(Jt(t,e),un(e),l&512&&s!==null&&Gr(s,s.return),e.flags&32){var c=e.stateNode;try{he(c,"")}catch(ue){Ve(e,e.return,ue)}}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&&it(c,u),Cr(v,p);var P=Cr(v,u);for(p=0;p<x.length;p+=2){var U=x[p],V=x[p+1];U==="style"?mn(c,V):U==="dangerouslySetInnerHTML"?J(c,V):U==="children"?he(c,V):pe(c,U,V,P)}switch(v){case"input":Qe(c,u);break;case"textarea":tr(c,u);break;case"select":var q=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var ie=u.value;ie!=null?Ht(c,!!u.multiple,ie,!1):q!==!!u.multiple&&(u.defaultValue!=null?Ht(c,!!u.multiple,u.defaultValue,!0):Ht(c,!!u.multiple,u.multiple?[]:"",!1))}c[Ns]=u}catch(ue){Ve(e,e.return,ue)}}break;case 6:if(Jt(t,e),un(e),l&4){if(e.stateNode===null)throw Error(o(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(ue){Ve(e,e.return,ue)}}break;case 3:if(Jt(t,e),un(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{hs(t.containerInfo)}catch(ue){Ve(e,e.return,ue)}break;case 4:Jt(t,e),un(e);break;case 13:Jt(t,e),un(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(oa=Ke())),l&4&&ad(e);break;case 22:if(U=s!==null&&s.memoizedState!==null,e.mode&1?(ht=(P=ht)||U,Jt(t,e),ht=P):Jt(t,e),un(e),l&8192){if(P=e.memoizedState!==null,(e.stateNode.isHidden=P)&&!U&&(e.mode&1)!==0)for(oe=e,U=e.child;U!==null;){for(V=oe=U;oe!==null;){switch(q=oe,ie=q.child,q.tag){case 0:case 11:case 14:case 15:$s(4,q,q.return);break;case 1:Gr(q,q.return);var ce=q.stateNode;if(typeof ce.componentWillUnmount=="function"){l=q,s=q.return;try{t=l,ce.props=t.memoizedProps,ce.state=t.memoizedState,ce.componentWillUnmount()}catch(ue){Ve(l,s,ue)}}break;case 5:Gr(q,q.return);break;case 22:if(q.memoizedState!==null){fd(V);continue}}ie!==null?(ie.return=q,oe=ie):fd(V)}U=U.sibling}e:for(U=null,V=e;;){if(V.tag===5){if(U===null){U=V;try{c=V.stateNode,P?(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=At("display",p))}catch(ue){Ve(e,e.return,ue)}}}else if(V.tag===6){if(U===null)try{V.stateNode.nodeValue=P?"":V.memoizedProps}catch(ue){Ve(e,e.return,ue)}}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;U===V&&(U=null),V=V.return}U===V&&(U=null),V.sibling.return=V.return,V=V.sibling}}break;case 19:Jt(t,e),un(e),l&4&&ad(e);break;case 21:break;default:Jt(t,e),un(e)}}function un(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(id(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&&(he(c,""),l.flags&=-33);var u=od(e);ra(e,u,c);break;case 3:case 4:var p=l.stateNode.containerInfo,v=od(e);na(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 Vh(e,t,s){oe=e,ud(e)}function ud(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||qi;if(!p){var v=c.alternate,x=v!==null&&v.memoizedState!==null||ht;v=qi;var P=ht;if(qi=p,(ht=x)&&!P)for(oe=c;oe!==null;)p=oe,x=p.child,p.tag===22&&p.memoizedState!==null?pd(c):x!==null?(x.return=p,oe=x):pd(c);for(;u!==null;)oe=u,ud(u),u=u.sibling;oe=c,qi=v,ht=P}dd(e)}else(c.subtreeFlags&8772)!==0&&u!==null?(u.return=c,oe=u):dd(e)}}function dd(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||Ui(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&&fu(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}fu(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 P=t.alternate;if(P!==null){var U=P.memoizedState;if(U!==null){var V=U.dehydrated;V!==null&&hs(V)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}ht||t.flags&512&&ta(t)}catch(q){Ve(t,t.return,q)}}if(t===e){oe=null;break}if(s=t.sibling,s!==null){s.return=t.return,oe=s;break}oe=t.return}}function fd(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 pd(e){for(;oe!==null;){var t=oe;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{Ui(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{ta(t)}catch(x){Ve(t,u,x)}break;case 5:var p=t.return;try{ta(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 Kh=Math.ceil,Hi=te.ReactCurrentDispatcher,sa=te.ReactCurrentOwner,Wt=te.ReactCurrentBatchConfig,Te=0,rt=null,Ye=null,at=0,Tt=0,Qr=Wn(0),Ze=0,Ds=null,dr=0,Vi=0,ia=0,Ls=null,kt=null,oa=0,Yr=1/0,Nn=null,Ki=!1,la=null,Vn=null,Gi=!1,Kn=null,Qi=0,zs=0,aa=null,Yi=-1,Xi=0;function vt(){return(Te&6)!==0?Ke():Yi!==-1?Yi:Yi=Ke()}function Gn(e){return(e.mode&1)===0?1:(Te&2)!==0&&at!==0?at&-at:Ph.transition!==null?(Xi===0&&(Xi=oc()),Xi):(e=Oe,e!==0||(e=window.event,e=e===void 0?16:mc(e.type)),e)}function Zt(e,t,s,l){if(50<zs)throw zs=0,aa=null,Error(o(185));cs(e,s,l),((Te&2)===0||e!==rt)&&(e===rt&&((Te&2)===0&&(Vi|=s),Ze===4&&Qn(e,at)),jt(e,l),s===1&&Te===0&&(t.mode&1)===0&&(Yr=Ke()+500,Ni&&Bn()))}function jt(e,t){var s=e.callbackNode;Pp(e,t);var l=oi(e,e===rt?at:0);if(l===0)s!==null&&rc(s),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(s!=null&&rc(s),t===1)e.tag===0?Eh(md.bind(null,e)):eu(md.bind(null,e)),Nh(function(){(Te&6)===0&&Bn()}),s=null;else{switch(lc(l)){case 1:s=Fo;break;case 4:s=sc;break;case 16:s=ni;break;case 536870912:s=ic;break;default:s=ni}s=Sd(s,hd.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function hd(e,t){if(Yi=-1,Xi=0,(Te&6)!==0)throw Error(o(327));var s=e.callbackNode;if(Xr()&&e.callbackNode!==s)return null;var l=oi(e,e===rt?at:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=Ji(e,l);else{t=l;var c=Te;Te|=2;var u=vd();(rt!==e||at!==t)&&(Nn=null,Yr=Ke()+500,pr(e,t));do try{Yh();break}catch(v){gd(e,v)}while(!0);bl(),Hi.current=u,Te=c,Ye!==null?t=0:(rt=null,at=0,t=Ze)}if(t!==0){if(t===2&&(c=Bo(e),c!==0&&(l=c,t=ca(e,c))),t===1)throw s=Ds,pr(e,0),Qn(e,l),jt(e,Ke()),s;if(t===6)Qn(e,l);else{if(c=e.current.alternate,(l&30)===0&&!Gh(c)&&(t=Ji(e,l),t===2&&(u=Bo(e),u!==0&&(l=u,t=ca(e,u))),t===1))throw s=Ds,pr(e,0),Qn(e,l),jt(e,Ke()),s;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(o(345));case 2:hr(e,kt,Nn);break;case 3:if(Qn(e,l),(l&130023424)===l&&(t=oa+500-Ke(),10<t)){if(oi(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){vt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=ml(hr.bind(null,e,kt,Nn),t);break}hr(e,kt,Nn);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=Ke()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Kh(l/1960))-l,10<l){e.timeoutHandle=ml(hr.bind(null,e,kt,Nn),l);break}hr(e,kt,Nn);break;case 5:hr(e,kt,Nn);break;default:throw Error(o(329))}}}return jt(e,Ke()),e.callbackNode===s?hd.bind(null,e):null}function ca(e,t){var s=Ls;return e.current.memoizedState.isDehydrated&&(pr(e,t).flags|=256),e=Ji(e,t),e!==2&&(t=kt,kt=s,t!==null&&ua(t)),e}function ua(e){kt===null?kt=e:kt.push.apply(kt,e)}function Gh(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&=~ia,t&=~Vi,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 md(e){if((Te&6)!==0)throw Error(o(327));Xr();var t=oi(e,0);if((t&1)===0)return jt(e,Ke()),null;var s=Ji(e,t);if(e.tag!==0&&s===2){var l=Bo(e);l!==0&&(t=l,s=ca(e,l))}if(s===1)throw s=Ds,pr(e,0),Qn(e,t),jt(e,Ke()),s;if(s===6)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hr(e,kt,Nn),jt(e,Ke()),null}function da(e,t){var s=Te;Te|=1;try{return e(t)}finally{Te=s,Te===0&&(Yr=Ke()+500,Ni&&Bn())}}function fr(e){Kn!==null&&Kn.tag===0&&(Te&6)===0&&Xr();var t=Te;Te|=1;var s=Wt.transition,l=Oe;try{if(Wt.transition=null,Oe=1,e)return e()}finally{Oe=l,Wt.transition=s,Te=t,(Te&6)===0&&Bn()}}function fa(){Tt=Qr.current,We(Qr)}function pr(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,Ch(s)),Ye!==null)for(s=Ye.return;s!==null;){var l=s;switch(kl(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Si();break;case 3:Vr(),We(yt),We(dt),Ol();break;case 5:Tl(l);break;case 4:Vr();break;case 13:We(Ue);break;case 19:We(Ue);break;case 10:_l(l.type._context);break;case 22:case 23:fa()}s=s.return}if(rt=e,Ye=e=Yn(e.current,null),at=Tt=t,Ze=0,Ds=null,ia=Vi=dr=0,kt=Ls=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 gd(e,t){do{var s=Ye;try{if(bl(),Ai.current=zi,$i){for(var l=He.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}$i=!1}if(ur=0,nt=Je=He=null,Rs=!1,Ts=0,sa.current=null,s===null||s.return===null){Ze=1,Ds=t,Ye=null;break}e:{var u=e,p=s.return,v=s,x=t;if(t=at,v.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){var P=x,U=v,V=U.tag;if((U.mode&1)===0&&(V===0||V===11||V===15)){var q=U.alternate;q?(U.updateQueue=q.updateQueue,U.memoizedState=q.memoizedState,U.lanes=q.lanes):(U.updateQueue=null,U.memoizedState=null)}var ie=Fu(p);if(ie!==null){ie.flags&=-257,Bu(ie,p,v,u,t),ie.mode&1&&Wu(u,P,t),t=ie,x=P;var ce=t.updateQueue;if(ce===null){var ue=new Set;ue.add(x),t.updateQueue=ue}else ce.add(x);break e}else{if((t&1)===0){Wu(u,P,t),pa();break e}x=Error(o(426))}}else if(Be&&v.mode&1){var Ge=Fu(p);if(Ge!==null){(Ge.flags&65536)===0&&(Ge.flags|=256),Bu(Ge,p,v,u,t),Cl(Kr(x,v));break e}}u=x=Kr(x,v),Ze!==4&&(Ze=2),Ls===null?Ls=[u]:Ls.push(u),u=p;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var _=Lu(u,x,t);du(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 K=zu(u,v,t);du(u,K);break e}}u=u.return}while(u!==null)}xd(s)}catch(de){t=de,Ye===s&&s!==null&&(Ye=s=s.return);continue}break}while(!0)}function vd(){var e=Hi.current;return Hi.current=zi,e===null?zi:e}function pa(){(Ze===0||Ze===3||Ze===2)&&(Ze=4),rt===null||(dr&268435455)===0&&(Vi&268435455)===0||Qn(rt,at)}function Ji(e,t){var s=Te;Te|=2;var l=vd();(rt!==e||at!==t)&&(Nn=null,pr(e,t));do try{Qh();break}catch(c){gd(e,c)}while(!0);if(bl(),Te=s,Hi.current=l,Ye!==null)throw Error(o(261));return rt=null,at=0,Ze}function Qh(){for(;Ye!==null;)yd(Ye)}function Yh(){for(;Ye!==null&&!kp();)yd(Ye)}function yd(e){var t=jd(e.alternate,e,Tt);e.memoizedProps=e.pendingProps,t===null?xd(e):Ye=t,sa.current=null}function xd(e){var t=e;do{var s=t.alternate;if(e=t.return,(t.flags&32768)===0){if(s=Bh(s,t,Tt),s!==null){Ye=s;return}}else{if(s=qh(s,t),s!==null){s.flags&=32767,Ye=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ze=6,Ye=null;return}}if(t=t.sibling,t!==null){Ye=t;return}Ye=t=e}while(t!==null);Ze===0&&(Ze=5)}function hr(e,t,s){var l=Oe,c=Wt.transition;try{Wt.transition=null,Oe=1,Xh(e,t,s,l)}finally{Wt.transition=c,Oe=l}return null}function Xh(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(Rp(e,u),e===rt&&(Ye=rt=null,at=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Gi||(Gi=!0,Sd(ni,function(){return Xr(),null})),u=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||u){u=Wt.transition,Wt.transition=null;var p=Oe;Oe=1;var v=Te;Te|=4,sa.current=null,Hh(e,s),cd(s,e),vh(pl),ci=!!fl,pl=fl=null,e.current=s,Vh(s),jp(),Te=v,Oe=p,Wt.transition=u}else e.current=s;if(Gi&&(Gi=!1,Kn=e,Qi=c),u=e.pendingLanes,u===0&&(Vn=null),Np(s.stateNode),jt(e,Ke()),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(Ki)throw Ki=!1,e=la,la=null,e;return(Qi&1)!==0&&e.tag!==0&&Xr(),u=e.pendingLanes,(u&1)!==0?e===aa?zs++:(zs=0,aa=e):zs=0,Bn(),null}function Xr(){if(Kn!==null){var e=lc(Qi),t=Wt.transition,s=Oe;try{if(Wt.transition=null,Oe=16>e?16:e,Kn===null)var l=!1;else{if(e=Kn,Kn=null,Qi=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 P=v[x];for(oe=P;oe!==null;){var U=oe;switch(U.tag){case 0:case 11:case 15:$s(8,U,u)}var V=U.child;if(V!==null)V.return=U,oe=V;else for(;oe!==null;){U=oe;var q=U.sibling,ie=U.return;if(sd(U),U===P){oe=null;break}if(q!==null){q.return=ie,oe=q;break}oe=ie}}}var ce=u.alternate;if(ce!==null){var ue=ce.child;if(ue!==null){ce.child=null;do{var Ge=ue.sibling;ue.sibling=null,ue=Ge}while(ue!==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:$s(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:Ui(9,v)}}catch(de){Ve(v,v.return,de)}if(v===p){oe=null;break e}var K=v.sibling;if(K!==null){K.return=v.return,oe=K;break e}oe=v.return}}if(Te=c,Bn(),on&&typeof on.onPostCommitFiberRoot=="function")try{on.onPostCommitFiberRoot(ri,e)}catch{}l=!0}return l}finally{Oe=s,Wt.transition=t}}return!1}function wd(e,t,s){t=Kr(s,t),t=Lu(e,t,1),e=Un(e,t,1),t=vt(),e!==null&&(cs(e,1,t),jt(e,t))}function Ve(e,t,s){if(e.tag===3)wd(e,e,s);else for(;t!==null;){if(t.tag===3){wd(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=zu(t,e,1),t=Un(t,e,1),e=vt(),t!==null&&(cs(t,1,e),jt(t,e));break}}t=t.return}}function Jh(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),t=vt(),e.pingedLanes|=e.suspendedLanes&s,rt===e&&(at&s)===s&&(Ze===4||Ze===3&&(at&130023424)===at&&500>Ke()-oa?pr(e,0):ia|=s),jt(e,t)}function kd(e,t){t===0&&((e.mode&1)===0?t=1:(t=ii,ii<<=1,(ii&130023424)===0&&(ii=4194304)));var s=vt();e=jn(e,t),e!==null&&(cs(e,t,s),jt(e,s))}function Zh(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),kd(e,s)}function em(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),kd(e,s)}var jd;jd=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,Fh(e,t,s);wt=(e.flags&131072)!==0}else wt=!1,Be&&(t.flags&1048576)!==0&&tu(t,_i,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Bi(e,t),e=t.pendingProps;var c=zr(t,dt.current);Hr(t,s),c=Dl(null,t,l,e,c,s);var u=Ll();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,Ci(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Pl(t),c.updater=Wi,t.stateNode=c,c._reactInternals=t,Ul(t,l,e,s),t=Gl(null,t,l,!0,u,s)):(t.tag=0,Be&&u&&wl(t),gt(null,t,c,s),t=t.child),t;case 16:l=t.elementType;e:{switch(Bi(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=nm(l),e=Yt(l,e),c){case 0:t=Kl(null,t,l,e,s);break e;case 1:t=Gu(null,t,l,e,s);break e;case 11:t=qu(null,t,l,e,s);break e;case 14:t=Uu(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),Kl(e,t,l,c,s);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Gu(e,t,l,c,s);case 3:e:{if(Qu(t),e===null)throw Error(o(387));l=t.pendingProps,u=t.memoizedState,c=u.element,uu(e,t),Mi(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=Yu(e,t,l,s,c);break e}else if(l!==c){c=Kr(Error(o(424)),t),t=Yu(e,t,l,s,c);break e}else for(Rt=zn(t.stateNode.containerInfo.firstChild),Pt=t,Be=!0,Qt=null,s=au(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Br(),l===c){t=Cn(e,t,s);break e}gt(e,t,l,s)}t=t.child}return t;case 5:return pu(t),e===null&&Sl(t),l=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,p=c.children,hl(l,c)?p=null:u!==null&&hl(l,u)&&(t.flags|=32),Ku(e,t),gt(e,t,p,s),t.child;case 6:return e===null&&Sl(t),null;case 13:return Xu(e,t,s);case 4:return Rl(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),qu(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(Pi,l._currentValue),l._currentValue=p,u!==null)if(Gt(u.value,p)){if(u.children===c.children&&!yt.current){t=Cn(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=Sn(-1,s&-s),x.tag=2;var P=u.updateQueue;if(P!==null){P=P.shared;var U=P.pending;U===null?x.next=x:(x.next=U.next,U.next=x),P.pending=x}}u.lanes|=s,x=u.alternate,x!==null&&(x.lanes|=s),Il(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),Il(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=Lt(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),Uu(e,t,l,c,s);case 15:return Hu(e,t,t.type,t.pendingProps,s);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Yt(l,c),Bi(e,t),t.tag=1,xt(l)?(e=!0,Ci(t)):e=!1,Hr(t,s),$u(t,l,c),Ul(t,l,c,s),Gl(null,t,l,!0,e,s);case 19:return Zu(e,t,s);case 22:return Vu(e,t,s)}throw Error(o(156,t.tag))};function Sd(e,t){return nc(e,t)}function tm(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 tm(e,t,s,l)}function ha(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nm(e){if(typeof e=="function")return ha(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fe)return 11;if(e===G)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 Zi(e,t,s,l,c,u){var p=2;if(l=e,typeof e=="function")ha(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case z: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 se:return e=Ft(13,s,t,c),e.elementType=se,e.lanes=u,e;case Ce:return e=Ft(19,s,t,c),e.elementType=Ce,e.lanes=u,e;case X:return eo(s,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ye:p=10;break e;case Y:p=9;break e;case fe:p=11;break e;case G:p=14;break e;case ve: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 eo(e,t,s,l){return e=Ft(22,e,l,t),e.elementType=X,e.lanes=s,e.stateNode={isHidden:!1},e}function ma(e,t,s){return e=Ft(6,e,null,t),e.lanes=s,e}function ga(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 rm(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=qo(0),this.expirationTimes=qo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qo(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function va(e,t,s,l,c,u,p,v,x){return e=new rm(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},Pl(u),e}function sm(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 Cd(e){if(!e)return Fn;e=e._reactInternals;e:{if(rr(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 Jc(e,s,t)}return t}function Nd(e,t,s,l,c,u,p,v,x){return e=va(s,l,!0,e,c,u,p,v,x),e.context=Cd(null),s=e.current,l=vt(),c=Gn(s),u=Sn(l,c),u.callback=t??null,Un(s,u,c),e.current.lanes=c,cs(e,c,l),jt(e,l),e}function to(e,t,s,l){var c=t.current,u=vt(),p=Gn(c);return s=Cd(s),t.context===null?t.context=s:t.pendingContext=s,t=Sn(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),Ti(e,c,p)),p}function no(e){return e=e.current,e.child?(e.child.tag===5,e.child.stateNode):null}function bd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function ya(e,t){bd(e,t),(e=e.alternate)&&bd(e,t)}function im(){return null}var _d=typeof reportError=="function"?reportError:function(e){console.error(e)};function xa(e){this._internalRoot=e}ro.prototype.render=xa.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));to(e,t,null,null)},ro.prototype.unmount=xa.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fr(function(){to(null,e,null,null)}),t[yn]=null}};function ro(e){this._internalRoot=e}ro.prototype.unstable_scheduleHydration=function(e){if(e){var t=uc();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&&pc(e)}};function wa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function so(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Id(){}function om(e,t,s,l,c){if(c){if(typeof l=="function"){var u=l;l=function(){var P=no(p);u.call(P)}}var p=Nd(t,l,e,0,null,!1,!1,"",Id);return e._reactRootContainer=p,e[yn]=p.current,Ss(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 P=no(x);v.call(P)}}var x=va(e,0,!1,null,null,!1,!1,"",Id);return e._reactRootContainer=x,e[yn]=x.current,Ss(e.nodeType===8?e.parentNode:e),fr(function(){to(t,x,s,l)}),x}function io(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=no(p);v.call(x)}}to(t,p,e,c)}else p=om(s,t,e,c,l);return no(p)}ac=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=as(t.pendingLanes);s!==0&&(Uo(t,s|1),jt(t,Ke()),(Te&6)===0&&(Yr=Ke()+500,Bn()))}break;case 13:fr(function(){var l=jn(e,1);if(l!==null){var c=vt();Zt(l,e,1,c)}}),ya(e,1)}},Ho=function(e){if(e.tag===13){var t=jn(e,134217728);if(t!==null){var s=vt();Zt(t,e,134217728,s)}ya(e,134217728)}},cc=function(e){if(e.tag===13){var t=Gn(e),s=jn(e,t);if(s!==null){var l=vt();Zt(s,e,t,l)}ya(e,t)}},uc=function(){return Oe},dc=function(e,t){var s=Oe;try{return Oe=e,t()}finally{Oe=s}},_r=function(e,t,s){switch(t){case"input":if(Qe(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=ji(l);if(!c)throw Error(o(90));mt(l),Qe(l,c)}}}break;case"textarea":tr(e,s);break;case"select":t=s.value,t!=null&&Ht(e,!!s.multiple,t,!1)}},j=da,b=fr;var lm={usingClientEntryPoint:!1,Events:[bs,Dr,ji,ls,Js,da]},Ws={findFiberByHostInstance:sr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},am={bundleType:Ws.bundleType,version:Ws.version,rendererPackageName:Ws.rendererPackageName,rendererConfig:Ws.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:te.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ec(e),e===null?null:e.stateNode},findFiberByHostInstance:Ws.findFiberByHostInstance||im,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 oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oo.isDisabled&&oo.supportsFiber)try{ri=oo.inject(am),on=oo}catch{}}return St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lm,St.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wa(t))throw Error(o(200));return sm(e,t,null,s)},St.createRoot=function(e,t){if(!wa(e))throw Error(o(299));var s=!1,l="",c=_d;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=va(e,1,!1,null,null,s,!1,l,c),e[yn]=t.current,Ss(e.nodeType===8?e.parentNode:e),new xa(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=ec(t),e=e===null?null:e.stateNode,e},St.flushSync=function(e){return fr(e)},St.hydrate=function(e,t,s){if(!so(t))throw Error(o(200));return io(null,e,t,!0,s)},St.hydrateRoot=function(e,t,s){if(!wa(e))throw Error(o(405));var l=s!=null&&s.hydratedSources||null,c=!1,u="",p=_d;if(s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),t=Nd(t,null,e,1,s??null,c,!1,u,p),e[yn]=t.current,Ss(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 ro(t)},St.render=function(e,t,s){if(!so(t))throw Error(o(200));return io(null,e,t,!1,s)},St.unmountComponentAtNode=function(e){if(!so(e))throw Error(o(40));return e._reactRootContainer?(fr(function(){io(null,null,e,!1,function(){e._reactRootContainer=null,e[yn]=null})}),!0):!1},St.unstable_batchedUpdates=da,St.unstable_renderSubtreeIntoContainer=function(e,t,s,l){if(!so(s))throw Error(o(200));if(e==null||e._reactInternals===void 0)throw Error(o(38));return io(e,t,s,!1,l)},St.version="18.3.1-next-f1338f8080-20240426",St}var $d;function xm(){if($d)return Sa.exports;$d=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(),Sa.exports=ym(),Sa.exports}var Dd;function wm(){if(Dd)return lo;Dd=1;var n=xm();return lo.createRoot=n.createRoot,lo.hydrateRoot=n.hydrateRoot,lo}var km=wm();const jm=Mf(km),Of={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:""},Ld=Object.freeze({status:"idle",requestId:null});function Ro(n){return n.activeSessionId?n.sessionSync[n.activeSessionId]??Ld:Ld}function jr(n){return!!(n.activeSessionId&&n.sessionSnapshot?.session.id===n.activeSessionId&&Ro(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:Sm[n]})}const Sm={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 Gs({children:n,className:r=""}){return i.jsx("div",{className:`markdown ${r}`.trim(),children:Af(n)})}function Af(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 T=[];for(a+=1;a<r.length&&!/^\s*```\s*$/.test(r[a]);)T.push(r[a]),a+=1;a<r.length&&(a+=1),o.push(i.jsx(Em,{language:f[1].trim(),content:T.join(`
|
|
12
|
+
`)},`code-${a}`));continue}const h=d.match(/^(#{1,6})\s+(.+)$/);if(h){const T=Math.min(6,h[1].length);o.push(Im(T,Vs(h[2],`heading-${a}`),`heading-${a}`)),a+=1;continue}if(/^\s*>\s?/.test(d)){const T=[];for(;a<r.length&&/^\s*>\s?/.test(r[a]);)T.push(r[a].replace(/^\s*>\s?/,"")),a+=1;o.push(i.jsx("blockquote",{children:Af(T.join(`
|
|
13
|
+
`))},`quote-${a}`));continue}if(d.match(/^\s*(?:[-*+] |\d+[.)] )(.+)$/)){const T=/^\s*\d/.test(d),C=[],M=T?/^\s*\d+[.)]\s+(.+)$/:/^\s*[-*+]\s+(.+)$/;for(;a<r.length;){const F=r[a].match(M);if(!F)break;C.push(F[1]),a+=1}const $=C.map((F,D)=>i.jsx("li",{children:Vs(F,`list-${a}-${D}`)},`item-${a}-${D}`));o.push(T?i.jsx("ol",{children:$},`list-${a}`):i.jsx("ul",{children:$},`list-${a}`));continue}const w=Pa(d);if(w&&w.length>=1&&a+1<r.length){const T=Nm(r[a+1]);if(T&&T.length===w.length){const C=[w];for(a+=2;a<r.length;){const M=Pa(r[a]);if(!M||M.length!==w.length)break;C.push(M),a+=1}o.push(bm(C,T,`table-${a}`));continue}}const S=[d.trim()];for(a+=1;a<r.length&&r[a].trim()&&!Cm(r[a]);)S.push(r[a].trim()),a+=1;o.push(i.jsx("p",{children:Vs(S.join(" "),`paragraph-${a}`)},`paragraph-${a}`))}return o}function Cm(n){return/^\s*```/.test(n)||/^(#{1,6})\s+/.test(n)||/^\s*>\s?/.test(n)||/^\s*(?:[-*+] |\d+[.)] )/.test(n)||Pa(n)!==null}function Pa(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 Nm(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 bm(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:Vs(h,`${o}-th-${g}`)},`th-${g}`))})}),i.jsx("tbody",{children:d.map((h,g)=>i.jsx("tr",{children:h.map((w,S)=>i.jsx("td",{style:f(r[S]),children:Vs(w,`${o}-td-${g}-${S}`)},`td-${g}-${S}`))},`tr-${g}`))})]},o)}function Vs(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 S=g.match(/^\[([^\]]+)\]\(([^)]+)\)$/);S&&_m(S[2])?a.push(i.jsx("a",{href:S[2],target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:S[1]},w)):a.push(g)}d=f.index+g.length}return d<n.length&&a.push(n.slice(d)),a}function _m(n){try{const r=new URL(n);return r.protocol==="https:"||r.protocol==="http:"||r.protocol==="mailto:"}catch{return!1}}function Im(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 Em({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 Zn(n){return n.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function qa(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=Zn(a);return d.length<=r?d:`${d.slice(0,r)}
|
|
14
|
+
…已截断`}const Pm=.02,Rm=.1;function ns(n,r,o){const a=Number.isFinite(n)?Math.round(n):r;return Math.min(o,Math.max(r,a))}function Tm({side:n,clientX:r,bounds:o,minWidth:a,maxWidth:d}){const f=n==="left"?r-o.left:o.right-r;return ns(f,a,d)}function Mm(n,r,o){const a=o-r;if(a<=0)return 0;const d=(ns(n,r,o)-r)/a;return Math.round(d*100)}function Om(n){const{key:r,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:f,side:h}=n,g=C=>ns(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?Rm:Pm,S=Math.max(1,Math.round((a-o)*w)),T=(r==="ArrowRight"?1:-1)*(h==="left"?1:-1);return g(f+T*S)}function $f({side:n,className:r,minWidth:o,maxWidth:a,defaultWidth:d,label:f,width:h,controls:g,boundsRef:w,resizingScope:S="workbench",onPreview:T,onCommit:C}){const M=m.useRef(ns(h??d,o,a)),$=m.useRef(null),F=m.useRef(null),D=m.useRef(null),W=()=>{D.current!==null&&cancelAnimationFrame(D.current),D.current=null},Z=()=>{$.current=null,F.current=null,W(),delete document.documentElement.dataset.panelResizing};m.useEffect(()=>Z,[]),m.useEffect(()=>{h===void 0||$.current!==null||(M.current=ns(h,o,a))},[h,o,a]);const L=Y=>{M.current=Y,F.current=Y,D.current===null&&(D.current=requestAnimationFrame(()=>{D.current=null;const fe=F.current;F.current=null,fe!==null&&T(fe)}))},pe=Y=>{let fe;if(w?.current){const se=w.current.getBoundingClientRect();fe={left:se.left,right:se.right}}else fe=Y.currentTarget.closest(".workbench-shell")?.getBoundingClientRect()??{left:0,right:window.innerWidth};return Tm({side:n,clientX:Y.clientX,bounds:fe,minWidth:o,maxWidth:a})},te=Y=>{if(Y.button!==0||$.current!==null)return;Y.preventDefault(),$.current=Y.pointerId,Y.currentTarget.setPointerCapture(Y.pointerId);const fe=S==="resource-split"?"resource-split":n;document.documentElement.dataset.panelResizing=fe,L(pe(Y))},ee=Y=>{$.current===Y.pointerId&&L(pe(Y))},N=Y=>{if($.current!==Y.pointerId)return;Y.currentTarget.hasPointerCapture(Y.pointerId)&&Y.currentTarget.releasePointerCapture(Y.pointerId);const fe=F.current??M.current;Z(),T(fe),C(fe)},z=Y=>{if($.current!==Y.pointerId)return;const fe=F.current??M.current;Z(),T(fe),C(fe)},re=Y=>{M.current=Y,T(Y),C(Y)},je=Y=>{const fe=Om({key:Y.key,shiftKey:Y.shiftKey,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:M.current,side:n});fe!==null&&(Y.preventDefault(),re(fe))},ye=Mm(M.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":ye,"aria-valuetext":`${M.current} 像素`,"aria-controls":g,tabIndex:0,title:`${f};方向键调整,Shift 加速,Enter 恢复默认,双击亦可恢复`,onPointerDown:te,onPointerMove:ee,onPointerUp:N,onPointerCancel:N,onLostPointerCapture:z,onKeyDown:je,onDoubleClick:()=>re(ns(d,o,a)),children:i.jsx("span",{})})}const Am=["ArrowDown","ArrowUp","Home","End","Escape"];function $m({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(),S=()=>{d(!1),h.current?.focus()};m.useEffect(()=>{if(!a)return;const C=M=>{f.current?.contains(M.target)||d(!1)};return document.addEventListener("pointerdown",C),()=>document.removeEventListener("pointerdown",C)},[a]),m.useEffect(()=>{if(!a)return;const C=r.findIndex(M=>!M.disabled);g.current[C>=0?C:0]?.focus()},[a]);const T=C=>{if(!Am.includes(C.key))return;if(C.preventDefault(),C.key==="Escape"){S();return}const M=r.map((D,W)=>({item:D,index:W})).filter(D=>!D.item.disabled);if(!M.length)return;const $=M.findIndex(D=>g.current[D.index]===document.activeElement);let F=0;if(C.key==="Home")F=0;else if(C.key==="End")F=M.length-1;else{const D=C.key==="ArrowDown"?1:-1;F=$<0?0:($+D+M.length)%M.length}g.current[M[F].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:T,children:r.map((C,M)=>i.jsxs("button",{ref:$=>{g.current[M]=$},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 Ua=240,To=280,Df=480,zd=48,Ha=320,Va=420,Lf=3200,Xe=48,Wd=560,zf="orion.web.workbench-layout.v2",Dm="orion.web.work-panel.v1",Ra=["agent","review","terminal","files","git"],wr=Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({expanded:!0,widthPx:To}),workPanel:Object.freeze({expanded:!0,widthPx:Va,activePanel:"agent",agentPanel:"goal"})});function ao(n,r){const o=Bm(n),a=Wf(r.projectNavigation.widthPx),d=Ys(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 S=o-Wd,C=r.projectNavigation.expanded&&S>=Ua?"dock":r.projectNavigation.expanded?"drawer":"rail",M=C==="dock"?Math.min(a,S):C==="rail"?zd:0;return Object.freeze({projectNavigation:Object.freeze({mode:C,widthPx:M}),conversationWidthPx:Math.max(0,o-M),workPanel:Object.freeze({mode:"drawer",widthPx:0})})}const f=r.projectNavigation.expanded?a:zd,h=o-f-Wd,g=r.workPanel.expanded&&h>=Ha,w=g?Math.min(d,h):Xe;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 Wf(n){const r=Number.isFinite(n)?Math.round(n):To;return Math.min(Df,Math.max(Ua,r))}function Ys(n){const r=Number.isFinite(n)?Math.round(n):Va;return Math.min(Lf,Math.max(Ha,r))}function Lm(n,r=null){if(!n)return Fm(r);try{const o=JSON.parse(n);if(!xo(o)||o.schemaVersion!==2)return wr;const a=xo(o.projectNavigation)?o.projectNavigation:{},d=xo(o.workPanel)?o.workPanel:{};return Ff({schemaVersion:2,projectNavigation:{expanded:typeof a.expanded=="boolean"?a.expanded:!0,widthPx:Wf(Number(a.widthPx))},workPanel:{expanded:typeof d.expanded=="boolean"?d.expanded:!0,widthPx:Ys(Number(d.widthPx)),activePanel:Xs(d.activePanel)?d.activePanel:"agent",agentPanel:qf(d.agentPanel)?d.agentPanel:"goal",order:qm(d.order)}})}catch{return wr}}function zm(){const n=Bf();if(!n)return wr;try{return Lm(n.localStorage.getItem(zf),n.localStorage.getItem(Dm))}catch{return wr}}function Wm(n){const r=Bf();if(r)try{r.localStorage.setItem(zf,JSON.stringify(n))}catch{}}function Fm(n){if(!n)return wr;try{const r=JSON.parse(n);return!xo(r)||r.schemaVersion!==1?wr:Ff({schemaVersion:2,projectNavigation:{expanded:!0,widthPx:To},workPanel:{expanded:typeof r.expanded=="boolean"?r.expanded:!0,widthPx:Ys(Number(r.widthPx)),activePanel:Xs(r.activePanel)?r.activePanel:"agent",agentPanel:qf(r.agentPanel)?r.agentPanel:"goal"}})}catch{return wr}}function Ff(n){return Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({...n.projectNavigation}),workPanel:Object.freeze({...n.workPanel})})}function Bm(n){return!Number.isFinite(n)||n<=0?1440:Math.max(320,Math.round(n))}function Bf(){return globalThis.window??null}function qm(n){if(!Array.isArray(n)||n.length!==Ra.length)return;const r=new Set;for(const o of n){if(!Xs(o)||r.has(o))return;r.add(o)}return Object.freeze([...n])}function Xs(n){return["agent","review","terminal","files","git"].includes(String(n))}function qf(n){return["goal","activity","integrations","diagnostics"].includes(String(n))}function xo(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Uf({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 Um({state:n,drawerOpen:r,dockVisible:o,collapsed:a,resizable:d,width:f,onCloseDrawer:h,onExpand:g,onCollapse:w,onOpenWorkspaceDialog:S,onOpenSettings:T,onLoadMoreWorkspaces:C,onCreateSession:M,onLoadWorkspaceSessions:$,onActivateContext:F,onSetPinned:D,onRemoveWorkspace:W,onRefreshSummary:Z,onRenameSession:L,onSessionTags:pe,onArchiveSession:te,onDeleteSession:ee,onRestoreSession:N,onWidthPreview:z,onWidthCommit:re}){const[je,ye]=m.useState(""),[Y,fe]=m.useState(0),[se,Ce]=m.useState(new Set(n.workspaceId?[n.workspaceId]:[])),G=m.useDeferredValue(je.trim().toLocaleLowerCase()),ve=m.useRef(null),X=!!n.pendingAction,E=X||n.processing;m.useEffect(()=>{r&&ve.current?.focus()},[r]),m.useEffect(()=>{n.workspaceId&&Ce(A=>new Set([...A,n.workspaceId]))},[n.workspaceId]),m.useEffect(()=>fe(0),[G]);const H=m.useMemo(()=>{const A=[...n.workspaces].sort(Hm);return G?A.filter(ne=>Bd(ne,G)?!0:(n.workspaceSessions[ne.id]?.items??[]).some(we=>[we.name,we.taskSummary,we.id].filter(xe=>!!xe).some(xe=>xe.toLocaleLowerCase().includes(G)))):A},[G,n.workspaceSessions,n.workspaces]);m.useEffect(()=>{const A=H.findIndex(ne=>ne.id===n.workspaceId);A<0||fe(ne=>A<ne||A>=ne+gr?Math.floor(A/gr)*gr:ne)},[H,n.workspaceId]);const R=H.slice(Y,Y+gr),y=!!(G&&(n.workspaceNextCursor||Object.values(n.workspaceSessions).some(A=>!!A.nextCursor))),O=A=>{const ne=new Set(se);ne.has(A.id)?ne.delete(A.id):(ne.add(A.id),n.workspaceSessions[A.id]?Z(A.id):$(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.jsxs("div",{className:"project-rail-brand","aria-hidden":"true",children:[i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{})]}),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:M,disabled:X||!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:T,children:i.jsx(Q,{name:"settings",size:17})}),i.jsx("span",{className:`connection-dot project-rail-connection ${n.connection}`,"aria-label":ba(n.connection),title:ba(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(Uf,{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:ve,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:S,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=>ye(A.target.value),placeholder:"搜索项目和会话"}),je?i.jsx("button",{type:"button","aria-label":"清除搜索",onClick:()=>ye(""),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:[R.map((A,ne)=>{const we=Y+ne,xe=H[we-1],be=se.has(A.id)||!!G,Se=n.workspaceSessions[A.id],_e=n.workspaceProjectSummaries[A.id],De=Bd(A,G)?Se?.items??[]:Vm(Se?.items??[],G);return i.jsxs(m.Fragment,{children:[we===0||xe?.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:()=>O(A),onKeyDown:Pe=>{if(Pe.key==="ArrowRight"){Pe.preventDefault(),be?Pe.currentTarget.closest(".project-node")?.querySelector(".project-session-main")?.focus():O(A);return}if(Pe.key==="ArrowLeft"&&be){Pe.preventDefault(),O(A);return}Fd(Pe)},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"}`:Km(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:()=>D(A.id,A.pinnedOrder===void 0),disabled:X,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:()=>W(A.id),disabled:X,children:i.jsx(Q,{name:"close",size:13})}):i.jsx("button",{type:"button",className:"icon-button project-add-session","aria-label":`在 ${A.label} 新建会话`,disabled:X||!A.available||!A.active,onClick:M,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:()=>$(A.id),children:"加载失败,重试"})}):null,De.map(Pe=>{const mt=A.active&&Pe.id===n.activeSessionId,Mt=n.sessionRuntimeById[Pe.id],Ot=Qm(Mt),ct=!A.active&&E,it=Xm(Mt?.phase),Qe=Pe.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||ct||!A.available,onClick:()=>{mt||F(A.id,Pe.id)},disabled:ct||!A.available,onKeyDown:ot=>{if(ot.key==="ArrowLeft"){ot.preventDefault(),document.getElementById(`project-${A.id}`)?.focus();return}Fd(ot)},children:[i.jsx("span",{className:`session-state ${Ot.tone}`,"aria-hidden":"true"}),i.jsxs("span",{children:[i.jsx("strong",{children:kr(Pe)}),i.jsxs("small",{children:[qd(Pe.updatedAt)," · ",Pe.messageCount," 条"]}),Qe.length>0?i.jsxs("small",{className:"project-session-tags","aria-label":"会话标签",children:[Qe.slice(0,3).map(ot=>i.jsx("span",{className:"session-tag-badge",children:ot},ot)),Qe.length>3?i.jsxs("span",{className:"session-tag-more",children:["+",Qe.length-3]}):null]}):null,Ot.label?i.jsx("small",{className:"project-session-status",children:Ot.label}):null]})]}),A.active?i.jsx($m,{label:`会话 ${kr(Pe)} 操作`,disabled:X,items:[{id:"rename",label:"重命名…",onSelect:()=>L(Pe)},{id:"tags",label:"管理标签…",onSelect:()=>pe(Pe)},{id:"archive",label:"归档",disabled:it,hint:it?"会话运行中":void 0,onSelect:()=>te(Pe)},{id:"delete",label:"删除…",danger:!0,disabled:it,hint:it?"会话运行中":void 0,onSelect:()=>ee(Pe)}]}):null]},Pe.id)}),Se?.status==="ready"&&!De.length?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-empty-session",disabled:E||!A.available,onClick:()=>F(A.id,null),children:G?"没有匹配会话":"打开项目"})}):null,Se?.nextCursor?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"text-button project-load-more",onClick:()=>$(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(Pe=>i.jsxs("div",{className:"archived-row",role:"listitem",children:[i.jsxs("span",{className:"archived-copy",children:[i.jsx("strong",{children:kr(Pe)}),i.jsx("small",{children:qd(Pe.updatedAt)})]}),i.jsx("button",{type:"button",className:"text-button",disabled:X,onClick:()=>N(Pe),children:"还原"}),i.jsx("button",{type:"button",className:"text-button archived-delete",disabled:X,onClick:()=>ee(Pe),children:"删除"})]},Pe.id))})]}):null]}):null]})]},A.id)}),H.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:()=>fe(A=>Math.max(0,A-gr)),children:"上一批项目"}):null,Y+gr<H.length?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>fe(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:Gm(n.connection),children:ba(n.connection)}),i.jsx("button",{type:"button",className:"icon-button rail-settings","aria-label":"打开设置",onClick:T,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($f,{side:"left",minWidth:Ua,maxWidth:Df,defaultWidth:To,label:"拖动或按方向键调整项目导航宽度",width:f,controls:"workspace-rail",onPreview:z,onCommit:re}):null]})}function Fd(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 Hm(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 Bd(n,r){return!!(r&&(n.label.toLocaleLowerCase().includes(r)||n.path.toLocaleLowerCase().includes(r)))}function Vm(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 kr(n){return n.name||n.taskSummary||`会话 ${n.id.slice(0,8)}`}function Hf(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function Km(n){return n.length<=31?n:`…${n.slice(-30)}`}function qd(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 ba(n){return n==="live"?"已连接":n==="offline"?"离线":n==="replay-required"?"事件流需恢复":n==="closed"?"已关闭":n==="connecting"?"正在连接…":"正在重连…"}function Gm(n){return n==="live"?"本地 Web Host 已连接":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重连本地 Web Host"}function Qm(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 Ym=new Set(["starting","queued","running","waiting_approval","stopping"]);function Xm(n){return n?Ym.has(n):!1}const Jm=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"}),Ud=Object.freeze({danger:"失败",idle:"空闲",running:"进行中",success:"已完成",warning:"部分完成"});function Zm(n){return Jm[n.trim().toLowerCase()]??"idle"}function eg(n){return Ud[n]??Ud.idle}function Ka({state:n,className:r="",label:o,describe:a=!0}){const d=Zm(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??eg(d)}):null]})}const is="orion.web.composer-drafts.v1",Vf=20,Ta=256*1024,tg=5*1024*1024;function ng(n,r){return Mo().entries.find(o=>o.workspaceId===n&&o.sessionId===r)??null}function rg(n){const r=Oo();if(!r)return;const o=Object.freeze({...n,references:[...n.references],updatedAt:Date.now()});if(Ma(o)>Ta)throw new Error(`Composer draft exceeds ${Ta} bytes.`);const a=Mo().entries.filter(f=>!(f.workspaceId===n.workspaceId&&f.sessionId===n.sessionId)),d=[o,...a].slice(0,Vf);for(;d.length>0&&Ma({version:1,entries:d})>tg;)d.pop();r.setItem(is,JSON.stringify({version:1,entries:d}))}function Hd(n,r){const o=Oo();if(!o)return;const a=Mo().entries.filter(d=>!(d.workspaceId===n&&d.sessionId===r));a.length===0?o.removeItem(is):o.setItem(is,JSON.stringify({version:1,entries:a}))}function sg(n){const r=Oo();if(!r)return;const o=Mo().entries.filter(a=>a.workspaceId!==n);o.length===0?r.removeItem(is):r.setItem(is,JSON.stringify({version:1,entries:o}))}function Mo(){const n=Oo();if(!n)return{version:1,entries:[]};try{const r=JSON.parse(n.getItem(is)??"");return r.version!==1||!Array.isArray(r.entries)?{version:1,entries:[]}:{version:1,entries:r.entries.filter(ig).slice(0,Vf)}}catch{return{version:1,entries:[]}}}function ig(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)&&Ma(r)<=Ta}function Oo(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}function Ma(n){return new TextEncoder().encode(JSON.stringify(n)).byteLength}const Kf=/^hmac-sha256:[0-9a-f]{64}$/,og=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,lg=/^(?:api[-_]?key|authorization|cookie|password|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|credential[-_]?value|headers?|env(?:ironment)?[-_]?name)$/i,ag=["ready","invalid","read-only","unavailable"],cg=["internal","model","global","project","session"],ug=["global","project","session"],dg=["live","next-logical-request","new-session","restart"],fg=["runtime_busy","read_only","invalid_document"],pg=["system","light","dark"],hg=["system","reduced"],mg=["classic","orion-blocksmith"],Gf=["auto","none","minimal","low","medium","high","xhigh","max"],gg=["ask","allow","deny"],vg=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function Oa(n){So(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(!Kf.test(a))throw new Error("Settings revision is invalid.");const d=nn(r.state,"Settings state",ag),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 S=Aa(r.models,"Settings models").map(wg),T=Aa(r.credentials,"Credential status").map(kg),C=r.currentSession===void 0?void 0:jg(r.currentSession),M=r.diagnostic===void 0?void 0:Sg(r.diagnostic);return{schemaVersion:2,revision:a,state:d,writable:rs(r.writable,"Settings writable"),hasDocument:rs(r.hasDocument,"Settings document availability"),workspace:_t(r.workspace,"Settings workspace"),sections:{appearance:{style:o===1?_g(d,rs(r.writable,"Settings writable")):Jr(h.style,"Visual style",bg),theme:Jr(h.theme,"Theme",Ng),motion:Jr(h.motion,"Motion",Ig)},defaults:{model:Jr(g.model,"Default model",Rg),effort:Jr(g.effort,"Default effort",Eg)},permissions:{toolConfirmation:Jr(w.toolConfirmation,"Tool confirmation",Pg)}},models:S,credentials:T,...C?{currentSession:C}:{},...M?{diagnostic:M}:{}}}function yg(n){So(n);const r=qt(n,"Settings mutation result");Ut(r,["requestId","revision","appliedKeys","settings"]);const o=_t(r.requestId,"Settings requestId");if(!og.test(o))throw new Error("Settings requestId is invalid.");const a=Oa(r.settings),d=_t(r.revision,"Settings mutation revision");if(d!==a.revision)throw new Error("Settings mutation revisions do not match.");const f=Aa(r.appliedKeys,"Applied setting keys").map((h,g)=>nn(h,`Applied setting key ${g+1}`,vg));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 xg(n){const r=qt(n.payload,"Settings invalidation payload");Ut(r,["revision","reason","state"]);const o=_t(r.revision,"Settings invalidation revision");if(!Kf.test(o))throw new Error("Settings invalidation revision is invalid.");return{apiVersion:1,eventId:_t(n.eventId,"Settings invalidation eventId"),cursor:Cg(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`,cg),scope:nn(a.scope,`${r} scope`,ug),applies:nn(a.applies,`${r} application timing`,dg),overridden:rs(a.overridden,`${r} override state`),writable:rs(a.writable,`${r} writable state`),...a.blockedReason===void 0?{}:{blockedReason:nn(a.blockedReason,`${r} blocked reason`,fg)}}}function wg(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 kg(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 jg(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",Gf),overridesProjectEffort:rs(r.overridesProjectEffort,"Current session effort override state")}}function Sg(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 So(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)So(o,r);return}for(const[o,a]of Object.entries(n)){if(lg.test(o))throw new Error("Settings response contains a forbidden secret-bearing field.");So(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 Aa(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 rs(n,r){if(typeof n!="boolean")throw new Error(`${r} must be boolean.`);return n}function Cg(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 Ng(n){return typeof n=="string"&&pg.includes(n)}function bg(n){return typeof n=="string"&&mg.includes(n)}function _g(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 Ig(n){return typeof n=="string"&&hg.includes(n)}function Eg(n){return typeof n=="string"&&Gf.includes(n)}function Pg(n){return typeof n=="string"&&gg.includes(n)}function Rg(n){return typeof n=="string"&&!!n.trim()}const co="/api/v1",Tg="x-orion-web-nonce",$a=100,Mg=50,dn=/^[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 Og{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:Oa(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 Oa(await this.query("/settings"))}async sessionSnapshot(r,o,a){const d=`/sessions/${encodeURIComponent(r)}/snapshot`;return this.query(_a(Ct(d,o),a??null,!0,Mg))}composerState(r,o){return this.query(Ct(`/sessions/${encodeURIComponent(r)}/composer-state`,o))}modelCatalog(r,o,a){return this.query(_a(Ct(`/sessions/${encodeURIComponent(r)}/model-catalog`,o),a??null,!1,$a))}composerAction(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/composer-actions`,"POST",{...o,requestId:qe()})}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 _n(f,o),this.query(`/tool-details/${encodeURIComponent(r)}?${f.toString()}`)}listFiles(r,o,a){const d=new URLSearchParams({pageSize:"100"});return _n(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 _n(d,o),a&&d.set("cursor",a),this.query(`/files/${encodeURIComponent(r)}/content?${d.toString()}`)}gitStatus(r,o){const a=new URLSearchParams({pageSize:"200"});return _n(a,r),o&&a.set("cursor",o),this.query(`/git/status?${a.toString()}`)}gitLog(r,o){const a=new URLSearchParams({pageSize:"30"});return _n(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 _n(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:qe()},{"X-Orion-User-Gesture":"terminal-create-v1"})}terminalAttachTicket(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}/attach-ticket`,"POST",{...o,requestId:qe()})}closeTerminal(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}`,"DELETE",{...o,requestId:qe()})}terminalSocket(r){const o=location.protocol==="https:"?"wss:":"ws:";return new WebSocket(`${o}//${location.host}${co}/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 _n(f,r),this.query(`/files/search?${f.toString()}`)}async reviewVerificationPage(r,o={}){const a=new URLSearchParams;return _n(a,r),o.sessionId&&a.set("sessionId",o.sessionId),o.cursor!==void 0&&a.set("cursor",String(o.cursor)),o.pageSize!==void 0&&a.set("pageSize",String(o.pageSize)),this.query(`/review/verification?${a.toString()}`)}gitStage(r,o,a){return this.mutate("/git/stage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:qe()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitUnstage(r,o,a){return this.mutate("/git/unstage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:qe()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitCommit(r,o,a){return this.mutate("/git/commit","POST",{...r,message:o,expectedRepositoryRevision:a,requestId:qe()},{"X-Orion-User-Gesture":"git-mutation-v1"})}activateContext(r){return this.mutate("/context/activate","POST",{...r,requestId:qe()})}async setWorkspacePinned(r,o,a){return(await this.mutate(`/workspaces/${encodeURIComponent(r)}/pin`,"POST",{requestId:qe(),pinned:o,...a})).workspace}removeWorkspace(r,o){return this.mutate(`/workspaces/${encodeURIComponent(r)}`,"DELETE",{requestId:qe(),...o})}async activateWorkspace(r,o){const a=await this.mutate("/workspaces/activate","POST",{requestId:qe(),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:qe(),...r})).session}activateSession(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/activate`,"POST",{requestId:qe(),...o})}async renameSession(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}`,"PATCH",{requestId:qe(),name:o,...a})).session}async updateSessionTags(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/tags`,"POST",{requestId:qe(),tags:[...o],...a})).session}async archiveSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/archive`,"POST",{requestId:qe(),...o})).session}async restoreSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/restore`,"POST",{requestId:qe(),...o})).session}async deleteSession(r,o){await this.mutate(`/sessions/${encodeURIComponent(r)}`,"DELETE",{requestId:qe(),...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:qe()})}async updateSettings(r,o,a,d=qe()){const f=await this.mutate("/settings","PATCH",{operations:o,expectedRevision:r,...a,requestId:d}),h=yg(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:qe()})}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(`${co}/events?cursor=${o}`),a.onopen=()=>{f=0,r.onStatus("live",f)},a.addEventListener("orion",C=>{if(!(h||g))try{const M=Ag(C.data);if(M.type==="replay_reset"){o=M.cursor,r.onEvent(M),g=!0,a?.close(),a=null,window.clearTimeout(d);return}if(M.cursor<=o)return;o=M.cursor,r.onEvent(M)}catch(M){r.onProtocolError?.(M instanceof Error?M.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)}}},S=()=>{h||g||a||(window.clearTimeout(d),w())},T=()=>{window.clearTimeout(d),a?.close(),a=null,!g&&r.onStatus("offline",f)};return window.addEventListener("online",S),window.addEventListener("offline",T),w(),{close(){h=!0,window.clearTimeout(d),a?.close(),a=null,window.removeEventListener("online",S),window.removeEventListener("offline",T)},cursor:()=>o}}collectionPage(r,o){return this.query(_a(r,o??null,!1,$a))}async query(r){const o=await fetch(`${co}${r}`,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",cache:"no-store"});return Vd(o)}async mutate(r,o,a,d={}){if(!this.nonce)throw new Ie("Web Workbench 尚未完成安全握手。",503);const f=await fetch(`${co}${r}`,{method:o,headers:{Accept:"application/json","Content-Type":"application/json",[Tg]:this.nonce,...d},credentials:"same-origin",cache:"no-store",body:JSON.stringify(a)});return Vd(f)}}async function Vd(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 Ag(n){const r=JSON.parse(n);if(!In(r)||r.apiVersion!==1||typeof r.eventId!="string"||!dn.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"||!dn.test(r.payload.contextRevision)||typeof r.payload.workspaceId!="string"||!dn.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 xg(r);if(r.type==="session_runtime_changed"&&(!In(r.payload.runtime)||r.sessionId!==r.payload.runtime.sessionId||!$g(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"||!dn.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"||!dn.test(r.payload.state.controlRevision)||typeof r.payload.state.contextRevision!="string"||!dn.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 $g(n){const r=n.phase==="queued";return typeof n.workspaceId=="string"&&dn.test(n.workspaceId)&&typeof n.sessionId=="string"&&dn.test(n.sessionId)&&typeof n.runtimeRevision=="string"&&dn.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"&&dn.test(n.queueId)&&Number.isSafeInteger(n.queuePosition)&&n.queuePosition>=1:n.queueId===void 0&&n.queuePosition===void 0)}function _a(n,r=null,o=!1,a=$a){const d=new URLSearchParams({pageSize:String(a)});return r&&d.set("cursor",r),o&&d.set("tail","1"),`${n}${n.includes("?")?"&":"?"}${d.toString()}`}function _n(n,r){n.set("expectedContextRevision",r.expectedContextRevision),n.set("workspaceId",r.workspaceId)}function Ct(n,r){const o=new URLSearchParams;return _n(o,r),`${n}${n.includes("?")?"&":"?"}${o.toString()}`}function In(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function qe(){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 Dg({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),[S,T]=m.useState(""),[C,M]=m.useState(new Set),$=m.useRef(null),F=`${a}:${d}`,D=m.useRef(F);D.current=F;const W=`${f.workspaceId}:${f.sessionId}`,Z=!d||!n.bootstrap?.configured||n.connection!=="live"||!jr(n),L=!!n.pendingAction,pe=n.sessionSnapshot?.sessionRuntime.phase==="queued",te=!Z&&!L,ee=te&&!pe;m.useEffect(()=>{if(!a||!d){h({workspaceId:a,sessionId:d,text:"",references:[]});return}const se=ng(a,d);h({workspaceId:a,sessionId:d,text:se?.text??"",references:se?.references??[]}),T(""),M(new Set)},[a,d]),m.useEffect(()=>{if(!(!f.workspaceId||!f.sessionId))try{f.text||f.references.length>0?rg(f):Hd(f.workspaceId,f.sessionId),T("")}catch(se){T(se instanceof Error?se.message:"草稿无法保存。")}},[f]),m.useEffect(()=>{!o||!d||W!==F||(h(se=>({...se,text:se.text.trim()?`${se.text.trimEnd()}
|
|
15
|
+
|
|
16
|
+
${o.text}`:o.text})),requestAnimationFrame(()=>$.current?.focus()))},[F,W,o,d]);const N=W===F?f.text:"",z=W===F?f.references:[],re=se=>h(Ce=>({...Ce,workspaceId:a,sessionId:d,text:se})),je=se=>{const Ce=new Set(se.map(Ks));M(G=>new Set([...G].filter(ve=>Ce.has(ve)))),h(G=>({...G,workspaceId:a,sessionId:d,references:se}))},ye=async se=>{const Ce=N.trim();if(!Ce||!ee)return;const G=F;try{se==="queue"?await r.queue(Ce,z):await r.submit(Ce,z),Hd(a,d),M(new Set),D.current===G&&h({workspaceId:a,sessionId:d,text:"",references:[]}),$.current?.focus()}catch(ve){ve instanceof Ie&&["context_reference_stale","context_reference_forbidden"].includes(ve.code??"")&&M(new Set(z.map(Ks))),T(ve instanceof Error?ve.message:"发送失败,草稿已保留。"),$.current?.focus()}},Y=se=>{se.preventDefault(),ye(n.processing?"queue":"submit")},fe=se=>{se.key!=="Enter"||se.shiftKey||se.nativeEvent.isComposing||(se.preventDefault(),n.processing&&(se.metaKey||se.ctrlKey)?ye("submit"):ye(n.processing?"queue":"submit"))};return i.jsxs("div",{className:"composer-control-center",children:[n.composer?.planReview?.status==="awaiting_review"?i.jsx(qg,{state:n,actions:r}):null,z.length>0?i.jsx(Bg,{references:z,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:$,id:"orion-composer",rows:3,maxLength:1e6,value:N,onChange:se=>re(se.target.value),onKeyDown:fe,placeholder:L?"正在同步会话控制状态…":pe?`任务正在排队${n.sessionSnapshot?.sessionRuntime.queuePosition?`(第 ${n.sessionSnapshot.sessionRuntime.queuePosition} 位)`:""}`:Z?"选择会话并配置模型后开始":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(Fg,{state:n,actions:r,disabled:!ee,references:z,onChange:je,onInsertCommand:()=>re(N.trim()?`${N.trimEnd()}
|
|
17
|
+
/`:"/")}),i.jsx(Da,{label:Kg(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:se=>{se==="auto"?w("auto"):bt(r.setMode(se))}}),i.jsx(Da,{label:Gg(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:se=>{se==="allow"?w("allow"):bt(r.setPermissionOverride(se==="inherit"?null:se))}})]}),i.jsxs("div",{className:"composer-actions composer-control-actions",children:[i.jsx(Lg,{state:n,actions:r,disabled:!ee}),i.jsx(Wg,{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:()=>{ye("submit")},disabled:!N.trim()||!ee,children:"Steer"})]}):null,pe?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>bt(r.cancelQueuedTurn()),disabled:!te,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})})]})]}),z.length>0||S||n.composer?.lastError?i.jsxs("div",{className:"composer-footline",children:[z.length>0?i.jsxs("span",{children:[z.length," 个 Context 引用"]}):null,S?i.jsx("span",{role:"alert",children:S}):n.composer?.lastError?i.jsx("span",{role:"alert",children:n.composer.lastError.message}):null]}):null]}),g?i.jsx(Ug,{kind:g,onCancel:()=>w(null),onConfirm:()=>{const se=g;w(null),bt(se==="auto"?r.setMode("auto"):r.setPermissionOverride("allow"))}}):null]})}function Lg({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(zg,{state:n,actions:r,disabled:o}),a?.effort.supported?i.jsx(Da,{label:n.composer?.pending.model?`${uo(a.effort.requested)} → ${uo(n.composer.pending.model.effort)}`:uo(a.effort.requested),accessibleLabel:"推理强度",disabled:o,value:a.effort.requested,options:d.map(f=>({value:f,label:uo(f),detail:f==="auto"?"采用模型或项目默认值":`请求 ${f} reasoning effort`})),onSelect:f=>bt(r.selectModel(a.modelId,f))}):null]})}function zg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),[f,h]=m.useState(""),g=m.useRef(null),w=m.useRef(null),S=m.useRef(null),T=n.composer?.model,C=n.modelCatalog,M=n.composer?.pending.model?`${T?.modelId??"模型"} → ${n.composer.pending.model.modelId}`:T?.modelId??"模型",$=f.trim().toLowerCase(),F=new Set((C?.unavailableProviders??[]).map(L=>L.id)),D=(C?.items??[]).filter(L=>!F.has(L.providerId)).filter(L=>[L.id,L.label,L.providerId,L.providerLabel].some(pe=>pe.toLowerCase().includes($))).slice(0,80),W=new Map;for(const L of D){const pe=L.providerLabel||L.providerId;W.set(pe,[...W.get(pe)??[],L])}const Z=()=>{d(!1),h(""),w.current?.focus()};return Ao(a,g,Z),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?Z():(d(!0),C||bt(r.loadModelCatalog()))},children:[i.jsx("span",{children:M}),i.jsx(Q,{name:"chevron",size:12})]}),a?i.jsxs("div",{className:"control-menu-popover model-catalog-popover",role:"menu","aria-label":"会话模型",ref:S,onKeyDown:L=>Qa(L,Z),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:L=>h(L.target.value),onKeyDown:L=>{L.key==="ArrowDown"?(L.preventDefault(),Qf(S.current)):L.key==="Escape"&&(L.stopPropagation(),Z())}})]}):null,C===null?i.jsx("p",{role:"status",children:"正在加载模型…"}):null,C&&D.length===0?i.jsx("p",{children:"没有匹配的可用模型"}):null,[...W.entries()].map(([L,pe])=>i.jsxs("section",{role:"group","aria-label":L,children:[i.jsx("div",{className:"model-provider-heading",children:L}),pe.map(te=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":te.id===T?.modelId,onClick:()=>{Z(),bt(r.selectModel(te.id))},children:[i.jsxs("span",{children:[i.jsx("strong",{children:te.label}),i.jsxs("small",{children:[es(te.contextWindow)," context",te.reasoning?" · reasoning":""]})]}),te.id===T?.modelId?i.jsx(Q,{name:"check",size:14}):null]},te.id))]},L)),C?.unavailableProviders.map(L=>i.jsxs("section",{role:"group","aria-label":`${L.id} 不可用`,children:[i.jsxs("div",{className:"model-provider-heading state-error",children:[L.id," · 不可用"]}),i.jsx("p",{children:L.reason}),i.jsx("button",{type:"button",role:"menuitem",onClick:()=>bt(r.loadModelCatalog()),children:"Retry"})]},L.id)),(C?.items.length??0)>80&&!$?i.jsx("p",{children:"显示前 80 项;输入关键词继续筛选。"}):null]}):null]})}function Wg({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,S=g?.source==="estimated",T=!!(g&&g.percent>=g.warningThresholdPercent);return Ao(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 ${S?"估算 ":""}${g.usedTokens} / ${g.safeInputBudget??g.contextWindow} tokens,${g.percent}%${T?",接近压缩阈值":""}`:"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?`${S?"~":""}${g.percent}%${T?" !":""}`:"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:es(g.usedTokens)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全输入预算"}),i.jsx("dd",{children:es(g.safeInputBudget??g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"原始窗口"}),i.jsx("dd",{children:es(g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"输出预留"}),i.jsx("dd",{children:es(g.reservedOutputTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全余量"}),i.jsx("dd",{children:es(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 Fg({state:n,actions:r,disabled:o,references:a,onChange:d,onInsertCommand:f}){const[h,g]=m.useState(!1),[w,S]=m.useState("root"),[T,C]=m.useState([]),[M,$]=m.useState(!1),[F,D]=m.useState(""),W=m.useRef(null),Z=m.useRef(null);Ao(h,W,()=>g(!1));const L=N=>{a.some(z=>z.kind===N.kind&&z.id===N.id)||d([...a,N]),g(!1),S("root")},pe=async()=>{S("files"),$(!0),D("");try{const N=await r.listFiles();C(N.items.filter(z=>z.readable&&!z.sensitive))}catch(N){D(N instanceof Error?N.message:"文件列表加载失败。")}finally{$(!1)}},te=async N=>{$(!0),D("");try{if(Gd(N)){const z=await r.listFiles(N.id);L({kind:"folder",id:N.id,label:N.name,revision:z.revision})}else if(Qg(N)){const z=await r.readFileContent(N.id);if(z.binary||z.sensitive)throw new Error("该文件不能加入模型 Context。");L({kind:"file",id:N.id,label:N.name,revision:z.revision})}}catch(z){D(z instanceof Error?z.message:"Context 引用加载失败。")}finally{$(!1)}},ee=async()=>{$(!0);try{const N=await r.review();L({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){D(N instanceof Error?N.message:"Review Context 加载失败。")}finally{$(!1)}};return i.jsxs("div",{className:"control-menu context-launcher",ref:W,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(()=>Qf(Z.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:Z,onKeyDown:N=>Qa(N,()=>g(!1)),children:[w!=="root"?i.jsx("button",{type:"button",role:"menuitem",onClick:()=>S("root"),children:"← 返回"}):null,w==="root"?i.jsxs(i.Fragment,{children:[i.jsx(bn,{label:"文件或目录",detail:"Workspace 内受控读取",onClick:()=>{pe()}}),i.jsx(bn,{label:"当前 Review",detail:"绑定 exact Git revision",onClick:()=>{ee()}}),i.jsx(bn,{label:"历史 Session",detail:"引用受控摘要",onClick:()=>S("sessions")}),i.jsx(bn,{label:"Skill",detail:"绑定已加载能力 digest",onClick:()=>S("skills")}),i.jsx(bn,{label:"命令",detail:"插入 / 命令入口",onClick:()=>{f(),g(!1)}}),a.length>0?i.jsx(bn,{label:"清除 Context",detail:"移除当前草稿全部引用",onClick:()=>{d([]),g(!1)}}):null]}):null,w==="files"?T.map(N=>i.jsx(bn,{label:N.name,detail:Gd(N)?"目录":`${N.sizeBytes??0} bytes`,onClick:()=>{te(N)}},N.id)):null,w==="sessions"?n.sessions.filter(N=>N.id!==n.activeSessionId).map(N=>i.jsx(bn,{label:N.name||`Session ${N.id.slice(0,8)}`,detail:`${N.messageCount} 条消息`,onClick:()=>L({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(bn,{label:N.name,detail:N.description,onClick:()=>L({kind:"skill",id:N.id,label:N.name,digest:N.digest})},N.id)):null,M?i.jsx("p",{role:"status",children:"正在加载…"}):null,F?i.jsx("p",{role:"alert",children:F}):null]}):null]})}function Bg({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(Ks(a))?" state-stale":""}`,children:[i.jsx("small",{children:Yg(a.kind)}),i.jsx("span",{children:a.label}),r.has(Ks(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})})]},Ks(a)))})}function qg({state:n,actions:r}){const o=n.composer.planReview,[a,d]=m.useState(!1),[f,h]=m.useState(""),g=!!n.pendingAction||n.connection!=="live"||!jr(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 Da({label:n,accessibleLabel:r,value:o,options:a,disabled:d,emptyLabel:f,onOpen:h,onSelect:g}){const[w,S]=m.useState(!1),T=m.useRef(null),C=m.useRef(null),M=m.useRef(null),$=m.useId(),F=()=>{S(!1),C.current?.focus()},D=()=>{S(!0),h?.(),requestAnimationFrame(()=>Hg(M.current))};return Ao(w,T,F),i.jsxs("div",{className:"control-menu",ref:T,children:[i.jsxs("button",{ref:C,type:"button",className:"composer-control-trigger","aria-label":r,"aria-haspopup":"menu","aria-expanded":w,"aria-controls":w?$:void 0,disabled:d,onClick:()=>{w?F():D()},onKeyDown:W=>{W.key==="ArrowDown"&&(W.preventDefault(),D())},children:[i.jsx("span",{children:n}),i.jsx(Q,{name:"chevron",size:12})]}),w?i.jsx("div",{id:$,ref:M,className:"control-menu-popover",role:"menu","aria-label":r,onKeyDown:W=>Qa(W,F),children:a.length===0?i.jsx("p",{children:f??"没有选项"}):a.map(W=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":W.value===o,onClick:()=>{F(),g(W.value)},children:[i.jsxs("span",{children:[i.jsx("strong",{children:W.label}),i.jsx("small",{children:W.detail})]}),W.value===o?i.jsx(Q,{name:"check",size:14}):null]},W.value))}):null]})}function bn({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 Ug({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=>Vg(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 Ga(n){return n?[...n.querySelectorAll('[role="menuitem"], [role="menuitemradio"]')].filter(r=>!r.disabled):[]}function Qf(n){Ga(n)[0]?.focus()}function Hg(n){const r=Ga(n);(r.find(o=>o.getAttribute("aria-checked")==="true")??r[0])?.focus()}function Qa(n,r){if(n.key==="Escape"){n.preventDefault(),r();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();const o=Ga(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 Vg(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 Ao(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 Kd(n){return n==="plan"?"PLAN":n==="auto"?"AUTO":"BUILD"}function Kg(n){const r=n.composer?.mode??n.mode,o=Kd(r.baseMode);return r.pendingBaseMode?`${o} → ${Kd(r.pendingBaseMode)}`:o}function Gg(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 uo(n){return n==="auto"?"Effort 自动":`Effort ${n}`}function Gd(n){return n.kind==="directory"||n.kind==="symlink"&&n.targetKind==="directory"}function Qg(n){return n.kind==="file"||n.kind==="symlink"&&n.targetKind==="file"}function Yg(n){return n==="file"?"FILE":n==="folder"?"FOLDER":n==="review"?"REVIEW":n==="session"?"SESSION":"SKILL"}function Ks(n){return`${n.kind}:${n.id}`}function bt(n){n.catch(()=>{})}function es(n){return n>=1e3?`${Math.round(n/1e3)}k`:String(n)}const Xg=48,Jg=64,Zg=new Set(["user","assistant"]);function ev(n,r={}){const o=nv(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(tv(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 tv(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)Zg.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 nv(n){return typeof n!="number"||!Number.isFinite(n)?Xg:Math.min(Jg,Math.max(1,Math.round(n)))}function Yf(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 rv(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?Yf(d):"未知"}}function Qd(n){const{clientY:r,railTop:o,railHeight:a,minOrder:d,maxOrder:f}=n;if(!Number.isFinite(a)||a<=0||!Number.isFinite(f)||!Number.isFinite(d)||f<=d)return d;const h=(r-o)/a;return Math.round(d+Math.max(0,Math.min(1,h))*(f-d))}function sv(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 La(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 iv(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 fo(n,r,o){return o<=r?0:Math.max(0,Math.min(1,(n-r)/(o-r)))}function ov({model:n,activeOrder:r,span:o,earlierInMemory:a,hasRemoteEarlier:d,loadBusy:f,reduceMotion:h,onLoadEarlier:g,onJumpToOrder:w,onJumpToLatest:S}){const T=m.useRef(null),C=m.useRef(null),[M,$]=m.useState(!1),[F,D]=m.useState(null),W=n.buckets.length,Z=W>0,L=n.minOrder,pe=n.maxOrder,te=m.useMemo(()=>{if(r===null||W===0)return 0;const X=n.buckets.findIndex(E=>r>=E.startOrder&&r<=E.endOrder);return X>=0?X+1:0},[r,n.buckets,W]),ee=o?fo(o.firstOrder,L,pe)*100:null,N=o?fo(o.lastOrder,L,pe)*100:null,z=r!==null?fo(r,L,pe)*100:null,re=m.useMemo(()=>r===null?null:rv(n,r),[r,n]),je=m.useCallback((X,E)=>{const H=T.current;if(!H)return;const R=H.getBoundingClientRect(),y=Qd({clientY:X,railTop:R.top,railHeight:R.height,minOrder:L,maxOrder:pe}),O=La(n,y);O!==null&&w(O,E)},[pe,L,n,w]),ye=X=>{C.current===X.pointerId&&je(X.clientY,"auto")},Y=X=>{X.button!==0||C.current!==null||(X.preventDefault(),C.current=X.pointerId,X.currentTarget.setPointerCapture(X.pointerId),document.documentElement.dataset.historyScrubbing="1",$(!0),je(X.clientY,"auto"))},fe=X=>{C.current===X.pointerId&&(X.currentTarget.hasPointerCapture(X.pointerId)&&X.currentTarget.releasePointerCapture(X.pointerId),C.current=null,delete document.documentElement.dataset.historyScrubbing,$(!1))},se=X=>{const E=iv({key:X.key,shiftKey:X.shiftKey,currentIndex:te-1,bucketCount:W,model:n});E!==null&&(X.preventDefault(),w(E,h?"auto":"smooth"))},Ce=X=>{if(C.current===X.pointerId){ye(X);return}const E=T.current;if(!E)return;const H=E.getBoundingClientRect(),R=Qd({clientY:X.clientY,railTop:H.top,railHeight:H.height,minOrder:L,maxOrder:pe}),y=La(n,R);if(y===null)return;const O=n.buckets.find(ne=>y>=ne.startOrder&&y<=ne.endOrder);if(!O)return;const A=n.anchors.find(ne=>ne.order===O.jumpOrder);D({order:y,label:`${Yf(A?.kind??"system")}${A?.label?` · ${av(A.label,40)}`:""}`,top:Math.max(0,Math.min(H.height-4,X.clientY-H.top))})};if(m.useEffect(()=>{M||D(null)},[M]),!Z)return null;const G=a>0||d,ve=a>0?`加载更早 · 剩 ${a} 项`:"从持久记录加载更早内容";return i.jsx("nav",{className:"history-rail","aria-label":"会话历史定位",children:i.jsxs("div",{className:"history-rail-inner",ref:T,children:[G?i.jsx("button",{type:"button",className:"history-load-earlier",onClick:g,disabled:f,children:ve}):null,i.jsxs("div",{className:"history-slider",role:"slider","aria-label":"已加载会话历史位置","aria-valuemin":0,"aria-valuemax":Math.max(0,W-1),"aria-valuenow":Math.max(0,te-1),"aria-valuetext":re?`已加载 ${re.bucketIndex}/${re.bucketCount} 个关键节点,当前为${re.kindLabel}`:`已加载 ${W} 个关键节点`,tabIndex:Z?0:void 0,onKeyDown:se,onPointerDown:Y,onPointerMove:Ce,onPointerUp:fe,onPointerCancel:fe,onLostPointerCapture:fe,onDoubleClick:S,children:[i.jsx("div",{className:"history-ticks","aria-hidden":"true",children:n.buckets.map(X=>i.jsx("span",{className:lv(X.hasError,X.kinds),style:{top:`${fo(X.jumpOrder,L,pe)*100}%`}},X.index))}),ee!==null&&N!==null?i.jsx("div",{className:"history-viewport-marker","aria-hidden":"true",style:{top:`${ee}%`,height:`${Math.max(2,N-ee)}%`}}):null,z!==null?i.jsx("div",{className:"history-active-dot","aria-hidden":"true",style:{top:`${z}%`}}):null]}),F?i.jsx("div",{className:"history-tooltip",style:{top:F.top},"aria-hidden":"true",children:F.label}):null]})})}function lv(n,r){return n?"history-tick history-tick-error":r.includes("user")?"history-tick history-tick-user":r.includes("assistant")?"history-tick history-tick-assistant":"history-tick history-tick-activity"}function av(n,r){const o=n.replace(/\s+/gu," ").trim();return o.length<=r?o:`${o.slice(0,r)}…`}const cv=10;function uv(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),[S,T]=m.useState(null),[C,M]=m.useState(null),$=m.useRef(d);$.current=d;const F=m.useRef(a),D=m.useRef(o);D.current=o;const W=()=>{if(w.current=null,g.current.length===0)return;const ee=g.current;if(g.current=[],ee.length===0)return;const z=r.current?.getBoundingClientRect().top??0,re=sv(ee,z);let je=Number.POSITIVE_INFINITY,ye=Number.NEGATIVE_INFINITY;for(const Y of ee)Y.topInViewport>=z-1&&(Y.order<je&&(je=Y.order),Y.order>ye&&(ye=Y.order));T(Y=>Y===re?Y:re),M(Y=>{if(!Number.isFinite(je)||!Number.isFinite(ye))return Y;const fe={firstOrder:je,lastOrder:ye};return Y?.firstOrder===fe.firstOrder&&Y?.lastOrder===fe.lastOrder?Y:fe})},Z=()=>{w.current===null&&(w.current=requestAnimationFrame(W))},L=()=>{h.current&&(h.current.disconnect(),h.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),g.current=[],f.current.clear(),T(null),M(null)};m.useEffect(()=>{if(F.current===a&&h.current)return;F.current=a,L();const ee=r.current;if(!ee||!o.anchors.length||typeof IntersectionObserver>"u")return;const N=new IntersectionObserver(z=>{const je=r.current?.getBoundingClientRect().top??0;for(const ye of z){const Y=Number(ye.target.dataset.order);Number.isFinite(Y)&&ye.isIntersecting&&g.current.push({order:Y,topInViewport:ye.boundingClientRect.top-je})}Z()},{root:ee,threshold:[0,.2,.6]});return h.current=N,f.current.clear(),ee.querySelectorAll("li[data-order]").forEach(z=>{const re=Number(z.dataset.order);Number.isFinite(re)&&(f.current.set(re,z),N.observe(z))}),()=>L()},[r,a,o.anchors.length,o.anchors[o.anchors.length-1]?.order]);const pe=m.useCallback((ee,N)=>{if(N){if(f.current.get(ee)===N)return;f.current.set(ee,N),h.current?.observe(N);return}const z=f.current.get(ee);z&&(h.current?.unobserve(z),f.current.delete(ee))},[]);return{activeOrder:S,span:C,registerItem:pe,scrollToOrder:(ee,N="smooth")=>{const z=r.current,re=La(D.current,ee),je=re!==null?f.current.get(re):void 0;if(!z||!je){if(!z||D.current.anchors.length===0)return;const Y=(ee-D.current.minOrder)/(D.current.maxOrder-D.current.minOrder||1);z.scrollTo({top:Math.max(0,Math.min(1,Y))*(z.scrollHeight-z.clientHeight),behavior:N}),$.current?.();return}const ye=je.getBoundingClientRect().top-z.getBoundingClientRect().top+z.scrollTop-cv;z.scrollTo({top:Math.max(0,ye),behavior:N}),$.current?.()}}}const Yd=320,dv=300,Ia=["system","light","dark"],fv={system:"monitor",light:"sun",dark:"moon"},Xd={system:"跟随系统",light:"浅色",dark:"深色"};function pv(n){const r=n??"system",o=Ia.indexOf(r),a=Ia[(o+1)%Ia.length];return{current:r,next:a}}function hv({state:n,actions:r,navigationOpen:o,inspectorExpanded:a,onOpenNavigation:d,onToggleInspector:f,onRevealSettings:h,onCreateSession:g,themePreference:w,onCycleTheme:S,onShowShortcuts:T,composerInsertion:C}){const M=n.sessions.find(E=>E.id===n.activeSessionId),$=Ro(n),F=m.useMemo(()=>mv(n),[n.edits,n.research,n.subtasks,n.tools,n.transcript]),[D,W]=m.useState(Yd),Z=F.slice(-D),L=m.useRef(null),pe=m.useRef(null),te=m.useRef(!0),ee=m.useRef(null),[N,z]=m.useState(!0),[re,je]=m.useState(!1),ye=m.useMemo(()=>Z.map(gv).filter(E=>E!==null),[Z]),Y=m.useMemo(()=>ev(ye),[ye]),fe=uv({viewportRef:L,model:Y,activeSessionId:n.activeSessionId,onUserNavigate:()=>{te.current=!1,z(!1)}});m.useEffect(()=>{const E=window.matchMedia("(prefers-reduced-motion: reduce)");je(E.matches);const H=R=>je(R.matches);return E.addEventListener("change",H),()=>E.removeEventListener("change",H)},[]),m.useEffect(()=>{W(Yd),te.current=!0,z(!0)},[n.activeSessionId]),m.useLayoutEffect(()=>{const E=L.current;if(E){if(ee.current){const H=ee.current;E.scrollTop=H.top+(E.scrollHeight-H.height),ee.current=null;return}te.current&&(E.scrollTop=E.scrollHeight)}},[Z.length,n.processing]),m.useLayoutEffect(()=>{const E=L.current,H=pe.current;if(!E||!H||typeof ResizeObserver>"u")return;const R=new ResizeObserver(()=>{te.current&&(E.scrollTop=E.scrollHeight)});return R.observe(H),()=>R.disconnect()},[n.activeSessionId]);const se=()=>{const E=L.current;if(!E)return;const H=E.scrollHeight-E.scrollTop-E.clientHeight<72;te.current=H,z(H)},Ce=!!n.sessionSnapshot?.transcript.nextCursor,G=async()=>{const E=L.current;if(E&&(ee.current={height:E.scrollHeight,top:E.scrollTop}),F.length>Z.length){W(H=>H+dv);return}if(Ce)try{await r.loadOlderTranscript(),W(H=>H+100)}catch{ee.current=null}},ve=()=>{const E=L.current;E&&(te.current=!0,z(!0),E.scrollTo({top:E.scrollHeight,behavior:"smooth"}))},X=pv(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:M?kr(M):"Orion Code"}),n.processing?i.jsx("span",{className:"running-pulse",children:"运行中"}):null]}),i.jsxs("p",{title:n.workspace,children:[M?.model??n.settings?.sections.defaults.model.effectiveValue??"本地工作台"," ","· ",Pv(n.workspace)]})]}),i.jsxs("div",{className:"header-actions",children:[i.jsx("button",{type:"button",className:"icon-button theme-cycle-button",onClick:S,"aria-label":`主题:${Xd[X.current]},点击切换为${Xd[X.next]}`,children:i.jsx(Q,{name:fv[X.current]})}),i.jsx("button",{type:"button",className:"icon-button shortcut-help-button",onClick:T,"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:L,role:"region","aria-label":"会话记录",tabIndex:0,onScroll:se,"aria-busy":n.processing,children:i.jsxs("div",{className:"transcript-content",ref:pe,children:[F.length>Z.length||Ce?i.jsx("button",{type:"button",className:"load-history",onClick:()=>{G()},disabled:!!n.pendingAction,children:F.length>Z.length?`加载更早内容 · 还剩 ${F.length-Z.length} 项`:"从持久记录加载更早内容"}):null,n.activeSessionId?$.status==="failed"&&Z.length===0?i.jsx(po,{icon:"warning",title:"会话快照加载失败",detail:$.error??"请重试当前会话快照。"}):($.status==="loading"||$.status==="refreshing")&&Z.length===0?i.jsx(po,{icon:"refresh",title:"正在同步会话",detail:"本地 Web Host 正在读取最近的会话快照。"}):Z.length===0?i.jsx(po,{icon:"spark",title:"准备好开始了",detail:"描述要构建、修复或调查的任务。Orion 会实时展示工具、文件变化与验证结果。"}):i.jsx("ol",{className:"timeline","aria-label":"会话记录",children:Z.map(E=>i.jsx("li",{id:`conversation-item-${n.activeSessionId??"none"}-${za(E)}`,"data-event-id":E.order,"data-order":E.order,ref:H=>fe.registerItem(E.order,H),children:yv(E,n)},za(E)))}):i.jsx(po,{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(ov,{model:Y,activeOrder:fe.activeOrder,span:fe.span,earlierInMemory:Math.max(0,F.length-Z.length),hasRemoteEarlier:Ce,loadBusy:!!n.pendingAction,reduceMotion:re,onLoadEarlier:()=>{G()},onJumpToOrder:(E,H)=>fe.scrollToOrder(E,H),onJumpToLatest:ve})]}),!N&&Z.length>0?i.jsxs("button",{type:"button",className:"jump-latest",onClick:ve,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(Nv,{state:n,actions:r}):null,n.queue.items.length>0?i.jsx(bv,{state:n,actions:r}):null]}):null,i.jsx(Dg,{state:n,actions:r,insertion:C})]})]})}function mv(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 za(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 gv(n){const r=n.order,o=za(n);if(n.kind==="tool")return{order:r,key:o,kind:"tool",label:Bs(n.value.summary)||n.value.name,priority:n.value.state==="error"?"error":"activity"};if(n.kind==="edit")return{order:r,key:o,kind:"edit",label:n.value.request.path,priority:"activity"};if(n.kind==="subtask")return{order:r,key:o,kind:"subtask",label:Bs(n.value.objective)||n.value.role,priority:vv.has(n.value.state)?"error":"activity"};if(n.kind==="research")return{order:r,key:o,kind:"research",label:Bs(n.value.objective)||"Research",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:Bs(g.summary)||g.name||g.detail||"工具活动",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:Bs(a.content)||a.title||(d==="user"?"用户任务":d==="assistant"?"Orion 回复":Wa(d))}}const vv=new Set(["failed","timed_out","rejected","cancelled"]);function Bs(n){if(!n)return null;const r=n.replace(/\s+/gu," ").trim();return r.length>80?`${r.slice(0,80)}…`:r}function yv(n,r){if(n.kind==="transcript")return i.jsx(xv,{entry:n.value});if(n.kind==="tool"){const o=r.transcript.find(a=>a.toolActivity?.callId===n.value.callId)?.toolActivity;return i.jsx(wv,{tool:n.value,activity:o})}return n.kind==="edit"?i.jsx(jv,{edit:n.value}):n.kind==="subtask"?i.jsx(Sv,{subtask:n.value}):i.jsx(Cv,{research:n.value})}function xv({entry:n}){if(n.toolActivity)return i.jsx(kv,{entry:n});if(Iv(n))return i.jsxs("details",{className:"reasoning-card",children:[i.jsxs("summary",{children:[i.jsx(Ka,{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(Gs,{children:n.content})]});const r=n.role;return i.jsxs("article",{className:`message-card role-${r}`,"aria-label":Wa(r),children:[i.jsxs("header",{children:[i.jsx("span",{className:"message-avatar","aria-hidden":"true",children:Ev(r)}),i.jsx("span",{children:n.title||Wa(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(Gs,{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 wv({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?` · ${Xf(n.duration)}`:""]})]}),n.outputBytes!==void 0?i.jsx("span",{className:"byte-pill",children:Jd(n.outputBytes)}):null]}),n.summary||n.error?i.jsx("p",{className:n.error?"tool-error-copy":"tool-summary",children:Zn(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:qa(n.args)})]}),a?i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"输出预览"}),i.jsx("pre",{tabIndex:0,children:Zn(a)}),r?.outputView?.omittedBytes?i.jsxs("p",{className:"truncation-note",children:["另有 ",Jd(r.outputView.omittedBytes)," 已折叠,可在 Inspector 中查看产物。"]}):null]}):null]})]})}function kv({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.jsx("pre",{tabIndex:0,children:Zn(r.outputView?.preview||r.body||"")}):null]})}function jv({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:Zn(r.newString)})]})]})}function Sv({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:Xf(n.durationMs)}):null]}),i.jsx("p",{children:n.objective}),n.summary?i.jsx(Gs,{children:n.summary}):null]})}function Cv({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(Gs,{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(Ka,{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 Nv({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"||!jr(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:qa(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 bv({state:n,actions:r}){const o=!!n.pendingAction||n.connection!=="live"||!jr(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(_v,{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 _v({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 S=async()=>{const T=g.trim();T&&(await d.editQueued(n.id,n.revision,T),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:T=>w(T.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(S()),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 po({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 Iv(n){const r=`${n.title??""}`.toLocaleLowerCase();return r.includes("reason")||r.includes("think")||r.includes("analysis")||r.includes("推理")||r.includes("思考")}function Wa(n){return n==="user"?"你":n==="assistant"?"Orion":n==="command"?"命令":n==="error"?"错误":n==="system"?"系统":n==="status"?"状态":"工具"}function Ev(n){return n==="user"?"Y":n==="assistant"?"O":n==="error"?"!":n==="command"?"›":"·"}function Pn(n){n.catch(()=>{})}function Xf(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 Jd(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function Pv(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function $o({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 Rv({open:n,onClose:r,state:o,onSelect:a,onLoadMore:d}){const[f,h]=m.useState(""),[g,w]=m.useState(""),[S,T]=m.useState(!1),[C,M]=m.useState(!1);m.useEffect(()=>{n&&(h(""),w(""),T(!1),M(!1))},[n]);const $=!!o.pendingAction||S,F=o.workspaces.slice(0,3),D=o.workspaces.slice(3),W=async L=>{const pe=L.trim();if(pe){if(pe===o.workspace){w("该目录已经是当前工作区。");return}w(""),T(!0);try{await a(pe),r()}catch(te){w(te instanceof Error?te.message:"工作区切换失败。")}finally{T(!1)}}},Z=L=>{L.preventDefault(),W(f)};return i.jsxs($o,{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:[F.map(L=>i.jsx(Zd,{workspace:L,locked:$,onSelect:W},L.id)),D.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"text-button workspace-toggle-all","aria-expanded":C,onClick:()=>M(L=>!L),children:C?"收起其他工作区":`其他工作区(${D.length})`}),C?D.map(L=>i.jsx(Zd,{workspace:L,locked:$,onSelect:W},L.id)):null]}):null,o.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{d()},disabled:$,children:"加载更多工作区"}):null]}),i.jsxs("form",{className:"workspace-path-form",onSubmit:Z,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:L=>{h(L.target.value),g&&w("")},placeholder:"/Users/name/project",spellCheck:!1,autoComplete:"off"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!f.trim()||$,children:S?"打开中…":"打开"})]}),g?i.jsx("p",{className:"field-error",role:"alert",children:g}):null]})]})}function Zd({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||Hf(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 Tv({open:n,onClose:r,session:o,pending:a,onRename:d}){const[f,h]=m.useState(""),[g,w]=m.useState(""),S=o?.id;m.useEffect(()=>{n&&o&&(h(kr(o)),w(""))},[n,S]);const T=async C=>{if(C.preventDefault(),!(!o||!f.trim())){w("");try{await d(o.id,f.trim()),r()}catch(M){w(M instanceof Error?M.message:"重命名失败,请重试。")}}};return i.jsx($o,{open:n,onClose:r,labelledBy:"rename-title",className:"rename-modal",children:i.jsxs("form",{onSubmit:T,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 ef=8;function Mv({open:n,onClose:r,session:o,pending:a,onSave:d}){const[f,h]=m.useState(()=>o?.tags?[...o.tags]:[]),[g,w]=m.useState(""),[S,T]=m.useState(""),C=o?.id;m.useEffect(()=>{n&&o&&(h(o.tags??[]),w(""),T(""))},[n,C]);const M=()=>{const D=g.trim().slice(0,32);if(w(""),!!D&&!f.includes(D)){if(f.length>=ef){T(`最多 ${ef} 个标签。`);return}h([...f,D]),T("")}},$=D=>h(f.filter(W=>W!==D)),F=async D=>{if(D.preventDefault(),!!o){T("");try{await d(o.id,f),r()}catch(W){T(W instanceof Error?W.message:"保存标签失败,请重试。")}}};return i.jsx($o,{open:n,onClose:r,labelledBy:"session-tags-title",className:"tags-modal",children:i.jsxs("form",{onSubmit:F,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:kr(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(D=>i.jsxs("span",{className:"session-tag-chip",role:"listitem",children:[D,i.jsx("button",{type:"button",className:"icon-button session-tag-remove","aria-label":`移除标签 ${D}`,onClick:()=>$(D),children:i.jsx(Q,{name:"close",size:11})})]},D))}),i.jsx("label",{htmlFor:"session-tag-input",children:"新标签"}),i.jsx("input",{id:"session-tag-input",value:g,onChange:D=>{w(D.target.value),S&&T("")},onKeyDown:D=>{(D.key==="Enter"||D.key===","||D.key===",")&&(D.preventDefault(),M())},placeholder:"回车或逗号添加",maxLength:32,autoFocus:!0}),S?i.jsx("p",{className:"field-error",role:"alert",children:S}):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 Ov({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($o,{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?`「${kr(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 Av=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function Co(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 $v(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 yr(n){return{openedAtRevision:n.revision,workspace:n.workspace,base:n,values:Wv(n),intents:{},serverLatest:null}}function Jf(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 Zf(n,r){const o=Co(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 tf(n,r){return{...n,serverLatest:r}}function Dv(n){const r=n.serverLatest;if(!r)return n;let o=yr(r);for(const a of Sr(n)){const d=n.intents[a];if(d){if(d.op==="unset"){o=Zf(o,a);continue}o=Jf(o,a,d.value)}}return o}function Sr(n){return Av.filter(r=>n.intents[r]!==void 0)}function Lv(n){return Sr(n).map(r=>{const o=n.intents[r];return o.op==="unset"?{op:"unset",key:r}:{op:"set",key:r,value:o.value}})}function zv(n){return n.serverLatest?Sr(n).filter(r=>{const o=Co(n.base,r),a=Co(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=Co(n,r);return o.explicitValue??o.effectiveValue}function Wv(n){const r=$v(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 No={phase:"closed",section:"general",draft:null,message:null,problemCode:null,confirmDiscard:!1};function Fv(n,r){switch(r.type){case"open":return{...No,phase:"ready",draft:yr(r.document)};case"close":return No;case"select_section":return{...n,section:r.section,confirmDiscard:!1};case"set_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:Jf(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:Zf(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:yr(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?tf(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:yr(r.document)};if(n.phase==="saving")return n;if(n.draft.base.revision===r.document.revision){const o=Sr(n.draft).length>0;return{...n,draft:o?{...n.draft,base:r.document}:yr(r.document)}}return n.draft.workspace!==r.document.workspace||Sr(n.draft).length===0?{...n,phase:"ready",draft:yr(r.document),message:"已采用 Host 的最新设置。",problemCode:null,confirmDiscard:!1}:{...n,phase:"conflict",draft:tf(n.draft,r.document),message:"Host 设置已更新。你的草稿仍被保留,请选择如何继续。",problemCode:"settings_revision_conflict",confirmDiscard:!1}}case"adopt_server":return n.draft?.serverLatest?{...n,phase:"ready",draft:yr(n.draft.serverLatest),message:"已采用服务器最新值。",problemCode:null}:n;case"rebase":return n.draft?.serverLatest?{...n,phase:"ready",draft:Dv(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 Bv=["auto","none","minimal","low","medium","high","xhigh","max"],qv=[{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 Uv({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),S=m.useRef(null),T=m.useRef(!1),C=m.useRef(null),M=m.useRef(No.phase),[$,F]=m.useReducer(Fv,No),[D,W]=m.useState(!1),[Z,L]=m.useState(!1),[pe,te]=m.useState(null),ee=o.settings??o.settingsMirror.lastGood,N=ee&&(!o.workspace||ee.workspace===o.workspace)?ee:null;m.useEffect(()=>{const G=f.current;G&&(n&&!G.open&&G.showModal(),!n&&G.open&&G.close())},[n]),m.useEffect(()=>{if(n&&!T.current)N&&(F({type:"open",document:N}),S.current=N),W(!1),L(!1),te(null);else if(n&&N&&S.current===null)F({type:"open",document:N}),S.current=N;else if(n&&N&&S.current!==null&&S.current!==N){if($.phase==="saving")return;S.current=N,F({type:"server_updated",document:N})}else!n&&T.current&&(F({type:"close"}),S.current=null,C.current=null);T.current=n},[N,$.phase,n]),m.useEffect(()=>{$.confirmDiscard&&g.current?.focus()},[$.confirmDiscard]),m.useEffect(()=>{const G=M.current;if(M.current=$.phase,!n||G!=="saving"||$.phase!=="success")return;const ve=of();f.current?.contains(ve)||h.current?.focus()},[$.phase,n]),m.useEffect(()=>{!n||N||o.settingsMirror.status==="loading"||a.refreshSettings().catch(()=>{})},[a,N,n,o.settingsMirror.status]),m.useEffect(()=>{!n||!$.draft||!o.workspace||$.draft.workspace!==o.workspace&&(F({type:"close"}),S.current=null)},[$.draft,n,o.workspace]);const z=$.draft,re=z?Sr(z):[],je=re.length>0,ye=o.processing&&re.some(G=>["defaults.effort","permissions.toolConfirmation"].includes(G)),Y=()=>{if($.phase!=="saving"){if(je){const G=of();w.current=G instanceof HTMLElement?G:null,F({type:"request_discard"});return}F({type:"close"}),r()}},fe=()=>{F({type:"close"}),r()},se=async G=>{if(G.preventDefault(),!z||!je||$.phase==="saving"||$.phase==="conflict")return;const ve=Lv(z),X=C.current??qe();C.current=X,F({type:"save_started"});try{const E=await a.updateSettings(z.base.revision,ve,X);C.current=null,S.current=E.settings,F({type:"save_succeeded",document:E.settings})}catch(E){const H=E instanceof Ie?E.code??"settings_rejected":"network";let R;H==="settings_revision_conflict"?(C.current=null,R=await a.refreshSettings().catch(()=>{}),R&&(S.current=R)):E instanceof Ie&&E.status<500&&(C.current=null);const y=H==="settings_revision_conflict"&&!R?"settings_recovery_required":H;F({type:"save_failed",code:y,message:Jv(y,E),...R?{latest:R}:{}})}},Ce=G=>{G.target===G.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:G=>{G.preventDefault(),Y()},onClick:Ce,children:i.jsxs("form",{onSubmit:se,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:$.phase==="saving",children:i.jsx(Q,{name:"close"})})]}),i.jsxs("div",{className:"settings-layout",children:[i.jsx("nav",{className:"settings-navigation","aria-label":"设置类别",children:qv.map(G=>i.jsxs("button",{type:"button",className:$.section===G.id?"active":"","aria-current":$.section===G.id?"page":void 0,onClick:()=>F({type:"select_section",section:G.id}),children:[i.jsx(Q,{name:G.icon,size:16}),i.jsx("span",{children:G.label})]},G.id))}),i.jsxs("div",{className:"settings-content",children:[i.jsx(Yv,{state:o}),z?i.jsxs(i.Fragment,{children:[$.phase==="conflict"?i.jsx(Xv,{draft:z,onAdopt:()=>{C.current=null,F({type:"adopt_server"})},onRebase:()=>{C.current=null,F({type:"rebase"})}}):null,$.message&&$.phase!=="conflict"?i.jsxs("div",{className:`settings-inline-message settings-message-${$.phase}`,role:$.phase==="rejected"?"alert":"status","aria-live":$.phase==="rejected"?"assertive":"polite",children:[i.jsx(Q,{name:$.phase==="success"?"check":"info",size:16}),i.jsx("span",{children:$.message})]}):null,$.section==="general"?i.jsx(Hv,{document:z.base,draft:z.values,dirtyKeys:re,saving:$.phase==="saving",onSet:(G,ve)=>F({type:"set_value",key:G,value:ve}),onReset:G=>F({type:"reset_value",key:G})}):null,$.section==="models"?i.jsx(Kv,{document:z.base,draft:z.values,dirtyKeys:re,runtimeBusy:o.processing,saving:$.phase==="saving",onGoToSessionControls:d,onSet:(G,ve)=>F({type:"set_value",key:G,value:ve}),onReset:G=>F({type:"reset_value",key:G})}):null,$.section==="permissions"?i.jsx(Gv,{document:z.base,value:z.values["permissions.toolConfirmation"],dirtyKeys:re,runtimeBusy:o.processing,saving:$.phase==="saving",confirmAllow:D,allowAcknowledged:Z,onAllowRequested:()=>{L(!1),W(!0)},onAllowAcknowledged:L,onConfirmAllow:()=>{F({type:"set_value",key:"permissions.toolConfirmation",value:"allow"}),W(!1),L(!1)},onCancelAllow:()=>{W(!1),L(!1)},onSet:G=>F({type:"set_value",key:"permissions.toolConfirmation",value:G}),onReset:()=>F({type:"reset_value",key:"permissions.toolConfirmation"})}):null,$.section==="advanced"?i.jsx(Qv,{state:o,document:z.base,documentAction:pe,onOpenDocument:()=>{te({tone:"status",message:"正在请求 Host 打开设置文件…"}),a.openSettingsDocument().then(()=>te({tone:"status",message:"已交给系统默认编辑器打开。"})).catch(G=>te({tone:"error",message:G instanceof Error?G.message:"无法打开设置文件。"}))},onRefresh:()=>{te({tone:"status",message:"正在重新载入 Host 设置…"}),a.refreshSettings().then(()=>te({tone:"status",message:"已载入最新设置。"})).catch(G=>te({tone:"error",message:G instanceof Error?G.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 返回可验证的设置快照。"})]})]})]}),$.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:()=>{F({type:"cancel_discard"});const G=w.current;requestAnimationFrame(()=>G?.focus())},children:"继续编辑"}),i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:fe,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:$.phase==="saving",children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!z||!je||$.phase==="saving"||$.phase==="conflict"||ye||z.base.state!=="ready"||!z.base.writable,children:$.phase==="saving"?"应用中…":`应用 ${re.length} 项`})]})]})})}function Hv({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(Do,{heading:"通用",detail:"外观偏好由 Host 保存,并在所有 Workbench 窗口保持一致。",children:[i.jsx(ss,{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:S=>d("appearance.style",S.target.value),children:[i.jsx("option",{value:"orion-blocksmith",children:"方块工坊(内置,默认)"}),i.jsx("option",{value:"classic",children:"经典"})]})}),i.jsx(ss,{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:S=>d("appearance.theme",S.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"?"方块工坊":"经典工作台"},${Vv(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(ss,{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:S=>d("appearance.motion",S.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"reduced",children:"减少动效"})]})})]})}function Vv(n){return n==="light"?"浅色":n==="dark"?"深色":"跟随系统"}function Kv({document:n,draft:r,dirtyKeys:o,saving:a,runtimeBusy:d,onSet:f,onReset:h,onGoToSessionControls:g}){const w=n.sections.defaults.model,S=n.sections.defaults.effort,T=n.models.some(C=>C.id===r["defaults.model"])?n.models:[{id:r["defaults.model"],label:r["defaults.model"]},...n.models];return i.jsxs(Do,{heading:"模型与推理",detail:"项目默认值通常从下一逻辑请求开始生效;当前会话覆盖保持可见。",children:[d?i.jsx(ep,{detail:"当前回合正在运行;项目推理强度暂时锁定,默认模型仍可用于新会话。"}):null,i.jsx(ss,{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:T.map(C=>i.jsxs("option",{value:C.id,children:[C.label,C.provider?` · ${C.provider}`:""]},C.id))})}),i.jsx(ss,{id:"settings-effort",label:"默认推理强度",description:"模型不支持的强度会由 Host 拒绝,不会静默降级。",field:S,dirty:o.includes("defaults.effort"),onReset:()=>h("defaults.effort"),disabled:a||d||!tn(n,S),children:i.jsx("select",{id:"settings-effort",value:r["defaults.effort"],disabled:a||d||!tn(n,S),onChange:C=>f("defaults.effort",C.target.value),children:Bv.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 Gv({document:n,value:r,dirtyKeys:o,runtimeBusy:a,saving:d,confirmAllow:f,allowAcknowledged:h,onAllowRequested:g,onAllowAcknowledged:w,onConfirmAllow:S,onCancelAllow:T,onSet:C,onReset:M}){const $=m.useRef(null),F=m.useRef(null),D=n.sections.permissions.toolConfirmation,W=d||a||!tn(n,D);return m.useEffect(()=>{f&&F.current?.focus()},[f]),i.jsxs(Do,{heading:"权限",detail:"默认确认策略不改变工作区边界、硬拒绝和高风险保护。",children:[a?i.jsx(ep,{}):null,i.jsx(ss,{id:"settings-tool-confirmation",label:"工具确认",description:"Ask 逐次询问;Deny 默认拒绝;Allow 仍受 Host 安全策略约束。",field:D,labelControl:!1,dirty:o.includes("permissions.toolConfirmation"),onReset:M,disabled:W,children:i.jsxs("fieldset",{id:"settings-tool-confirmation",className:"segmented-field",disabled:W,children:[i.jsx("legend",{className:"sr-only",children:"默认工具确认策略"}),["ask","allow","deny"].map(Z=>i.jsxs("label",{children:[i.jsx("input",{ref:Z==="allow"?$:void 0,type:"radio",name:"settings-permission",value:Z,checked:r===Z,onChange:()=>Z==="allow"?g():C(Z)}),i.jsx("span",{children:Z==="ask"?"Ask":Z==="allow"?"Allow":"Deny"})]},Z))]})}),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:F,type:"checkbox",checked:h,onChange:Z=>w(Z.target.checked)}),i.jsx("span",{children:"我理解这会扩大默认授权范围"})]}),i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{T(),requestAnimationFrame(()=>$.current?.focus())},children:"保持当前策略"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!h,onClick:S,children:"启用 Allow"})]})]}):null,i.jsx("p",{className:"settings-help",children:"Agent 的 BUILD / PLAN / AUTO 模式与工具确认策略互相独立。"})]})}function Qv({state:n,document:r,documentAction:o,onOpenDocument:a,onRefresh:d}){return i.jsxs(Do,{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:Zn(r.diagnostic.code)}),i.jsx("p",{children:Zn(r.diagnostic.message)})]})]}):null,i.jsxs("dl",{className:"settings-facts",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"状态"}),i.jsx("dd",{children:iy(r.state)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"工作区"}),i.jsx("dd",{title:"仅显示目录名",children:Hf(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:rf(r.revision)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Last good"}),i.jsx("dd",{children:n.settingsMirror.lastGood?rf(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:sy(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(nf,{title:"Skills",count:n.skills.length,names:n.skills.map(f=>f.name)}),i.jsx(nf,{title:"MCP",count:n.mcpServers.length,names:n.mcpServers.map(f=>f.name)})]})]})]})}function Yv({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 Do({heading:n,detail:r,children:o}){return i.jsxs("section",{className:"settings-section","aria-labelledby":`settings-${sf(n)}-heading`,children:[i.jsxs("header",{className:"settings-section-heading",children:[i.jsx("h3",{id:`settings-${sf(n)}-heading`,children:n}),i.jsx("p",{children:r})]}),i.jsx("div",{className:"settings-section-fields",children:o})]})}function ss({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:Zv(a.source)}),i.jsx("span",{children:ey(a.scope)}),i.jsx("span",{children:ty(a.applies)}),f?i.jsx("strong",{children:"草稿"}):null]}),a.blockedReason?i.jsx("small",{className:"settings-blocked-reason",children:ny(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 Xv({draft:n,onAdopt:r,onRebase:o}){const a=zv(n),d=Sr(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:ry(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 ep({detail:n="当前回合正在运行;相关设置会在 Runtime 空闲后解锁。"}={}){return i.jsxs("div",{className:"settings-busy",role:"status",children:[i.jsx(Q,{name:"activity",size:15})," ",n]})}function nf({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 Jv(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 Zv(n){return`来源:${n==="internal"?"内置":n==="model"?"模型":n==="global"?"全局":n==="project"?"项目":"会话"}`}function ey(n){return`作用域:${n==="global"?"全局":n==="project"?"项目":"会话"}`}function ty(n){return`生效:${n==="live"?"立即":n==="next-logical-request"?"下次请求":n==="new-session"?"新会话":"重启后"}`}function ny(n){return n==="runtime_busy"?"Runtime 正在运行,暂不可修改。":n==="read_only"?"此字段来自只读配置。":"设置文档无效,修复前不可修改。"}function ry(n){return n==="appearance.style"?"视觉风格":n==="appearance.theme"?"主题":n==="appearance.motion"?"动效":n==="defaults.model"?"默认模型":n==="defaults.effort"?"默认推理强度":"工具确认"}function sy(n){return n==="environment"?"环境提供":n==="legacy"?"Host 旧配置":"未配置"}function iy(n){return n==="ready"?"可用":n==="invalid"?"无效":n==="read-only"?"只读":"不可用"}function rf(n){return n.length>24?`${n.slice(0,20)}…`:n}function sf(n){return n.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").toLowerCase()||"section"}function of(){return typeof document>"u"?null:document.activeElement}const oy=["导航","面板","编辑","浮层"],tp=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 ly(){if(typeof navigator>"u")return!1;const n=navigator.platform??"";return/mac|iphone|ipad|ipod/i.test(n)||/Mac/i.test(navigator.userAgent??"")}function ay(n,r=ly()){return n.map(a=>a==="Mod"?r?"⌘":"Ctrl":a==="Shift"?r?"⇧":"Shift":a==="Alt"?r?"⌥":"Alt":a.toUpperCase()).join(r?" ":"+")}function bo(n,r){let o=!1,a=!1,d=!1,f=null;for(const S of r)S==="Mod"?o=!0:S==="Shift"?a=!0:S==="Alt"?d=!0:f=S;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 _o(n){return tp.find(r=>r.id===n)}function cy(){return oy.map(n=>({group:n,items:tp.filter(r=>r.group===n)})).filter(n=>n.items.length>0)}function uy({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=cy();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:ay(w.tokens)})})]},w.id))})]},h))}),i.jsx("footer",{className:"shortcut-help-footer",children:i.jsxs("p",{children:["按 ",i.jsx("kbd",{children:"Esc"})," 关闭本面板,焦点会回到打开它的位置。"]})})]})}const dy="modulepreload",fy=function(n){return"/"+n},lf={},Lo=function(r,o,a){let d=Promise.resolve();if(o&&o.length>0){let w=function(S){return Promise.all(S.map(T=>Promise.resolve(T).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(S=>{if(S=fy(S),S in lf)return;lf[S]=!0;const T=S.endsWith(".css"),C=T?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${S}"]${C}`))return;const M=document.createElement("link");if(M.rel=T?"stylesheet":dy,T||(M.as="script"),M.crossOrigin="",M.href=S,g&&M.setAttribute("nonce",g),document.head.appendChild(M),T)return new Promise(($,F)=>{M.addEventListener("load",$),M.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${S}`)))})}))}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)})},vr=[{id:"goal",label:"Goal",icon:"goal"},{id:"activity",label:"活动",icon:"activity"},{id:"integrations",label:"能力",icon:"branch"},{id:"diagnostics",label:"诊断",icon:"diagnostics"}];function py({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=vr.findIndex(S=>S.id===o),w=h.key==="Home"?0:h.key==="End"?vr.length-1:(g+(h.key==="ArrowRight"?1:-1)+vr.length)%vr.length;a(vr[w].id),requestAnimationFrame(()=>document.getElementById(`${d}-tab-${vr[w].id}`)?.focus())};return i.jsxs("div",{className:"agent-panel",children:[i.jsx("div",{className:"inspector-tabs",role:"tablist","aria-label":"详情类别",onKeyDown:f,children:vr.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(hy,{state:n,actions:r}):null,o==="activity"?i.jsx(gy,{state:n,actions:r}):null,o==="integrations"?i.jsx(xy,{state:n,actions:r}):null,o==="diagnostics"?i.jsx(wy,{state:n,actions:r}):null]})]})}function hy({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"||!jr(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(my,{onCreate:g=>r.controlGoal("create",g),disabled:f||!n.activeSessionId}),i.jsx(af,{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:[cf(o.tokensUsed),o.tokenBudget?` / ${cf(o.tokenBudget)}`:""]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"用时"}),i.jsx("dd",{children:jy(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(af,{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:Sy(g.timestamp)})]})]},`${g.timestamp}-${w}`))})]}):null]})}function my({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 af({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(Gs,{children:r}):i.jsx("p",{className:"muted-copy",children:"还没有保存的计划。切换到 PLAN 模式后提交任务,Runtime 会生成并保存计划。"})]})}function gy({state:n,actions:r}){const o=m.useMemo(()=>n.tools.filter(a=>ky(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(vy,{tool:a},a.callId))}):i.jsx(wo,{text:"还没有工具活动"})]}),i.jsx(yy,{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:np(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(wo,{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(wo,{text:"还没有子代理或研究活动"}):null]})]})}function vy({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 yy({state:n,actions:r}){const[o,a]=m.useState(""),[d,f]=m.useState(""),[h,g]=m.useState(),[w,S]=m.useState(0),[T,C]=m.useState(!1),[M,$]=m.useState("");m.useEffect(()=>{a(""),f(""),g(void 0),$("")},[n.activeSessionId]);const F=async(D,W=0)=>{C(!0),$("");try{const Z=await r.readToolDetail(D,W);a(D),f(L=>W===0?Z.content:`${L}${Z.content}`),g(Z.nextOffsetBytes),S(Z.totalBytes)}catch(Z){$(Z instanceof Error?Z.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(D=>i.jsxs("button",{type:"button",className:o&&D.artifactId===o?"active":"",disabled:!D.artifactId||T,onClick:()=>D.artifactId&&void F(D.artifactId),children:[i.jsxs("span",{children:[i.jsx("strong",{children:D.toolName}),i.jsxs("small",{children:["#",D.sequence," · ",uf(D.outputBytes)]})]}),i.jsx(Q,{name:"chevron",size:13})]},`${D.callId}:${D.sequence}`))}):i.jsx(wo,{text:"没有可读取的持久化输出"}),n.toolDetailNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{r.loadMoreToolDetails()},disabled:!!n.pendingAction,children:"加载更多输出记录"}):null,M?i.jsx("p",{className:"field-error",role:"alert",children:M}):null,o?i.jsxs("div",{className:"detail-output",children:[i.jsxs("div",{children:[i.jsxs("span",{children:[uf(w)," · 已脱敏"]}),i.jsx("code",{children:o})]}),i.jsx("pre",{tabIndex:0,children:Zn(d)}),h!==void 0?i.jsx("button",{type:"button",className:"secondary-button",disabled:T,onClick:()=>{F(o,h)},children:T?"读取中…":"加载更多"}):null]}):null]})}function xy({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 wy({state:n,actions:r}){const o=n.diagnostics,a=Ro(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:Cy(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:np(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(ho,{title:"Context usage",value:o.contextUsage}):null,o?.tokenUsage?i.jsx(ho,{title:"Token usage",value:o.tokenUsage}):null,o?.harness?i.jsx(ho,{title:"Harness",value:o.harness}):null,n.loopStats?i.jsx(ho,{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 ho({title:n,value:r}){return i.jsxs("details",{className:"json-section",children:[i.jsx("summary",{children:n}),i.jsx("pre",{tabIndex:0,children:qa(r,12e3)})]})}function wo({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 ky(n){return/write|edit|patch|delete|move|rename|mkdir|create/i.test(n.name)}function np(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function cf(n){return new Intl.NumberFormat("zh-CN",{notation:n>99999?"compact":"standard"}).format(n)}function jy(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 uf(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function Sy(n){const r=Date.parse(n);return Number.isFinite(r)?new Date(r).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""}function Cy(n){return n==="live"?"本地 Web Host 连接正常":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重新连接本地 Web Host"}function Ny({width:n,onPreview:r,onCommit:o,maxWidth:a=Lf}){return i.jsx($f,{side:"right",className:"work-panel-resize-handle",minWidth:Ha,maxWidth:a,defaultWidth:Va,label:"拖动或按方向键调整工作面板宽度",width:n,controls:"work-panel-detail",onPreview:r,onCommit:o})}const by=["agent","review","terminal","files","git"],_y=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"}}),Iy=new Map(by.map(n=>{const r=_y[n];return[n,Object.freeze({id:n,label:r.label,icon:r.icon,kind:r.kind})]})),Ey=m.lazy(()=>Lo(()=>import("./TerminalPanel-Cz0ohyPm.js"),__vite__mapDeps([0,1])).then(n=>({default:n.TerminalPanel}))),Py=m.lazy(()=>Lo(()=>import("./FilesPanel-dW61EHHn.js"),__vite__mapDeps([2,3])).then(n=>({default:n.FilesPanel}))),Ry=m.lazy(()=>Lo(()=>import("./GitPanel-ykbaVNlo.js"),__vite__mapDeps([4,3,5])).then(n=>({default:n.GitPanel}))),Ty=m.lazy(()=>Lo(()=>import("./ReviewPanel-1oqfaqoh.js"),__vite__mapDeps([6,3,5])).then(n=>({default:n.ReviewPanel}))),My=["focus-work-panel-1","focus-work-panel-2","focus-work-panel-3","focus-work-panel-4","focus-work-panel-5"],mo=Object.freeze(Object.fromEntries([...Iy].map(([n,r])=>[n,{label:r.label,icon:r.icon}]))),Oy=new Set(["starting","running","stopping","queued","waiting_approval","interrupted","failed"]);function Ay(n,r){return n?Oy.has(n)?n==="failed"||n==="interrupted"?"failed":n==="queued"||n==="waiting_approval"?"queued":"running":null:r?"running":null}function $y({state:n,actions:r,mode:o,expanded:a,activePanel:d,panelOrder:f,agentPanel:h,onExpand:g,onCollapse:w,onPanelChange:S,onAgentPanelChange:T,onWidthPreview:C,onWidthCommit:M,width:$,maxWidthPx:F,onSendToComposer:D,resourceNavigatorWidths:W,onResourceNavigatorWidthCommit:Z}){const L=m.useRef(null),pe=m.useRef(null),te=m.useRef(null),ee=m.useRef(a),N=m.useId(),z=m.useRef(new Set([d]));z.current.add(d);const re=m.useRef(d==="terminal"||z.current.has("terminal"));d==="terminal"&&(re.current=!0);const[je,ye]=m.useState(!1),Y=f&&f.length===Ra.length?f:Ra,fe=n.workspaceResourceEpochs[n.workspaceId]??{files:0,git:0,review:0},se=n.sessionRuntimeById[n.activeSessionId??""]?.phase,Ce=Ay(se,n.processing);m.useEffect(()=>{if(o!=="overlay"||!a)return;let R=0,y=0;const O=()=>{R+=1,pe.current?.focus(),(document.activeElement===pe.current||R>=10)&&window.clearInterval(y)};return y=window.setInterval(O,16),O(),()=>window.clearInterval(y)},[a,o]),m.useEffect(()=>{const R=ee.current;if(ee.current=a,!(o!=="dock"||R===a)){if(!a){requestAnimationFrame(()=>L.current?.querySelector(`[data-work-panel-id="${d}"]`)?.focus());return}je&&(ye(!1),requestAnimationFrame(()=>te.current?.focus()))}},[d,a,o,je]),m.useEffect(()=>{const R=_o("toggle-work-panel"),y=O=>{if(R&&bo(O,R.tokens)){O.preventDefault(),a?w():(ye(!0),g());return}const A=My.findIndex(we=>{const xe=_o(we);return xe?bo(O,xe.tokens):!1}),ne=Y[A];ne&&(O.preventDefault(),!(a&&d===ne)&&(S(ne),a||g()))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,o,w,g,S]);const G=R=>{if(R.key==="Escape"&&a&&!R.target.closest('[role="alertdialog"], .terminal-host, input, textarea, [contenteditable]')){R.preventDefault(),w();return}if(o!=="overlay"||!a||R.key!=="Tab")return;const y=Dy(L.current);if(!y.length){R.preventDefault(),L.current?.focus();return}const O=y.indexOf(document.activeElement);R.shiftKey&&O<=0?(R.preventDefault(),y.at(-1)?.focus()):!R.shiftKey&&(O<0||O===y.length-1)&&(R.preventDefault(),y[0].focus())},ve=R=>{if(o==="overlay"){S(R),a||(ye(!0),g());return}if(a&&d===R){w();return}a||ye(!0),S(R),g()},X=(R=!1)=>i.jsx("nav",{className:R?"work-panel-rail work-panel-rail-overlay":"work-panel-rail","aria-label":"工作面板快捷入口","aria-orientation":R?"horizontal":"vertical",children:Y.map((y,O)=>{const A=mo[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} · ⌘⇧${O+1}`,onClick:()=>ve(y),children:[i.jsx(Q,{name:A.icon,size:17}),y==="terminal"&&Ce?i.jsx(Ka,{state:Ce,className:"rail-status-dot",describe:!1}):null]},y)})}),E=R=>i.jsxs("div",{id:`${N}-${R}`,className:"work-panel-pane",role:"tabpanel","aria-label":mo[R].label,hidden:R!==d,children:[R==="agent"?i.jsx(py,{state:n,actions:r,tab:h,onTabChange:T}):null,R==="review"?i.jsx(Ty,{workspaceId:n.workspaceId,refreshEpoch:fe.review,actions:r,onSendToComposer:D,navigatorWidthPx:W.review,onNavigatorWidthCommit:y=>Z("review",y)}):null,R==="terminal"?i.jsx(Ey,{workspaceId:n.workspaceId,workspacePath:n.workspace,styleNonce:n.bootstrap?.nonce??"",available:!!n.bootstrap?.capabilities.terminal,actions:r}):null,R==="files"?i.jsx(Py,{workspaceId:n.workspaceId,refreshEpoch:fe.files,actions:r,navigatorWidthPx:W.files,onNavigatorWidthCommit:y=>Z("files",y)}):null,R==="git"?i.jsx(Ry,{workspaceId:n.workspaceId,refreshEpoch:fe.git,actions:r,onSendToComposer:D,navigatorWidthPx:W.git,onNavigatorWidthCommit:y=>Z("git",y)}):null]},R),H=d==="terminal"||!re.current?[d]:[d,"terminal"];return i.jsxs("aside",{ref:L,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:G,children:[o==="dock"?i.jsxs("div",{className:"work-panel-dock-body",children:[a?i.jsxs("section",{ref:te,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:mo[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:H.map(R=>E(R))})})]}):null,X()]}):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:mo[d].label})]}),i.jsx("div",{className:"work-panel-header-actions",children:i.jsx("button",{ref:pe,type:"button",className:"icon-button",onClick:w,"aria-label":"关闭工作面板","aria-controls":"work-panel-detail","aria-expanded":"true",children:i.jsx(Q,{name:"close"})})})]}),X(!0),i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:H.map(R=>E(R))})})]}),o==="dock"&&a?i.jsx(Ny,{width:$,maxWidth:F,onPreview:C,onCommit:M}):null]})}function Dy(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 rp="orion.web.right-workspace.v3",Io=4,ko=300,sp=160,ip=420,Ly=280,zy=["files","git","review"],Eo=Object.freeze({files:ko,git:ko,review:ko});function op(n){return Number.isFinite(n)?Math.min(ip,Math.max(sp,Math.round(n))):ko}function Fx(n){const r=Number.isFinite(n)?n:0,o=Math.min(ip,r*.48,r-Ly);return Math.max(sp,Math.floor(o))}const lp=Object.freeze({expanded:!0,activePanel:"agent",detailWidthPx:560,taskSubview:"overview",resourceNavigatorWidthPx:Eo}),Wy=lp;function df(){return Object.freeze({schemaVersion:Io,projectNavigation:Object.freeze({expanded:!0,widthPx:280}),workPanel:Object.freeze({byWorkspace:Object.freeze({}),fallback:Wy})})}function Fy(n){const r=Ya(n.agentPanel);return Object.freeze({expanded:n.expanded!==!1,activePanel:Xs(n.activePanel)?n.activePanel:"agent",detailWidthPx:Math.max(320,Ys(Number.isFinite(n.widthPx)?Number(n.widthPx)-Xe:560)),taskSubview:r,resourceNavigatorWidthPx:Eo})}function By(n,r){return n.workPanel.byWorkspace[r]??n.workPanel.fallback}function ap(n,r,o){const a=n.workPanel.byWorkspace[r]??n.workPanel.fallback,d=Object.freeze({...a,...o,resourceNavigatorWidthPx:o.resourceNavigatorWidthPx??a.resourceNavigatorWidthPx}),f={schemaVersion:Io,projectNavigation:n.projectNavigation,workPanel:{...n.workPanel,byWorkspace:Object.freeze({...n.workPanel.byWorkspace,[r]:d})}};return Object.freeze(f)}function qy(n,r,o,a){const d=By(n,r);return ap(n,r,{...d,resourceNavigatorWidthPx:Object.freeze({...d.resourceNavigatorWidthPx,[o]:op(a)})})}function Uy(n){if(!n)return null;try{const r=JSON.parse(n);if(!xr(r))return null;const o=r.schemaVersion;if(o!==3&&o!==Io)return null;const a=xr(r.projectNavigation)?r.projectNavigation:{},d=xr(r.workPanel)?r.workPanel:{},f=xr(d.byWorkspace)?d.byWorkspace:{},h=xr(d.fallback)?d.fallback:{},g={};for(const[w,S]of Object.entries(f))xr(S)&&(g[w]=ff(S));return Object.freeze({schemaVersion:Io,projectNavigation:Object.freeze({expanded:a.expanded!==!1,widthPx:Ys(Number(a.widthPx)||280)}),workPanel:Object.freeze({byWorkspace:Object.freeze(g),fallback:ff(h)})})}catch{return null}}function ff(n){return Object.freeze({expanded:n.expanded!==!1,activePanel:Xs(n.activePanel)?n.activePanel:"agent",detailWidthPx:cp(Number(n.detailWidthPx)),taskSubview:Ya(n.taskSubview),resourceNavigatorWidthPx:Hy(n.resourceNavigatorWidthPx)})}function Hy(n){if(!xr(n))return Eo;const r={...Eo};for(const o of zy){const a=Number(n[o]);Number.isFinite(a)&&(r[o]=op(a))}return Object.freeze(r)}function cp(n){return Number.isFinite(n)?Math.min(3200,Math.max(360,Math.round(n))):lp.detailWidthPx}function Ya(n){const r=String(n);return r==="goal"||r==="overview"?"overview":r==="activity"?"activity":r==="integrations"||r==="capabilities"?"capabilities":r==="diagnostics"?"diagnostics":"overview"}function Vy(n){switch(n){case"overview":return"goal";case"activity":return"activity";case"capabilities":return"integrations";case"diagnostics":return"diagnostics"}}function xr(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Ky(n){return["agent","review","terminal","files","git"].includes(n)}function Gy(){const n=globalThis;try{return Uy(n.window?.localStorage.getItem(rp)??null)}catch{return null}}function pf(n){const r=globalThis;try{r.window?.localStorage.setItem(rp,JSON.stringify(n))}catch{}}function Qy(n,r){const[o,a]=m.useState(Gy),d=n??"__fallback__",f=m.useMemo(()=>Fy(r),[]),h=m.useMemo(()=>{const S=o?.workPanel.byWorkspace[d]??o?.workPanel.fallback??f;return{workspaceId:d,expanded:S.expanded,activePanel:Ky(S.activePanel)?S.activePanel:"agent",agentPanel:Vy(S.taskSubview),detailWidthPx:S.detailWidthPx,resourceNavigatorWidthPx:S.resourceNavigatorWidthPx}},[o,d,f]),g=m.useCallback(S=>{a(T=>{const C=T??df(),M=C.workPanel.byWorkspace[d]??C.workPanel.fallback??f,$={expanded:S.expanded??M.expanded,activePanel:S.activePanel??M.activePanel,detailWidthPx:S.detailWidthPx??M.detailWidthPx,taskSubview:S.agentPanel?Ya(S.agentPanel):M.taskSubview,resourceNavigatorWidthPx:M.resourceNavigatorWidthPx},F=ap(C,d,$);return pf(F),F})},[d,f]),w=m.useCallback((S,T)=>{a(C=>{const M=C??df(),$=qy(M,d,S,T);return pf($),$})},[d]);return{value:h,update:g,setResourceNavigatorWidth:w}}const Xa=320,hf=360,Yy=1024,Xy=768,Jy=.8;function up(n){return Number.isFinite(n)&&n>0?Math.round(n):1440}function dp(n){const r=Math.floor(n*Jy),o=n-Xa-Xe;return Math.max(0,Math.min(r,o))}function mf(n){const r=up(n.containerWidth),o=Math.max(0,Math.round(n.leftWidthPx)),a=Math.max(0,r-o);if(r<Xy)return Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(r<Yy)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:Xe,conversationWidthPx:a-Xe,canResize:!1});const d=dp(a);if(d<hf)return Object.freeze({mode:"rail",detailWidthPx:Xe,conversationWidthPx:a-Xe,canResize:!1});const f=Math.max(hf,Math.min(cp(n.storedDetailWidthPx),d)),h=a-f-Xe;return h<Xa?Object.freeze({mode:"rail",detailWidthPx:Xe,conversationWidthPx:a-Xe,canResize:!1}):Object.freeze({mode:"dock",detailWidthPx:f,conversationWidthPx:h,canResize:d>f})}function gf(n){const r=up(n.containerWidth),o=n.navigationExpanded?Math.max(240,Math.min(480,Math.round(n.navigationWidthPx))):Xe;let a=mf({containerWidth:r,leftWidthPx:o,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});const d=mf({containerWidth:r,leftWidthPx:Xe,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});return n.navigationExpanded&&(a.mode==="dock"&&a.conversationWidthPx<Xa||a.mode!=="dock"&&d.mode==="dock")?(a=d,Object.freeze({projectNavigation:Object.freeze({mode:"rail",widthPx:Xe}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Xe: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+Xe:a.detailWidthPx})})}function Zy(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 Po=1e4,ex=256,tx=256,nx=128,rx=8,fp=8*1024*1024,sx=64;function ix(n=Of,r){switch(r.type){case"baseline_loaded":{const o=n.workspaceId!==r.bootstrap.workspaceId||n.activeSessionId!==r.bootstrap.activeSessionId?Qs(n):n,a=Nf(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:hx()?"reconnecting":"offline",announcement:`启动失败:${r.message}`};case"connection_changed":return n.connection==="replay-required"?n:{...n,connection:r.phase,connectionAttempt:r.attempt,announcement:mx(r.phase,r.attempt)};case"event_received":return ox(n,r.envelope);case"session_snapshot_started":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:go(Hs(n,r.sessionId,{status:r.cached?"refreshing":"loading",requestId:r.requestId}),{snapshotLoads:1});case"session_snapshot_loaded":{const o=r.snapshot.session.id;return!Cf(n,r.contextRevision,r.workspaceId)||!Sf(n,o,r.requestId)?n:n.activeSessionId!==o?r.requestId===void 0?n:jf(yf(n,r.snapshot),o):jf(vf(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:pp(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?yf(n,r.snapshot):r.snapshot.runtime.active!==!0?n:cx(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=hp(r.snapshot).filter(d=>!o.has(d.id));return{...n,transcript:[...a,...n.transcript].sort((d,f)=>d.order-f.order).slice(-Po),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 wf(n,a=>ux(a,r.session));case"session_archived":{const o=xf(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=wf(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],{...xf(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:Nf(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(!Cf(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(!Sf(n,r.sessionId,r.requestId)||r.sessionId!==n.activeSessionId&&r.requestId===void 0)return n;const o=go(Hs(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=vf({...n,activeSessionId:g},n.sessionProjectionById[g],!1);return go({...Hs(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={...Qs(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?Hs(f,r.activeSessionId,{status:"loading",requestId:n.sessionSync[r.activeSessionId]?.requestId??null}):f;return go(h,d)}case"recovering":return{...n,connection:"connecting",replayReason:void 0,notice:null,announcement:"正在重新加载会话状态"}}}function ox(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?Qs(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:pp(o,a)}if(r.type==="session_runtime_changed"){const a=r.payload.runtime,d=o.sessionProjectionById[a.sessionId],f=Wo(o.sessionRuntimeById,a),h=d?zo(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:Fa(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"?lx(o,r.payload.value):ax(o,r.payload.value,r.eventId,r.cursor,r.timestamp)}function lx(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 ax(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:jo(n.transcript,f,Po)}}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(-Po).map((h,g)=>({...h,eventId:`${o}:${g}`,order:a-1+(g+1)/(f+1),receivedAt:d,live:!1}))}}case"transcript_clear":return{...Qs(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:Fa(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:Fa(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:jo(n.edits,f,ex)}}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:jo(n.traces,r.event,tx)};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:fx(n.research,r.event,o,a,d)};case"goal_event":return dx(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 vf(n,r,o=!0){const a=hp(r).slice(-Po),d=gp(r.runtime.agentMode)?r.runtime.agentMode:n.mode.baseMode,f=r.pendingApprovals[0],h=mp(r.goal);return{...Qs(n),lastCursor:o?Math.max(n.lastCursor,r.eventCursor):n.lastCursor,activeSessionId:r.session.id,sessionProjectionById:zo(n.sessionProjectionById,r),sessionRuntimeById:Wo(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 yf(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:zo(n.sessionProjectionById,r),sessionRuntimeById:Wo(n.sessionRuntimeById,r.sessionRuntime),sessions:er(n.sessions,r.session),workspaceSessions:o}}function pp(n,r){const o=n.sessionProjectionById[r.sessionId],a=o?zo(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:Wo(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 cx(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:mp(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 hp(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:px(r.timestamp),live:!1}})}function mp(n){if(!n||!qs(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=qs(r.budget)?r.budget:null,a=qs(r.lastStopDecision)?r.lastStopDecision:null,d=a&&qs(a.reason)?vo(a.reason.message):vo(r.stopReason),f=qs(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:Ea(r.tokenBudget)??Ea(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:Ea(r.planRevision),planPhase:vo(r.planPhase),nextAction:vo(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 ux(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 xf(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 wf(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 dx(n,r,o){switch(r.type){case"goal_updated":case"goal_restored":return{...n,goal:r.goal,goalActivity:Zr(n.goalActivity,r.type,"Goal 状态已更新",o)};case"goal_completed":return{...n,goal:r.goal,goalActivity:Zr(n.goalActivity,r.type,r.audit.verificationSummary,o),announcement:"Goal 已完成并通过运行时审计"};case"goal_cleared":return{...n,goal:null,goalEvidence:[],goalActivity:Zr(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:Zr(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:Zr(n.goalActivity,`${r.type}:${r.phase}`,r.reason,o)};case"goal_audit_failed":return{...n,goalActivity:Zr(n.goalActivity,r.type,r.summary,o),notice:{id:Date.parse(o),tone:"warning",title:"Goal 审计尚未通过",detail:r.summary}}}}function fx(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(S=>S.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 Fa(n,r){return[...n.filter(o=>o.callId!==r.callId),r].sort((o,a)=>o.order-a.order).slice(-1e3)}function zo(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+kf(f),0);for(;o.length>1&&(o.length>rx||a>fp);){const d=o.shift();d&&(a-=kf(d[1]))}return Object.freeze(Object.fromEntries(o))}function Wo(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 kf(n){try{return JSON.stringify(n).length*2}catch{return fp}}function Qs(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 Hs(n,r,o){const a={...n.sessionSync};delete a[r],a[r]=o;const d=Object.keys(a).length-sx;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 go(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 jf(n,r){const o=Hs(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 Sf(n,r,o){return o===void 0||n.sessionSync[r]?.requestId===o}function Cf(n,r,o){return(r===void 0||n.contextRevision===r)&&(o===void 0||n.workspaceId===o)}function Zr(n,r,o,a){return jo(n,{type:r,message:o,timestamp:a},nx)}function jo(n,r,o){const a=[...n,r];return a.length<=o?a:a.slice(a.length-o)}function Nf(n,r){const o=n.agentMode;return gp(o)?{baseMode:o,pendingBaseMode:null}:r}function gp(n){return n==="interactive"||n==="plan"||n==="auto"}function px(n){const r=new Date(n);return Number.isFinite(r.getTime())?r.toISOString():new Date(0).toISOString()}function qs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function en(n,r=0){return typeof n=="number"&&Number.isFinite(n)?n:r}function Ea(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function vo(n){return typeof n=="string"&&n?n:void 0}function hx(){return typeof navigator>"u"||navigator.onLine}function mx(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 bf="orion.web.theme",_f="orion.web.motion";function gx(n){const r=Ef(bf),o=Ef(_f),a=vx(r),d=yx(o),f=[],h=[];return r!==null&&h.push(bf),o!==null&&h.push(_f),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 If(n){if(!(typeof window>"u"))for(const r of n)try{window.localStorage.removeItem(r)}catch{}}function Ef(n){if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}}function vx(n){return n==="system"||n==="light"||n==="dark"?n:null}function yx(n){return n==="system"||n==="reduced"?n:null}class xx{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 wx(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 kx=7,jx=2;function Sx(){const n=m.useMemo(()=>new Og,[]),r=m.useMemo(()=>new xx(()=>n.settings()),[n]),[o,a]=m.useReducer(ix,Of),[d,f]=m.useState(0),h=m.useRef(o),g=m.useRef(null),w=m.useRef(0),S=m.useRef(0),T=m.useRef(new Map),C=m.useRef(0),M=m.useRef(0),$=m.useRef(new Map),F=m.useRef(()=>{}),D=m.useRef(!1);h.current=o,m.useEffect(()=>r.subscribe(()=>{a({type:"settings_mirror_changed",snapshot:r.getSnapshot()})}),[r]);const W=m.useCallback((j,b=Re(h.current),B={})=>{const le=`${b.workspaceId}:${b.expectedContextRevision}:${j}`,ae=$.current.get(le);if(ae&&!B.force)return ae.promise;const Ae=++M.current;a({type:"session_snapshot_started",sessionId:j,requestId:Ae,cached:!!h.current.sessionProjectionById[j],contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId});const Le=n.sessionSnapshot(j,b).then(et=>(Pf(et,j,b),a({type:"session_snapshot_loaded",snapshot:et,requestId:Ae,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId,advanceEventCursor:g.current===null}),et)).catch(et=>{const It=ts(et);throw a({type:"snapshot_failed",sessionId:j,detail:It,requestId:Ae,contextRevision:b.expectedContextRevision,workspaceId:b.workspaceId}),new Ie(It,et instanceof Ie?et.status:503,"session_snapshot_sync_failed",et instanceof Ie?et.type:void 0)}).finally(()=>{$.current.get(le)?.requestId===Ae&&$.current.delete(le)});return $.current.set(le,{requestId:Ae,promise:Le}),Le},[n]),Z=m.useCallback(async()=>{const j=++S.current;try{const b=await n.bootstrap(),B={expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId};r.reset(),r.accept(b.settings);const[le,ae,Ae]=await Promise.all([n.listWorkspaces(B),n.listSessions(B),r.refresh()]),Le=Nx(b.workspaceId,ae.sessions,b.activeSessionId);Us(b.workspaceId,Le);const et=Object.freeze({...b,activeSessionId:Le}),It=Le?await n.sessionSnapshot(Le,B).then(tt=>(Pf(tt,Le,B),{snapshot:tt,error:void 0})).catch(tt=>({snapshot:null,error:tt})):{snapshot:null,error:void 0},Ir=await Cx(n,r,Ae.document??Ae.lastGood??b.settings,B);if(j!==S.current)return;a({type:"baseline_loaded",bootstrap:et,workspaces:le,sessions:ae.sessions,sessionNextCursor:ae.nextCursor,diagnostics:{},settings:Ir,skills:[],skillNextCursor:null,mcpServers:[],mcpNextCursor:null,toolDetails:[],toolDetailNextCursor:null}),It.snapshot&&a({type:"session_snapshot_loaded",snapshot:It.snapshot,contextRevision:B.expectedContextRevision,workspaceId:B.workspaceId}),It.error&&a({type:"snapshot_failed",sessionId:Le,detail:ts(It.error),contextRevision:B.expectedContextRevision,workspaceId:B.workspaceId}),F.current();const Er=ae.sessions.map(tt=>tt.id).filter(tt=>tt!==Le).slice(0,kx);F.current=Tx(()=>{j===S.current&&Mx(Er,jx,async tt=>{j===S.current&&await W(tt,B).catch(()=>{})})}),n.workspaceProjectSummary(b.workspaceId,B).then(tt=>{j===S.current&&a({type:"workspace_project_summary_loaded",summary:tt})}).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(([tt,Zs,ei,ti])=>{j===S.current&&(a({type:"diagnostics_loaded",diagnostics:tt}),a({type:"capabilities_loaded",skills:Zs.skills,skillNextCursor:Zs.nextCursor,mcpServers:ei.servers,mcpNextCursor:ei.nextCursor}),a({type:"tool_details_loaded",details:ti.details,nextCursor:ti.nextCursor}))})}catch(b){throw b}},[n,W,r]),L=m.useCallback(async()=>{let j;for(let b=0;b<3;b+=1)try{await Z();return}catch(B){if(j=B,!Px(B)||b===2)break;await Rx(100*3**b)}throw a({type:"boot_failed",message:ts(j)}),j},[Z]);m.useEffect(()=>{if(D.current)return;D.current=!0;let j=!0;return L().catch(()=>{}),()=>{j=!1}},[L]),m.useEffect(()=>()=>{F.current()},[]);const pe=o.bootstrap!==null;m.useEffect(()=>{if(!pe)return;const j=n.connectEvents({cursor:h.current.lastCursor,onEvent:b=>{if(a({type:"event_received",envelope:b}),Ox(b)){const B=h.current;if(b.sessionId&&B.contextRevision&&B.workspaceId){const le=b.sessionId,ae=++C.current;T.current.set(le,ae);const Ae=B.contextRevision,Le=B.workspaceId;n.sessionSnapshot(le,{expectedContextRevision:Ae,workspaceId:Le}).then(et=>{T.current.get(le)===ae&&a({type:"durable_session_metadata_loaded",snapshot:et,contextRevision:Ae,workspaceId:Le})}).catch(()=>{}).finally(()=>{T.current.get(le)===ae&&T.current.delete(le)})}}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=j,()=>{j.close(),g.current===j&&(g.current=null)}},[n,pe,r,d]);const te=m.useCallback(()=>{g.current?.close(),g.current=null},[]),ee=m.useCallback(()=>{f(j=>j+1)},[]);m.useEffect(()=>{!o.workspace||o.boot!=="ready"||o.pendingAction||o.bootstrap?.workspace!==o.workspace&&(te(),L().catch(j=>Tf(a,"工作区刷新失败",j)).finally(ee))},[L,te,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&&W(o.activeSessionId).catch(()=>{}))},[W,o.activeSessionId,o.boot,o.bootstrap?.workspace,o.pendingAction,o.sessionSnapshot,o.workspace]);const N=m.useCallback(async(j,b)=>{const B=++w.current;a({type:"pending_action",label:j});try{return await b()}catch(le){throw Ex(le)||Tf(a,`${j}失败`,le),le}finally{w.current===B&&a({type:"pending_action",label:null})}},[]),z=m.useCallback(async(j,b)=>N(j,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 le=h.current.sessionSnapshot;if(!le||!jr(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:le.sessionRuntime.runtimeRevision});return _x(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(j,b)=>N(j,async()=>{const B=h.current,le=B.composer;if(B.connection!=="live"||!B.activeSessionId||!jr(B)||!le||le.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:le.sessionRuntime.runtimeRevision,expectedControlRevision:le.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("重新连接",L),[L,N]),ye=m.useCallback(()=>N("刷新诊断",async()=>{const j=++S.current,b=await n.diagnostics(Re(h.current));j===S.current&&a({type:"diagnostics_loaded",diagnostics:b})}),[n,N]),Y=m.useCallback(()=>N("刷新工具详情",async()=>{const j=++S.current,b=await n.toolDetails(Re(h.current));j===S.current&&a({type:"tool_details_loaded",details:b.details,nextCursor:b.nextCursor})}),[n,N]),fe=m.useCallback(()=>N("加载更多工作区",async()=>{const j=Re(h.current),b=h.current.workspaceNextCursor;if(b)try{const B=await n.listWorkspaces(j,b);a({type:"workspaces_loaded",value:B,append:!0})}catch(B){if(!yo(B))throw B;a({type:"workspaces_loaded",value:await n.listWorkspaces(j)})}}),[n,N]),se=m.useCallback(()=>N("加载更多会话",async()=>{const j=h.current.sessionNextCursor;if(!j)return;const b=Re(h.current);try{const B=await n.listSessions(b,j);a({type:"sessions_loaded",sessions:B.sessions,nextCursor:B.nextCursor,append:!0})}catch(B){if(!yo(B))throw B;const le=await n.listSessions(b);a({type:"sessions_loaded",sessions:le.sessions,nextCursor:le.nextCursor})}}),[n,N]),Ce=m.useCallback(async(j,b=!1)=>{const B=Re(h.current),le=h.current.workspaceSessions[j],ae=b?le?.nextCursor:void 0;if(b&&!ae)return;a({type:"workspace_sessions_loading",workspaceId:j});const Ae=n.workspaceProjectSummary(j,B).catch(()=>null);try{const Le=await n.listWorkspaceSessions(j,B,ae??void 0);a({type:"workspace_sessions_loaded",workspaceId:j,sessions:Le.sessions,nextCursor:Le.nextCursor,append:b});const et=await Ae;et&&a({type:"workspace_project_summary_loaded",summary:et})}catch(Le){throw a({type:"workspace_sessions_failed",workspaceId:j,detail:ts(Le)}),Le}},[n]),G=m.useCallback(async j=>{const b=await n.workspaceProjectSummary(j,Re(h.current));a({type:"workspace_project_summary_loaded",summary:b})},[n]),ve=m.useCallback(()=>N("加载更多能力",async()=>{const j=Re(h.current),b=h.current.skillNextCursor,B=h.current.mcpNextCursor;if(!(!b&&!B))try{const[le,ae]=await Promise.all([b?n.skills(j,b):Promise.resolve({skills:[],nextCursor:null}),B?n.mcp(j,B):Promise.resolve({servers:[],nextCursor:null})]);a({type:"capabilities_loaded",skills:le.skills,skillNextCursor:le.nextCursor,mcpServers:ae.servers,mcpNextCursor:ae.nextCursor,append:!0})}catch(le){if(!yo(le))throw le;const[ae,Ae]=await Promise.all([n.skills(j),n.mcp(j)]);a({type:"capabilities_loaded",skills:ae.skills,skillNextCursor:ae.nextCursor,mcpServers:Ae.servers,mcpNextCursor:Ae.nextCursor})}}),[n,N]),X=m.useCallback(()=>N("加载更多工具详情",async()=>{const j=Re(h.current),b=h.current.toolDetailNextCursor;if(b)try{const B=await n.toolDetails(j,b);a({type:"tool_details_loaded",details:B.details,nextCursor:B.nextCursor,append:!0})}catch(B){if(!yo(B))throw B;const le=await n.toolDetails(j);a({type:"tool_details_loaded",details:le.details,nextCursor:le.nextCursor})}}),[n,N]),E=m.useCallback(async()=>{const j=h.current;if(j.connection!=="replay-required"){if(!j.activeSessionId)return;await W(j.activeSessionId,Re(j),{force:!0});return}await N("恢复本地 Web Host 事件流",async()=>{te(),a({type:"recovering"});try{await L()}finally{ee()}})},[L,W,te,ee,N]),H=m.useCallback(j=>N("切换工作区",async()=>{te();try{const b=await n.activateWorkspace(j,Re(h.current));a({type:"workspaces_loaded",value:b}),a({type:"reset_session_view",activeSessionId:null}),await L()}finally{ee()}}),[n,L,te,ee,N]),R=m.useCallback(j=>{const b=h.current;if(b.activeSessionId===j&&b.sessionSnapshot&&b.sessionSync[j]?.status==="ready")return Promise.resolve();const B=Re(b);return(async()=>{Us(B.workspaceId,j),a({type:"reset_session_view",activeSessionId:j}),await W(j,B)})()},[W]),y=m.useCallback((j,b)=>j===h.current.workspaceId&&b?R(b):N("切换项目上下文",async()=>{const B=h.current,le=B.contextRevision;if(!le)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");if(j===B.workspaceId){Us(j,b),a({type:"reset_session_view",activeSessionId:b}),b&&await W(b,Re(B));return}Us(j,b),te(),++S.current;try{const ae=await n.activateContext({expectedContextRevision:le,workspaceId:j,sessionId:b});if(ae.contextRevision!==ae.bootstrap.contextRevision||ae.bootstrap.workspaceId!==j)throw new Ie("Host 返回的项目上下文不一致。",502,"context_response_invalid");a({type:"reset_session_view",activeSessionId:b}),await L()}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,L,W,te,ee,N,R]),O=m.useCallback((j,b)=>N(b?"置顶项目":"取消置顶",async()=>{await n.setWorkspacePinned(j,b,Re(h.current)),a({type:"workspaces_loaded",value:await n.listWorkspaces(Re(h.current))})}),[n,N]),A=m.useCallback(j=>N("移除项目",async()=>{const b=h.current;if(!b.contextRevision)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.removeWorkspace(j,Re(b)),sg(j),a({type:"workspaces_loaded",value:await n.listWorkspaces(Re(h.current))})}),[n,N]),ne=m.useCallback(()=>N("创建会话",async()=>{const j=Re(h.current),b=await n.createSession(j);Us(j.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 W(b.id,j)}),[n,W,N]),we=R,xe=m.useCallback(()=>N("加载更早记录",async()=>{const j=h.current.sessionSnapshot,b=h.current.activeSessionId,B=j?.transcript.nextCursor;if(!(!j||!b||!B))try{const le=await n.sessionSnapshot(b,Re(h.current),B);if(le.session.id!==j.session.id||le.threadId!==j.threadId||le.threadCursor!==j.threadCursor||le.projectionDigest!==j.projectionDigest)throw new Ie("加载历史记录时会话快照发生变化,正在恢复最新快照。",409,"transcript_cursor_stale");a({type:"older_transcript_loaded",snapshot:le})}catch(le){if(!(le instanceof Ie)||le.code!=="transcript_cursor_stale")throw le;te(),a({type:"recovering"});try{await W(b,Re(h.current),{force:!0})}finally{ee()}}}),[n,W,te,ee,N]),be=m.useCallback((j,b)=>N("重命名会话",async()=>{const B=await n.renameSession(j,b,Re(h.current)),le=er(h.current.sessions,B);a({type:"sessions_loaded",sessions:le,nextCursor:h.current.sessionNextCursor})}),[n,N]),Se=m.useCallback((j,b)=>N("更新会话标签",async()=>{const B=await n.updateSessionTags(j,b,Re(h.current));a({type:"session_updated",session:B})}),[n,N]),_e=m.useCallback(j=>N("归档会话",async()=>{const b=await n.archiveSession(j,Re(h.current));a({type:"session_archived",session:b})}),[n,N]),De=m.useCallback(j=>N("还原会话",async()=>{const b=await n.restoreSession(j,Re(h.current));a({type:"session_restored",session:b})}),[n,N]),Pe=m.useCallback(j=>N("删除会话",async()=>{await n.deleteSession(j,Re(h.current)),a({type:"session_deleted",sessionId:j})}),[n,N]),mt=m.useCallback(async(j,b=!1)=>{const B=Re(h.current),le=h.current.archivedSessions,ae=b?le?.nextCursor:void 0;if(!(b&&!ae)){a({type:"archived_sessions_loading",workspaceId:j});try{const Ae=await n.listArchivedWorkspaceSessions(j,B,ae??void 0);a({type:"archived_sessions_loaded",workspaceId:j,sessions:Ae.sessions,nextCursor:Ae.nextCursor,append:b})}catch(Ae){throw a({type:"archived_sessions_failed",workspaceId:j,detail:ts(Ae)}),Ae}}},[n]),Mt=m.useCallback((j,b)=>z("提交任务",{type:"submit",text:j,contextReferences:b}),[z]),Ot=m.useCallback((j,b)=>z("加入队列",{type:"queue_followup",text:j,contextReferences:b}),[z]),ct=m.useCallback(async(j,b)=>{await re("移除排队消息",{type:"remove_queue_item",itemId:j,expectedItemRevision:b})},[re]),it=m.useCallback(async(j,b,B)=>{await re("编辑排队消息",{type:"edit_queue_item",itemId:j,expectedItemRevision:b,text:B})},[re]),Qe=m.useCallback(async(j,b,B)=>{await re("移动排队消息",{type:"move_queue_item",itemId:j,expectedItemRevision:b,targetIndex:B})},[re]),ot=m.useCallback(async()=>{await z("清空队列",{type:"clear_followups"})},[z]),fn=m.useCallback(async()=>{const j=h.current.sessionSnapshot?.sessionRuntime;if(!j||j.phase!=="queued"||!j.queueId)throw new Ie("排队任务已变化,请等待状态同步后重试。",409,"session_queue_conflict");await z("取消排队任务",{type:"cancel_queued_turn",queueId:j.queueId})},[z]),rn=m.useCallback(async()=>{await z("中断任务",{type:"interrupt"})},[z]),Ht=m.useCallback(async j=>{h.current.mode.baseMode===j&&!h.current.mode.pendingBaseMode||await re("切换模式",{type:"set_agent_mode",mode:j})},[re]),Rn=m.useCallback(async j=>{await re(j===null?"继承项目权限":"切换会话权限",j===null?{type:"clear_permission_override"}:{type:"set_permission_override",value:j})},[re]),ut=m.useCallback(()=>N("加载模型目录",async()=>{const j=h.current;if(!j.activeSessionId)return;const b=await n.modelCatalog(j.activeSessionId,Re(j));a({type:"model_catalog_loaded",catalog:b})}),[n,N]),tr=m.useCallback(async(j,b)=>{await re("切换会话模型",{type:"select_model",modelId:j,...b?{effort:b}:{}})},[re]),nr=m.useCallback(async()=>{await re("压缩上下文",{type:"compact_context"})},[re]),sn=m.useCallback(async(j,b,B)=>{await re("审核计划",{type:"review_plan",planDigest:j,action:b,...B?{feedback:B}:{}})},[re]),pn=m.useCallback(async(j,b="once")=>{const B=h.current.permission;B&&(await z(j?"确认工具权限":"拒绝工具权限",{type:"permission_decision",requestPermissionId:B.id,approved:j,scope:b}),a({type:"approval_resolved",requestId:B.id,approved:j}))},[z]),hn=m.useCallback(async(j,b)=>{await z("更新 Goal",{type:"goal_control",goalAction:j,objective:b});const B=++S.current;te();try{const le=h.current.activeSessionId,ae=Re(h.current),[Ae]=await Promise.all([n.diagnostics(ae),le?W(le,ae,{force:!0}):Promise.resolve()]);if(B!==S.current)return;a({type:"diagnostics_loaded",diagnostics:Ae})}finally{ee()}},[n,W,te,ee,z]),J=m.useCallback(async()=>{const j=await r.refresh(),b=j.document??j.lastGood;if(!b)throw new Ie(j.error??"设置尚不可用。",503);return b},[r]),he=m.useCallback(async(j,b,B)=>{if(b.length<1||b.length>20)throw new Ie("设置变更必须包含 1 到 20 个字段。",400,"settings_invalid_operation");const le=await n.updateSettings(j,b,Re(h.current),B);return r.accept(le.settings),le},[n,r]),Ne=m.useCallback(async()=>{await n.openSettingsDocument()},[n]),Fe=m.useCallback((j,b=0)=>n.readToolDetail(j,Re(h.current),b),[n]),At=m.useCallback((j,b)=>n.listFiles(Re(h.current),j,b),[n]),mn=m.useCallback((j,b)=>n.readFileContent(j,Re(h.current),b),[n]),Tn=m.useCallback(j=>n.gitStatus(Re(h.current),j),[n]),Vt=m.useCallback(j=>n.gitLog(Re(h.current),j),[n]),Cr=m.useCallback((j,b)=>n.gitDiff(j,Re(h.current),b),[n]),Nr=m.useCallback(()=>n.review(Re(h.current)),[n]),br=m.useCallback(async()=>(await n.terminals(Re(h.current))).terminals,[n]),_r=m.useCallback(async(j,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:j,rows:b})},[n]),gn=m.useCallback(async j=>{const b=h.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.terminalAttachTicket(j,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),vn=m.useCallback(async j=>{const b=h.current;if(!b.contextRevision||!b.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.closeTerminal(j,{expectedContextRevision:b.contextRevision,workspaceId:b.workspaceId})},[n]),os=m.useCallback(j=>n.terminalSocket(j),[n]),ls=m.useCallback(()=>a({type:"notice",notice:null}),[]),Js=m.useMemo(()=>({retryBoot:je,refreshDiagnostics:ye,refreshToolDetails:Y,loadMoreWorkspaces:fe,loadMoreSessions:se,loadWorkspaceSessions:Ce,refreshWorkspaceProjectSummary:G,loadMoreCapabilities:ve,loadMoreToolDetails:X,recoverSession:E,switchWorkspace:H,activateContext:y,setWorkspacePinned:O,removeWorkspace:A,createSession:ne,activateSession:we,loadOlderTranscript:xe,renameSession:be,updateSessionTags:Se,archiveSession:_e,restoreSession:De,deleteSession:Pe,loadArchivedWorkspaceSessions:mt,submit:Mt,queue:Ot,removeQueued:ct,editQueued:it,moveQueued:Qe,clearQueue:ot,cancelQueuedTurn:fn,interrupt:rn,setMode:Ht,setPermissionOverride:Rn,loadModelCatalog:ut,selectModel:tr,compactContext:nr,reviewPlan:sn,answerPermission:pn,controlGoal:hn,refreshSettings:J,updateSettings:he,openSettingsDocument:Ne,readToolDetail:Fe,listFiles:At,readFileContent:mn,gitStatus:Tn,gitLog:Vt,gitDiff:Cr,review:Nr,terminals:br,createTerminal:_r,terminalAttachTicket:gn,closeTerminal:vn,terminalSocket:os,dismissNotice:ls}),[we,y,vn,_r,Cr,Vt,Tn,At,xe,ve,se,X,fe,ut,Ce,pn,ot,fn,nr,sn,hn,ne,ls,it,rn,Ot,mn,Fe,Nr,E,ye,J,Y,G,ct,A,be,De,Se,_e,Pe,mt,je,Ht,Rn,tr,O,Mt,H,Qe,gn,os,br,he,Ne]);return{state:o,actions:Js}}async function Cx(n,r,o,a){let d=o;for(let f=0;f<2;f+=1){const h=gx(d);if(h.keysToClear.length===0||d.state!=="ready"||!d.writable)return d;if(h.operations.length===0)return If(h.keysToClear),d;try{const g=await n.updateSettings(d.revision,h.operations,a,qe());return r.accept(g.settings),If(h.keysToClear),g.settings}catch(g){if(f===0&&g instanceof Ie&&g.code==="settings_revision_conflict"){const w=await r.refresh(),S=w.document??w.lastGood;if(S){d=S;continue}}return d}}return d}function Re(n){if(!n.contextRevision||!n.workspaceId)throw new Ie("工作区上下文尚未完成同步。",409,"context_revision_conflict");return{expectedContextRevision:n.contextRevision,workspaceId:n.workspaceId}}function Pf(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 Rf="orion.web.view-id.v1",vp="orion.web.foreground-session.v1:";function Nx(n,r,o){const a=yp(`${vp}${n}`);return wx(a,r,o)}function Us(n,r){bx();const o=`${vp}${n}`;try{r?globalThis.sessionStorage?.setItem(o,r):globalThis.sessionStorage?.removeItem(o)}catch{}}function bx(){const n=yp(Rf);if(n)return n;const r=globalThis.crypto?.randomUUID?.()??`view-${Date.now().toString(36)}`;try{globalThis.sessionStorage?.setItem(Rf,r)}catch{}return r}function yp(n){try{return globalThis.sessionStorage?.getItem(n)??null}catch{return null}}function _x(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(Ix(n),409)}function Ix(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 Tf(n,r,o,a="error"){n({type:"notice",notice:{id:Date.now(),tone:a,title:r,detail:ts(o)}})}function ts(n){return n instanceof Ie||n instanceof Error?n.message:"发生未知错误。"}function yo(n){return n instanceof Ie&&n.code==="collection_cursor_stale"}function Ex(n){return n instanceof Ie&&["composer_control_conflict","session_runtime_revision_conflict","session_snapshot_sync_failed"].includes(n.code??"")}function Px(n){return n instanceof Ie&&["context_revision_conflict","runtime_busy","active_session_changed"].includes(n.code??"")}function Rx(n){return new Promise(r=>{globalThis.setTimeout(r,n)})}function Tx(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 Mx(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 Ox(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 Ax=5e3;function $x(n,r){return r||n.tone==="error"?null:Ax}function Dx({uid:n,notice:r,reconnectNeeded:o,snapshotRetryNeeded:a,pendingAction:d,onDismiss:f,onRecover:h}){const g=o||a,w=!g,S=m.useRef(f);m.useEffect(()=>{S.current=f},[f]);const T=$x(r,g);m.useEffect(()=>{if(T===null)return;const $=window.setTimeout(()=>S.current(n),T);return()=>window.clearTimeout($)},[T,n]);const C=`notice-${n}`,M=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:M,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 Lx(){const{state:n,actions:r}=Sx(),[o,a]=m.useState(!1),[d,f]=m.useState(zm),{value:h,update:g,setResourceNavigatorWidth:w}=Qy(n.workspaceId,d.workPanel),[S,T]=m.useState(!1),[C,M]=m.useState(!1),[$,F]=m.useState(!1),[D,W]=m.useState(null),[Z,L]=m.useState(null),[pe,te]=m.useState(null),[ee,N]=m.useState(!1),[z,re]=m.useState([]),je=m.useRef(0),ye=m.useRef(n.notice),Y=m.useRef(null),[fe,se]=m.useState(null),Ce=m.useRef(null),G=m.useRef(!1),ve=m.useRef(!1),X=m.useRef(null),E=zx(X),H=E>1180,R=H?gf({containerWidth:E,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:h.expanded,workDetailWidthPx:h.detailWidthPx}):ao(E,d),y=R.projectNavigation.mode==="drawer",O=R.workPanel.mode==="drawer",A=R.workPanel.mode==="rail"&&h.expanded,ne=O||A&&S,we=O||A?S:R.workPanel.mode==="dock",xe=ne&&S,be=y&&o,Se=be||xe,_e=n.settings?.state==="ready"?n.settings:n.settingsMirror.lastGood??n.settings,De=_e?.sections.appearance.theme.effectiveValue,Pe=_e?.sections.appearance.motion.effectiveValue,mt=_e?.sections.appearance.style.effectiveValue??"orion-blocksmith",Mt=Ro(n),Ot=m.useCallback(()=>{if(!n.workspace)return;const J=_e?.revision;if(!J)return;const he=_e?.sections.appearance.theme.effectiveValue??"system",Ne=he==="system"?"light":he==="light"?"dark":"system";r.updateSettings(J,[{op:"set",key:"appearance.theme",value:Ne}],qe()).catch(Fe=>{console.warn("[theme] 主题切换写入失败",Fe)})},[r,_e,n.workspace]),ct=m.useCallback(J=>{f(he=>{const Ne={...he,projectNavigation:{...he.projectNavigation,...J}};return Wm(Ne),Ne})},[]),it=m.useCallback(J=>{g({...J,detailWidthPx:J.widthPx===void 0?void 0:Math.max(360,J.widthPx-Xe)})},[g]),Qe=m.useCallback(()=>{Ce.current=document.activeElement instanceof HTMLElement?document.activeElement:null},[]),ot=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector(".project-search input")?.focus())},[]),fn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector('.workspace-rail [aria-label="打开设置"]')?.focus())},[]),rn=m.useCallback(()=>{y&&(Qe(),T(!1),a(!0)),fn()},[fn,y,Qe]),Ht=m.useCallback(()=>{G.current=be,be&&(a(!1),T(!1),Ce.current=null),M(!0)},[be]),Rn=m.useCallback(()=>{M(!1),G.current&&(G.current=!1,ve.current=!0,a(!0))},[]),ut=m.useCallback(()=>{a(!1),T(!1),ve.current=!1;const J=Ce.current;Ce.current=null,J&&requestAnimationFrame(()=>J.focus())},[]);m.useLayoutEffect(()=>{document.documentElement.dataset.theme=De??"system",document.documentElement.dataset.motion=Pe??"system",document.documentElement.dataset.uiStyle=mt},[Pe,De,mt]),m.useEffect(()=>{ye.current=n.notice;const J=n.notice;J&&Y.current!==J.id&&(Y.current=J.id,re(he=>he.some(Ne=>Ne.notice.id===J.id)?he:[...he,{uid:++je.current,notice:J}].slice(-4)))},[n.notice]),m.useEffect(()=>{const J=n.workspaceId;if(!J)return;const he=n.workspaceSessions[J],Ne=n.archivedSessions;he?.status==="ready"&&(Ne.ownerWorkspaceId===J&&Ne.status!=="idle"||r.loadArchivedWorkspaceSessions(J))},[r,n.archivedSessions,n.workspaceId,n.workspaceSessions]);const tr=m.useCallback(J=>{const he=z.find(Ne=>Ne.uid===J);he&&(ye.current?.id===he.notice.id&&r.dismissNotice(),re(Ne=>Ne.filter(Fe=>Fe.uid!==J)))},[r,z]),nr=m.useCallback(J=>{const he=z.find(Ne=>Ne.uid===J);he&&(ye.current?.id===he.notice.id&&r.dismissNotice(),re(Ne=>Ne.filter(Fe=>Fe.uid!==J)),r.recoverSession())},[r,z]);m.useEffect(()=>{const J=window.matchMedia("(prefers-color-scheme: light)"),he=document.querySelector('meta[name="theme-color"]'),Ne=()=>{he&&(he.content=Zy(mt,De??"system",J.matches))};return Ne(),J.addEventListener("change",Ne),()=>J.removeEventListener("change",Ne)},[De,mt]),m.useEffect(()=>{a(!1),T(!1),Ce.current=null,G.current=!1,ve.current=!1},[n.activeSessionId,n.workspace]),m.useLayoutEffect(()=>{a(!1),T(!1),Ce.current=null,ve.current=!1},[R.projectNavigation.mode,R.workPanel.mode,y,O]),m.useEffect(()=>{const J=he=>{const Ne=_o("toggle-project-navigation");if(Ne&&bo(he,Ne.tokens)){if(he.preventDefault(),y){if(o){ut();return}Qe(),T(!1),a(!0);return}const Fe=!d.projectNavigation.expanded,At=!!(!Fe&&document.activeElement?.closest(".workspace-rail")),mn=ao(E,{...d,projectNavigation:{...d.projectNavigation,expanded:Fe}});if(Fe&&mn.projectNavigation.mode==="drawer"){ct({expanded:Fe}),Qe(),T(!1),a(!0);return}ct({expanded:Fe}),Fe?ot():At&&requestAnimationFrame(()=>{(document.querySelector('.project-navigator-collapsed [aria-label="展开项目导航"]')??document.querySelector(".mobile-nav-toggle"))?.focus()})}};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[ut,ot,o,y,d.projectNavigation,Qe,E,ct]),m.useEffect(()=>{const J=_o("open-shortcut-help");if(!J)return;const he=Ne=>{bo(Ne,J.tokens)&&(Ne.preventDefault(),N(Fe=>!Fe))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[]),m.useEffect(()=>{if(!Se)return;const J=document.querySelector(".conversation-column"),he=document.querySelector(".workspace-rail"),Ne=document.querySelector(".work-panel"),Fe=document.querySelector(".workbench-notice-stack"),At=document.querySelector(".skip-link");J&&(J.inert=!0),he&&(he.inert=xe),Ne&&(Ne.inert=o),Fe&&(Fe.inert=!0),At&&(At.inert=!0);const mn=window.setTimeout(()=>{const Vt=xe?Ne?.querySelector('[aria-label="关闭工作面板"]'):ve.current?he?.querySelector('[aria-label="打开设置"]'):he?.querySelector(".drawer-close");ve.current=!1,Vt?.focus()},0),Tn=Vt=>{Vt.key==="Escape"&&!Vt.target?.closest?.('[role="alertdialog"]')&&ut()};return window.addEventListener("keydown",Tn),()=>{J&&(J.inert=!1),he&&(he.inert=!1),Ne&&(Ne.inert=!1),Fe&&(Fe.inert=!1),At&&(At.inert=!1),window.clearTimeout(mn),window.removeEventListener("keydown",Tn)}},[ut,Se,o,xe,n.notice]);const sn=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector("#main-content h1")?.focus())},[]),pn=()=>{a(!1),r.createSession().then(sn,sn)},hn=()=>{G.current=!1,ve.current=!1,M(!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:X,className:`workbench-shell project-navigation-${R.projectNavigation.mode} work-panel-mode-${R.workPanel.mode} ${A&&S?"work-panel-transient-overlay":""}`,style:{"--project-navigation-width":`${R.projectNavigation.widthPx}px`,"--project-navigation-preferred-width":`${d.projectNavigation.widthPx}px`,"--work-panel-width":`${R.workPanel.widthPx}px`,"--work-panel-preferred-width":`${h.detailWidthPx+Xe}px`},"aria-busy":n.boot==="loading",children:[i.jsx(Um,{state:n,drawerOpen:be,dockVisible:!0,collapsed:R.projectNavigation.mode==="rail",resizable:R.projectNavigation.mode==="dock",width:R.projectNavigation.widthPx,onCloseDrawer:ut,onExpand:()=>{y?(Qe(),T(!1),a(!0)):(ct({expanded:!0}),ot())},onCollapse:()=>{y?ut():ct({expanded:!1})},onOpenWorkspaceDialog:()=>F(!0),onOpenSettings:Ht,onLoadMoreWorkspaces:()=>{r.loadMoreWorkspaces()},onCreateSession:pn,onLoadWorkspaceSessions:(J,he)=>{r.loadWorkspaceSessions(J,he)},onActivateContext:(J,he)=>{a(!1),r.activateContext(J,he).then(sn,sn)},onSetPinned:(J,he)=>{r.setWorkspacePinned(J,he)},onRemoveWorkspace:J=>{r.removeWorkspace(J)},onRefreshSummary:J=>{r.refreshWorkspaceProjectSummary(J)},onRenameSession:W,onSessionTags:L,onArchiveSession:J=>{r.archiveSession(J.id)},onDeleteSession:te,onRestoreSession:J=>{r.restoreSession(J.id)},onWidthPreview:J=>{const he=ao(E,{...d,projectNavigation:{...d.projectNavigation,widthPx:J}});X.current?.style.setProperty("--project-navigation-width",`${he.projectNavigation.widthPx}px`)},onWidthCommit:J=>ct({widthPx:J})}),i.jsx(hv,{state:n,actions:r,navigationOpen:y?be:R.projectNavigation.mode==="dock",inspectorExpanded:we,onOpenNavigation:()=>{if(!y){ct({expanded:!0}),ot();return}Qe(),T(!1),a(!0)},onToggleInspector:()=>{if(O||A){if(S){ut();return}Qe(),a(!1),T(!0);return}it({expanded:!h.expanded})},onRevealSettings:rn,onCreateSession:pn,themePreference:De,onCycleTheme:Ot,onShowShortcuts:()=>N(!0),composerInsertion:fe}),i.jsx($y,{state:n,actions:r,mode:ne?"overlay":"dock",expanded:we,activePanel:h.activePanel,panelOrder:d.workPanel.order,agentPanel:h.agentPanel,onExpand:()=>{O||A?T(!0):it({expanded:!0})},onCollapse:()=>{ne?ut():it({expanded:!1})},onPanelChange:J=>it({activePanel:J}),onAgentPanelChange:J=>it({agentPanel:J}),onWidthPreview:J=>{const he=H?gf({containerWidth:E,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:!0,workDetailWidthPx:Math.max(360,J-Xe)}):ao(E,{...d,workPanel:{...d.workPanel,widthPx:J}});X.current?.style.setProperty("--work-panel-width",`${he.workPanel.widthPx}px`)},onWidthCommit:J=>it({widthPx:J}),width:R.workPanel.widthPx,maxWidthPx:H?dp(E-(d.projectNavigation.expanded?d.projectNavigation.widthPx:Xe))+Xe:void 0,onSendToComposer:J=>{se({id:Date.now(),text:J}),O&&ut(),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:ut}):null,z.length>0?i.jsx("div",{className:"workbench-notice-stack","aria-live":"polite",children:z.map(J=>i.jsx(Dx,{uid:J.uid,notice:J.notice,reconnectNeeded:n.connection==="replay-required",snapshotRetryNeeded:J.notice.domain==="session-snapshot"&&Mt.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(Uf,{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(Uv,{open:C,onClose:Rn,state:n,actions:r,onGoToSessionControls:hn}),i.jsx(Rv,{open:$,onClose:()=>F(!1),state:n,onSelect:r.switchWorkspace,onLoadMore:r.loadMoreWorkspaces}),i.jsx(Tv,{open:!!D,onClose:()=>W(null),session:D,pending:!!n.pendingAction,onRename:r.renameSession}),i.jsx(Mv,{open:!!Z,onClose:()=>L(null),session:Z,pending:!!n.pendingAction,onSave:r.updateSessionTags}),i.jsx(Ov,{open:!!pe,onClose:()=>te(null),session:pe,pending:!!n.pendingAction,onConfirm:r.deleteSession}),i.jsx(uy,{open:ee,onClose:()=>N(!1)})]})}function zx(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 xp=document.getElementById("root");if(!xp)throw new Error("Orion Web root element was not found.");jm.createRoot(xp).render(i.jsx(mm.StrictMode,{children:i.jsx(Lx,{})}));export{Q as I,$f as P,ko as R,Ka as S,Ie as W,sp as a,Fx as b,op as c,i as j,m as r,Zn as s};
|