@orion-agents/orion-code 0.3.19 → 0.3.20
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 -3
- package/README.md +5 -7
- package/README.zh-CN.md +4 -5
- package/dist/runtime/release-receipts.d.ts +18 -1
- package/dist/runtime/release-receipts.js +57 -6
- package/dist/web-client/assets/{FilesPanel-DGWgLv6R.js → FilesPanel-DLMT8aKW.js} +1 -1
- package/dist/web-client/assets/{GitPanel-DIuJNXoB.js → GitPanel-DrVyBNCX.js} +1 -1
- package/dist/web-client/assets/{ReviewPanel-YWZXJdm5.js → ReviewPanel-BRrUqVPn.js} +1 -1
- package/dist/web-client/assets/{TerminalPanel-DPSMepio.js → TerminalPanel-CTJtYCLj.js} +1 -1
- package/dist/web-client/assets/index-D5ze0fOv.js +20 -0
- package/dist/web-client/assets/{useAutoNotice-h7c0Iz1E.js → useAutoNotice-Bsr8yfc3.js} +1 -1
- package/dist/web-client/index.html +1 -1
- package/npm-shrinkwrap.json +27 -27
- package/package.json +1 -1
- package/dist/web-client/assets/index-DYeu_rs7.js +0 -20
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-CTJtYCLj.js","assets/TerminalPanel-DLuoa74B.css","assets/FilesPanel-DLMT8aKW.js","assets/useAutoNotice-Bsr8yfc3.js","assets/GitPanel-DrVyBNCX.js","assets/ReviewPanel-BRrUqVPn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ym=Object.defineProperty;var xm=(n,r,o)=>r in n?ym(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var Ht=(n,r,o)=>xm(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 p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&a(p)}).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 Qf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Wa={exports:{}},ei={},Fa={exports:{}},Pe={};var Bd;function wm(){if(Bd)return Pe;Bd=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"),p=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),C=Symbol.iterator;function E(v){return v===null||typeof v!="object"?null:(v=C&&v[C]||v["@@iterator"],typeof v=="function"?v:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,L={};function z(v,O,ce){this.props=v,this.context=O,this.refs=L,this.updater=ce||_}z.prototype.isReactComponent={},z.prototype.setState=function(v,O){if(typeof v!="object"&&typeof v!="function"&&v!=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,v,O,"setState")},z.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function ie(){}ie.prototype=z.prototype;function F(v,O,ce){this.props=v,this.context=O,this.refs=L,this.updater=ce||_}var Se=F.prototype=new ie;Se.constructor=F,A(Se,z.prototype),Se.isPureReactComponent=!0;var se=Array.isArray,re=Object.prototype.hasOwnProperty,b={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function te(v,O,ce){var pe,ye={},Z=null,he=null;if(O!=null)for(pe in O.ref!==void 0&&(he=O.ref),O.key!==void 0&&(Z=""+O.key),O)re.call(O,pe)&&!D.hasOwnProperty(pe)&&(ye[pe]=O[pe]);var je=arguments.length-2;if(je===1)ye.children=ce;else if(1<je){for(var le=Array(je),Te=0;Te<je;Te++)le[Te]=arguments[Te+2];ye.children=le}if(v&&v.defaultProps)for(pe in je=v.defaultProps,je)ye[pe]===void 0&&(ye[pe]=je[pe]);return{$$typeof:n,type:v,key:Z,ref:he,props:ye,_owner:b.current}}function Ce(v,O){return{$$typeof:n,type:v.type,key:O,ref:v.ref,props:v.props,_owner:v._owner}}function xe(v){return typeof v=="object"&&v!==null&&v.$$typeof===n}function J(v){var O={"=":"=0",":":"=2"};return"$"+v.replace(/[=:]/g,function(ce){return O[ce]})}var G=/\/+/g;function K(v,O){return typeof v=="object"&&v!==null&&v.key!=null?J(""+v.key):O.toString(36)}function be(v,O,ce,pe,ye){var Z=typeof v;(Z==="undefined"||Z==="boolean")&&(v=null);var he=!1;if(v===null)he=!0;else switch(Z){case"string":case"number":he=!0;break;case"object":switch(v.$$typeof){case n:case r:he=!0}}if(he)return he=v,ye=ye(he),v=pe===""?"."+K(he,0):pe,se(ye)?(ce="",v!=null&&(ce=v.replace(G,"$&/")+"/"),be(ye,O,ce,"",function(Te){return Te})):ye!=null&&(xe(ye)&&(ye=Ce(ye,ce+(!ye.key||he&&he.key===ye.key?"":(""+ye.key).replace(G,"$&/")+"/")+v)),O.push(ye)),1;if(he=0,pe=pe===""?".":pe+":",se(v))for(var je=0;je<v.length;je++){Z=v[je];var le=pe+K(Z,je);he+=be(Z,O,ce,le,ye)}else if(le=E(v),typeof le=="function")for(v=le.call(v),je=0;!(Z=v.next()).done;)Z=Z.value,le=pe+K(Z,je++),he+=be(Z,O,ce,le,ye);else if(Z==="object")throw O=String(v),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return he}function $(v,O,ce){if(v==null)return v;var pe=[],ye=0;return be(v,pe,"","",function(Z){return O.call(ce,Z,ye++)}),pe}function fe(v){if(v._status===-1){var O=v._result;O=O(),O.then(function(ce){(v._status===0||v._status===-1)&&(v._status=1,v._result=ce)},function(ce){(v._status===0||v._status===-1)&&(v._status=2,v._result=ce)}),v._status===-1&&(v._status=0,v._result=O)}if(v._status===1)return v._result.default;throw v._result}var V={current:null},W={transition:null},ne={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:W,ReactCurrentOwner:b};function q(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:$,forEach:function(v,O,ce){$(v,function(){O.apply(this,arguments)},ce)},count:function(v){var O=0;return $(v,function(){O++}),O},toArray:function(v){return $(v,function(O){return O})||[]},only:function(v){if(!xe(v))throw Error("React.Children.only expected to receive a single React element child.");return v}},Pe.Component=z,Pe.Fragment=o,Pe.Profiler=d,Pe.PureComponent=F,Pe.StrictMode=a,Pe.Suspense=x,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,Pe.act=q,Pe.cloneElement=function(v,O,ce){if(v==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+v+".");var pe=A({},v.props),ye=v.key,Z=v.ref,he=v._owner;if(O!=null){if(O.ref!==void 0&&(Z=O.ref,he=b.current),O.key!==void 0&&(ye=""+O.key),v.type&&v.type.defaultProps)var je=v.type.defaultProps;for(le in O)re.call(O,le)&&!D.hasOwnProperty(le)&&(pe[le]=O[le]===void 0&&je!==void 0?je[le]:O[le])}var le=arguments.length-2;if(le===1)pe.children=ce;else if(1<le){je=Array(le);for(var Te=0;Te<le;Te++)je[Te]=arguments[Te+2];pe.children=je}return{$$typeof:n,type:v.type,key:ye,ref:Z,props:pe,_owner:he}},Pe.createContext=function(v){return v={$$typeof:p,_currentValue:v,_currentValue2:v,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},v.Provider={$$typeof:f,_context:v},v.Consumer=v},Pe.createElement=te,Pe.createFactory=function(v){var O=te.bind(null,v);return O.type=v,O},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(v){return{$$typeof:g,render:v}},Pe.isValidElement=xe,Pe.lazy=function(v){return{$$typeof:R,_payload:{_status:-1,_result:v},_init:fe}},Pe.memo=function(v,O){return{$$typeof:w,type:v,compare:O===void 0?null:O}},Pe.startTransition=function(v){var O=W.transition;W.transition={};try{v()}finally{W.transition=O}},Pe.unstable_act=q,Pe.useCallback=function(v,O){return V.current.useCallback(v,O)},Pe.useContext=function(v){return V.current.useContext(v)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(v){return V.current.useDeferredValue(v)},Pe.useEffect=function(v,O){return V.current.useEffect(v,O)},Pe.useId=function(){return V.current.useId()},Pe.useImperativeHandle=function(v,O,ce){return V.current.useImperativeHandle(v,O,ce)},Pe.useInsertionEffect=function(v,O){return V.current.useInsertionEffect(v,O)},Pe.useLayoutEffect=function(v,O){return V.current.useLayoutEffect(v,O)},Pe.useMemo=function(v,O){return V.current.useMemo(v,O)},Pe.useReducer=function(v,O,ce){return V.current.useReducer(v,O,ce)},Pe.useRef=function(v){return V.current.useRef(v)},Pe.useState=function(v){return V.current.useState(v)},Pe.useSyncExternalStore=function(v,O,ce){return V.current.useSyncExternalStore(v,O,ce)},Pe.useTransition=function(){return V.current.useTransition()},Pe.version="18.3.1",Pe}var qd;function cc(){return qd||(qd=1,Fa.exports=wm()),Fa.exports}var Ud;function km(){if(Ud)return ei;Ud=1;var n=cc(),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 p(g,x,w){var R,C={},E=null,_=null;w!==void 0&&(E=""+w),x.key!==void 0&&(E=""+x.key),x.ref!==void 0&&(_=x.ref);for(R in x)a.call(x,R)&&!f.hasOwnProperty(R)&&(C[R]=x[R]);if(g&&g.defaultProps)for(R in x=g.defaultProps,x)C[R]===void 0&&(C[R]=x[R]);return{$$typeof:r,type:g,key:E,ref:_,props:C,_owner:d.current}}return ei.Fragment=o,ei.jsx=p,ei.jsxs=p,ei}var Hd;function jm(){return Hd||(Hd=1,Wa.exports=km()),Wa.exports}var i=jm(),m=cc();const Sm=Qf(m);var No={},Ba={exports:{}},St={},qa={exports:{}},Ua={};var Vd;function Cm(){return Vd||(Vd=1,(function(n){function r(W,ne){var q=W.length;W.push(ne);e:for(;0<q;){var v=q-1>>>1,O=W[v];if(0<d(O,ne))W[v]=ne,W[q]=O,q=v;else break e}}function o(W){return W.length===0?null:W[0]}function a(W){if(W.length===0)return null;var ne=W[0],q=W.pop();if(q!==ne){W[0]=q;e:for(var v=0,O=W.length,ce=O>>>1;v<ce;){var pe=2*(v+1)-1,ye=W[pe],Z=pe+1,he=W[Z];if(0>d(ye,q))Z<O&&0>d(he,ye)?(W[v]=he,W[Z]=q,v=Z):(W[v]=ye,W[pe]=q,v=pe);else if(Z<O&&0>d(he,q))W[v]=he,W[Z]=q,v=Z;else break e}}return ne}function d(W,ne){var q=W.sortIndex-ne.sortIndex;return q!==0?q:W.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var p=Date,g=p.now();n.unstable_now=function(){return p.now()-g}}var x=[],w=[],R=1,C=null,E=3,_=!1,A=!1,L=!1,z=typeof setTimeout=="function"?setTimeout:null,ie=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Se(W){for(var ne=o(w);ne!==null;){if(ne.callback===null)a(w);else if(ne.startTime<=W)a(w),ne.sortIndex=ne.expirationTime,r(x,ne);else break;ne=o(w)}}function se(W){if(L=!1,Se(W),!A)if(o(x)!==null)A=!0,fe(re);else{var ne=o(w);ne!==null&&V(se,ne.startTime-W)}}function re(W,ne){A=!1,L&&(L=!1,ie(te),te=-1),_=!0;var q=E;try{for(Se(ne),C=o(x);C!==null&&(!(C.expirationTime>ne)||W&&!J());){var v=C.callback;if(typeof v=="function"){C.callback=null,E=C.priorityLevel;var O=v(C.expirationTime<=ne);ne=n.unstable_now(),typeof O=="function"?C.callback=O:C===o(x)&&a(x),Se(ne)}else a(x);C=o(x)}if(C!==null)var ce=!0;else{var pe=o(w);pe!==null&&V(se,pe.startTime-ne),ce=!1}return ce}finally{C=null,E=q,_=!1}}var b=!1,D=null,te=-1,Ce=5,xe=-1;function J(){return!(n.unstable_now()-xe<Ce)}function G(){if(D!==null){var W=n.unstable_now();xe=W;var ne=!0;try{ne=D(!0,W)}finally{ne?K():(b=!1,D=null)}}else b=!1}var K;if(typeof F=="function")K=function(){F(G)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,$=be.port2;be.port1.onmessage=G,K=function(){$.postMessage(null)}}else K=function(){z(G,0)};function fe(W){D=W,b||(b=!0,K())}function V(W,ne){te=z(function(){W(n.unstable_now())},ne)}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(W){W.callback=null},n.unstable_continueExecution=function(){A||_||(A=!0,fe(re))},n.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Ce=0<W?Math.floor(1e3/W):5},n.unstable_getCurrentPriorityLevel=function(){return E},n.unstable_getFirstCallbackNode=function(){return o(x)},n.unstable_next=function(W){switch(E){case 1:case 2:case 3:var ne=3;break;default:ne=E}var q=E;E=ne;try{return W()}finally{E=q}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(W,ne){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var q=E;E=W;try{return ne()}finally{E=q}},n.unstable_scheduleCallback=function(W,ne,q){var v=n.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?v+q:v):q=v,W){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=q+O,W={id:R++,callback:ne,priorityLevel:W,startTime:q,expirationTime:O,sortIndex:-1},q>v?(W.sortIndex=q,r(w,W),o(x)===null&&W===o(w)&&(L?(ie(te),te=-1):L=!0,V(se,q-v))):(W.sortIndex=O,r(x,W),A||_||(A=!0,fe(re))),W},n.unstable_shouldYield=J,n.unstable_wrapCallback=function(W){var ne=E;return function(){var q=E;E=ne;try{return W.apply(this,arguments)}finally{E=q}}}})(Ua)),Ua}var Kd;function bm(){return Kd||(Kd=1,qa.exports=Cm()),qa.exports}var Gd;function Nm(){if(Gd)return St;Gd=1;var n=cc(),r=bm();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){p(e,t),p(e+"Capture",t)}function p(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"),x=Object.prototype.hasOwnProperty,w=/^[: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]*$/,R={},C={};function E(e){return x.call(C,e)?!0:x.call(R,e)?!1:w.test(e)?C[e]=!0:(R[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 A(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 L(e,t,s,l,c,u,h){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=h}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){z[e]=new L(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];z[t]=new L(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){z[e]=new L(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){z[e]=new L(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){z[e]=new L(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){z[e]=new L(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){z[e]=new L(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){z[e]=new L(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){z[e]=new L(e,5,!1,e.toLowerCase(),null,!1,!1)});var ie=/[\-:]([a-z])/g;function F(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(ie,F);z[t]=new L(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ie,F);z[t]=new L(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ie,F);z[t]=new L(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){z[e]=new L(e,1,!1,e.toLowerCase(),null,!1,!1)}),z.xlinkHref=new L("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){z[e]=new L(e,1,!1,e.toLowerCase(),null,!0,!0)});function Se(e,t,s,l){var c=z.hasOwnProperty(t)?z[t]:null;(c!==null?c.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(A(t,s,c,l)&&(s=null),l||c===null?E(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 se=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,re=Symbol.for("react.element"),b=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),Ce=Symbol.for("react.profiler"),xe=Symbol.for("react.provider"),J=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),be=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),W=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var q=Object.assign,v;function O(e){if(v===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);v=t&&t[1]||""}return`
|
|
3
|
+
`+v+e}var ce=!1;function pe(e,t){if(!e||ce)return"";ce=!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(T){var l=T}Reflect.construct(e,[],t)}else{try{t.call()}catch(T){l=T}e.call(t.prototype)}else{try{throw Error()}catch(T){l=T}e()}}catch(T){if(T&&l&&typeof T.stack=="string"){for(var c=T.stack.split(`
|
|
4
|
+
`),u=l.stack.split(`
|
|
5
|
+
`),h=c.length-1,y=u.length-1;1<=h&&0<=y&&c[h]!==u[y];)y--;for(;1<=h&&0<=y;h--,y--)if(c[h]!==u[y]){if(h!==1||y!==1)do if(h--,y--,0>y||c[h]!==u[y]){var j=`
|
|
6
|
+
`+c[h].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),j}while(1<=h&&0<=y);break}}}finally{ce=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?O(e):""}function ye(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=pe(e.type,!1),e;case 11:return e=pe(e.type.render,!1),e;case 1:return e=pe(e.type,!0),e;default:return""}}function Z(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 D:return"Fragment";case b:return"Portal";case Ce:return"Profiler";case te:return"StrictMode";case K:return"Suspense";case be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case J:return(e.displayName||"Context")+".Consumer";case xe:return(e._context.displayName||"Context")+".Provider";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return t=e.displayName||null,t!==null?t:Z(e.type)||"Memo";case fe:t=e._payload,e=e._init;try{return Z(e(t))}catch{}}return null}function he(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 Z(t);case 8:return t===te?"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 je(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function le(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Te(e){var t=le(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(h){l=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(h){l=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qe(e){e._valueTracker||(e._valueTracker=Te(e))}function Je(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),l="";return e&&(l=le(e)?e.checked?"true":"false":e.value),e=l,e!==s?(t.setValue(e),!0):!1}function It(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 lt(e,t){var s=t.checked;return q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Lt(e,t){var s=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;s=je(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 vt(e,t){t=t.checked,t!=null&&Se(e,"checked",t,!1)}function _t(e,t){vt(e,t);var s=je(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")?at(e,t.type,s):t.hasOwnProperty("defaultValue")&&at(e,t.type,je(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Et(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 at(e,t,s){(t!=="number"||It(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var At=Array.isArray;function $t(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=""+je(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 q({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function nr(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(At(s)){if(1<s.length)throw Error(o(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:je(s)}}function rr(e,t){var s=je(t.value),l=je(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 ht(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function sr(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 Tn(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?sr(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Dt,On=(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(Dt=Dt||document.createElement("div"),Dt.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Dt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function on(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Q={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},Ne=["Webkit","ms","Moz","O"];Object.keys(Q).forEach(function(e){Ne.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Q[t]=Q[e]})});function _e(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Q.hasOwnProperty(e)&&Q[e]?(""+t).trim():t+"px"}function ze(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var l=s.indexOf("--")===0,c=_e(s,t[s],l);s==="float"&&(s="cssFloat"),l?e.setProperty(s,c):e[s]=c}}var Gt=q({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 ln(e,t){if(t){if(Gt[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 mn(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 Qt=null;function Tr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Or=null,gn=null,Mn=null;function fi(e){if(e=zs(e)){if(typeof Or!="function")throw Error(o(280));var t=e.stateNode;t&&(t=Wi(t),Or(e.stateNode,e.type,t))}}function pi(e){gn?Mn?Mn.push(e):Mn=[e]:gn=e}function hi(){if(gn){var e=gn,t=Mn;if(Mn=gn=null,fi(e),t)for(e=0;e<t.length;e++)fi(t[e])}}function mi(e,t){return e(t)}function gi(){}var hs=!1;function vi(e,t,s){if(hs)return e(t,s);hs=!0;try{return mi(e,t,s)}finally{hs=!1,(gn!==null||Mn!==null)&&(gi(),hi())}}function ir(e,t){var s=e.stateNode;if(s===null)return null;var l=Wi(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 ms=!1;if(g)try{var or={};Object.defineProperty(or,"passive",{get:function(){ms=!0}}),window.addEventListener("test",or,or),window.removeEventListener("test",or,or)}catch{ms=!1}function sl(e,t,s,l,c,u,h,y,j){var T=Array.prototype.slice.call(arguments,3);try{t.apply(s,T)}catch(U){this.onError(U)}}var lr=!1,Mr=null,ar=!1,Lr=null,yi={onError:function(e){lr=!0,Mr=e}};function xi(e,t,s,l,c,u,h,y,j){lr=!1,Mr=null,sl.apply(yi,arguments)}function wi(e,t,s,l,c,u,h,y,j){if(xi.apply(this,arguments),lr){if(lr){var T=Mr;lr=!1,Mr=null}else throw Error(o(198));ar||(ar=!0,Lr=T)}}function an(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 gs(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 vs(e){if(an(e)!==e)throw Error(o(188))}function ki(e){var t=e.alternate;if(!t){if(t=an(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 vs(c),e;if(u===l)return vs(c),t;u=u.sibling}throw Error(o(188))}if(s.return!==l.return)s=c,l=u;else{for(var h=!1,y=c.child;y;){if(y===s){h=!0,s=c,l=u;break}if(y===l){h=!0,l=c,s=u;break}y=y.sibling}if(!h){for(y=u.child;y;){if(y===s){h=!0,s=u,l=c;break}if(y===l){h=!0,l=u,s=c;break}y=y.sibling}if(!h)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 ys(e){return e=ki(e),e!==null?xs(e):null}function xs(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=xs(e);if(t!==null)return t;e=e.sibling}return null}var ws=r.unstable_scheduleCallback,ji=r.unstable_cancelCallback,k=r.unstable_shouldYield,N=r.unstable_requestPaint,M=r.unstable_now,ee=r.unstable_getCurrentPriorityLevel,ge=r.unstable_ImmediatePriority,Ae=r.unstable_UserBlockingPriority,Ze=r.unstable_NormalPriority,et=r.unstable_LowPriority,cn=r.unstable_IdlePriority,cr=null,tt=null;function il(e){if(tt&&typeof tt.onCommitFiberRoot=="function")try{tt.onCommitFiberRoot(cr,e,void 0,(e.current.flags&128)===128)}catch{}}var Pt=Math.clz32?Math.clz32:Si,ol=Math.log,ct=Math.LN2;function Si(e){return e>>>=0,e===0?32:31-(ol(e)/ct|0)|0}var ur=64,dr=4194304;function ks(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 Ci(e,t){var s=e.pendingLanes;if(s===0)return 0;var l=0,c=e.suspendedLanes,u=e.pingedLanes,h=s&268435455;if(h!==0){var y=h&~c;y!==0?l=ks(y):(u&=h,u!==0&&(l=ks(u)))}else h=s&~c,h!==0?l=ks(h):u!==0&&(l=ks(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-Pt(t),c=1<<s,l|=e[s],t&=~c;return l}function $p(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 Dp(e,t){for(var s=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes;0<u;){var h=31-Pt(u),y=1<<h,j=c[h];j===-1?((y&s)===0||(y&l)!==0)&&(c[h]=$p(y,t)):j<=t&&(e.expiredLanes|=y),u&=~y}}function ll(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function xc(){var e=ur;return ur<<=1,(ur&4194240)===0&&(ur=64),e}function al(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function js(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Pt(t),e[t]=s}function zp(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-Pt(s),u=1<<c;t[c]=0,l[c]=-1,e[c]=-1,s&=~u}}function cl(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var l=31-Pt(s),c=1<<l;c&t|e[l]&t&&(e[l]|=t),s&=~c}}var Me=0;function wc(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var kc,ul,jc,Sc,Cc,dl=!1,bi=[],Ln=null,An=null,$n=null,Ss=new Map,Cs=new Map,Dn=[],Wp="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 bc(e,t){switch(e){case"focusin":case"focusout":Ln=null;break;case"dragenter":case"dragleave":An=null;break;case"mouseover":case"mouseout":$n=null;break;case"pointerover":case"pointerout":Ss.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cs.delete(t.pointerId)}}function bs(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=zs(t),t!==null&&ul(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Fp(e,t,s,l,c){switch(t){case"focusin":return Ln=bs(Ln,e,t,s,l,c),!0;case"dragenter":return An=bs(An,e,t,s,l,c),!0;case"mouseover":return $n=bs($n,e,t,s,l,c),!0;case"pointerover":var u=c.pointerId;return Ss.set(u,bs(Ss.get(u)||null,e,t,s,l,c)),!0;case"gotpointercapture":return u=c.pointerId,Cs.set(u,bs(Cs.get(u)||null,e,t,s,l,c)),!0}return!1}function Nc(e){var t=fr(e.target);if(t!==null){var s=an(t);if(s!==null){if(t=s.tag,t===13){if(t=gs(s),t!==null){e.blockedOn=t,Cc(e.priority,function(){jc(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 Ni(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=pl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);Qt=l,s.target.dispatchEvent(l),Qt=null}else return t=zs(s),t!==null&&ul(t),e.blockedOn=s,!1;t.shift()}return!0}function Ic(e,t,s){Ni(e)&&s.delete(t)}function Bp(){dl=!1,Ln!==null&&Ni(Ln)&&(Ln=null),An!==null&&Ni(An)&&(An=null),$n!==null&&Ni($n)&&($n=null),Ss.forEach(Ic),Cs.forEach(Ic)}function Ns(e,t){e.blockedOn===t&&(e.blockedOn=null,dl||(dl=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Bp)))}function Is(e){function t(c){return Ns(c,e)}if(0<bi.length){Ns(bi[0],e);for(var s=1;s<bi.length;s++){var l=bi[s];l.blockedOn===e&&(l.blockedOn=null)}}for(Ln!==null&&Ns(Ln,e),An!==null&&Ns(An,e),$n!==null&&Ns($n,e),Ss.forEach(t),Cs.forEach(t),s=0;s<Dn.length;s++)l=Dn[s],l.blockedOn===e&&(l.blockedOn=null);for(;0<Dn.length&&(s=Dn[0],s.blockedOn===null);)Nc(s),s.blockedOn===null&&Dn.shift()}var Ar=se.ReactCurrentBatchConfig,Ii=!0;function qp(e,t,s,l){var c=Me,u=Ar.transition;Ar.transition=null;try{Me=1,fl(e,t,s,l)}finally{Me=c,Ar.transition=u}}function Up(e,t,s,l){var c=Me,u=Ar.transition;Ar.transition=null;try{Me=4,fl(e,t,s,l)}finally{Me=c,Ar.transition=u}}function fl(e,t,s,l){if(Ii){var c=pl(e,t,s,l);if(c===null)Pl(e,t,l,_i,s),bc(e,l);else if(Fp(c,e,t,s,l))l.stopPropagation();else if(bc(e,l),t&4&&-1<Wp.indexOf(e)){for(;c!==null;){var u=zs(c);if(u!==null&&kc(u),u=pl(e,t,s,l),u===null&&Pl(e,t,l,_i,s),u===c)break;c=u}c!==null&&l.stopPropagation()}else Pl(e,t,l,null,s)}}var _i=null;function pl(e,t,s,l){if(_i=null,e=Tr(l),e=fr(e),e!==null)if(t=an(e),t===null)e=null;else if(s=t.tag,s===13){if(e=gs(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 _i=e,null}function _c(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(ee()){case ge:return 1;case Ae:return 4;case Ze:case et:return 16;case cn:return 536870912;default:return 16}default:return 16}}var zn=null,hl=null,Ei=null;function Ec(){if(Ei)return Ei;var e,t=hl,s=t.length,l,c="value"in zn?zn.value:zn.textContent,u=c.length;for(e=0;e<s&&t[e]===c[e];e++);var h=s-e;for(l=1;l<=h&&t[s-l]===c[u-l];l++);return Ei=c.slice(e,1<l?1-l:void 0)}function Pi(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 Ri(){return!0}function Pc(){return!1}function Rt(e){function t(s,l,c,u,h){this._reactName=s,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(s=e[y],this[y]=s?s(u):u[y]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ri:Pc,this.isPropagationStopped=Pc,this}return q(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=Ri)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ri)},persist:function(){},isPersistent:Ri}),t}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ml=Rt($r),_s=q({},$r,{view:0,detail:0}),Hp=Rt(_s),gl,vl,Es,Ti=q({},_s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xl,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!==Es&&(Es&&e.type==="mousemove"?(gl=e.screenX-Es.screenX,vl=e.screenY-Es.screenY):vl=gl=0,Es=e),gl)},movementY:function(e){return"movementY"in e?e.movementY:vl}}),Rc=Rt(Ti),Vp=q({},Ti,{dataTransfer:0}),Kp=Rt(Vp),Gp=q({},_s,{relatedTarget:0}),yl=Rt(Gp),Qp=q({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),Yp=Rt(Qp),Xp=q({},$r,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Jp=Rt(Xp),Zp=q({},$r,{data:0}),Tc=Rt(Zp),eh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},th={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"},nh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nh[e])?!!t[e]:!1}function xl(){return rh}var sh=q({},_s,{key:function(e){if(e.key){var t=eh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Pi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?th[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xl,charCode:function(e){return e.type==="keypress"?Pi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Pi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ih=Rt(sh),oh=q({},Ti,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oc=Rt(oh),lh=q({},_s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xl}),ah=Rt(lh),ch=q({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),uh=Rt(ch),dh=q({},Ti,{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}),fh=Rt(dh),ph=[9,13,27,32],wl=g&&"CompositionEvent"in window,Ps=null;g&&"documentMode"in document&&(Ps=document.documentMode);var hh=g&&"TextEvent"in window&&!Ps,Mc=g&&(!wl||Ps&&8<Ps&&11>=Ps),Lc=" ",Ac=!1;function $c(e,t){switch(e){case"keyup":return ph.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dr=!1;function mh(e,t){switch(e){case"compositionend":return Dc(t);case"keypress":return t.which!==32?null:(Ac=!0,Lc);case"textInput":return e=t.data,e===Lc&&Ac?null:e;default:return null}}function gh(e,t){if(Dr)return e==="compositionend"||!wl&&$c(e,t)?(e=Ec(),Ei=hl=zn=null,Dr=!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 Mc&&t.locale!=="ko"?null:t.data;default:return null}}var vh={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 zc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vh[e.type]:t==="textarea"}function Wc(e,t,s,l){pi(l),t=$i(t,"onChange"),0<t.length&&(s=new ml("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var Rs=null,Ts=null;function yh(e){su(e,0)}function Oi(e){var t=qr(e);if(Je(t))return e}function xh(e,t){if(e==="change")return t}var Fc=!1;if(g){var kl;if(g){var jl="oninput"in document;if(!jl){var Bc=document.createElement("div");Bc.setAttribute("oninput","return;"),jl=typeof Bc.oninput=="function"}kl=jl}else kl=!1;Fc=kl&&(!document.documentMode||9<document.documentMode)}function qc(){Rs&&(Rs.detachEvent("onpropertychange",Uc),Ts=Rs=null)}function Uc(e){if(e.propertyName==="value"&&Oi(Ts)){var t=[];Wc(t,Ts,e,Tr(e)),vi(yh,t)}}function wh(e,t,s){e==="focusin"?(qc(),Rs=t,Ts=s,Rs.attachEvent("onpropertychange",Uc)):e==="focusout"&&qc()}function kh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Oi(Ts)}function jh(e,t){if(e==="click")return Oi(t)}function Sh(e,t){if(e==="input"||e==="change")return Oi(t)}function Ch(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:Ch;function Os(e,t){if(Yt(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(!x.call(t,c)||!Yt(e[c],t[c]))return!1}return!0}function Hc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vc(e,t){var s=Hc(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=Hc(s)}}function Kc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gc(){for(var e=window,t=It();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=It(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 bh(e){var t=Gc(),s=e.focusedElem,l=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Kc(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=Vc(s,u);var h=Vc(s,l);c&&h&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==h.node||e.focusOffset!==h.offset)&&(t=t.createRange(),t.setStart(c.node,c.offset),e.removeAllRanges(),u>l?(e.addRange(t),e.extend(h.node,h.offset)):(t.setEnd(h.node,h.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 Nh=g&&"documentMode"in document&&11>=document.documentMode,zr=null,Cl=null,Ms=null,bl=!1;function Qc(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bl||zr==null||zr!==It(l)||(l=zr,"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}),Ms&&Os(Ms,l)||(Ms=l,l=$i(Cl,"onSelect"),0<l.length&&(t=new ml("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=zr)))}function Mi(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Wr={animationend:Mi("Animation","AnimationEnd"),animationiteration:Mi("Animation","AnimationIteration"),animationstart:Mi("Animation","AnimationStart"),transitionend:Mi("Transition","TransitionEnd")},Nl={},Yc={};g&&(Yc=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function Li(e){if(Nl[e])return Nl[e];if(!Wr[e])return e;var t=Wr[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Yc)return Nl[e]=t[s];return e}var Xc=Li("animationend"),Jc=Li("animationiteration"),Zc=Li("animationstart"),eu=Li("transitionend"),tu=new Map,nu="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 Wn(e,t){tu.set(e,t),f(t,[e])}for(var Il=0;Il<nu.length;Il++){var _l=nu[Il],Ih=_l.toLowerCase(),_h=_l[0].toUpperCase()+_l.slice(1);Wn(Ih,"on"+_h)}Wn(Xc,"onAnimationEnd"),Wn(Jc,"onAnimationIteration"),Wn(Zc,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(eu,"onTransitionEnd"),p("onMouseEnter",["mouseout","mouseover"]),p("onMouseLeave",["mouseout","mouseover"]),p("onPointerEnter",["pointerout","pointerover"]),p("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 Ls="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(" "),Eh=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ls));function ru(e,t,s){var l=e.type||"unknown-event";e.currentTarget=s,wi(l,t,void 0,e),e.currentTarget=null}function su(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 h=l.length-1;0<=h;h--){var y=l[h],j=y.instance,T=y.currentTarget;if(y=y.listener,j!==u&&c.isPropagationStopped())break e;ru(c,y,T),u=j}else for(h=0;h<l.length;h++){if(y=l[h],j=y.instance,T=y.currentTarget,y=y.listener,j!==u&&c.isPropagationStopped())break e;ru(c,y,T),u=j}}}if(ar)throw e=Lr,ar=!1,Lr=null,e}function We(e,t){var s=t[Al];s===void 0&&(s=t[Al]=new Set);var l=e+"__bubble";s.has(l)||(iu(t,e,2,!1),s.add(l))}function El(e,t,s){var l=0;t&&(l|=4),iu(s,e,l,t)}var Ai="_reactListening"+Math.random().toString(36).slice(2);function As(e){if(!e[Ai]){e[Ai]=!0,a.forEach(function(s){s!=="selectionchange"&&(Eh.has(s)||El(s,!1,e),El(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ai]||(t[Ai]=!0,El("selectionchange",!1,t))}}function iu(e,t,s,l){switch(_c(t)){case 1:var c=qp;break;case 4:c=Up;break;default:c=fl}s=c.bind(null,t,s,e),c=void 0,!ms||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,s,{capture:!0,passive:c}):e.addEventListener(t,s,!0):c!==void 0?e.addEventListener(t,s,{passive:c}):e.addEventListener(t,s,!1)}function Pl(e,t,s,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var y=l.stateNode.containerInfo;if(y===c||y.nodeType===8&&y.parentNode===c)break;if(h===4)for(h=l.return;h!==null;){var j=h.tag;if((j===3||j===4)&&(j=h.stateNode.containerInfo,j===c||j.nodeType===8&&j.parentNode===c))return;h=h.return}for(;y!==null;){if(h=fr(y),h===null)return;if(j=h.tag,j===5||j===6){l=u=h;continue e}y=y.parentNode}}l=l.return}vi(function(){var T=u,U=Tr(s),H=[];e:{var B=tu.get(e);if(B!==void 0){var oe=ml,ue=e;switch(e){case"keypress":if(Pi(s)===0)break e;case"keydown":case"keyup":oe=ih;break;case"focusin":ue="focus",oe=yl;break;case"focusout":ue="blur",oe=yl;break;case"beforeblur":case"afterblur":oe=yl;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":oe=Rc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=Kp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=ah;break;case Xc:case Jc:case Zc:oe=Yp;break;case eu:oe=uh;break;case"scroll":oe=Hp;break;case"wheel":oe=fh;break;case"copy":case"cut":case"paste":oe=Jp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Oc}var de=(t&4)!==0,Ve=!de&&e==="scroll",I=de?B!==null?B+"Capture":null:B;de=[];for(var S=T,P;S!==null;){P=S;var Y=P.stateNode;if(P.tag===5&&Y!==null&&(P=Y,I!==null&&(Y=ir(S,I),Y!=null&&de.push($s(S,Y,P)))),Ve)break;S=S.return}0<de.length&&(B=new oe(B,ue,null,s,U),H.push({event:B,listeners:de}))}}if((t&7)===0){e:{if(B=e==="mouseover"||e==="pointerover",oe=e==="mouseout"||e==="pointerout",B&&s!==Qt&&(ue=s.relatedTarget||s.fromElement)&&(fr(ue)||ue[vn]))break e;if((oe||B)&&(B=U.window===U?U:(B=U.ownerDocument)?B.defaultView||B.parentWindow:window,oe?(ue=s.relatedTarget||s.toElement,oe=T,ue=ue?fr(ue):null,ue!==null&&(Ve=an(ue),ue!==Ve||ue.tag!==5&&ue.tag!==6)&&(ue=null)):(oe=null,ue=T),oe!==ue)){if(de=Rc,Y="onMouseLeave",I="onMouseEnter",S="mouse",(e==="pointerout"||e==="pointerover")&&(de=Oc,Y="onPointerLeave",I="onPointerEnter",S="pointer"),Ve=oe==null?B:qr(oe),P=ue==null?B:qr(ue),B=new de(Y,S+"leave",oe,s,U),B.target=Ve,B.relatedTarget=P,Y=null,fr(U)===T&&(de=new de(I,S+"enter",ue,s,U),de.target=P,de.relatedTarget=Ve,Y=de),Ve=Y,oe&&ue)t:{for(de=oe,I=ue,S=0,P=de;P;P=Fr(P))S++;for(P=0,Y=I;Y;Y=Fr(Y))P++;for(;0<S-P;)de=Fr(de),S--;for(;0<P-S;)I=Fr(I),P--;for(;S--;){if(de===I||I!==null&&de===I.alternate)break t;de=Fr(de),I=Fr(I)}de=null}else de=null;oe!==null&&ou(H,B,oe,de,!1),ue!==null&&Ve!==null&&ou(H,Ve,ue,de,!0)}}e:{if(B=T?qr(T):window,oe=B.nodeName&&B.nodeName.toLowerCase(),oe==="select"||oe==="input"&&B.type==="file")var me=xh;else if(zc(B))if(Fc)me=Sh;else{me=kh;var we=wh}else(oe=B.nodeName)&&oe.toLowerCase()==="input"&&(B.type==="checkbox"||B.type==="radio")&&(me=jh);if(me&&(me=me(e,T))){Wc(H,me,s,U);break e}we&&we(e,B,T),e==="focusout"&&(we=B._wrapperState)&&we.controlled&&B.type==="number"&&at(B,"number",B.value)}switch(we=T?qr(T):window,e){case"focusin":(zc(we)||we.contentEditable==="true")&&(zr=we,Cl=T,Ms=null);break;case"focusout":Ms=Cl=zr=null;break;case"mousedown":bl=!0;break;case"contextmenu":case"mouseup":case"dragend":bl=!1,Qc(H,s,U);break;case"selectionchange":if(Nh)break;case"keydown":case"keyup":Qc(H,s,U)}var ke;if(wl)e:{switch(e){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else Dr?$c(e,s)&&(Ie="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ie="onCompositionStart");Ie&&(Mc&&s.locale!=="ko"&&(Dr||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&Dr&&(ke=Ec()):(zn=U,hl="value"in zn?zn.value:zn.textContent,Dr=!0)),we=$i(T,Ie),0<we.length&&(Ie=new Tc(Ie,e,null,s,U),H.push({event:Ie,listeners:we}),ke?Ie.data=ke:(ke=Dc(s),ke!==null&&(Ie.data=ke)))),(ke=hh?mh(e,s):gh(e,s))&&(T=$i(T,"onBeforeInput"),0<T.length&&(U=new Tc("onBeforeInput","beforeinput",null,s,U),H.push({event:U,listeners:T}),U.data=ke))}su(H,t)})}function $s(e,t,s){return{instance:e,listener:t,currentTarget:s}}function $i(e,t){for(var s=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;c.tag===5&&u!==null&&(c=u,u=ir(e,s),u!=null&&l.unshift($s(e,u,c)),u=ir(e,t),u!=null&&l.push($s(e,u,c))),e=e.return}return l}function Fr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ou(e,t,s,l,c){for(var u=t._reactName,h=[];s!==null&&s!==l;){var y=s,j=y.alternate,T=y.stateNode;if(j!==null&&j===l)break;y.tag===5&&T!==null&&(y=T,c?(j=ir(s,u),j!=null&&h.unshift($s(s,j,y))):c||(j=ir(s,u),j!=null&&h.push($s(s,j,y)))),s=s.return}h.length!==0&&e.push({event:t,listeners:h})}var Ph=/\r\n?/g,Rh=/\u0000|\uFFFD/g;function lu(e){return(typeof e=="string"?e:""+e).replace(Ph,`
|
|
7
|
+
`).replace(Rh,"")}function Di(e,t,s){if(t=lu(t),lu(e)!==t&&s)throw Error(o(425))}function zi(){}var Rl=null,Tl=null;function Ol(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,Th=typeof clearTimeout=="function"?clearTimeout:void 0,au=typeof Promise=="function"?Promise:void 0,Oh=typeof queueMicrotask=="function"?queueMicrotask:typeof au<"u"?function(e){return au.resolve(null).then(e).catch(Mh)}:Ml;function Mh(e){setTimeout(function(){throw e})}function Ll(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),Is(t);return}l--}else s!=="$"&&s!=="$?"&&s!=="$!"||l++;s=c}while(s);Is(t)}function Fn(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 cu(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 Br=Math.random().toString(36).slice(2),un="__reactFiber$"+Br,Ds="__reactProps$"+Br,vn="__reactContainer$"+Br,Al="__reactEvents$"+Br,Lh="__reactListeners$"+Br,Ah="__reactHandles$"+Br;function fr(e){var t=e[un];if(t)return t;for(var s=e.parentNode;s;){if(t=s[vn]||s[un]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=cu(e);e!==null;){if(s=e[un])return s;e=cu(e)}return t}e=s,s=e.parentNode}return null}function zs(e){return e=e[un]||e[vn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function Wi(e){return e[Ds]||null}var $l=[],Ur=-1;function Bn(e){return{current:e}}function Fe(e){0>Ur||(e.current=$l[Ur],$l[Ur]=null,Ur--)}function De(e,t){Ur++,$l[Ur]=e.current,e.current=t}var qn={},ut=Bn(qn),yt=Bn(!1),pr=qn;function Hr(e,t){var s=e.type.contextTypes;if(!s)return qn;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 Fi(){Fe(yt),Fe(ut)}function uu(e,t,s){if(ut.current!==qn)throw Error(o(168));De(ut,t),De(yt,s)}function du(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,he(e)||"Unknown",c));return q({},s,l)}function Bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qn,pr=ut.current,De(ut,e),De(yt,yt.current),!0}function fu(e,t,s){var l=e.stateNode;if(!l)throw Error(o(169));s?(e=du(e,t,pr),l.__reactInternalMemoizedMergedChildContext=e,Fe(yt),Fe(ut),De(ut,e)):Fe(yt),De(yt,s)}var yn=null,qi=!1,Dl=!1;function pu(e){yn===null?yn=[e]:yn.push(e)}function $h(e){qi=!0,pu(e)}function Un(){if(!Dl&&yn!==null){Dl=!0;var e=0,t=Me;try{var s=yn;for(Me=1;e<s.length;e++){var l=s[e];do l=l(!0);while(l!==null)}yn=null,qi=!1}catch(c){throw yn!==null&&(yn=yn.slice(e+1)),ws(ge,Un),c}finally{Me=t,Dl=!1}}return null}var Vr=[],Kr=0,Ui=null,Hi=0,zt=[],Wt=0,hr=null,xn=1,wn="";function mr(e,t){Vr[Kr++]=Hi,Vr[Kr++]=Ui,Ui=e,Hi=t}function hu(e,t,s){zt[Wt++]=xn,zt[Wt++]=wn,zt[Wt++]=hr,hr=e;var l=xn;e=wn;var c=32-Pt(l)-1;l&=~(1<<c),s+=1;var u=32-Pt(t)+c;if(30<u){var h=c-c%5;u=(l&(1<<h)-1).toString(32),l>>=h,c-=h,xn=1<<32-Pt(t)+c|s<<c|l,wn=u+e}else xn=1<<u|s<<c|l,wn=e}function zl(e){e.return!==null&&(mr(e,1),hu(e,1,0))}function Wl(e){for(;e===Ui;)Ui=Vr[--Kr],Vr[Kr]=null,Hi=Vr[--Kr],Vr[Kr]=null;for(;e===hr;)hr=zt[--Wt],zt[Wt]=null,wn=zt[--Wt],zt[Wt]=null,xn=zt[--Wt],zt[Wt]=null}var Tt=null,Ot=null,Be=!1,Xt=null;function mu(e,t){var s=Ut(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 gu(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,Tt=e,Ot=Fn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tt=e,Ot=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=hr!==null?{id:xn,overflow:wn}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Ut(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,Tt=e,Ot=null,!0):!1;default:return!1}}function Fl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Bl(e){if(Be){var t=Ot;if(t){var s=t;if(!gu(e,t)){if(Fl(e))throw Error(o(418));t=Fn(s.nextSibling);var l=Tt;t&&gu(e,t)?mu(l,s):(e.flags=e.flags&-4097|2,Be=!1,Tt=e)}}else{if(Fl(e))throw Error(o(418));e.flags=e.flags&-4097|2,Be=!1,Tt=e}}}function vu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tt=e}function Vi(e){if(e!==Tt)return!1;if(!Be)return vu(e),Be=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ol(e.type,e.memoizedProps)),t&&(t=Ot)){if(Fl(e))throw yu(),Error(o(418));for(;t;)mu(e,t),t=Fn(t.nextSibling)}if(vu(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){Ot=Fn(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Ot=null}}else Ot=Tt?Fn(e.stateNode.nextSibling):null;return!0}function yu(){for(var e=Ot;e;)e=Fn(e.nextSibling)}function Gr(){Ot=Tt=null,Be=!1}function ql(e){Xt===null?Xt=[e]:Xt.push(e)}var Dh=se.ReactCurrentBatchConfig;function Ws(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(h){var y=c.refs;h===null?delete y[u]:y[u]=h},t._stringRef=u,t)}if(typeof e!="string")throw Error(o(284));if(!s._owner)throw Error(o(290,e))}return e}function Ki(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function xu(e){var t=e._init;return t(e._payload)}function wu(e){function t(I,S){if(e){var P=I.deletions;P===null?(I.deletions=[S],I.flags|=16):P.push(S)}}function s(I,S){if(!e)return null;for(;S!==null;)t(I,S),S=S.sibling;return null}function l(I,S){for(I=new Map;S!==null;)S.key!==null?I.set(S.key,S):I.set(S.index,S),S=S.sibling;return I}function c(I,S){return I=Jn(I,S),I.index=0,I.sibling=null,I}function u(I,S,P){return I.index=P,e?(P=I.alternate,P!==null?(P=P.index,P<S?(I.flags|=2,S):P):(I.flags|=2,S)):(I.flags|=1048576,S)}function h(I){return e&&I.alternate===null&&(I.flags|=2),I}function y(I,S,P,Y){return S===null||S.tag!==6?(S=Ma(P,I.mode,Y),S.return=I,S):(S=c(S,P),S.return=I,S)}function j(I,S,P,Y){var me=P.type;return me===D?U(I,S,P.props.children,Y,P.key):S!==null&&(S.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===fe&&xu(me)===S.type)?(Y=c(S,P.props),Y.ref=Ws(I,S,P),Y.return=I,Y):(Y=yo(P.type,P.key,P.props,null,I.mode,Y),Y.ref=Ws(I,S,P),Y.return=I,Y)}function T(I,S,P,Y){return S===null||S.tag!==4||S.stateNode.containerInfo!==P.containerInfo||S.stateNode.implementation!==P.implementation?(S=La(P,I.mode,Y),S.return=I,S):(S=c(S,P.children||[]),S.return=I,S)}function U(I,S,P,Y,me){return S===null||S.tag!==7?(S=Sr(P,I.mode,Y,me),S.return=I,S):(S=c(S,P),S.return=I,S)}function H(I,S,P){if(typeof S=="string"&&S!==""||typeof S=="number")return S=Ma(""+S,I.mode,P),S.return=I,S;if(typeof S=="object"&&S!==null){switch(S.$$typeof){case re:return P=yo(S.type,S.key,S.props,null,I.mode,P),P.ref=Ws(I,null,S),P.return=I,P;case b:return S=La(S,I.mode,P),S.return=I,S;case fe:var Y=S._init;return H(I,Y(S._payload),P)}if(At(S)||ne(S))return S=Sr(S,I.mode,P,null),S.return=I,S;Ki(I,S)}return null}function B(I,S,P,Y){var me=S!==null?S.key:null;if(typeof P=="string"&&P!==""||typeof P=="number")return me!==null?null:y(I,S,""+P,Y);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case re:return P.key===me?j(I,S,P,Y):null;case b:return P.key===me?T(I,S,P,Y):null;case fe:return me=P._init,B(I,S,me(P._payload),Y)}if(At(P)||ne(P))return me!==null?null:U(I,S,P,Y,null);Ki(I,P)}return null}function oe(I,S,P,Y,me){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return I=I.get(P)||null,y(S,I,""+Y,me);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case re:return I=I.get(Y.key===null?P:Y.key)||null,j(S,I,Y,me);case b:return I=I.get(Y.key===null?P:Y.key)||null,T(S,I,Y,me);case fe:var we=Y._init;return oe(I,S,P,we(Y._payload),me)}if(At(Y)||ne(Y))return I=I.get(P)||null,U(S,I,Y,me,null);Ki(S,Y)}return null}function ue(I,S,P,Y){for(var me=null,we=null,ke=S,Ie=S=0,st=null;ke!==null&&Ie<P.length;Ie++){ke.index>Ie?(st=ke,ke=null):st=ke.sibling;var Oe=B(I,ke,P[Ie],Y);if(Oe===null){ke===null&&(ke=st);break}e&&ke&&Oe.alternate===null&&t(I,ke),S=u(Oe,S,Ie),we===null?me=Oe:we.sibling=Oe,we=Oe,ke=st}if(Ie===P.length)return s(I,ke),Be&&mr(I,Ie),me;if(ke===null){for(;Ie<P.length;Ie++)ke=H(I,P[Ie],Y),ke!==null&&(S=u(ke,S,Ie),we===null?me=ke:we.sibling=ke,we=ke);return Be&&mr(I,Ie),me}for(ke=l(I,ke);Ie<P.length;Ie++)st=oe(ke,I,Ie,P[Ie],Y),st!==null&&(e&&st.alternate!==null&&ke.delete(st.key===null?Ie:st.key),S=u(st,S,Ie),we===null?me=st:we.sibling=st,we=st);return e&&ke.forEach(function(Zn){return t(I,Zn)}),Be&&mr(I,Ie),me}function de(I,S,P,Y){var me=ne(P);if(typeof me!="function")throw Error(o(150));if(P=me.call(P),P==null)throw Error(o(151));for(var we=me=null,ke=S,Ie=S=0,st=null,Oe=P.next();ke!==null&&!Oe.done;Ie++,Oe=P.next()){ke.index>Ie?(st=ke,ke=null):st=ke.sibling;var Zn=B(I,ke,Oe.value,Y);if(Zn===null){ke===null&&(ke=st);break}e&&ke&&Zn.alternate===null&&t(I,ke),S=u(Zn,S,Ie),we===null?me=Zn:we.sibling=Zn,we=Zn,ke=st}if(Oe.done)return s(I,ke),Be&&mr(I,Ie),me;if(ke===null){for(;!Oe.done;Ie++,Oe=P.next())Oe=H(I,Oe.value,Y),Oe!==null&&(S=u(Oe,S,Ie),we===null?me=Oe:we.sibling=Oe,we=Oe);return Be&&mr(I,Ie),me}for(ke=l(I,ke);!Oe.done;Ie++,Oe=P.next())Oe=oe(ke,I,Ie,Oe.value,Y),Oe!==null&&(e&&Oe.alternate!==null&&ke.delete(Oe.key===null?Ie:Oe.key),S=u(Oe,S,Ie),we===null?me=Oe:we.sibling=Oe,we=Oe);return e&&ke.forEach(function(vm){return t(I,vm)}),Be&&mr(I,Ie),me}function Ve(I,S,P,Y){if(typeof P=="object"&&P!==null&&P.type===D&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case re:e:{for(var me=P.key,we=S;we!==null;){if(we.key===me){if(me=P.type,me===D){if(we.tag===7){s(I,we.sibling),S=c(we,P.props.children),S.return=I,I=S;break e}}else if(we.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===fe&&xu(me)===we.type){s(I,we.sibling),S=c(we,P.props),S.ref=Ws(I,we,P),S.return=I,I=S;break e}s(I,we);break}else t(I,we);we=we.sibling}P.type===D?(S=Sr(P.props.children,I.mode,Y,P.key),S.return=I,I=S):(Y=yo(P.type,P.key,P.props,null,I.mode,Y),Y.ref=Ws(I,S,P),Y.return=I,I=Y)}return h(I);case b:e:{for(we=P.key;S!==null;){if(S.key===we)if(S.tag===4&&S.stateNode.containerInfo===P.containerInfo&&S.stateNode.implementation===P.implementation){s(I,S.sibling),S=c(S,P.children||[]),S.return=I,I=S;break e}else{s(I,S);break}else t(I,S);S=S.sibling}S=La(P,I.mode,Y),S.return=I,I=S}return h(I);case fe:return we=P._init,Ve(I,S,we(P._payload),Y)}if(At(P))return ue(I,S,P,Y);if(ne(P))return de(I,S,P,Y);Ki(I,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,S!==null&&S.tag===6?(s(I,S.sibling),S=c(S,P),S.return=I,I=S):(s(I,S),S=Ma(P,I.mode,Y),S.return=I,I=S),h(I)):s(I,S)}return Ve}var Qr=wu(!0),ku=wu(!1),Gi=Bn(null),Qi=null,Yr=null,Ul=null;function Hl(){Ul=Yr=Qi=null}function Vl(e){var t=Gi.current;Fe(Gi),e._currentValue=t}function Kl(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 Xr(e,t){Qi=e,Ul=Yr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(wt=!0),e.firstContext=null)}function Ft(e){var t=e._currentValue;if(Ul!==e)if(e={context:e,memoizedValue:t,next:null},Yr===null){if(Qi===null)throw Error(o(308));Yr=e,Qi.dependencies={lanes:0,firstContext:e}}else Yr=Yr.next=e;return t}var gr=null;function Gl(e){gr===null?gr=[e]:gr.push(e)}function ju(e,t,s,l){var c=t.interleaved;return c===null?(s.next=s,Gl(t)):(s.next=c.next,c.next=s),t.interleaved=s,kn(e,l)}function kn(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 Hn=!1;function Ql(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Su(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 jn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vn(e,t,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Re&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,kn(e,s)}return c=l.interleaved,c===null?(t.next=t,Gl(l)):(t.next=c.next,c.next=t),l.interleaved=t,kn(e,s)}function Yi(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,cl(e,s)}}function Cu(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 h={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};u===null?c=u=h:u=u.next=h,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 Xi(e,t,s,l){var c=e.updateQueue;Hn=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,y=c.shared.pending;if(y!==null){c.shared.pending=null;var j=y,T=j.next;j.next=null,h===null?u=T:h.next=T,h=j;var U=e.alternate;U!==null&&(U=U.updateQueue,y=U.lastBaseUpdate,y!==h&&(y===null?U.firstBaseUpdate=T:y.next=T,U.lastBaseUpdate=j))}if(u!==null){var H=c.baseState;h=0,U=T=j=null,y=u;do{var B=y.lane,oe=y.eventTime;if((l&B)===B){U!==null&&(U=U.next={eventTime:oe,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ue=e,de=y;switch(B=t,oe=s,de.tag){case 1:if(ue=de.payload,typeof ue=="function"){H=ue.call(oe,H,B);break e}H=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=de.payload,B=typeof ue=="function"?ue.call(oe,H,B):ue,B==null)break e;H=q({},H,B);break e;case 2:Hn=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,B=c.effects,B===null?c.effects=[y]:B.push(y))}else oe={eventTime:oe,lane:B,tag:y.tag,payload:y.payload,callback:y.callback,next:null},U===null?(T=U=oe,j=H):U=U.next=oe,h|=B;if(y=y.next,y===null){if(y=c.shared.pending,y===null)break;B=y,y=B.next,B.next=null,c.lastBaseUpdate=B,c.shared.pending=null}}while(!0);if(U===null&&(j=H),c.baseState=j,c.firstBaseUpdate=T,c.lastBaseUpdate=U,t=c.shared.interleaved,t!==null){c=t;do h|=c.lane,c=c.next;while(c!==t)}else u===null&&(c.shared.lanes=0);xr|=h,e.lanes=h,e.memoizedState=H}}function bu(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 Fs={},dn=Bn(Fs),Bs=Bn(Fs),qs=Bn(Fs);function vr(e){if(e===Fs)throw Error(o(174));return e}function Yl(e,t){switch(De(qs,t),De(Bs,e),De(dn,Fs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Tn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Tn(t,e)}Fe(dn),De(dn,t)}function Jr(){Fe(dn),Fe(Bs),Fe(qs)}function Nu(e){vr(qs.current);var t=vr(dn.current),s=Tn(t,e.type);t!==s&&(De(Bs,e),De(dn,s))}function Xl(e){Bs.current===e&&(Fe(dn),Fe(Bs))}var qe=Bn(0);function Ji(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 Jl=[];function Zl(){for(var e=0;e<Jl.length;e++)Jl[e]._workInProgressVersionPrimary=null;Jl.length=0}var Zi=se.ReactCurrentDispatcher,ea=se.ReactCurrentBatchConfig,yr=0,Ue=null,Ye=null,nt=null,eo=!1,Us=!1,Hs=0,zh=0;function dt(){throw Error(o(321))}function ta(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Yt(e[s],t[s]))return!1;return!0}function na(e,t,s,l,c,u){if(yr=u,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Zi.current=e===null||e.memoizedState===null?qh:Uh,e=s(l,c),Us){u=0;do{if(Us=!1,Hs=0,25<=u)throw Error(o(301));u+=1,nt=Ye=null,t.updateQueue=null,Zi.current=Hh,e=s(l,c)}while(Us)}if(Zi.current=ro,t=Ye!==null&&Ye.next!==null,yr=0,nt=Ye=Ue=null,eo=!1,t)throw Error(o(300));return e}function ra(){var e=Hs!==0;return Hs=0,e}function fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?Ue.memoizedState=nt=e:nt=nt.next=e,nt}function Bt(){if(Ye===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=nt===null?Ue.memoizedState:nt.next;if(t!==null)nt=t,Ye=e;else{if(e===null)throw Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},nt===null?Ue.memoizedState=nt=e:nt=nt.next=e}return nt}function Vs(e,t){return typeof t=="function"?t(e):t}function sa(e){var t=Bt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=Ye,c=l.baseQueue,u=s.pending;if(u!==null){if(c!==null){var h=c.next;c.next=u.next,u.next=h}l.baseQueue=c=u,s.pending=null}if(c!==null){u=c.next,l=l.baseState;var y=h=null,j=null,T=u;do{var U=T.lane;if((yr&U)===U)j!==null&&(j=j.next={lane:0,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null}),l=T.hasEagerState?T.eagerState:e(l,T.action);else{var H={lane:U,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null};j===null?(y=j=H,h=l):j=j.next=H,Ue.lanes|=U,xr|=U}T=T.next}while(T!==null&&T!==u);j===null?h=l:j.next=y,Yt(l,t.memoizedState)||(wt=!0),t.memoizedState=l,t.baseState=h,t.baseQueue=j,s.lastRenderedState=l}if(e=s.interleaved,e!==null){c=e;do u=c.lane,Ue.lanes|=u,xr|=u,c=c.next;while(c!==e)}else c===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function ia(e){var t=Bt(),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 h=c=c.next;do u=e(u,h.action),h=h.next;while(h!==c);Yt(u,t.memoizedState)||(wt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),s.lastRenderedState=u}return[u,l]}function Iu(){}function _u(e,t){var s=Ue,l=Bt(),c=t(),u=!Yt(l.memoizedState,c);if(u&&(l.memoizedState=c,wt=!0),l=l.queue,oa(Ru.bind(null,s,l,e),[e]),l.getSnapshot!==t||u||nt!==null&&nt.memoizedState.tag&1){if(s.flags|=2048,Ks(9,Pu.bind(null,s,l,c,t),void 0,null),rt===null)throw Error(o(349));(yr&30)!==0||Eu(s,t,c)}return c}function Eu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ue.updateQueue,t===null?(t={lastEffect:null,stores:null},Ue.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Pu(e,t,s,l){t.value=s,t.getSnapshot=l,Tu(t)&&Ou(e)}function Ru(e,t,s){return s(function(){Tu(t)&&Ou(e)})}function Tu(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Yt(e,s)}catch{return!0}}function Ou(e){var t=kn(e,1);t!==null&&tn(t,e,1,-1)}function Mu(e){var t=fn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vs,lastRenderedState:e},t.queue=e,e=e.dispatch=Bh.bind(null,Ue,e),[t.memoizedState,e]}function Ks(e,t,s,l){return e={tag:e,create:t,destroy:s,deps:l,next:null},t=Ue.updateQueue,t===null?(t={lastEffect:null,stores:null},Ue.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,t.lastEffect=e)),e}function Lu(){return Bt().memoizedState}function to(e,t,s,l){var c=fn();Ue.flags|=e,c.memoizedState=Ks(1|t,s,void 0,l===void 0?null:l)}function no(e,t,s,l){var c=Bt();l=l===void 0?null:l;var u=void 0;if(Ye!==null){var h=Ye.memoizedState;if(u=h.destroy,l!==null&&ta(l,h.deps)){c.memoizedState=Ks(t,s,u,l);return}}Ue.flags|=e,c.memoizedState=Ks(1|t,s,u,l)}function Au(e,t){return to(8390656,8,e,t)}function oa(e,t){return no(2048,8,e,t)}function $u(e,t){return no(4,2,e,t)}function Du(e,t){return no(4,4,e,t)}function zu(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 Wu(e,t,s){return s=s!=null?s.concat([e]):null,no(4,4,zu.bind(null,t,e),s)}function la(){}function Fu(e,t){var s=Bt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&ta(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function Bu(e,t){var s=Bt();t=t===void 0?null:t;var l=s.memoizedState;return l!==null&&t!==null&&ta(t,l[1])?l[0]:(e=e(),s.memoizedState=[e,t],e)}function qu(e,t,s){return(yr&21)===0?(e.baseState&&(e.baseState=!1,wt=!0),e.memoizedState=s):(Yt(s,t)||(s=xc(),Ue.lanes|=s,xr|=s,e.baseState=!0),t)}function Wh(e,t){var s=Me;Me=s!==0&&4>s?s:4,e(!0);var l=ea.transition;ea.transition={};try{e(!1),t()}finally{Me=s,ea.transition=l}}function Uu(){return Bt().memoizedState}function Fh(e,t,s){var l=Yn(e);if(s={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null},Hu(e))Vu(t,s);else if(s=ju(e,t,s,l),s!==null){var c=gt();tn(s,e,l,c),Ku(s,t,l)}}function Bh(e,t,s){var l=Yn(e),c={lane:l,action:s,hasEagerState:!1,eagerState:null,next:null};if(Hu(e))Vu(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,y=u(h,s);if(c.hasEagerState=!0,c.eagerState=y,Yt(y,h)){var j=t.interleaved;j===null?(c.next=c,Gl(t)):(c.next=j.next,j.next=c),t.interleaved=c;return}}catch{}s=ju(e,t,c,l),s!==null&&(c=gt(),tn(s,e,l,c),Ku(s,t,l))}}function Hu(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function Vu(e,t){Us=eo=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Ku(e,t,s){if((s&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,cl(e,s)}}var ro={readContext:Ft,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useInsertionEffect:dt,useLayoutEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useMutableSource:dt,useSyncExternalStore:dt,useId:dt,unstable_isNewReconciler:!1},qh={readContext:Ft,useCallback:function(e,t){return fn().memoizedState=[e,t===void 0?null:t],e},useContext:Ft,useEffect:Au,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,to(4194308,4,zu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return to(4194308,4,e,t)},useInsertionEffect:function(e,t){return to(4,2,e,t)},useMemo:function(e,t){var s=fn();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var l=fn();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=Fh.bind(null,Ue,e),[l.memoizedState,e]},useRef:function(e){var t=fn();return e={current:e},t.memoizedState=e},useState:Mu,useDebugValue:la,useDeferredValue:function(e){return fn().memoizedState=e},useTransition:function(){var e=Mu(!1),t=e[0];return e=Wh.bind(null,e[1]),fn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var l=Ue,c=fn();if(Be){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),rt===null)throw Error(o(349));(yr&30)!==0||Eu(l,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,Au(Ru.bind(null,l,u,e),[e]),l.flags|=2048,Ks(9,Pu.bind(null,l,u,s,t),void 0,null),s},useId:function(){var e=fn(),t=rt.identifierPrefix;if(Be){var s=wn,l=xn;s=(l&~(1<<32-Pt(l)-1)).toString(32)+s,t=":"+t+"R"+s,s=Hs++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=zh++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Uh={readContext:Ft,useCallback:Fu,useContext:Ft,useEffect:oa,useImperativeHandle:Wu,useInsertionEffect:$u,useLayoutEffect:Du,useMemo:Bu,useReducer:sa,useRef:Lu,useState:function(){return sa(Vs)},useDebugValue:la,useDeferredValue:function(e){var t=Bt();return qu(t,Ye.memoizedState,e)},useTransition:function(){var e=sa(Vs)[0],t=Bt().memoizedState;return[e,t]},useMutableSource:Iu,useSyncExternalStore:_u,useId:Uu,unstable_isNewReconciler:!1},Hh={readContext:Ft,useCallback:Fu,useContext:Ft,useEffect:oa,useImperativeHandle:Wu,useInsertionEffect:$u,useLayoutEffect:Du,useMemo:Bu,useReducer:ia,useRef:Lu,useState:function(){return ia(Vs)},useDebugValue:la,useDeferredValue:function(e){var t=Bt();return Ye===null?t.memoizedState=e:qu(t,Ye.memoizedState,e)},useTransition:function(){var e=ia(Vs)[0],t=Bt().memoizedState;return[e,t]},useMutableSource:Iu,useSyncExternalStore:_u,useId:Uu,unstable_isNewReconciler:!1};function Jt(e,t){if(e&&e.defaultProps){t=q({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function aa(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:q({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var so={isMounted:function(e){return(e=e._reactInternals)?an(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var l=gt(),c=Yn(e),u=jn(l,c);u.payload=t,s!=null&&(u.callback=s),t=Vn(e,u,c),t!==null&&(tn(t,e,c,l),Yi(t,e,c))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=gt(),c=Yn(e),u=jn(l,c);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=Vn(e,u,c),t!==null&&(tn(t,e,c,l),Yi(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=gt(),l=Yn(e),c=jn(s,l);c.tag=2,t!=null&&(c.callback=t),t=Vn(e,c,l),t!==null&&(tn(t,e,l,s),Yi(t,e,l))}};function Gu(e,t,s,l,c,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,h):t.prototype&&t.prototype.isPureReactComponent?!Os(s,l)||!Os(c,u):!0}function Qu(e,t,s){var l=!1,c=qn,u=t.contextType;return typeof u=="object"&&u!==null?u=Ft(u):(c=xt(t)?pr:ut.current,l=t.contextTypes,u=(l=l!=null)?Hr(e,c):qn),t=new t(s,u),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=so,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=u),t}function Yu(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&&so.enqueueReplaceState(t,t.state,null)}function ca(e,t,s,l){var c=e.stateNode;c.props=s,c.state=e.memoizedState,c.refs={},Ql(e);var u=t.contextType;typeof u=="object"&&u!==null?c.context=Ft(u):(u=xt(t)?pr:ut.current,c.context=Hr(e,u)),c.state=e.memoizedState,u=t.getDerivedStateFromProps,typeof u=="function"&&(aa(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&&so.enqueueReplaceState(c,c.state,null),Xi(e,s,c,l),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function Zr(e,t){try{var s="",l=t;do s+=ye(l),l=l.return;while(l);var c=s}catch(u){c=`
|
|
8
|
+
Error generating stack: `+u.message+`
|
|
9
|
+
`+u.stack}return{value:e,source:t,stack:c,digest:null}}function ua(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function da(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var Vh=typeof WeakMap=="function"?WeakMap:Map;function Xu(e,t,s){s=jn(-1,s),s.tag=3,s.payload={element:null};var l=t.value;return s.callback=function(){fo||(fo=!0,Na=l),da(e,t)},s}function Ju(e,t,s){s=jn(-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(){da(e,t)}}var u=e.stateNode;return u!==null&&typeof u.componentDidCatch=="function"&&(s.callback=function(){da(e,t),typeof l!="function"&&(Gn===null?Gn=new Set([this]):Gn.add(this));var h=t.stack;this.componentDidCatch(t.value,{componentStack:h!==null?h:""})}),s}function Zu(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new Vh;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=om.bind(null,e,t,s),t.then(e,e))}function ed(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 td(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=jn(-1,1),t.tag=2,Vn(s,t,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=c,e)}var Kh=se.ReactCurrentOwner,wt=!1;function mt(e,t,s,l){t.child=e===null?ku(t,null,s,l):Qr(t,e.child,s,l)}function nd(e,t,s,l,c){s=s.render;var u=t.ref;return Xr(t,c),l=na(e,t,s,l,u,c),s=ra(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Sn(e,t,c)):(Be&&s&&zl(t),t.flags|=1,mt(e,t,l,c),t.child)}function rd(e,t,s,l,c){if(e===null){var u=s.type;return typeof u=="function"&&!Oa(u)&&u.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=u,sd(e,t,u,l,c)):(e=yo(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 h=u.memoizedProps;if(s=s.compare,s=s!==null?s:Os,s(h,l)&&e.ref===t.ref)return Sn(e,t,c)}return t.flags|=1,e=Jn(u,l),e.ref=t.ref,e.return=t,t.child=e}function sd(e,t,s,l,c){if(e!==null){var u=e.memoizedProps;if(Os(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,Sn(e,t,c)}return fa(e,t,s,l,c)}function id(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},De(ts,Mt),Mt|=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,De(ts,Mt),Mt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=u!==null?u.baseLanes:s,De(ts,Mt),Mt|=l}else u!==null?(l=u.baseLanes|s,t.memoizedState=null):l=s,De(ts,Mt),Mt|=l;return mt(e,t,c,s),t.child}function od(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function fa(e,t,s,l,c){var u=xt(s)?pr:ut.current;return u=Hr(t,u),Xr(t,c),s=na(e,t,s,l,u,c),l=ra(),e!==null&&!wt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,Sn(e,t,c)):(Be&&l&&zl(t),t.flags|=1,mt(e,t,s,c),t.child)}function ld(e,t,s,l,c){if(xt(s)){var u=!0;Bi(t)}else u=!1;if(Xr(t,c),t.stateNode===null)oo(e,t),Qu(t,s,l),ca(t,s,l,c),l=!0;else if(e===null){var h=t.stateNode,y=t.memoizedProps;h.props=y;var j=h.context,T=s.contextType;typeof T=="object"&&T!==null?T=Ft(T):(T=xt(s)?pr:ut.current,T=Hr(t,T));var U=s.getDerivedStateFromProps,H=typeof U=="function"||typeof h.getSnapshotBeforeUpdate=="function";H||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==l||j!==T)&&Yu(t,h,l,T),Hn=!1;var B=t.memoizedState;h.state=B,Xi(t,l,h,c),j=t.memoizedState,y!==l||B!==j||yt.current||Hn?(typeof U=="function"&&(aa(t,s,U,l),j=t.memoizedState),(y=Hn||Gu(t,s,y,l,B,j,T))?(H||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=j),h.props=l,h.state=j,h.context=T,l=y):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{h=t.stateNode,Su(e,t),y=t.memoizedProps,T=t.type===t.elementType?y:Jt(t.type,y),h.props=T,H=t.pendingProps,B=h.context,j=s.contextType,typeof j=="object"&&j!==null?j=Ft(j):(j=xt(s)?pr:ut.current,j=Hr(t,j));var oe=s.getDerivedStateFromProps;(U=typeof oe=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==H||B!==j)&&Yu(t,h,l,j),Hn=!1,B=t.memoizedState,h.state=B,Xi(t,l,h,c);var ue=t.memoizedState;y!==H||B!==ue||yt.current||Hn?(typeof oe=="function"&&(aa(t,s,oe,l),ue=t.memoizedState),(T=Hn||Gu(t,s,T,l,B,ue,j)||!1)?(U||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,ue,j),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,ue,j)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ue),h.props=l,h.state=ue,h.context=j,l=T):(typeof h.componentDidUpdate!="function"||y===e.memoizedProps&&B===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&B===e.memoizedState||(t.flags|=1024),l=!1)}return pa(e,t,s,l,u,c)}function pa(e,t,s,l,c,u){od(e,t);var h=(t.flags&128)!==0;if(!l&&!h)return c&&fu(t,s,!1),Sn(e,t,u);l=t.stateNode,Kh.current=t;var y=h&&typeof s.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&h?(t.child=Qr(t,e.child,null,u),t.child=Qr(t,null,y,u)):mt(e,t,y,u),t.memoizedState=l.state,c&&fu(t,s,!0),t.child}function ad(e){var t=e.stateNode;t.pendingContext?uu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&uu(e,t.context,!1),Yl(e,t.containerInfo)}function cd(e,t,s,l,c){return Gr(),ql(c),t.flags|=256,mt(e,t,s,l),t.child}var ha={dehydrated:null,treeContext:null,retryLane:0};function ma(e){return{baseLanes:e,cachePool:null,transitions:null}}function ud(e,t,s){var l=t.pendingProps,c=qe.current,u=!1,h=(t.flags&128)!==0,y;if((y=h)||(y=e!==null&&e.memoizedState===null?!1:(c&2)!==0),y?(u=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),De(qe,c&1),e===null)return Bl(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):(h=l.children,e=l.fallback,u?(l=t.mode,u=t.child,h={mode:"hidden",children:h},(l&1)===0&&u!==null?(u.childLanes=0,u.pendingProps=h):u=xo(h,l,0,null),e=Sr(e,l,s,null),u.return=t,e.return=t,u.sibling=e,t.child=u,t.child.memoizedState=ma(s),t.memoizedState=ha,e):ga(t,h));if(c=e.memoizedState,c!==null&&(y=c.dehydrated,y!==null))return Gh(e,t,h,l,y,c,s);if(u){u=l.fallback,h=t.mode,c=e.child,y=c.sibling;var j={mode:"hidden",children:l.children};return(h&1)===0&&t.child!==c?(l=t.child,l.childLanes=0,l.pendingProps=j,t.deletions=null):(l=Jn(c,j),l.subtreeFlags=c.subtreeFlags&14680064),y!==null?u=Jn(y,u):(u=Sr(u,h,s,null),u.flags|=2),u.return=t,l.return=t,l.sibling=u,t.child=l,l=u,u=t.child,h=e.child.memoizedState,h=h===null?ma(s):{baseLanes:h.baseLanes|s,cachePool:null,transitions:h.transitions},u.memoizedState=h,u.childLanes=e.childLanes&~s,t.memoizedState=ha,l}return u=e.child,e=u.sibling,l=Jn(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 ga(e,t){return t=xo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function io(e,t,s,l){return l!==null&&ql(l),Qr(t,e.child,null,s),e=ga(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gh(e,t,s,l,c,u,h){if(s)return t.flags&256?(t.flags&=-257,l=ua(Error(o(422))),io(e,t,h,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(u=l.fallback,c=t.mode,l=xo({mode:"visible",children:l.children},c,0,null),u=Sr(u,c,h,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,h),t.child.memoizedState=ma(h),t.memoizedState=ha,u);if((t.mode&1)===0)return io(e,t,h,null);if(c.data==="$!"){if(l=c.nextSibling&&c.nextSibling.dataset,l)var y=l.dgst;return l=y,u=Error(o(419)),l=ua(u,l,void 0),io(e,t,h,l)}if(y=(h&e.childLanes)!==0,wt||y){if(l=rt,l!==null){switch(h&-h){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|h))!==0?0:c,c!==0&&c!==u.retryLane&&(u.retryLane=c,kn(e,c),tn(l,e,c,-1))}return Ta(),l=ua(Error(o(421))),io(e,t,h,l)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=lm.bind(null,e),c._reactRetry=t,null):(e=u.treeContext,Ot=Fn(c.nextSibling),Tt=t,Be=!0,Xt=null,e!==null&&(zt[Wt++]=xn,zt[Wt++]=wn,zt[Wt++]=hr,xn=e.id,wn=e.overflow,hr=t),t=ga(t,l.children),t.flags|=4096,t)}function dd(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Kl(e.return,t,s)}function va(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 fd(e,t,s){var l=t.pendingProps,c=l.revealOrder,u=l.tail;if(mt(e,t,l.children,s),l=qe.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&dd(e,s,t);else if(e.tag===19)dd(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(De(qe,l),(t.mode&1)===0)t.memoizedState=null;else switch(c){case"forwards":for(s=t.child,c=null;s!==null;)e=s.alternate,e!==null&&Ji(e)===null&&(c=s),s=s.sibling;s=c,s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),va(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&&Ji(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}va(t,!0,s,null,u);break;case"together":va(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function oo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Sn(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),xr|=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=Jn(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Jn(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Qh(e,t,s){switch(t.tag){case 3:ad(t),Gr();break;case 5:Nu(t);break;case 1:xt(t.type)&&Bi(t);break;case 4:Yl(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,c=t.memoizedProps.value;De(Gi,l._currentValue),l._currentValue=c;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(De(qe,qe.current&1),t.flags|=128,null):(s&t.child.childLanes)!==0?ud(e,t,s):(De(qe,qe.current&1),e=Sn(e,t,s),e!==null?e.sibling:null);De(qe,qe.current&1);break;case 19:if(l=(s&t.childLanes)!==0,(e.flags&128)!==0){if(l)return fd(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),De(qe,qe.current),l)break;return null;case 22:case 23:return t.lanes=0,id(e,t,s)}return Sn(e,t,s)}var pd,ya,hd,md;pd=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}},ya=function(){},hd=function(e,t,s,l){var c=e.memoizedProps;if(c!==l){e=t.stateNode,vr(dn.current);var u=null;switch(s){case"input":c=lt(e,c),l=lt(e,l),u=[];break;case"select":c=q({},c,{value:void 0}),l=q({},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=zi)}ln(s,l);var h;s=null;for(T in c)if(!l.hasOwnProperty(T)&&c.hasOwnProperty(T)&&c[T]!=null)if(T==="style"){var y=c[T];for(h in y)y.hasOwnProperty(h)&&(s||(s={}),s[h]="")}else T!=="dangerouslySetInnerHTML"&&T!=="children"&&T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(d.hasOwnProperty(T)?u||(u=[]):(u=u||[]).push(T,null));for(T in l){var j=l[T];if(y=c?.[T],l.hasOwnProperty(T)&&j!==y&&(j!=null||y!=null))if(T==="style")if(y){for(h in y)!y.hasOwnProperty(h)||j&&j.hasOwnProperty(h)||(s||(s={}),s[h]="");for(h in j)j.hasOwnProperty(h)&&y[h]!==j[h]&&(s||(s={}),s[h]=j[h])}else s||(u||(u=[]),u.push(T,s)),s=j;else T==="dangerouslySetInnerHTML"?(j=j?j.__html:void 0,y=y?y.__html:void 0,j!=null&&y!==j&&(u=u||[]).push(T,j)):T==="children"?typeof j!="string"&&typeof j!="number"||(u=u||[]).push(T,""+j):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&(d.hasOwnProperty(T)?(j!=null&&T==="onScroll"&&We("scroll",e),u||y===j||(u=[])):(u=u||[]).push(T,j))}s&&(u=u||[]).push("style",s);var T=u;(t.updateQueue=T)&&(t.flags|=4)}},md=function(e,t,s,l){s!==l&&(t.flags|=4)};function Gs(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 ft(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 Yh(e,t,s){var l=t.pendingProps;switch(Wl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(t),null;case 1:return xt(t.type)&&Fi(),ft(t),null;case 3:return l=t.stateNode,Jr(),Fe(yt),Fe(ut),Zl(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Xt!==null&&(Ea(Xt),Xt=null))),ya(e,t),ft(t),null;case 5:Xl(t);var c=vr(qs.current);if(s=t.type,e!==null&&t.stateNode!=null)hd(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 ft(t),null}if(e=vr(dn.current),Vi(t)){l=t.stateNode,s=t.type;var u=t.memoizedProps;switch(l[un]=t,l[Ds]=u,e=(t.mode&1)!==0,s){case"dialog":We("cancel",l),We("close",l);break;case"iframe":case"object":case"embed":We("load",l);break;case"video":case"audio":for(c=0;c<Ls.length;c++)We(Ls[c],l);break;case"source":We("error",l);break;case"img":case"image":case"link":We("error",l),We("load",l);break;case"details":We("toggle",l);break;case"input":Lt(l,u),We("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!u.multiple},We("invalid",l);break;case"textarea":nr(l,u),We("invalid",l)}ln(s,u),c=null;for(var h in u)if(u.hasOwnProperty(h)){var y=u[h];h==="children"?typeof y=="string"?l.textContent!==y&&(u.suppressHydrationWarning!==!0&&Di(l.textContent,y,e),c=["children",y]):typeof y=="number"&&l.textContent!==""+y&&(u.suppressHydrationWarning!==!0&&Di(l.textContent,y,e),c=["children",""+y]):d.hasOwnProperty(h)&&y!=null&&h==="onScroll"&&We("scroll",l)}switch(s){case"input":Qe(l),Et(l,u,!0);break;case"textarea":Qe(l),ht(l);break;case"select":case"option":break;default:typeof u.onClick=="function"&&(l.onclick=zi)}l=c,t.updateQueue=l,l!==null&&(t.flags|=4)}else{h=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=sr(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=h.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=h.createElement(s,{is:l.is}):(e=h.createElement(s),s==="select"&&(h=e,l.multiple?h.multiple=!0:l.size&&(h.size=l.size))):e=h.createElementNS(e,s),e[un]=t,e[Ds]=l,pd(e,t,!1,!1),t.stateNode=e;e:{switch(h=mn(s,l),s){case"dialog":We("cancel",e),We("close",e),c=l;break;case"iframe":case"object":case"embed":We("load",e),c=l;break;case"video":case"audio":for(c=0;c<Ls.length;c++)We(Ls[c],e);c=l;break;case"source":We("error",e),c=l;break;case"img":case"image":case"link":We("error",e),We("load",e),c=l;break;case"details":We("toggle",e),c=l;break;case"input":Lt(e,l),c=lt(e,l),We("invalid",e);break;case"option":c=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},c=q({},l,{value:void 0}),We("invalid",e);break;case"textarea":nr(e,l),c=Rn(e,l),We("invalid",e);break;default:c=l}ln(s,c),y=c;for(u in y)if(y.hasOwnProperty(u)){var j=y[u];u==="style"?ze(e,j):u==="dangerouslySetInnerHTML"?(j=j?j.__html:void 0,j!=null&&On(e,j)):u==="children"?typeof j=="string"?(s!=="textarea"||j!=="")&&on(e,j):typeof j=="number"&&on(e,""+j):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(d.hasOwnProperty(u)?j!=null&&u==="onScroll"&&We("scroll",e):j!=null&&Se(e,u,j,h))}switch(s){case"input":Qe(e),Et(e,l,!1);break;case"textarea":Qe(e),ht(e);break;case"option":l.value!=null&&e.setAttribute("value",""+je(l.value));break;case"select":e.multiple=!!l.multiple,u=l.value,u!=null?$t(e,!!l.multiple,u,!1):l.defaultValue!=null&&$t(e,!!l.multiple,l.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=zi)}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 ft(t),null;case 6:if(e&&t.stateNode!=null)md(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(s=vr(qs.current),vr(dn.current),Vi(t)){if(l=t.stateNode,s=t.memoizedProps,l[un]=t,(u=l.nodeValue!==s)&&(e=Tt,e!==null))switch(e.tag){case 3:Di(l.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Di(l.nodeValue,s,(e.mode&1)!==0)}u&&(t.flags|=4)}else l=(s.nodeType===9?s:s.ownerDocument).createTextNode(l),l[un]=t,t.stateNode=l}return ft(t),null;case 13:if(Fe(qe),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Be&&Ot!==null&&(t.mode&1)!==0&&(t.flags&128)===0)yu(),Gr(),t.flags|=98560,u=!1;else if(u=Vi(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[un]=t}else Gr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),u=!1}else Xt!==null&&(Ea(Xt),Xt=null),u=!0;if(!u)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=s,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(qe.current&1)!==0?Xe===0&&(Xe=3):Ta())),t.updateQueue!==null&&(t.flags|=4),ft(t),null);case 4:return Jr(),ya(e,t),e===null&&As(t.stateNode.containerInfo),ft(t),null;case 10:return Vl(t.type._context),ft(t),null;case 17:return xt(t.type)&&Fi(),ft(t),null;case 19:if(Fe(qe),u=t.memoizedState,u===null)return ft(t),null;if(l=(t.flags&128)!==0,h=u.rendering,h===null)if(l)Gs(u,!1);else{if(Xe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=Ji(e),h!==null){for(t.flags|=128,Gs(u,!1),l=h.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,h=u.alternate,h===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=h.childLanes,u.lanes=h.lanes,u.child=h.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=h.memoizedProps,u.memoizedState=h.memoizedState,u.updateQueue=h.updateQueue,u.type=h.type,e=h.dependencies,u.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return De(qe,qe.current&1|2),t.child}e=e.sibling}u.tail!==null&&M()>ns&&(t.flags|=128,l=!0,Gs(u,!1),t.lanes=4194304)}else{if(!l)if(e=Ji(h),e!==null){if(t.flags|=128,l=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Gs(u,!0),u.tail===null&&u.tailMode==="hidden"&&!h.alternate&&!Be)return ft(t),null}else 2*M()-u.renderingStartTime>ns&&s!==1073741824&&(t.flags|=128,l=!0,Gs(u,!1),t.lanes=4194304);u.isBackwards?(h.sibling=t.child,t.child=h):(s=u.last,s!==null?s.sibling=h:t.child=h,u.last=h)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=M(),t.sibling=null,s=qe.current,De(qe,l?s&1|2:s&1),t):(ft(t),null);case 22:case 23:return Ra(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Mt&1073741824)!==0&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),null;case 24:return null;case 25:return null}throw Error(o(156,t.tag))}function Xh(e,t){switch(Wl(t),t.tag){case 1:return xt(t.type)&&Fi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jr(),Fe(yt),Fe(ut),Zl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Xl(t),null;case 13:if(Fe(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Gr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(qe),null;case 4:return Jr(),null;case 10:return Vl(t.type._context),null;case 22:case 23:return Ra(),null;case 24:return null;default:return null}}var lo=!1,pt=!1,Jh=typeof WeakSet=="function"?WeakSet:Set,ae=null;function es(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(l){He(e,t,l)}else s.current=null}function xa(e,t,s){try{s()}catch(l){He(e,t,l)}}var gd=!1;function Zh(e,t){if(Rl=Ii,e=Gc(),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 h=0,y=-1,j=-1,T=0,U=0,H=e,B=null;t:for(;;){for(var oe;H!==s||c!==0&&H.nodeType!==3||(y=h+c),H!==u||l!==0&&H.nodeType!==3||(j=h+l),H.nodeType===3&&(h+=H.nodeValue.length),(oe=H.firstChild)!==null;)B=H,H=oe;for(;;){if(H===e)break t;if(B===s&&++T===c&&(y=h),B===u&&++U===l&&(j=h),(oe=H.nextSibling)!==null)break;H=B,B=H.parentNode}H=oe}s=y===-1||j===-1?null:{start:y,end:j}}else s=null}s=s||{start:0,end:0}}else s=null;for(Tl={focusedElem:e,selectionRange:s},Ii=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var ue=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ue!==null){var de=ue.memoizedProps,Ve=ue.memoizedState,I=t.stateNode,S=I.getSnapshotBeforeUpdate(t.elementType===t.type?de:Jt(t.type,de),Ve);I.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var P=t.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Y){He(t,t.return,Y)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return ue=gd,gd=!1,ue}function Qs(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&&xa(t,s,u)}c=c.next}while(c!==l)}}function ao(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 wa(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 vd(e){var t=e.alternate;t!==null&&(e.alternate=null,vd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[un],delete t[Ds],delete t[Al],delete t[Lh],delete t[Ah])),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 yd(e){return e.tag===5||e.tag===3||e.tag===4}function xd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yd(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 ka(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=zi));else if(l!==4&&(e=e.child,e!==null))for(ka(e,t,s),e=e.sibling;e!==null;)ka(e,t,s),e=e.sibling}function ja(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(ja(e,t,s),e=e.sibling;e!==null;)ja(e,t,s),e=e.sibling}var it=null,Zt=!1;function Kn(e,t,s){for(s=s.child;s!==null;)wd(e,t,s),s=s.sibling}function wd(e,t,s){if(tt&&typeof tt.onCommitFiberUnmount=="function")try{tt.onCommitFiberUnmount(cr,s)}catch{}switch(s.tag){case 5:pt||es(s,t);case 6:var l=it,c=Zt;it=null,Kn(e,t,s),it=l,Zt=c,it!==null&&(Zt?(e=it,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):it.removeChild(s.stateNode));break;case 18:it!==null&&(Zt?(e=it,s=s.stateNode,e.nodeType===8?Ll(e.parentNode,s):e.nodeType===1&&Ll(e,s),Is(e)):Ll(it,s.stateNode));break;case 4:l=it,c=Zt,it=s.stateNode.containerInfo,Zt=!0,Kn(e,t,s),it=l,Zt=c;break;case 0:case 11:case 14:case 15:if(!pt&&(l=s.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){c=l=l.next;do{var u=c,h=u.destroy;u=u.tag,h!==void 0&&((u&2)!==0||(u&4)!==0)&&xa(s,t,h),c=c.next}while(c!==l)}Kn(e,t,s);break;case 1:if(!pt&&(es(s,t),l=s.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=s.memoizedProps,l.state=s.memoizedState,l.componentWillUnmount()}catch(y){He(s,t,y)}Kn(e,t,s);break;case 21:Kn(e,t,s);break;case 22:s.mode&1?(pt=(l=pt)||s.memoizedState!==null,Kn(e,t,s),pt=l):Kn(e,t,s);break;default:Kn(e,t,s)}}function kd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Jh),t.forEach(function(l){var c=am.bind(null,e,l);s.has(l)||(s.add(l),l.then(c,c))})}}function en(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,h=t,y=h;e:for(;y!==null;){switch(y.tag){case 5:it=y.stateNode,Zt=!1;break e;case 3:it=y.stateNode.containerInfo,Zt=!0;break e;case 4:it=y.stateNode.containerInfo,Zt=!0;break e}y=y.return}if(it===null)throw Error(o(160));wd(u,h,c),it=null,Zt=!1;var j=c.alternate;j!==null&&(j.return=null),c.return=null}catch(T){He(c,t,T)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jd(t,e),t=t.sibling}function jd(e,t){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(en(t,e),pn(e),l&4){try{Qs(3,e,e.return),ao(3,e)}catch(de){He(e,e.return,de)}try{Qs(5,e,e.return)}catch(de){He(e,e.return,de)}}break;case 1:en(t,e),pn(e),l&512&&s!==null&&es(s,s.return);break;case 5:if(en(t,e),pn(e),l&512&&s!==null&&es(s,s.return),e.flags&32){var c=e.stateNode;try{on(c,"")}catch(de){He(e,e.return,de)}}if(l&4&&(c=e.stateNode,c!=null)){var u=e.memoizedProps,h=s!==null?s.memoizedProps:u,y=e.type,j=e.updateQueue;if(e.updateQueue=null,j!==null)try{y==="input"&&u.type==="radio"&&u.name!=null&&vt(c,u),mn(y,h);var T=mn(y,u);for(h=0;h<j.length;h+=2){var U=j[h],H=j[h+1];U==="style"?ze(c,H):U==="dangerouslySetInnerHTML"?On(c,H):U==="children"?on(c,H):Se(c,U,H,T)}switch(y){case"input":_t(c,u);break;case"textarea":rr(c,u);break;case"select":var B=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!u.multiple;var oe=u.value;oe!=null?$t(c,!!u.multiple,oe,!1):B!==!!u.multiple&&(u.defaultValue!=null?$t(c,!!u.multiple,u.defaultValue,!0):$t(c,!!u.multiple,u.multiple?[]:"",!1))}c[Ds]=u}catch(de){He(e,e.return,de)}}break;case 6:if(en(t,e),pn(e),l&4){if(e.stateNode===null)throw Error(o(162));c=e.stateNode,u=e.memoizedProps;try{c.nodeValue=u}catch(de){He(e,e.return,de)}}break;case 3:if(en(t,e),pn(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{Is(t.containerInfo)}catch(de){He(e,e.return,de)}break;case 4:en(t,e),pn(e);break;case 13:en(t,e),pn(e),c=e.child,c.flags&8192&&(u=c.memoizedState!==null,c.stateNode.isHidden=u,!u||c.alternate!==null&&c.alternate.memoizedState!==null||(ba=M())),l&4&&kd(e);break;case 22:if(U=s!==null&&s.memoizedState!==null,e.mode&1?(pt=(T=pt)||U,en(t,e),pt=T):en(t,e),pn(e),l&8192){if(T=e.memoizedState!==null,(e.stateNode.isHidden=T)&&!U&&(e.mode&1)!==0)for(ae=e,U=e.child;U!==null;){for(H=ae=U;ae!==null;){switch(B=ae,oe=B.child,B.tag){case 0:case 11:case 14:case 15:Qs(4,B,B.return);break;case 1:es(B,B.return);var ue=B.stateNode;if(typeof ue.componentWillUnmount=="function"){l=B,s=B.return;try{t=l,ue.props=t.memoizedProps,ue.state=t.memoizedState,ue.componentWillUnmount()}catch(de){He(l,s,de)}}break;case 5:es(B,B.return);break;case 22:if(B.memoizedState!==null){bd(H);continue}}oe!==null?(oe.return=B,ae=oe):bd(H)}U=U.sibling}e:for(U=null,H=e;;){if(H.tag===5){if(U===null){U=H;try{c=H.stateNode,T?(u=c.style,typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"):(y=H.stateNode,j=H.memoizedProps.style,h=j!=null&&j.hasOwnProperty("display")?j.display:null,y.style.display=_e("display",h))}catch(de){He(e,e.return,de)}}}else if(H.tag===6){if(U===null)try{H.stateNode.nodeValue=T?"":H.memoizedProps}catch(de){He(e,e.return,de)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===e)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===e)break e;for(;H.sibling===null;){if(H.return===null||H.return===e)break e;U===H&&(U=null),H=H.return}U===H&&(U=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:en(t,e),pn(e),l&4&&kd(e);break;case 21:break;default:en(t,e),pn(e)}}function pn(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(yd(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&&(on(c,""),l.flags&=-33);var u=xd(e);ja(e,u,c);break;case 3:case 4:var h=l.stateNode.containerInfo,y=xd(e);ka(e,y,h);break;default:throw Error(o(161))}}catch(j){He(e,e.return,j)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function em(e,t,s){ae=e,Sd(e)}function Sd(e,t,s){for(var l=(e.mode&1)!==0;ae!==null;){var c=ae,u=c.child;if(c.tag===22&&l){var h=c.memoizedState!==null||lo;if(!h){var y=c.alternate,j=y!==null&&y.memoizedState!==null||pt;y=lo;var T=pt;if(lo=h,(pt=j)&&!T)for(ae=c;ae!==null;)h=ae,j=h.child,h.tag===22&&h.memoizedState!==null?Nd(c):j!==null?(j.return=h,ae=j):Nd(c);for(;u!==null;)ae=u,Sd(u),u=u.sibling;ae=c,lo=y,pt=T}Cd(e)}else(c.subtreeFlags&8772)!==0&&u!==null?(u.return=c,ae=u):Cd(e)}}function Cd(e){for(;ae!==null;){var t=ae;if((t.flags&8772)!==0){var s=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:pt||ao(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!pt)if(s===null)l.componentDidMount();else{var c=t.elementType===t.type?s.memoizedProps:Jt(t.type,s.memoizedProps);l.componentDidUpdate(c,s.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var u=t.updateQueue;u!==null&&bu(t,u,l);break;case 3:var h=t.updateQueue;if(h!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}bu(t,h,s)}break;case 5:var y=t.stateNode;if(s===null&&t.flags&4){s=y;var j=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":j.autoFocus&&s.focus();break;case"img":j.src&&(s.src=j.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var T=t.alternate;if(T!==null){var U=T.memoizedState;if(U!==null){var H=U.dehydrated;H!==null&&Is(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}pt||t.flags&512&&wa(t)}catch(B){He(t,t.return,B)}}if(t===e){ae=null;break}if(s=t.sibling,s!==null){s.return=t.return,ae=s;break}ae=t.return}}function bd(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var s=t.sibling;if(s!==null){s.return=t.return,ae=s;break}ae=t.return}}function Nd(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{ao(4,t)}catch(j){He(t,s,j)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var c=t.return;try{l.componentDidMount()}catch(j){He(t,c,j)}}var u=t.return;try{wa(t)}catch(j){He(t,u,j)}break;case 5:var h=t.return;try{wa(t)}catch(j){He(t,h,j)}}}catch(j){He(t,t.return,j)}if(t===e){ae=null;break}var y=t.sibling;if(y!==null){y.return=t.return,ae=y;break}ae=t.return}}var tm=Math.ceil,co=se.ReactCurrentDispatcher,Sa=se.ReactCurrentOwner,qt=se.ReactCurrentBatchConfig,Re=0,rt=null,Ke=null,ot=0,Mt=0,ts=Bn(0),Xe=0,Ys=null,xr=0,uo=0,Ca=0,Xs=null,kt=null,ba=0,ns=1/0,Cn=null,fo=!1,Na=null,Gn=null,po=!1,Qn=null,ho=0,Js=0,Ia=null,mo=-1,go=0;function gt(){return(Re&6)!==0?M():mo!==-1?mo:mo=M()}function Yn(e){return(e.mode&1)===0?1:(Re&2)!==0&&ot!==0?ot&-ot:Dh.transition!==null?(go===0&&(go=xc()),go):(e=Me,e!==0||(e=window.event,e=e===void 0?16:_c(e.type)),e)}function tn(e,t,s,l){if(50<Js)throw Js=0,Ia=null,Error(o(185));js(e,s,l),((Re&2)===0||e!==rt)&&(e===rt&&((Re&2)===0&&(uo|=s),Xe===4&&Xn(e,ot)),jt(e,l),s===1&&Re===0&&(t.mode&1)===0&&(ns=M()+500,qi&&Un()))}function jt(e,t){var s=e.callbackNode;Dp(e,t);var l=Ci(e,e===rt?ot:0);if(l===0)s!==null&&ji(s),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(s!=null&&ji(s),t===1)e.tag===0?$h(_d.bind(null,e)):pu(_d.bind(null,e)),Oh(function(){(Re&6)===0&&Un()}),s=null;else{switch(wc(l)){case 1:s=ge;break;case 4:s=Ae;break;case 16:s=Ze;break;case 536870912:s=cn;break;default:s=Ze}s=Ad(s,Id.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function Id(e,t){if(mo=-1,go=0,(Re&6)!==0)throw Error(o(327));var s=e.callbackNode;if(rs()&&e.callbackNode!==s)return null;var l=Ci(e,e===rt?ot:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=vo(e,l);else{t=l;var c=Re;Re|=2;var u=Pd();(rt!==e||ot!==t)&&(Cn=null,ns=M()+500,kr(e,t));do try{sm();break}catch(y){Ed(e,y)}while(!0);Hl(),co.current=u,Re=c,Ke!==null?t=0:(rt=null,ot=0,t=Xe)}if(t!==0){if(t===2&&(c=ll(e),c!==0&&(l=c,t=_a(e,c))),t===1)throw s=Ys,kr(e,0),Xn(e,l),jt(e,M()),s;if(t===6)Xn(e,l);else{if(c=e.current.alternate,(l&30)===0&&!nm(c)&&(t=vo(e,l),t===2&&(u=ll(e),u!==0&&(l=u,t=_a(e,u))),t===1))throw s=Ys,kr(e,0),Xn(e,l),jt(e,M()),s;switch(e.finishedWork=c,e.finishedLanes=l,t){case 0:case 1:throw Error(o(345));case 2:jr(e,kt,Cn);break;case 3:if(Xn(e,l),(l&130023424)===l&&(t=ba+500-M(),10<t)){if(Ci(e,0)!==0)break;if(c=e.suspendedLanes,(c&l)!==l){gt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=Ml(jr.bind(null,e,kt,Cn),t);break}jr(e,kt,Cn);break;case 4:if(Xn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,c=-1;0<l;){var h=31-Pt(l);u=1<<h,h=t[h],h>c&&(c=h),l&=~u}if(l=c,l=M()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*tm(l/1960))-l,10<l){e.timeoutHandle=Ml(jr.bind(null,e,kt,Cn),l);break}jr(e,kt,Cn);break;case 5:jr(e,kt,Cn);break;default:throw Error(o(329))}}}return jt(e,M()),e.callbackNode===s?Id.bind(null,e):null}function _a(e,t){var s=Xs;return e.current.memoizedState.isDehydrated&&(kr(e,t).flags|=256),e=vo(e,t),e!==2&&(t=kt,kt=s,t!==null&&Ea(t)),e}function Ea(e){kt===null?kt=e:kt.push.apply(kt,e)}function nm(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(!Yt(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 Xn(e,t){for(t&=~Ca,t&=~uo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-Pt(t),l=1<<s;e[s]=-1,t&=~l}}function _d(e){if((Re&6)!==0)throw Error(o(327));rs();var t=Ci(e,0);if((t&1)===0)return jt(e,M()),null;var s=vo(e,t);if(e.tag!==0&&s===2){var l=ll(e);l!==0&&(t=l,s=_a(e,l))}if(s===1)throw s=Ys,kr(e,0),Xn(e,t),jt(e,M()),s;if(s===6)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jr(e,kt,Cn),jt(e,M()),null}function Pa(e,t){var s=Re;Re|=1;try{return e(t)}finally{Re=s,Re===0&&(ns=M()+500,qi&&Un())}}function wr(e){Qn!==null&&Qn.tag===0&&(Re&6)===0&&rs();var t=Re;Re|=1;var s=qt.transition,l=Me;try{if(qt.transition=null,Me=1,e)return e()}finally{Me=l,qt.transition=s,Re=t,(Re&6)===0&&Un()}}function Ra(){Mt=ts.current,Fe(ts)}function kr(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,Th(s)),Ke!==null)for(s=Ke.return;s!==null;){var l=s;switch(Wl(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Fi();break;case 3:Jr(),Fe(yt),Fe(ut),Zl();break;case 5:Xl(l);break;case 4:Jr();break;case 13:Fe(qe);break;case 19:Fe(qe);break;case 10:Vl(l.type._context);break;case 22:case 23:Ra()}s=s.return}if(rt=e,Ke=e=Jn(e.current,null),ot=Mt=t,Xe=0,Ys=null,Ca=uo=xr=0,kt=Xs=null,gr!==null){for(t=0;t<gr.length;t++)if(s=gr[t],l=s.interleaved,l!==null){s.interleaved=null;var c=l.next,u=s.pending;if(u!==null){var h=u.next;u.next=c,l.next=h}s.pending=l}gr=null}return e}function Ed(e,t){do{var s=Ke;try{if(Hl(),Zi.current=ro,eo){for(var l=Ue.memoizedState;l!==null;){var c=l.queue;c!==null&&(c.pending=null),l=l.next}eo=!1}if(yr=0,nt=Ye=Ue=null,Us=!1,Hs=0,Sa.current=null,s===null||s.return===null){Xe=1,Ys=t,Ke=null;break}e:{var u=e,h=s.return,y=s,j=t;if(t=ot,y.flags|=32768,j!==null&&typeof j=="object"&&typeof j.then=="function"){var T=j,U=y,H=U.tag;if((U.mode&1)===0&&(H===0||H===11||H===15)){var B=U.alternate;B?(U.updateQueue=B.updateQueue,U.memoizedState=B.memoizedState,U.lanes=B.lanes):(U.updateQueue=null,U.memoizedState=null)}var oe=ed(h);if(oe!==null){oe.flags&=-257,td(oe,h,y,u,t),oe.mode&1&&Zu(u,T,t),t=oe,j=T;var ue=t.updateQueue;if(ue===null){var de=new Set;de.add(j),t.updateQueue=de}else ue.add(j);break e}else{if((t&1)===0){Zu(u,T,t),Ta();break e}j=Error(o(426))}}else if(Be&&y.mode&1){var Ve=ed(h);if(Ve!==null){(Ve.flags&65536)===0&&(Ve.flags|=256),td(Ve,h,y,u,t),ql(Zr(j,y));break e}}u=j=Zr(j,y),Xe!==4&&(Xe=2),Xs===null?Xs=[u]:Xs.push(u),u=h;do{switch(u.tag){case 3:u.flags|=65536,t&=-t,u.lanes|=t;var I=Xu(u,j,t);Cu(u,I);break e;case 1:y=j;var S=u.type,P=u.stateNode;if((u.flags&128)===0&&(typeof S.getDerivedStateFromError=="function"||P!==null&&typeof P.componentDidCatch=="function"&&(Gn===null||!Gn.has(P)))){u.flags|=65536,t&=-t,u.lanes|=t;var Y=Ju(u,y,t);Cu(u,Y);break e}}u=u.return}while(u!==null)}Td(s)}catch(me){t=me,Ke===s&&s!==null&&(Ke=s=s.return);continue}break}while(!0)}function Pd(){var e=co.current;return co.current=ro,e===null?ro:e}function Ta(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),rt===null||(xr&268435455)===0&&(uo&268435455)===0||Xn(rt,ot)}function vo(e,t){var s=Re;Re|=2;var l=Pd();(rt!==e||ot!==t)&&(Cn=null,kr(e,t));do try{rm();break}catch(c){Ed(e,c)}while(!0);if(Hl(),Re=s,co.current=l,Ke!==null)throw Error(o(261));return rt=null,ot=0,Xe}function rm(){for(;Ke!==null;)Rd(Ke)}function sm(){for(;Ke!==null&&!k();)Rd(Ke)}function Rd(e){var t=Ld(e.alternate,e,Mt);e.memoizedProps=e.pendingProps,t===null?Td(e):Ke=t,Sa.current=null}function Td(e){var t=e;do{var s=t.alternate;if(e=t.return,(t.flags&32768)===0){if(s=Yh(s,t,Mt),s!==null){Ke=s;return}}else{if(s=Xh(s,t),s!==null){s.flags&=32767,Ke=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Xe=6,Ke=null;return}}if(t=t.sibling,t!==null){Ke=t;return}Ke=t=e}while(t!==null);Xe===0&&(Xe=5)}function jr(e,t,s){var l=Me,c=qt.transition;try{qt.transition=null,Me=1,im(e,t,s,l)}finally{qt.transition=c,Me=l}return null}function im(e,t,s,l){do rs();while(Qn!==null);if((Re&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(zp(e,u),e===rt&&(Ke=rt=null,ot=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||po||(po=!0,Ad(Ze,function(){return rs(),null})),u=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||u){u=qt.transition,qt.transition=null;var h=Me;Me=1;var y=Re;Re|=4,Sa.current=null,Zh(e,s),jd(s,e),bh(Tl),Ii=!!Rl,Tl=Rl=null,e.current=s,em(s),N(),Re=y,Me=h,qt.transition=u}else e.current=s;if(po&&(po=!1,Qn=e,ho=c),u=e.pendingLanes,u===0&&(Gn=null),il(s.stateNode),jt(e,M()),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(fo)throw fo=!1,e=Na,Na=null,e;return(ho&1)!==0&&e.tag!==0&&rs(),u=e.pendingLanes,(u&1)!==0?e===Ia?Js++:(Js=0,Ia=e):Js=0,Un(),null}function rs(){if(Qn!==null){var e=wc(ho),t=qt.transition,s=Me;try{if(qt.transition=null,Me=16>e?16:e,Qn===null)var l=!1;else{if(e=Qn,Qn=null,ho=0,(Re&6)!==0)throw Error(o(331));var c=Re;for(Re|=4,ae=e.current;ae!==null;){var u=ae,h=u.child;if((ae.flags&16)!==0){var y=u.deletions;if(y!==null){for(var j=0;j<y.length;j++){var T=y[j];for(ae=T;ae!==null;){var U=ae;switch(U.tag){case 0:case 11:case 15:Qs(8,U,u)}var H=U.child;if(H!==null)H.return=U,ae=H;else for(;ae!==null;){U=ae;var B=U.sibling,oe=U.return;if(vd(U),U===T){ae=null;break}if(B!==null){B.return=oe,ae=B;break}ae=oe}}}var ue=u.alternate;if(ue!==null){var de=ue.child;if(de!==null){ue.child=null;do{var Ve=de.sibling;de.sibling=null,de=Ve}while(de!==null)}}ae=u}}if((u.subtreeFlags&2064)!==0&&h!==null)h.return=u,ae=h;else e:for(;ae!==null;){if(u=ae,(u.flags&2048)!==0)switch(u.tag){case 0:case 11:case 15:Qs(9,u,u.return)}var I=u.sibling;if(I!==null){I.return=u.return,ae=I;break e}ae=u.return}}var S=e.current;for(ae=S;ae!==null;){h=ae;var P=h.child;if((h.subtreeFlags&2064)!==0&&P!==null)P.return=h,ae=P;else e:for(h=S;ae!==null;){if(y=ae,(y.flags&2048)!==0)try{switch(y.tag){case 0:case 11:case 15:ao(9,y)}}catch(me){He(y,y.return,me)}if(y===h){ae=null;break e}var Y=y.sibling;if(Y!==null){Y.return=y.return,ae=Y;break e}ae=y.return}}if(Re=c,Un(),tt&&typeof tt.onPostCommitFiberRoot=="function")try{tt.onPostCommitFiberRoot(cr,e)}catch{}l=!0}return l}finally{Me=s,qt.transition=t}}return!1}function Od(e,t,s){t=Zr(s,t),t=Xu(e,t,1),e=Vn(e,t,1),t=gt(),e!==null&&(js(e,1,t),jt(e,t))}function He(e,t,s){if(e.tag===3)Od(e,e,s);else for(;t!==null;){if(t.tag===3){Od(t,e,s);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Gn===null||!Gn.has(l))){e=Zr(s,e),e=Ju(t,e,1),t=Vn(t,e,1),e=gt(),t!==null&&(js(t,1,e),jt(t,e));break}}t=t.return}}function om(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),t=gt(),e.pingedLanes|=e.suspendedLanes&s,rt===e&&(ot&s)===s&&(Xe===4||Xe===3&&(ot&130023424)===ot&&500>M()-ba?kr(e,0):Ca|=s),jt(e,t)}function Md(e,t){t===0&&((e.mode&1)===0?t=1:(t=dr,dr<<=1,(dr&130023424)===0&&(dr=4194304)));var s=gt();e=kn(e,t),e!==null&&(js(e,t,s),jt(e,s))}function lm(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Md(e,s)}function am(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),Md(e,s)}var Ld;Ld=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,Qh(e,t,s);wt=(e.flags&131072)!==0}else wt=!1,Be&&(t.flags&1048576)!==0&&hu(t,Hi,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;oo(e,t),e=t.pendingProps;var c=Hr(t,ut.current);Xr(t,s),c=na(null,t,l,e,c,s);var u=ra();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xt(l)?(u=!0,Bi(t)):u=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,Ql(t),c.updater=so,t.stateNode=c,c._reactInternals=t,ca(t,l,e,s),t=pa(null,t,l,!0,u,s)):(t.tag=0,Be&&u&&zl(t),mt(null,t,c,s),t=t.child),t;case 16:l=t.elementType;e:{switch(oo(e,t),e=t.pendingProps,c=l._init,l=c(l._payload),t.type=l,c=t.tag=um(l),e=Jt(l,e),c){case 0:t=fa(null,t,l,e,s);break e;case 1:t=ld(null,t,l,e,s);break e;case 11:t=nd(null,t,l,e,s);break e;case 14:t=rd(null,t,l,Jt(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:Jt(l,c),fa(e,t,l,c,s);case 1:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Jt(l,c),ld(e,t,l,c,s);case 3:e:{if(ad(t),e===null)throw Error(o(387));l=t.pendingProps,u=t.memoizedState,c=u.element,Su(e,t),Xi(t,l,null,s);var h=t.memoizedState;if(l=h.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){c=Zr(Error(o(423)),t),t=cd(e,t,l,s,c);break e}else if(l!==c){c=Zr(Error(o(424)),t),t=cd(e,t,l,s,c);break e}else for(Ot=Fn(t.stateNode.containerInfo.firstChild),Tt=t,Be=!0,Xt=null,s=ku(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Gr(),l===c){t=Sn(e,t,s);break e}mt(e,t,l,s)}t=t.child}return t;case 5:return Nu(t),e===null&&Bl(t),l=t.type,c=t.pendingProps,u=e!==null?e.memoizedProps:null,h=c.children,Ol(l,c)?h=null:u!==null&&Ol(l,u)&&(t.flags|=32),od(e,t),mt(e,t,h,s),t.child;case 6:return e===null&&Bl(t),null;case 13:return ud(e,t,s);case 4:return Yl(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Qr(t,null,l,s):mt(e,t,l,s),t.child;case 11:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Jt(l,c),nd(e,t,l,c,s);case 7:return mt(e,t,t.pendingProps,s),t.child;case 8:return mt(e,t,t.pendingProps.children,s),t.child;case 12:return mt(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(l=t.type._context,c=t.pendingProps,u=t.memoizedProps,h=c.value,De(Gi,l._currentValue),l._currentValue=h,u!==null)if(Yt(u.value,h)){if(u.children===c.children&&!yt.current){t=Sn(e,t,s);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var y=u.dependencies;if(y!==null){h=u.child;for(var j=y.firstContext;j!==null;){if(j.context===l){if(u.tag===1){j=jn(-1,s&-s),j.tag=2;var T=u.updateQueue;if(T!==null){T=T.shared;var U=T.pending;U===null?j.next=j:(j.next=U.next,U.next=j),T.pending=j}}u.lanes|=s,j=u.alternate,j!==null&&(j.lanes|=s),Kl(u.return,s,t),y.lanes|=s;break}j=j.next}}else if(u.tag===10)h=u.type===t.type?null:u.child;else if(u.tag===18){if(h=u.return,h===null)throw Error(o(341));h.lanes|=s,y=h.alternate,y!==null&&(y.lanes|=s),Kl(h,s,t),h=u.sibling}else h=u.child;if(h!==null)h.return=u;else for(h=u;h!==null;){if(h===t){h=null;break}if(u=h.sibling,u!==null){u.return=h.return,h=u;break}h=h.return}u=h}mt(e,t,c.children,s),t=t.child}return t;case 9:return c=t.type,l=t.pendingProps.children,Xr(t,s),c=Ft(c),l=l(c),t.flags|=1,mt(e,t,l,s),t.child;case 14:return l=t.type,c=Jt(l,t.pendingProps),c=Jt(l.type,c),rd(e,t,l,c,s);case 15:return sd(e,t,t.type,t.pendingProps,s);case 17:return l=t.type,c=t.pendingProps,c=t.elementType===l?c:Jt(l,c),oo(e,t),t.tag=1,xt(l)?(e=!0,Bi(t)):e=!1,Xr(t,s),Qu(t,l,c),ca(t,l,c,s),pa(null,t,l,!0,e,s);case 19:return fd(e,t,s);case 22:return id(e,t,s)}throw Error(o(156,t.tag))};function Ad(e,t){return ws(e,t)}function cm(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 Ut(e,t,s,l){return new cm(e,t,s,l)}function Oa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function um(e){if(typeof e=="function")return Oa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===G)return 11;if(e===$)return 14}return 2}function Jn(e,t){var s=e.alternate;return s===null?(s=Ut(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 yo(e,t,s,l,c,u){var h=2;if(l=e,typeof e=="function")Oa(e)&&(h=1);else if(typeof e=="string")h=5;else e:switch(e){case D:return Sr(s.children,c,u,t);case te:h=8,c|=8;break;case Ce:return e=Ut(12,s,t,c|2),e.elementType=Ce,e.lanes=u,e;case K:return e=Ut(13,s,t,c),e.elementType=K,e.lanes=u,e;case be:return e=Ut(19,s,t,c),e.elementType=be,e.lanes=u,e;case V:return xo(s,c,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xe:h=10;break e;case J:h=9;break e;case G:h=11;break e;case $:h=14;break e;case fe:h=16,l=null;break e}throw Error(o(130,e==null?e:typeof e,""))}return t=Ut(h,s,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function Sr(e,t,s,l){return e=Ut(7,e,l,t),e.lanes=s,e}function xo(e,t,s,l){return e=Ut(22,e,l,t),e.elementType=V,e.lanes=s,e.stateNode={isHidden:!1},e}function Ma(e,t,s){return e=Ut(6,e,null,t),e.lanes=s,e}function La(e,t,s){return t=Ut(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dm(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=al(0),this.expirationTimes=al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=al(0),this.identifierPrefix=l,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function Aa(e,t,s,l,c,u,h,y,j){return e=new dm(e,t,s,y,j),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Ut(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:l,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ql(u),e}function fm(e,t,s){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:b,key:l==null?null:""+l,children:e,containerInfo:t,implementation:s}}function $d(e){if(!e)return qn;e=e._reactInternals;e:{if(an(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 du(e,s,t)}return t}function Dd(e,t,s,l,c,u,h,y,j){return e=Aa(s,l,!0,e,c,u,h,y,j),e.context=$d(null),s=e.current,l=gt(),c=Yn(s),u=jn(l,c),u.callback=t??null,Vn(s,u,c),e.current.lanes=c,js(e,c,l),jt(e,l),e}function wo(e,t,s,l){var c=t.current,u=gt(),h=Yn(c);return s=$d(s),t.context===null?t.context=s:t.pendingContext=s,t=jn(u,h),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=Vn(c,t,h),e!==null&&(tn(e,c,h,u),Yi(e,c,h)),h}function ko(e){return e=e.current,e.child?(e.child.tag===5,e.child.stateNode):null}function zd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function $a(e,t){zd(e,t),(e=e.alternate)&&zd(e,t)}function pm(){return null}var Wd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Da(e){this._internalRoot=e}jo.prototype.render=Da.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));wo(e,t,null,null)},jo.prototype.unmount=Da.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wr(function(){wo(null,e,null,null)}),t[vn]=null}};function jo(e){this._internalRoot=e}jo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Sc();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Dn.length&&t!==0&&t<Dn[s].priority;s++);Dn.splice(s,0,e),s===0&&Nc(e)}};function za(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 Fd(){}function hm(e,t,s,l,c){if(c){if(typeof l=="function"){var u=l;l=function(){var T=ko(h);u.call(T)}}var h=Dd(t,l,e,0,null,!1,!1,"",Fd);return e._reactRootContainer=h,e[vn]=h.current,As(e.nodeType===8?e.parentNode:e),wr(),h}for(;c=e.lastChild;)e.removeChild(c);if(typeof l=="function"){var y=l;l=function(){var T=ko(j);y.call(T)}}var j=Aa(e,0,!1,null,null,!1,!1,"",Fd);return e._reactRootContainer=j,e[vn]=j.current,As(e.nodeType===8?e.parentNode:e),wr(function(){wo(t,j,s,l)}),j}function Co(e,t,s,l,c){var u=s._reactRootContainer;if(u){var h=u;if(typeof c=="function"){var y=c;c=function(){var j=ko(h);y.call(j)}}wo(t,h,e,c)}else h=hm(s,t,e,c,l);return ko(h)}kc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=ks(t.pendingLanes);s!==0&&(cl(t,s|1),jt(t,M()),(Re&6)===0&&(ns=M()+500,Un()))}break;case 13:wr(function(){var l=kn(e,1);if(l!==null){var c=gt();tn(l,e,1,c)}}),$a(e,1)}},ul=function(e){if(e.tag===13){var t=kn(e,134217728);if(t!==null){var s=gt();tn(t,e,134217728,s)}$a(e,134217728)}},jc=function(e){if(e.tag===13){var t=Yn(e),s=kn(e,t);if(s!==null){var l=gt();tn(s,e,t,l)}$a(e,t)}},Sc=function(){return Me},Cc=function(e,t){var s=Me;try{return Me=e,t()}finally{Me=s}},Or=function(e,t,s){switch(t){case"input":if(_t(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=Wi(l);if(!c)throw Error(o(90));Je(l),_t(l,c)}}}break;case"textarea":rr(e,s);break;case"select":t=s.value,t!=null&&$t(e,!!s.multiple,t,!1)}},mi=Pa,gi=wr;var mm={usingClientEntryPoint:!1,Events:[zs,qr,Wi,pi,hi,Pa]},Zs={findFiberByHostInstance:fr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gm={bundleType:Zs.bundleType,version:Zs.version,rendererPackageName:Zs.rendererPackageName,rendererConfig:Zs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:se.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ys(e),e===null?null:e.stateNode},findFiberByHostInstance:Zs.findFiberByHostInstance||pm,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 bo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bo.isDisabled&&bo.supportsFiber)try{cr=bo.inject(gm),tt=bo}catch{}}return St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mm,St.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!za(t))throw Error(o(200));return fm(e,t,null,s)},St.createRoot=function(e,t){if(!za(e))throw Error(o(299));var s=!1,l="",c=Wd;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Aa(e,1,!1,null,null,s,!1,l,c),e[vn]=t.current,As(e.nodeType===8?e.parentNode:e),new Da(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=ys(t),e=e===null?null:e.stateNode,e},St.flushSync=function(e){return wr(e)},St.hydrate=function(e,t,s){if(!So(t))throw Error(o(200));return Co(null,e,t,!0,s)},St.hydrateRoot=function(e,t,s){if(!za(e))throw Error(o(405));var l=s!=null&&s.hydratedSources||null,c=!1,u="",h=Wd;if(s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(h=s.onRecoverableError)),t=Dd(t,null,e,1,s??null,c,!1,u,h),e[vn]=t.current,As(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 jo(t)},St.render=function(e,t,s){if(!So(t))throw Error(o(200));return Co(null,e,t,!1,s)},St.unmountComponentAtNode=function(e){if(!So(e))throw Error(o(40));return e._reactRootContainer?(wr(function(){Co(null,null,e,!1,function(){e._reactRootContainer=null,e[vn]=null})}),!0):!1},St.unstable_batchedUpdates=Pa,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 Co(e,t,s,!1,l)},St.version="18.3.1-next-f1338f8080-20240426",St}var Qd;function Im(){if(Qd)return Ba.exports;Qd=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(),Ba.exports=Nm(),Ba.exports}var Yd;function _m(){if(Yd)return No;Yd=1;var n=Im();return No.createRoot=n.createRoot,No.hydrateRoot=n.hydrateRoot,No}var Em=_m();const Pm=Qf(Em),Yf={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:""},Xd=Object.freeze({status:"idle",requestId:null});function Qo(n){return n.activeSessionId?n.sessionSync[n.activeSessionId]??Xd:Xd}function Pr(n){return!!(n.activeSessionId&&n.sessionSnapshot?.session.id===n.activeSessionId&&Qo(n).status==="ready")}function X({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:Rm[n]})}const Rm={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"})]}),"chevron-left":i.jsx("path",{d:"m15 7-5 5 5 5"})};function li({children:n,className:r=""}){return i.jsx("div",{className:`markdown ${r}`.trim(),children:Xf(n)})}function Xf(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 R=[];for(a+=1;a<r.length&&!/^\s*```\s*$/.test(r[a]);)R.push(r[a]),a+=1;a<r.length&&(a+=1),o.push(i.jsx($m,{language:f[1].trim(),content:R.join(`
|
|
12
|
+
`)},`code-${a}`));continue}const p=d.match(/^(#{1,6})\s+(.+)$/);if(p){const R=Math.min(6,p[1].length);o.push(Am(R,ii(p[2],`heading-${a}`),`heading-${a}`)),a+=1;continue}if(/^\s*>\s?/.test(d)){const R=[];for(;a<r.length&&/^\s*>\s?/.test(r[a]);)R.push(r[a].replace(/^\s*>\s?/,"")),a+=1;o.push(i.jsx("blockquote",{children:Xf(R.join(`
|
|
13
|
+
`))},`quote-${a}`));continue}if(d.match(/^\s*(?:[-*+] |\d+[.)] )(.+)$/)){const R=/^\s*\d/.test(d),C=[],E=R?/^\s*\d+[.)]\s+(.+)$/:/^\s*[-*+]\s+(.+)$/;for(;a<r.length;){const A=r[a].match(E);if(!A)break;C.push(A[1]),a+=1}const _=C.map((A,L)=>i.jsx("li",{children:ii(A,`list-${a}-${L}`)},`item-${a}-${L}`));o.push(R?i.jsx("ol",{children:_},`list-${a}`):i.jsx("ul",{children:_},`list-${a}`));continue}const x=Ya(d);if(x&&x.length>=1&&a+1<r.length){const R=Om(r[a+1]);if(R&&R.length===x.length){const C=[x];for(a+=2;a<r.length;){const E=Ya(r[a]);if(!E||E.length!==x.length)break;C.push(E),a+=1}o.push(Mm(C,R,`table-${a}`));continue}}const w=[d.trim()];for(a+=1;a<r.length&&r[a].trim()&&!Tm(r[a]);)w.push(r[a].trim()),a+=1;o.push(i.jsx("p",{children:ii(w.join(" "),`paragraph-${a}`)},`paragraph-${a}`))}return o}function Tm(n){return/^\s*```/.test(n)||/^(#{1,6})\s+/.test(n)||/^\s*>\s?/.test(n)||/^\s*(?:[-*+] |\d+[.)] )/.test(n)||Ya(n)!==null}function Ya(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 Om(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 Mm(n,r,o){const[a,...d]=n,f=p=>p==="left"?void 0:{textAlign:p};return i.jsxs("table",{className:"markdown-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:a.map((p,g)=>i.jsx("th",{style:f(r[g]),children:ii(p,`${o}-th-${g}`)},`th-${g}`))})}),i.jsx("tbody",{children:d.map((p,g)=>i.jsx("tr",{children:p.map((x,w)=>i.jsx("td",{style:f(r[w]),children:ii(x,`${o}-td-${g}-${w}`)},`td-${g}-${w}`))},`tr-${g}`))})]},o)}function ii(n,r){const o=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\[[^\]\n]+\]\([^\s)]+\))/g,a=[];let d=0,f,p=0;for(;f=o.exec(n);){f.index>d&&a.push(n.slice(d,f.index));const g=f[0],x=`${r}-${p++}`;if(g.startsWith("`"))a.push(i.jsx("code",{children:g.slice(1,-1)},x));else if(g.startsWith("**"))a.push(i.jsx("strong",{children:g.slice(2,-2)},x));else{const w=g.match(/^\[([^\]]+)\]\(([^)]+)\)$/);w&&Lm(w[2])?a.push(i.jsx("a",{href:w[2],target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:w[1]},x)):a.push(g)}d=f.index+g.length}return d<n.length&&a.push(n.slice(d)),a}function Lm(n){try{const r=new URL(n);return r.protocol==="https:"||r.protocol==="http:"||r.protocol==="mailto:"}catch{return!1}}function Am(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 $m({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(X,{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 Pn(n){return n.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function uc(n,r=8e3){const o=/api.?key|authorization|cookie|password|secret|token/i;let a;try{a=JSON.stringify(n,(f,p)=>f&&o.test(f)?"[REDACTED]":p,2)}catch{a=String(n)}const d=Pn(a);return d.length<=r?d:`${d.slice(0,r)}
|
|
14
|
+
…已截断`}const Dm=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"}),Jd=Object.freeze({danger:"失败",idle:"空闲",running:"进行中",success:"已完成",warning:"部分完成"});function zm(n){return Dm[n.trim().toLowerCase()]??"idle"}function Wm(n){return Jd[n]??Jd.idle}function dc({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??Wm(d)}):null]})}const ps="orion.web.composer-drafts.v1",Jf=20,Xa=256*1024,Fm=5*1024*1024;function Bm(n,r){return Yo().entries.find(o=>o.workspaceId===n&&o.sessionId===r)??null}function qm(n){const r=Xo();if(!r)return;const o=Object.freeze({...n,references:[...n.references],updatedAt:Date.now()});if(Ja(o)>Xa)throw new Error(`Composer draft exceeds ${Xa} bytes.`);const a=Yo().entries.filter(f=>!(f.workspaceId===n.workspaceId&&f.sessionId===n.sessionId)),d=[o,...a].slice(0,Jf);for(;d.length>0&&Ja({version:1,entries:d})>Fm;)d.pop();r.setItem(ps,JSON.stringify({version:1,entries:d}))}function Zd(n,r){const o=Xo();if(!o)return;const a=Yo().entries.filter(d=>!(d.workspaceId===n&&d.sessionId===r));a.length===0?o.removeItem(ps):o.setItem(ps,JSON.stringify({version:1,entries:a}))}function Um(n){const r=Xo();if(!r)return;const o=Yo().entries.filter(a=>a.workspaceId!==n);o.length===0?r.removeItem(ps):r.setItem(ps,JSON.stringify({version:1,entries:o}))}function Yo(){const n=Xo();if(!n)return{version:1,entries:[]};try{const r=JSON.parse(n.getItem(ps)??"");return r.version!==1||!Array.isArray(r.entries)?{version:1,entries:[]}:{version:1,entries:r.entries.filter(Hm).slice(0,Jf)}}catch{return{version:1,entries:[]}}}function Hm(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)&&Ja(r)<=Xa}function Xo(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}function Ja(n){return new TextEncoder().encode(JSON.stringify(n)).byteLength}const Zf=/^hmac-sha256:[0-9a-f]{64}$/,Vm=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Km=/^(?:api[-_]?key|authorization|cookie|password|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|credential[-_]?value|headers?|env(?:ironment)?[-_]?name)$/i,Gm=["ready","invalid","read-only","unavailable"],Qm=["internal","model","global","project","session"],Ym=["global","project","session"],Xm=["live","next-logical-request","new-session","restart"],Jm=["runtime_busy","read_only","invalid_document"],Zm=["system","light","dark"],eg=["system","reduced"],tg=["classic","orion-blocksmith"],ep=["auto","none","minimal","low","medium","high","xhigh","max"],ng=["ask","allow","deny"],rg=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function Za(n){Fo(n);const r=Vt(n,"Settings document");if(Kt(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=Nt(r.revision,"Settings revision");if(!Zf.test(a))throw new Error("Settings revision is invalid.");const d=sn(r.state,"Settings state",Gm),f=Vt(r.sections,"Settings sections");Kt(f,["appearance","defaults","permissions"]);const p=Vt(f.appearance,"Appearance settings");Kt(p,o===1?["theme","motion"]:["style","theme","motion"]);const g=Vt(f.defaults,"Default settings");Kt(g,["model","effort"]);const x=Vt(f.permissions,"Permission settings");Kt(x,["toolConfirmation"]);const w=ec(r.models,"Settings models").map(og),R=ec(r.credentials,"Credential status").map(lg),C=r.currentSession===void 0?void 0:ag(r.currentSession),E=r.diagnostic===void 0?void 0:cg(r.diagnostic);return{schemaVersion:2,revision:a,state:d,writable:cs(r.writable,"Settings writable"),hasDocument:cs(r.hasDocument,"Settings document availability"),workspace:Nt(r.workspace,"Settings workspace"),sections:{appearance:{style:o===1?pg(d,cs(r.writable,"Settings writable")):ss(p.style,"Visual style",fg),theme:ss(p.theme,"Theme",dg),motion:ss(p.motion,"Motion",hg)},defaults:{model:ss(g.model,"Default model",vg),effort:ss(g.effort,"Default effort",mg)},permissions:{toolConfirmation:ss(x.toolConfirmation,"Tool confirmation",gg)}},models:w,credentials:R,...C?{currentSession:C}:{},...E?{diagnostic:E}:{}}}function sg(n){Fo(n);const r=Vt(n,"Settings mutation result");Kt(r,["requestId","revision","appliedKeys","settings"]);const o=Nt(r.requestId,"Settings requestId");if(!Vm.test(o))throw new Error("Settings requestId is invalid.");const a=Za(r.settings),d=Nt(r.revision,"Settings mutation revision");if(d!==a.revision)throw new Error("Settings mutation revisions do not match.");const f=ec(r.appliedKeys,"Applied setting keys").map((p,g)=>sn(p,`Applied setting key ${g+1}`,rg));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 ig(n){const r=Vt(n.payload,"Settings invalidation payload");Kt(r,["revision","reason","state"]);const o=Nt(r.revision,"Settings invalidation revision");if(!Zf.test(o))throw new Error("Settings invalidation revision is invalid.");return{apiVersion:1,eventId:Nt(n.eventId,"Settings invalidation eventId"),cursor:ug(n.cursor,"Settings invalidation cursor"),sessionId:null,threadId:null,durable:!1,timestamp:Nt(n.timestamp,"Settings invalidation timestamp"),type:"settings_invalidated",payload:{revision:o,reason:sn(r.reason,"Settings invalidation reason",["local-write","external-edit","workspace-change"]),state:sn(r.state,"Settings invalidation state",["ready","invalid"])}}}function ss(n,r,o){const a=Vt(n,`${r} field`);if(Kt(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:sn(a.source,`${r} source`,Qm),scope:sn(a.scope,`${r} scope`,Ym),applies:sn(a.applies,`${r} application timing`,Xm),overridden:cs(a.overridden,`${r} override state`),writable:cs(a.writable,`${r} writable state`),...a.blockedReason===void 0?{}:{blockedReason:sn(a.blockedReason,`${r} blocked reason`,Jm)}}}function og(n,r){const o=Vt(n,`Model ${r+1}`);return Kt(o,["id","label","provider"]),{id:Nt(o.id,`Model ${r+1} id`),label:Nt(o.label,`Model ${r+1} label`),...o.provider===void 0?{}:{provider:Nt(o.provider,`Model ${r+1} provider`)}}}function lg(n,r){const o=Vt(n,`Credential ${r+1}`);if(Kt(o,["providerId","state","source","writable"]),o.writable!==!1)throw new Error("Browser credential status must be read-only.");return{providerId:Nt(o.providerId,`Credential ${r+1} provider`),state:sn(o.state,`Credential ${r+1} state`,["ready","missing","unavailable"]),source:sn(o.source,`Credential ${r+1} source`,["environment","legacy","none"]),writable:!1}}function ag(n){const r=Vt(n,"Current session settings");return Kt(r,["model","effort","overridesProjectEffort"]),{model:Nt(r.model,"Current session model"),effort:sn(r.effort,"Current session effort",ep),overridesProjectEffort:cs(r.overridesProjectEffort,"Current session effort override state")}}function cg(n){const r=Vt(n,"Settings diagnostic");return Kt(r,["code","message"]),{code:Nt(r.code,"Settings diagnostic code"),message:Nt(r.message,"Settings diagnostic message")}}function Fo(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)Fo(o,r);return}for(const[o,a]of Object.entries(n)){if(Km.test(o))throw new Error("Settings response contains a forbidden secret-bearing field.");Fo(a,r)}}finally{r.delete(n)}}}function Vt(n,r){if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${r} must be an object.`);return n}function ec(n,r){if(!Array.isArray(n))throw new Error(`${r} must be an array.`);return n}function Nt(n,r){if(typeof n!="string"||!n.trim())throw new Error(`${r} must be text.`);return n}function cs(n,r){if(typeof n!="boolean")throw new Error(`${r} must be boolean.`);return n}function ug(n,r){if(!Number.isSafeInteger(n)||n<0)throw new Error(`${r} must be a non-negative safe integer.`);return n}function sn(n,r,o){if(typeof n!="string"||!o.includes(n))throw new Error(`${r} is invalid.`);return n}function Kt(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 dg(n){return typeof n=="string"&&Zm.includes(n)}function fg(n){return typeof n=="string"&&tg.includes(n)}function pg(n,r){const o=n==="invalid"?"invalid_document":n==="ready"&&r?void 0:"read_only";return{effectiveValue:"orion-blocksmith",inheritedValue:"orion-blocksmith",source:"internal",scope:"global",applies:"live",overridden:!1,writable:n==="ready"&&r,...o?{blockedReason:o}:{}}}function hg(n){return typeof n=="string"&&eg.includes(n)}function mg(n){return typeof n=="string"&&ep.includes(n)}function gg(n){return typeof n=="string"&&ng.includes(n)}function vg(n){return typeof n=="string"&&!!n.trim()}const Io="/api/v1",yg="x-orion-web-nonce",tc=100,xg=50,hn=/^[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 Ee extends Error{constructor(o,a,d,f){super(o);Ht(this,"status");Ht(this,"code");Ht(this,"type");this.status=a,this.code=d,this.type=f,this.name="WebApiError"}}class wg{constructor(){Ht(this,"nonce","")}async bootstrap(){const r=await this.query("/bootstrap");if(!In(r)||r.apiVersion!==1||typeof r.nonce!="string")throw new Ee("Web Host 返回了不兼容的启动协议。",502);return this.nonce=r.nonce,{...r,settings:Za(r.settings)}}async listWorkspaces(r,o){const a=await this.collectionPage(Le("/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(Le(`/workspaces/${encodeURIComponent(r)}/sessions`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}workspaceProjectSummary(r,o){return this.query(Le(`/workspaces/${encodeURIComponent(r)}/summary`,o))}async listSessions(r,o){const a=await this.collectionPage(Le("/sessions",r),o);return{sessions:a.items,nextCursor:a.nextCursor}}diagnostics(r){return this.query(Le("/diagnostics",r))}async settings(){return Za(await this.query("/settings"))}async sessionSnapshot(r,o,a){const d=`/sessions/${encodeURIComponent(r)}/snapshot`;return this.query(Ha(Le(d,o),a??null,!0,xg))}composerState(r,o){return this.query(Le(`/sessions/${encodeURIComponent(r)}/composer-state`,o))}modelCatalog(r,o,a){return this.query(Ha(Le(`/sessions/${encodeURIComponent(r)}/model-catalog`,o),a??null,!1,tc))}composerAction(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/composer-actions`,"POST",{...o,requestId:$e()})}async skills(r,o){const a=await this.collectionPage(Le("/skills",r),o);return{skills:a.items,nextCursor:a.nextCursor}}async mcp(r,o){const a=await this.collectionPage(Le("/mcp",r),o);return{servers:a.items,nextCursor:a.nextCursor}}async toolDetails(r,o){const a=await this.collectionPage(Le("/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 Nn(f,o),this.query(`/tool-details/${encodeURIComponent(r)}?${f.toString()}`)}listFiles(r,o,a){const d=new URLSearchParams({pageSize:"100"});return Nn(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 Nn(d,o),a&&d.set("cursor",a),this.query(`/files/${encodeURIComponent(r)}/content?${d.toString()}`)}writeFileContent(r,o,a,d){return this.mutate("/files/write","POST",{...r,fileId:o,content:a,expectedRevision:d,requestId:$e()},{"X-Orion-User-Gesture":"file-mutation-v1"})}gitStatus(r,o,a){const d=new URLSearchParams({pageSize:"200"});return Nn(d,r),o&&d.set("cursor",o),a?.group&&d.set("group",a.group),a?.query&&d.set("query",a.query),this.query(`/git/status?${d.toString()}`)}gitLog(r,o){const a=new URLSearchParams({pageSize:"30"});return Nn(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 Nn(d,o),a&&d.set("cursor",a),this.query(`/git/diff/${encodeURIComponent(r)}?${d.toString()}`)}gitDiffDocument(r,o,a,d,f){const p=new URLSearchParams({lineLimit:"240",byteLimit:String(262144)});return Nn(p,o),a&&p.set("cursor",a),d&&p.set("ignoreWhitespace","1"),f&&p.set("wordDiff","1"),this.query(`/git/diff-v2/${encodeURIComponent(r)}?${p.toString()}`)}review(r){return this.query(Le("/review",r))}async terminals(r,o){const a=await this.collectionPage(Le("/terminals",r),o);return{terminals:a.items,nextCursor:a.nextCursor}}createTerminal(r){return this.mutate("/terminals","POST",{...r,requestId:$e()},{"X-Orion-User-Gesture":"terminal-create-v1"})}terminalAttachTicket(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}/attach-ticket`,"POST",{...o,requestId:$e()})}closeTerminal(r,o){return this.mutate(`/terminals/${encodeURIComponent(r)}`,"DELETE",{...o,requestId:$e()})}terminalSocket(r){const o=location.protocol==="https:"?"wss:":"ws:";return new WebSocket(`${o}//${location.host}${Io}/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 Nn(f,r),this.query(`/files/search?${f.toString()}`)}gitStage(r,o,a){return this.mutate("/git/stage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:$e()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitUnstage(r,o,a){return this.mutate("/git/unstage","POST",{...r,fileIds:o,expectedRepositoryRevision:a,requestId:$e()},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitCommit(r,o){return this.mutate("/git/commit","POST",{...r,summary:o.summary,...o.body===void 0?{}:{body:o.body},expectedRepositoryRevision:o.expectedRepositoryRevision,requestId:o.requestId},{"X-Orion-User-Gesture":"git-mutation-v1"})}gitCompare(r,o){const a=new URLSearchParams({base:o.baseRef,head:o.headRef,mode:o.mode});return this.query(Le(`/git/compare?${a.toString()}`,r))}gitCompareFileDiff(r,o){const a=new URLSearchParams({baseOid:o.baseOid,headOid:o.headOid,path:o.path});return o.cursor&&a.set("cursor",o.cursor),this.query(Le(`/git/compare/file?${a.toString()}`,r))}gitRefs(r){return this.query(Le("/git/refs",r))}gitHistory(r,o){const a=new URLSearchParams;for(const[d,f]of Object.entries(o))f!==void 0&&f!==""&&a.set(d,String(f));return this.query(Le(`/git/history?${a.toString()}`,r))}gitCommitDetail(r,o,a=0){const d=new URLSearchParams({parent:String(a)});return this.query(Le(`/git/commit/${encodeURIComponent(o)}?${d.toString()}`,r))}gitCommitFiles(r,o,a=0){const d=new URLSearchParams({parent:String(a)});return this.query(Le(`/git/commit/${encodeURIComponent(o)}/files?${d.toString()}`,r))}gitCommitDiff(r,o){const a=new URLSearchParams({path:o.path,parent:String(o.parentIndex??0)});return o.cursor&&a.set("cursor",o.cursor),this.query(Le(`/git/commit/${encodeURIComponent(o.oid)}/diff?${a.toString()}`,r))}gitFilesTarget(r,o){const a=new URLSearchParams({fileToken:o});return this.query(Le(`/git/files-target?${a.toString()}`,r))}gitGraph(r,o=200){const a=new URLSearchParams({limit:String(o)});return this.query(Le(`/git/graph?${a.toString()}`,r))}gitConflictVersions(r,o){const a=new URLSearchParams({path:o});return this.query(Le(`/git/conflict?${a.toString()}`,r))}gitBlob(r,o){const a=new URLSearchParams({path:o.path,rev:o.rev});return this.query(Le(`/git/blob?${a.toString()}`,r))}gitSubmodules(r){return this.query(Le("/git/submodules",r))}gitBlame(r,o){const a=new URLSearchParams({path:o.path});return o.rev&&a.set("rev",o.rev),o.limit!==void 0&&a.set("limit",String(o.limit)),this.query(Le(`/git/blame?${a.toString()}`,r))}gitFileHistory(r,o){const a=new URLSearchParams({path:o.path});return o.rev&&a.set("rev",o.rev),o.limit!==void 0&&a.set("limit",String(o.limit)),this.query(Le(`/git/file-history?${a.toString()}`,r))}gitCommitPreview(r){return this.query(Le("/git/commit/preview",r))}gitApplyPatch(r,o){return this.mutate("/git/patch","POST",{...r,fileId:o.fileId,...o.hunkIds?{hunkIds:[...o.hunkIds]}:{},...o.lineIds?{lineIds:[...o.lineIds]}:{},expectedRepositoryRevision:o.expectedRepositoryRevision,requestId:$e()},{"X-Orion-User-Gesture":"git-mutation-v1"})}activateContext(r){return this.mutate("/context/activate","POST",{...r,requestId:$e()})}async setWorkspacePinned(r,o,a){return(await this.mutate(`/workspaces/${encodeURIComponent(r)}/pin`,"POST",{requestId:$e(),pinned:o,...a})).workspace}removeWorkspace(r,o){return this.mutate(`/workspaces/${encodeURIComponent(r)}`,"DELETE",{requestId:$e(),...o})}async activateWorkspace(r,o){const a=await this.mutate("/workspaces/activate","POST",{requestId:$e(),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}}pickDirectory(r){return this.mutate("/workspaces/pick-directory","POST",{requestId:$e(),...r.title?{title:r.title}:{},...r.initialPath?{initialPath:r.initialPath}:{}})}async inspectWorkspace(r,o){return(await this.mutate("/workspaces/inspect","POST",{requestId:$e(),path:r,...o?{source:o}:{}})).candidate}async createSession(r){return(await this.mutate("/sessions","POST",{requestId:$e(),...r})).session}activateSession(r,o){return this.mutate(`/sessions/${encodeURIComponent(r)}/activate`,"POST",{requestId:$e(),...o})}async renameSession(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}`,"PATCH",{requestId:$e(),name:o,...a})).session}async updateSessionTags(r,o,a){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/tags`,"POST",{requestId:$e(),tags:[...o],...a})).session}async archiveSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/archive`,"POST",{requestId:$e(),...o})).session}async restoreSession(r,o){return(await this.mutate(`/sessions/${encodeURIComponent(r)}/restore`,"POST",{requestId:$e(),...o})).session}async deleteSession(r,o){await this.mutate(`/sessions/${encodeURIComponent(r)}`,"DELETE",{requestId:$e(),...o})}async listArchivedWorkspaceSessions(r,o,a){const d=await this.collectionPage(Le(`/workspaces/${encodeURIComponent(r)}/sessions/archived`,o),a);return{sessions:d.items,nextCursor:d.nextCursor}}command(r){return this.mutate("/commands","POST",{...r,requestId:$e()})}async updateSettings(r,o,a,d=$e()){const f=await this.mutate("/settings","PATCH",{operations:o,expectedRevision:r,...a,requestId:d}),p=sg(f);if(p.requestId!==d)throw new Ee("Host 返回了其他设置请求的结果。",502,"settings_response_invalid");const g=o.map(x=>x.key);if(p.appliedKeys.length!==g.length||g.some(x=>!p.appliedKeys.includes(x)))throw new Ee("Host 返回的设置字段与提交内容不一致。",502,"settings_response_invalid");return p}openSettingsDocument(){return this.mutate("/settings/open-document","POST",{requestId:$e()})}connectEvents(r){let o=Math.max(0,r.cursor??0),a=null,d,f=0,p=!1,g=!1;const x=()=>{if(!(p||g)){if(!navigator.onLine){r.onStatus("offline",f);return}r.onStatus(f===0?"connecting":"reconnecting",f),a=new EventSource(`${Io}/events?cursor=${o}`),a.onopen=()=>{f=0,r.onStatus("live",f)},a.addEventListener("orion",C=>{if(!(p||g))try{const E=kg(C.data);if(E.type==="replay_reset"){o=E.cursor,r.onEvent(E),g=!0,a?.close(),a=null,window.clearTimeout(d);return}if(E.cursor<=o)return;o=E.cursor,r.onEvent(E)}catch(E){r.onProtocolError?.(E instanceof Error?E.message:"无法解析 Web Host 事件流消息。")}}),a.onerror=()=>{if(a?.close(),a=null,p||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(x,C)}}},w=()=>{p||g||a||(window.clearTimeout(d),x())},R=()=>{window.clearTimeout(d),a?.close(),a=null,!g&&r.onStatus("offline",f)};return window.addEventListener("online",w),window.addEventListener("offline",R),x(),{close(){p=!0,window.clearTimeout(d),a?.close(),a=null,window.removeEventListener("online",w),window.removeEventListener("offline",R)},cursor:()=>o}}collectionPage(r,o){return this.query(Ha(r,o??null,!1,tc))}async query(r){const o=await fetch(`${Io}${r}`,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",cache:"no-store"});return ef(o)}async mutate(r,o,a,d={}){if(!this.nonce)throw new Ee("Web Workbench 尚未完成安全握手。",503);const f=await fetch(`${Io}${r}`,{method:o,headers:{Accept:"application/json","Content-Type":"application/json",[yg]:this.nonce,...d},credentials:"same-origin",cache:"no-store",body:JSON.stringify(a)});return ef(f)}}async function ef(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 Ee(d,n.status,typeof a.code=="string"?a.code:void 0,typeof a.type=="string"?a.type:void 0)}return o}function kg(n){const r=JSON.parse(n);if(!In(r)||r.apiVersion!==1||typeof r.eventId!="string"||!hn.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"||!hn.test(r.payload.contextRevision)||typeof r.payload.workspaceId!="string"||!hn.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 ig(r);if(r.type==="session_runtime_changed"&&(!In(r.payload.runtime)||r.sessionId!==r.payload.runtime.sessionId||!jg(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"||!hn.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"||!hn.test(r.payload.state.controlRevision)||typeof r.payload.state.contextRevision!="string"||!hn.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 jg(n){const r=n.phase==="queued";return typeof n.workspaceId=="string"&&hn.test(n.workspaceId)&&typeof n.sessionId=="string"&&hn.test(n.sessionId)&&typeof n.runtimeRevision=="string"&&hn.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"&&hn.test(n.queueId)&&Number.isSafeInteger(n.queuePosition)&&n.queuePosition>=1:n.queueId===void 0&&n.queuePosition===void 0)}function Ha(n,r=null,o=!1,a=tc){const d=new URLSearchParams({pageSize:String(a)});return r&&d.set("cursor",r),o&&d.set("tail","1"),`${n}${n.includes("?")?"&":"?"}${d.toString()}`}function Nn(n,r){n.set("expectedContextRevision",r.expectedContextRevision),n.set("workspaceId",r.workspaceId)}function Le(n,r){const o=new URLSearchParams;return Nn(o,r),`${n}${n.includes("?")?"&":"?"}${o.toString()}`}function In(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function $e(){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 Sg({state:n,actions:r,insertion:o}){const a=n.workspaceId,d=n.activeSessionId??"",[f,p]=m.useState({workspaceId:a,sessionId:d,text:"",references:[]}),[g,x]=m.useState(null),[w,R]=m.useState(""),[C,E]=m.useState(new Set),_=m.useRef(null),A=`${a}:${d}`,L=m.useRef(A);L.current=A;const z=`${f.workspaceId}:${f.sessionId}`,ie=!d||!n.bootstrap?.configured||n.connection!=="live"||!Pr(n),F=!!n.pendingAction,Se=n.sessionSnapshot?.sessionRuntime.phase==="queued",se=!ie&&!F,re=se&&!Se;m.useEffect(()=>{if(!a||!d){p({workspaceId:a,sessionId:d,text:"",references:[]});return}const K=Bm(a,d);p({workspaceId:a,sessionId:d,text:K?.text??"",references:K?.references??[]}),R(""),E(new Set)},[a,d]),m.useEffect(()=>{if(!(!f.workspaceId||!f.sessionId))try{f.text||f.references.length>0?qm(f):Zd(f.workspaceId,f.sessionId),R("")}catch(K){R(K instanceof Error?K.message:"草稿无法保存。")}},[f]),m.useEffect(()=>{!o||!d||z!==A||(p(K=>({...K,text:K.text.trim()?`${K.text.trimEnd()}
|
|
15
|
+
|
|
16
|
+
${o.text}`:o.text})),requestAnimationFrame(()=>_.current?.focus()))},[A,z,o,d]);const b=z===A?f.text:"",D=z===A?f.references:[],te=K=>p(be=>({...be,workspaceId:a,sessionId:d,text:K})),Ce=K=>{const be=new Set(K.map(oi));E($=>new Set([...$].filter(fe=>be.has(fe)))),p($=>({...$,workspaceId:a,sessionId:d,references:K}))},xe=async K=>{const be=b.trim();if(!be||!re)return;const $=A;try{K==="queue"?await r.queue(be,D):await r.submit(be,D),Zd(a,d),E(new Set),L.current===$&&p({workspaceId:a,sessionId:d,text:"",references:[]}),_.current?.focus()}catch(fe){fe instanceof Ee&&["context_reference_stale","context_reference_forbidden"].includes(fe.code??"")&&E(new Set(D.map(oi))),R(fe instanceof Error?fe.message:"发送失败,草稿已保留。"),_.current?.focus()}},J=K=>{K.preventDefault(),xe(n.processing?"queue":"submit")},G=K=>{K.key!=="Enter"||K.shiftKey||K.nativeEvent.isComposing||(K.preventDefault(),n.processing&&(K.metaKey||K.ctrlKey)?xe("submit"):xe(n.processing?"queue":"submit"))};return i.jsxs("div",{className:"composer-control-center",children:[n.composer?.planReview?.status==="awaiting_review"?i.jsx(Eg,{state:n,actions:r}):null,D.length>0?i.jsx(_g,{references:D,invalidReferenceKeys:C,onChange:Ce}):null,i.jsxs("form",{className:"composer composer-v032",onSubmit:J,children:[i.jsx("label",{htmlFor:"orion-composer",className:"sr-only",children:"发送给 Orion"}),i.jsx("textarea",{ref:_,id:"orion-composer",rows:3,maxLength:1e6,value:b,onChange:K=>te(K.target.value),onKeyDown:G,placeholder:F?"正在同步会话控制状态…":Se?`任务正在排队${n.sessionSnapshot?.sessionRuntime.queuePosition?`(第 ${n.sessionSnapshot.sessionRuntime.queuePosition} 位)`:""}`:ie?"选择会话并配置模型后开始":n.processing?"输入后续消息;Enter 排队,⌘/Ctrl+Enter Steer":"描述任务,或输入 / 查看命令…",disabled:!re}),i.jsxs("div",{className:"composer-toolbar composer-control-toolbar",children:[i.jsxs("div",{className:"composer-controls composer-control-row",children:[i.jsx(Ig,{state:n,actions:r,disabled:!re,references:D,onChange:Ce,onInsertCommand:()=>te(b.trim()?`${b.trimEnd()}
|
|
17
|
+
/`:"/")}),i.jsx(nc,{label:Og(n),accessibleLabel:"工作模式",disabled:!re,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:K=>{K==="auto"?x("auto"):bt(r.setMode(K))}}),i.jsx(nc,{label:Mg(n),accessibleLabel:"会话权限",disabled:!re,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:K=>{K==="allow"?x("allow"):bt(r.setPermissionOverride(K==="inherit"?null:K))}})]}),i.jsxs("div",{className:"composer-actions composer-control-actions",children:[i.jsx(Cg,{state:n,actions:r,disabled:!re}),i.jsx(Ng,{state:n,actions:r,disabled:!re}),n.processing?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"icon-text-button stop-button",onClick:()=>bt(r.interrupt()),disabled:!re,children:[i.jsx(X,{name:"stop",size:14}),"停止"]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{xe("submit")},disabled:!b.trim()||!re,children:"Steer"})]}):null,Se?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>bt(r.cancelQueuedTurn()),disabled:!se,children:"取消排队"}):null,i.jsx("button",{type:"submit",className:"send-button composer-send-icon","aria-label":n.processing?"加入消息队列":"发送消息",disabled:!re||!b.trim(),children:i.jsx(X,{name:"arrow-up",size:17})})]})]}),D.length>0||w||n.composer?.lastError?i.jsxs("div",{className:"composer-footline",children:[D.length>0?i.jsxs("span",{children:[D.length," 个 Context 引用"]}):null,w?i.jsx("span",{role:"alert",children:w}):n.composer?.lastError?i.jsx("span",{role:"alert",children:n.composer.lastError.message}):null]}):null]}),g?i.jsx(Pg,{kind:g,onCancel:()=>x(null),onConfirm:()=>{const K=g;x(null),bt(K==="auto"?r.setMode("auto"):r.setPermissionOverride("allow"))}}):null]})}function Cg({state:n,actions:r,disabled:o}){const a=n.composer?.model,d=["auto",...a?.effort.supportedLevels??[]];return i.jsxs("div",{className:"model-control-cluster",children:[i.jsx(bg,{state:n,actions:r,disabled:o}),a?.effort.supported?i.jsx(nc,{label:n.composer?.pending.model?`${_o(a.effort.requested)} → ${_o(n.composer.pending.model.effort)}`:_o(a.effort.requested),accessibleLabel:"推理强度",disabled:o,value:a.effort.requested,options:d.map(f=>({value:f,label:_o(f),detail:f==="auto"?"采用模型或项目默认值":`请求 ${f} reasoning effort`})),onSelect:f=>bt(r.selectModel(a.modelId,f))}):null]})}function bg({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),[f,p]=m.useState(""),g=m.useRef(null),x=m.useRef(null),w=m.useRef(null),R=n.composer?.model,C=n.modelCatalog,E=n.composer?.pending.model?`${R?.modelId??"模型"} → ${n.composer.pending.model.modelId}`:R?.modelId??"模型",_=f.trim().toLowerCase(),A=new Set((C?.unavailableProviders??[]).map(F=>F.id)),L=(C?.items??[]).filter(F=>!A.has(F.providerId)).filter(F=>[F.id,F.label,F.providerId,F.providerLabel].some(Se=>Se.toLowerCase().includes(_))).slice(0,80),z=new Map;for(const F of L){const Se=F.providerLabel||F.providerId;z.set(Se,[...z.get(Se)??[],F])}const ie=()=>{d(!1),p(""),x.current?.focus()};return Jo(a,g,ie),i.jsxs("div",{className:"control-menu",ref:g,children:[i.jsxs("button",{ref:x,type:"button",className:"composer-control-trigger","aria-label":"会话模型","aria-haspopup":"menu","aria-expanded":a,disabled:o,onClick:()=>{a?ie():(d(!0),C||bt(r.loadModelCatalog()))},children:[i.jsx("span",{children:E}),i.jsx(X,{name:"chevron",size:12})]}),a?i.jsxs("div",{className:"control-menu-popover model-catalog-popover",role:"menu","aria-label":"会话模型",ref:w,onKeyDown:F=>pc(F,ie),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:F=>p(F.target.value),onKeyDown:F=>{F.key==="ArrowDown"?(F.preventDefault(),tp(w.current)):F.key==="Escape"&&(F.stopPropagation(),ie())}})]}):null,C===null?i.jsx("p",{role:"status",children:"正在加载模型…"}):null,C&&L.length===0?i.jsx("p",{children:"没有匹配的可用模型"}):null,[...z.entries()].map(([F,Se])=>i.jsxs("section",{role:"group","aria-label":F,children:[i.jsx("div",{className:"model-provider-heading",children:F}),Se.map(se=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":se.id===R?.modelId,onClick:()=>{ie(),bt(r.selectModel(se.id))},children:[i.jsxs("span",{children:[i.jsx("strong",{children:se.label}),i.jsxs("small",{children:[ls(se.contextWindow)," context",se.reasoning?" · reasoning":""]})]}),se.id===R?.modelId?i.jsx(X,{name:"check",size:14}):null]},se.id))]},F)),C?.unavailableProviders.map(F=>i.jsxs("section",{role:"group","aria-label":`${F.id} 不可用`,children:[i.jsxs("div",{className:"model-provider-heading state-error",children:[F.id," · 不可用"]}),i.jsx("p",{children:F.reason}),i.jsx("button",{type:"button",role:"menuitem",onClick:()=>bt(r.loadModelCatalog()),children:"Retry"})]},F.id)),(C?.items.length??0)>80&&!_?i.jsx("p",{children:"显示前 80 项;输入关键词继续筛选。"}):null]}):null]})}function Ng({state:n,actions:r,disabled:o}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),g=n.composer?.contextUsage,x=g?Math.max(0,Math.min(100,g.percent)):null,w=g?.source==="estimated",R=!!(g&&g.percent>=g.warningThresholdPercent);return Jo(a,f,()=>{d(!1),p.current?.focus()}),i.jsxs("div",{className:"context-meter-wrap",ref:f,children:[i.jsxs("button",{ref:p,type:"button",className:"context-meter-button","aria-label":g?`Context ${w?"估算 ":""}${g.usedTokens} / ${g.safeInputBudget??g.contextWindow} tokens,${g.percent}%${R?",接近压缩阈值":""}`:"Context 用量不可用","aria-haspopup":"dialog","aria-expanded":a,disabled:o,onClick:()=>d(C=>!C),children:[i.jsx("span",{className:"context-meter-ring",style:{"--context-percent":`${x??0}%`},"aria-hidden":"true"}),i.jsx("span",{children:g?`${w?"~":""}${g.percent}%${R?" !":""}`:"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(X,{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:ls(g.usedTokens)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全输入预算"}),i.jsx("dd",{children:ls(g.safeInputBudget??g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"原始窗口"}),i.jsx("dd",{children:ls(g.contextWindow)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"输出预留"}),i.jsx("dd",{children:ls(g.reservedOutputTokens??0)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"安全余量"}),i.jsx("dd",{children:ls(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 Ig({state:n,actions:r,disabled:o,references:a,onChange:d,onInsertCommand:f}){const[p,g]=m.useState(!1),[x,w]=m.useState("root"),[R,C]=m.useState([]),[E,_]=m.useState(!1),[A,L]=m.useState(""),z=m.useRef(null),ie=m.useRef(null);Jo(p,z,()=>g(!1));const F=b=>{a.some(D=>D.kind===b.kind&&D.id===b.id)||d([...a,b]),g(!1),w("root")},Se=async()=>{w("files"),_(!0),L("");try{const b=await r.listFiles();C(b.items.filter(D=>D.readable&&!D.sensitive))}catch(b){L(b instanceof Error?b.message:"文件列表加载失败。")}finally{_(!1)}},se=async b=>{_(!0),L("");try{if(nf(b)){const D=await r.listFiles(b.id);F({kind:"folder",id:b.id,label:b.name,revision:D.revision})}else if(Lg(b)){const D=await r.readFileContent(b.id);if(D.binary||D.sensitive)throw new Error("该文件不能加入模型 Context。");F({kind:"file",id:b.id,label:b.name,revision:D.revision})}}catch(D){L(D instanceof Error?D.message:"Context 引用加载失败。")}finally{_(!1)}},re=async()=>{_(!0);try{const b=await r.review();F({kind:"review",id:"working-tree",label:b.truncated?`Review · ${b.totalChangedFiles} files · ${b.changedFiles.length} visible`:`Review · ${b.totalChangedFiles} files`,gitRevision:b.repositoryRevision})}catch(b){L(b instanceof Error?b.message:"Review Context 加载失败。")}finally{_(!1)}};return i.jsxs("div",{className:"control-menu context-launcher",ref:z,children:[i.jsx("button",{type:"button",className:"context-add-button","aria-label":"添加 Context","aria-haspopup":"menu","aria-expanded":p,disabled:o,onClick:()=>{const b=!p;g(b),b&&requestAnimationFrame(()=>tp(ie.current))},children:i.jsx(X,{name:"add",size:17})}),p?i.jsxs("div",{className:"control-menu-popover context-launcher-menu",role:"menu","aria-label":"添加 Context",ref:ie,onKeyDown:b=>pc(b,()=>g(!1)),children:[x!=="root"?i.jsx("button",{type:"button",role:"menuitem",onClick:()=>w("root"),children:"← 返回"}):null,x==="root"?i.jsxs(i.Fragment,{children:[i.jsx(bn,{label:"文件或目录",detail:"Workspace 内受控读取",onClick:()=>{Se()}}),i.jsx(bn,{label:"当前 Review",detail:"绑定 exact Git revision",onClick:()=>{re()}}),i.jsx(bn,{label:"历史 Session",detail:"引用受控摘要",onClick:()=>w("sessions")}),i.jsx(bn,{label:"Skill",detail:"绑定已加载能力 digest",onClick:()=>w("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,x==="files"?R.map(b=>i.jsx(bn,{label:b.name,detail:nf(b)?"目录":`${b.sizeBytes??0} bytes`,onClick:()=>{se(b)}},b.id)):null,x==="sessions"?n.sessions.filter(b=>b.id!==n.activeSessionId).map(b=>i.jsx(bn,{label:b.name||`Session ${b.id.slice(0,8)}`,detail:`${b.messageCount} 条消息`,onClick:()=>F({kind:"session",id:b.id,label:b.name||`Session ${b.id.slice(0,8)}`,digest:b.contextDigest})},b.id)):null,x==="skills"?n.skills.filter(b=>b.userInvocable).map(b=>i.jsx(bn,{label:b.name,detail:b.description,onClick:()=>F({kind:"skill",id:b.id,label:b.name,digest:b.digest})},b.id)):null,E?i.jsx("p",{role:"status",children:"正在加载…"}):null,A?i.jsx("p",{role:"alert",children:A}):null]}):null]})}function _g({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(oi(a))?" state-stale":""}`,children:[i.jsx("small",{children:Ag(a.kind)}),i.jsx("span",{children:a.label}),r.has(oi(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(X,{name:"close",size:12})})]},oi(a)))})}function Eg({state:n,actions:r}){const o=n.composer.planReview,[a,d]=m.useState(!1),[f,p]=m.useState(""),g=!!n.pendingAction||n.connection!=="live"||!Pr(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:x=>p(x.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 nc({label:n,accessibleLabel:r,value:o,options:a,disabled:d,emptyLabel:f,onOpen:p,onSelect:g}){const[x,w]=m.useState(!1),R=m.useRef(null),C=m.useRef(null),E=m.useRef(null),_=m.useId(),A=()=>{w(!1),C.current?.focus()},L=()=>{w(!0),p?.(),requestAnimationFrame(()=>Rg(E.current))};return Jo(x,R,A),i.jsxs("div",{className:"control-menu",ref:R,children:[i.jsxs("button",{ref:C,type:"button",className:"composer-control-trigger","aria-label":r,"aria-haspopup":"menu","aria-expanded":x,"aria-controls":x?_:void 0,disabled:d,onClick:()=>{x?A():L()},onKeyDown:z=>{z.key==="ArrowDown"&&(z.preventDefault(),L())},children:[i.jsx("span",{children:n}),i.jsx(X,{name:"chevron",size:12})]}),x?i.jsx("div",{id:_,ref:E,className:"control-menu-popover",role:"menu","aria-label":r,onKeyDown:z=>pc(z,A),children:a.length===0?i.jsx("p",{children:f??"没有选项"}):a.map(z=>i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":z.value===o,onClick:()=>{A(),g(z.value)},children:[i.jsxs("span",{children:[i.jsx("strong",{children:z.label}),i.jsx("small",{children:z.detail})]}),z.value===o?i.jsx(X,{name:"check",size:14}):null]},z.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 Pg({kind:n,onCancel:r,onConfirm:o}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null);return m.useEffect(()=>{const g=document.querySelector(n==="auto"?'[aria-label="工作模式"]':'[aria-label="会话权限"]');return p.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=>Tg(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:p,type:"button",className:"secondary-button",onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!a,onClick:o,children:"确认启用"})]})]})})}function fc(n){return n?[...n.querySelectorAll('[role="menuitem"], [role="menuitemradio"]')].filter(r=>!r.disabled):[]}function tp(n){fc(n)[0]?.focus()}function Rg(n){const r=fc(n);(r.find(o=>o.getAttribute("aria-checked")==="true")??r[0])?.focus()}function pc(n,r){if(n.key==="Escape"){n.preventDefault(),r();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();const o=fc(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 Tg(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 Jo(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 tf(n){return n==="plan"?"PLAN":n==="auto"?"AUTO":"BUILD"}function Og(n){const r=n.composer?.mode??n.mode,o=tf(r.baseMode);return r.pendingBaseMode?`${o} → ${tf(r.pendingBaseMode)}`:o}function Mg(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 _o(n){return n==="auto"?"Effort 自动":`Effort ${n}`}function nf(n){return n.kind==="directory"||n.kind==="symlink"&&n.targetKind==="directory"}function Lg(n){return n.kind==="file"||n.kind==="symlink"&&n.targetKind==="file"}function Ag(n){return n==="file"?"FILE":n==="folder"?"FOLDER":n==="review"?"REVIEW":n==="session"?"SESSION":"SKILL"}function oi(n){return`${n.kind}:${n.id}`}function bt(n){n.catch(()=>{})}function ls(n){return n>=1e3?`${Math.round(n/1e3)}k`:String(n)}const $g=48,Dg=64,zg=new Set(["user","assistant"]);function Wg(n,r={}){const o=Bg(r.maxBuckets),a=[...n].filter(g=>Number.isFinite(g.order)).sort((g,x)=>g.order-x.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),p=[];for(let g=0;g<d;g+=1){const x=a.slice(g*f,(g+1)*f);if(x.length===0)break;p.push(Fg(g,x))}return Object.freeze({anchors:Object.freeze(a),buckets:Object.freeze(p),minOrder:p[0]?.startOrder??0,maxOrder:p.at(-1)?.endOrder??0})}function Fg(n,r){const o=[],a=new Set;let d=!1,f=null;for(const p of r)a.has(p.kind)||(a.add(p.kind),o.push(p.kind)),p.priority==="error"&&(d=!0,(!f||p.priority==="error")&&(f=p));if(!f){let p=null;for(const g of r)zg.has(g.kind)&&(p=g);f=p??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(p=>p.order)),kinds:Object.freeze(o),hasError:d,jumpOrder:f.order})}function Bg(n){return typeof n!="number"||!Number.isFinite(n)?$g:Math.min(Dg,Math.max(1,Math.round(n)))}function qg(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 Ug(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?qg(d):"未知"}}function rf(n,r){return r<=0?0:r===1?.5:Math.max(0,Math.min(r-1,n))/(r-1)}function Eo(n,r){const o=n.buckets.findIndex(a=>r>=a.startOrder&&r<=a.endOrder);return o>=0?o:null}function Hg(n){const r=n.kind==="tool"||n.kind==="edit"||n.kind==="subtask"||n.kind==="research"?160:240,o=n.label.length,a=.35+Math.log2(1+o/r)*.55;return Math.max(.15,Math.min(1,a))}const Vg=220,Kg=400;function Gg(n,r={}){const o=typeof r.maxTicks=="number"&&Number.isFinite(r.maxTicks)?Math.max(1,Math.min(Kg,Math.round(r.maxTicks))):Vg,a=[...n].filter(p=>Number.isFinite(p.order)).sort((p,g)=>p.order-g.order);if(a.length===0)return Object.freeze([]);const d=[];if(a.length<=o)for(const p of a)d.push([p]);else{const p=Math.ceil(a.length/o);for(let g=0;g<a.length;g+=p)d.push(a.slice(g,g+p))}const f=d.map((p,g)=>{const x=p.some(_=>_.priority==="error");let R=p.reduce((_,A)=>A.order>_.order?A:_,p[0]),C=-1;for(const _ of p){const A=_.priority==="error"?2:_.priority==="turn"?1:0;A>=C&&(C=A,R=_)}const E=Math.max(.15,Math.min(1,p.reduce((_,A)=>_+Hg(A),0)/p.length+(x?.1:0)));return{index:g,orders:Object.freeze(p.map(_=>_.order)),jumpOrder:R.order,weight:E,hasError:x}});return Object.freeze(f)}function Qg(n){return n>=.72?"history-tick-l":n>=.45?"history-tick-m":"history-tick-s"}function sf(n){const{clientY:r,railTop:o,railHeight:a,tickCount:d}=n;if(!Number.isFinite(a)||a<=0||d<=0)return 0;const f=(r-o)/a;return Math.max(0,Math.min(d-1,Math.round(f*(d-1))))}function Yg(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 Xg(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 Jg(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 p;if(r==="ArrowUp"||r==="ArrowLeft")p=o-f;else if(r==="ArrowDown"||r==="ArrowRight")p=o+f;else if(r==="PageUp")p=o-5;else if(r==="PageDown")p=o+5;else return null;const g=Math.max(0,Math.min(a-1,p));return d.buckets[g]?.jumpOrder??null}function Zg({model:n,activeOrder:r,span:o,hasEarlierHistory:a,processing:d,reduceMotion:f,onJumpToOrder:p,onJumpToLatest:g}){const x=m.useRef(null),w=m.useRef(null),R=m.useRef(!1),C=m.useRef(null),E=m.useRef(null),[_,A]=m.useState(!1),[L,z]=m.useState(null),ie=m.useMemo(()=>Gg(n.anchors),[n.anchors]),F=ie.length,Se=m.useMemo(()=>{if(r===null||F===0)return 0;const $=Eo(n,r);return $!==null?$+1:0},[r,n,F]),se=m.useMemo(()=>r===null?null:Ug(n,r),[r,n]),re=o!==null?Eo(n,o.firstOrder)??0:null,b=o!==null?Eo(n,o.lastOrder)??n.buckets.length-1:null,D=m.useMemo(()=>ie.map($=>Eo(n,$.jumpOrder)),[n,ie]),te=m.useCallback(()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null),z(null)},[]),Ce=m.useCallback($=>{const fe=x.current;if(!fe)return;const V=fe.getBoundingClientRect(),W=sf({clientY:$,railTop:V.top,railHeight:V.height,tickCount:F}),ne=ie[W];if(!ne)return;const q=n.anchors.find(ce=>ce.order===ne.jumpOrder);let v=q?.preview;if(q?.kind==="user"){const pe=n.anchors.find(ye=>ye.order>q.order&&ye.kind==="assistant")?.preview;pe&&(v=v?`${v}
|
|
18
|
+
|
|
19
|
+
${pe}`:pe)}const O=rf(W,F)*V.height;z({title:Pn(q?.label??""),preview:v?Pn(v):null,top:Math.max(8,Math.min(V.height-140,O))})},[n,F,ie]),xe=m.useCallback($=>{E.current=$,C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{C.current=null;const fe=E.current;fe===null||w.current!==null||R.current||Ce(fe)},120)},[Ce]);m.useEffect(()=>{const $=()=>{R.current||te()};return window.addEventListener("scroll",$,!0),()=>window.removeEventListener("scroll",$,!0)},[te]),m.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]);const J=m.useCallback(($,fe)=>{const V=x.current;if(!V)return;const W=V.getBoundingClientRect(),ne=sf({clientY:$,railTop:W.top,railHeight:W.height,tickCount:F}),q=ie[ne];q&&p(q.jumpOrder,fe)},[p,F,ie]),G=$=>{$.button!==0||w.current!==null||($.preventDefault(),w.current=$.pointerId,$.currentTarget.setPointerCapture($.pointerId),document.documentElement.dataset.historyScrubbing="1",R.current=!0,A(!0),te(),J($.clientY,"auto"))},K=$=>{w.current===$.pointerId&&($.currentTarget.hasPointerCapture($.pointerId)&&$.currentTarget.releasePointerCapture($.pointerId),w.current=null,R.current=!1,delete document.documentElement.dataset.historyScrubbing,A(!1),te())},be=$=>{const fe=Jg({key:$.key,shiftKey:$.shiftKey,currentIndex:Se-1,bucketCount:n.buckets.length,model:n});fe!==null&&($.preventDefault(),p(fe,f?"auto":"smooth"))};return F===0?null:i.jsx("nav",{className:"history-rail","aria-label":"会话历史定位",children:i.jsxs("div",{className:"history-rail-inner",ref:x,children:[i.jsxs("div",{className:"history-slider",role:"slider","aria-label":"已加载会话历史位置","aria-valuemin":0,"aria-valuemax":Math.max(0,n.buckets.length-1),"aria-valuenow":Math.max(0,Se-1),"aria-valuetext":se?`已加载 ${se.bucketIndex}/${se.bucketCount} 个关键节点,当前为${se.kindLabel}${a?";更早历史可在正文顶部加载":""}`:`已加载 ${n.buckets.length} 个关键节点${a?";更早历史可在正文顶部加载":""}`,tabIndex:0,onKeyDown:be,onPointerDown:G,onPointerMove:$=>{if(w.current===$.pointerId){J($.clientY,"auto");return}xe($.clientY)},onPointerLeave:te,onPointerUp:K,onPointerCancel:K,onLostPointerCapture:K,onDoubleClick:g,children:[i.jsx("div",{className:"history-ticks","aria-hidden":"true",children:ie.map(($,fe)=>{const V=D[fe],W=V!==null&&re!==null&&b!==null&&V>=re&&V<=b;return i.jsx("span",{className:["history-tick",Qg($.weight),W?"is-viewport":"",$.hasError?"is-error":"",_?"is-scrubbing":""].filter(Boolean).join(" "),style:{top:`${rf($.index,F)*100}%`}},$.index)})}),d?i.jsx("span",{className:"history-live-bar","aria-hidden":"true"}):null]}),L?i.jsxs("div",{className:"history-preview-card",style:{top:L.top},"aria-hidden":"true",children:[i.jsx("strong",{children:L.title}),L.preview?i.jsx("p",{children:L.preview}):null]}):null]})})}const ev=10;function tv(n){const{viewportRef:r,model:o,activeSessionId:a,onUserNavigate:d}=n,f=m.useRef(new Map),p=m.useRef(null),g=m.useRef([]),x=m.useRef(null),[w,R]=m.useState(null),[C,E]=m.useState(null),_=m.useRef(d);_.current=d;const A=m.useRef(a),L=m.useRef(o);L.current=o;const z=()=>{if(x.current=null,g.current.length===0)return;const re=g.current;if(g.current=[],re.length===0)return;const D=r.current?.getBoundingClientRect().top??0,te=Yg(re,D);let Ce=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY;for(const J of re)J.topInViewport>=D-1&&(J.order<Ce&&(Ce=J.order),J.order>xe&&(xe=J.order));R(J=>J===te?J:te),E(J=>{if(!Number.isFinite(Ce)||!Number.isFinite(xe))return J;const G={firstOrder:Ce,lastOrder:xe};return J?.firstOrder===G.firstOrder&&J?.lastOrder===G.lastOrder?J:G})},ie=()=>{x.current===null&&(x.current=requestAnimationFrame(z))},F=()=>{p.current&&(p.current.disconnect(),p.current=null),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),g.current=[],f.current.clear(),R(null),E(null)};m.useEffect(()=>{if(A.current===a&&p.current)return;A.current=a,F();const re=r.current;if(!re||!o.anchors.length||typeof IntersectionObserver>"u")return;const b=new IntersectionObserver(D=>{const Ce=r.current?.getBoundingClientRect().top??0;for(const xe of D){const J=Number(xe.target.dataset.order);Number.isFinite(J)&&xe.isIntersecting&&g.current.push({order:J,topInViewport:xe.boundingClientRect.top-Ce})}ie()},{root:re,threshold:[0,.2,.6]});return p.current=b,f.current.clear(),re.querySelectorAll("li[data-order]").forEach(D=>{const te=Number(D.dataset.order);Number.isFinite(te)&&(f.current.set(te,D),b.observe(D))}),()=>F()},[r,a,o.anchors.length,o.anchors[o.anchors.length-1]?.order]);const Se=m.useCallback((re,b)=>{if(b){if(f.current.get(re)===b)return;f.current.set(re,b),p.current?.observe(b);return}const D=f.current.get(re);D&&(p.current?.unobserve(D),f.current.delete(re))},[]);return{activeOrder:w,span:C,registerItem:Se,scrollToOrder:(re,b="smooth")=>{const D=r.current,te=Xg(L.current,re),Ce=te!==null?f.current.get(te):void 0;if(!D||!Ce){if(!D||L.current.anchors.length===0)return;const J=(re-L.current.minOrder)/(L.current.maxOrder-L.current.minOrder||1);D.scrollTo({top:Math.max(0,Math.min(1,J))*(D.scrollHeight-D.clientHeight),behavior:b}),_.current?.();return}const xe=Ce.getBoundingClientRect().top-D.getBoundingClientRect().top+D.scrollTop-ev;D.scrollTo({top:Math.max(0,xe),behavior:b}),_.current?.()}}}const Va=40;function Cr(n){if(n.length===0)return 0;let r=1;for(let o=0;o<n.length;o+=1)n.charCodeAt(o)===10&&(r+=1);return r}function nv(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function rv(n){if(n==null)return null;const r=n.trim();if(r.length===0)return{format:"plain",displayText:n,isEnvelope:!1,lineCount:0,isLong:!1};let o;try{o=JSON.parse(r)}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:Cr(n),isLong:Cr(n)>Va}}if(nv(o)&&typeof o.output=="string"){const a=o.output;return{format:"envelope",displayText:a,isEnvelope:!0,lineCount:Cr(a),isLong:Cr(a)>Va}}try{const a=JSON.stringify(o,null,2);return{format:"json",displayText:a,isEnvelope:!1,lineCount:Cr(a),isLong:Cr(a)>Va}}catch{return{format:"plain",displayText:n,isEnvelope:!1,lineCount:Cr(n),isLong:!1}}}function np({text:n,defaultOpen:r=!1,note:o=null}){const a=rv(n),d=r||!a?.isLong,[f,p]=m.useState(d),[g,x]=m.useState(!1),w=m.useRef(null);if(m.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current)},[]),a===null)return null;const R=Pn(a.displayText),C=async()=>{try{await navigator.clipboard.writeText(a.displayText),x(!0),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>x(!1),1400)}catch{}},E=i.jsx("pre",{className:"tool-output-text",tabIndex:0,children:R});if(!a.isLong||r)return i.jsxs("div",{className:"tool-output-preview tool-output-preview-open",children:[E,o?i.jsx("p",{className:"truncation-note",children:o}):null]});const _=`${a.lineCount} 行 · ${a.format==="envelope"?"已解包":"文本"}`;return i.jsx("div",{className:"tool-output-preview",children:i.jsxs("details",{className:"tool-output-fold",open:f,onToggle:A=>p(A.target.open),children:[i.jsxs("summary",{children:[i.jsxs("span",{children:[_,a.isEnvelope?" · 输出已安全还原换行":""]}),i.jsx("button",{type:"button",className:"text-button",onClick:A=>{A.preventDefault(),C()},children:g?"已复制":"复制原始响应"})]}),E,o?i.jsx("p",{className:"truncation-note",children:o}):null]})})}const of=320,sv=300;function iv({state:n,actions:r,onRevealSettings:o,onCreateSession:a,composerInsertion:d,navigationOpen:f,navigationOverlay:p,onOpenNavigation:g}){const x=Qo(n),w=m.useMemo(()=>ov(n),[n.edits,n.research,n.subtasks,n.tools,n.transcript]),[R,C]=m.useState(of),E=w.slice(-R),_=m.useRef(null),A=m.useRef(null),L=m.useRef(!0),z=m.useRef(null),[ie,F]=m.useState(!0),[Se,se]=m.useState(!1),re=m.useMemo(()=>E.map(lv).filter(G=>G!==null),[E]),b=m.useMemo(()=>Wg(re),[re]),D=tv({viewportRef:_,model:b,activeSessionId:n.activeSessionId,onUserNavigate:()=>{L.current=!1,F(!1)}});m.useEffect(()=>{const G=window.matchMedia("(prefers-reduced-motion: reduce)");se(G.matches);const K=be=>se(be.matches);return G.addEventListener("change",K),()=>G.removeEventListener("change",K)},[]),m.useEffect(()=>{C(of),L.current=!0,F(!0)},[n.activeSessionId]),m.useLayoutEffect(()=>{const G=_.current;if(G){if(z.current){const K=z.current;G.scrollTop=K.top+(G.scrollHeight-K.height),z.current=null;return}L.current&&(G.scrollTop=G.scrollHeight)}},[E.length,n.processing]),m.useLayoutEffect(()=>{const G=_.current,K=A.current;if(!G||!K||typeof ResizeObserver>"u")return;const be=new ResizeObserver(()=>{L.current&&(G.scrollTop=G.scrollHeight)});return be.observe(K),()=>be.disconnect()},[n.activeSessionId]);const te=()=>{const G=_.current;if(!G)return;const K=G.scrollHeight-G.scrollTop-G.clientHeight<72;L.current=K,F(K)},Ce=!!n.sessionSnapshot?.transcript.nextCursor,xe=async()=>{const G=_.current;if(G&&(z.current={height:G.scrollHeight,top:G.scrollTop}),w.length>E.length){C(K=>K+sv);return}if(Ce)try{await r.loadOlderTranscript(),C(K=>K+100)}catch{z.current=null}},J=()=>{const G=_.current;G&&(L.current=!0,F(!0),G.scrollTo({top:G.scrollHeight,behavior:"smooth"}))};return i.jsxs("main",{className:"conversation-column",id:"main-content",children:[p?i.jsx("button",{type:"button",className:"icon-button mobile-nav-toggle",onClick:g,"aria-label":"打开会话导航","aria-controls":"workspace-rail","aria-expanded":f,children:i.jsx(X,{name:"menu"})}):null,n.bootstrap?.configured?null:i.jsxs("div",{className:"configuration-banner",role:"status",children:[i.jsx(X,{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:o,children:"转到设置"})]}),i.jsxs("div",{className:"transcript-stage",children:[i.jsx("div",{className:"transcript-viewport",ref:_,role:"region","aria-label":"会话记录",tabIndex:0,onScroll:te,"aria-busy":n.processing,children:i.jsxs("div",{className:"transcript-content",ref:A,children:[w.length>E.length||Ce?i.jsx("button",{type:"button",className:"load-history",onClick:()=>{xe()},disabled:!!n.pendingAction,children:w.length>E.length?`加载更早内容 · 还剩 ${w.length-E.length} 项`:"从持久记录加载更早内容"}):null,n.activeSessionId?x.status==="failed"&&E.length===0?i.jsx(Po,{icon:"warning",title:"会话快照加载失败",detail:x.error??"请重试当前会话快照。"}):(x.status==="loading"||x.status==="refreshing")&&E.length===0?i.jsx(Po,{icon:"refresh",title:"正在同步会话",detail:"本地 Web Host 正在读取最近的会话快照。"}):E.length===0?i.jsx(Po,{icon:"spark",title:"准备好开始了",detail:"描述要构建、修复或调查的任务。Orion 会实时展示工具、文件变化与验证结果。"}):i.jsx("ol",{className:"timeline","aria-label":"会话记录",children:E.map(G=>i.jsx("li",{id:`conversation-item-${n.activeSessionId??"none"}-${rc(G)}`,"data-event-id":G.order,"data-order":G.order,ref:K=>D.registerItem(G.order,K),children:cv(G,n)},rc(G)))}):i.jsx(Po,{icon:"workspace",title:"选择或创建一个会话",detail:"Orion 会在当前工作区运行,并沿用 CLI/TUI 的权限与持久化状态。",action:"创建会话",onAction:a}),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(Zg,{model:b,activeOrder:D.activeOrder,span:D.span,hasEarlierHistory:w.length>E.length||Ce,processing:n.processing,reduceMotion:Se,onJumpToOrder:(G,K)=>D.scrollToOrder(G,K),onJumpToLatest:J})]}),!ie&&E.length>0?i.jsxs("button",{type:"button",className:"jump-latest",onClick:J,children:[i.jsx(X,{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(gv,{state:n,actions:r}):null,n.queue.items.length>0?i.jsx(vv,{state:n,actions:r}):null]}):null,i.jsx(Sg,{state:n,actions:r,insertion:d})]})]})}function ov(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 rc(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 lv(n){const r=n.order,o=rc(n);if(n.kind==="tool")return{order:r,key:o,kind:"tool",label:ti(n.value.summary)||n.value.name,preview:is(n.value.summary),priority:n.value.state==="error"?"error":"activity"};if(n.kind==="edit")return{order:r,key:o,kind:"edit",label:n.value.request.path,preview:is(`${n.value.request.path}
|
|
20
|
+
${n.value.request.newString??""}`),priority:"activity"};if(n.kind==="subtask")return{order:r,key:o,kind:"subtask",label:ti(n.value.objective)||n.value.role,preview:is(n.value.summary||n.value.objective),priority:av.has(n.value.state)?"error":"activity"};if(n.kind==="research")return{order:r,key:o,kind:"research",label:ti(n.value.objective)||"Research",preview:is(n.value.conclusion||n.value.objective),priority:n.value.stage==="failed"?"error":"activity"};const a=n.value;if(a.toolActivity){const g=a.toolActivity;return{order:r,key:o,kind:"tool",label:ti(g.summary)||g.name||g.detail||"工具活动",preview:is(g.summary||g.body),priority:g.state==="error"?"error":"activity"}}const d=a.role;let f;return d==="user"||d==="assistant"?f="turn":f=d==="error"||d==="command"&&a.command?.success===!1?"error":"activity",(a.errorLayer||a.budgetStop)&&(f="error"),{order:r,key:o,kind:d==="user"?"user":d==="assistant"?"assistant":"system",priority:f,label:ti(a.content)||a.title||(d==="user"?"用户任务":d==="assistant"?"Orion 回复":sc(d)),preview:is(a.content)}}const av=new Set(["failed","timed_out","rejected","cancelled"]);function ti(n){if(!n)return null;const r=n.replace(/\s+/gu," ").trim();return r.length>80?`${r.slice(0,80)}…`:r}function is(n){if(!n)return;const r=n.trim();if(r)return r.length<=280?r:`${r.slice(0,280)}…`}function cv(n,r){if(n.kind==="transcript")return i.jsx(uv,{entry:n.value});if(n.kind==="tool"){const o=r.transcript.find(a=>a.toolActivity?.callId===n.value.callId)?.toolActivity;return i.jsx(dv,{tool:n.value,activity:o})}return n.kind==="edit"?i.jsx(pv,{edit:n.value}):n.kind==="subtask"?i.jsx(hv,{subtask:n.value}):i.jsx(mv,{research:n.value})}function uv({entry:n}){if(n.toolActivity)return i.jsx(fv,{entry:n});if(xv(n))return i.jsxs("details",{className:"reasoning-card",children:[i.jsxs("summary",{children:[i.jsx(dc,{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(li,{children:n.content})]});const r=n.role;return i.jsxs("article",{className:`message-card role-${r}`,"aria-label":sc(r),children:[i.jsxs("header",{children:[i.jsx("span",{className:"message-avatar","aria-hidden":"true",children:wv(r)}),i.jsx("span",{children:n.title||sc(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(li,{children:n.content})}),n.budgetStop?i.jsxs("div",{className:"budget-stop",role:"status",children:[i.jsx(X,{name:"pause",size:15}),i.jsxs("span",{children:[n.budgetStop.reason," · 状态已保留"]})]}):null]})}function dv({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(X,{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?` · ${rp(n.duration)}`:""]})]}),n.outputBytes!==void 0?i.jsx("span",{className:"byte-pill",children:ic(n.outputBytes)}):null]}),n.summary||n.error?i.jsx("p",{className:n.error?"tool-error-copy":"tool-summary",children:Pn(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:uc(n.args)})]}),a?i.jsxs("div",{className:"tool-detail-section",children:[i.jsx("span",{className:"micro-label",children:"输出预览"}),i.jsx(np,{text:a,defaultOpen:n.state==="error",note:r?.outputView?.omittedBytes?`另有 ${ic(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})]})}function fv({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(X,{name:"terminal",size:15})}),i.jsxs("div",{className:"tool-title",children:[i.jsx("strong",{children:r.name}),i.jsx("span",{children:r.detail})]})]}),r.summary?i.jsx("p",{className:"tool-summary",children:r.summary}):null,r.outputView?.preview||r.body?i.jsxs("div",{className:"tool-detail-section tool-output-section",children:[i.jsx("span",{className:"micro-label",children:"输出"}),i.jsx(np,{text:r.outputView?.preview||r.body,defaultOpen:r.state==="error",note:r.outputView?.omittedBytes?`另有 ${ic(r.outputView.omittedBytes)} 已折叠,可在 Inspector 中查看产物。`:null})]}):null]})}function pv({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(X,{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:Pn(r.newString)})]})]})}function hv({subtask:n}){return i.jsxs("details",{className:`activity-card subtask-card state-${n.state}`,children:[i.jsxs("summary",{children:[i.jsx(X,{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:rp(n.durationMs)}):null]}),i.jsx("p",{children:n.objective}),n.summary?i.jsx(li,{children:n.summary}):null]})}function mv({research:n}){return i.jsxs("details",{className:`activity-card research-card state-${n.stage}`,children:[i.jsxs("summary",{children:[i.jsx(X,{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(li,{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(dc,{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 gv({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"||!Pr(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(X,{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:uc(o.args,6e3)})]}),i.jsxs("div",{className:"approval-actions",children:[i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>En(r.answerPermission(!1)),disabled:f,children:"拒绝"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>En(r.answerPermission(!0,"once")),disabled:f,children:"仅本次"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>En(r.answerPermission(!0,"project")),disabled:f,children:"允许此项目"}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>En(r.answerPermission(!0,"global")),disabled:f,children:"始终允许"})]}),i.jsx("p",{className:"approval-footnote",children:"项目与全局授权会写入 Orion 配置;拒绝不会丢失当前会话。"})]})}function vv({state:n,actions:r}){const o=!!n.pendingAction||n.connection!=="live"||!Pr(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(yv,{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:()=>En(r.clearQueue()),disabled:o,children:"清空队列"})]})]})}function yv({item:n,index:r,count:o,disabled:a,actions:d}){const[f,p]=m.useState(!1),[g,x]=m.useState(n.text);m.useEffect(()=>x(n.text),[n.text]);const w=async()=>{const R=g.trim();R&&(await d.editQueued(n.id,n.revision,R),p(!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:R=>x(R.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:()=>En(d.moveQueued(n.id,n.revision,r-1)),disabled:a||r===0,children:i.jsx(X,{name:"arrow-up",size:13})}),i.jsx("button",{type:"button",className:"icon-button queue-move-down","aria-label":`下移排队消息 ${r+1}`,onClick:()=>En(d.moveQueued(n.id,n.revision,r+1)),disabled:a||r===o-1,children:i.jsx(X,{name:"arrow-up",size:13})}),f?i.jsx("button",{type:"button",className:"text-button",onClick:()=>En(w()),disabled:a||!g.trim(),children:"保存"}):i.jsx("button",{type:"button",className:"text-button",onClick:()=>p(!0),disabled:a,children:"编辑"}),i.jsx("button",{type:"button",className:"icon-button","aria-label":`移除排队消息 ${r+1}`,onClick:()=>En(d.removeQueued(n.id,n.revision)),disabled:a,children:i.jsx(X,{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(X,{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 xv(n){const r=`${n.title??""}`.toLocaleLowerCase();return r.includes("reason")||r.includes("think")||r.includes("analysis")||r.includes("推理")||r.includes("思考")}function sc(n){return n==="user"?"你":n==="assistant"?"Orion":n==="command"?"命令":n==="error"?"错误":n==="system"?"系统":n==="status"?"状态":"工具"}function wv(n){return n==="user"?"Y":n==="assistant"?"O":n==="error"?"!":n==="command"?"›":"·"}function En(n){n.catch(()=>{})}function rp(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 ic(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}const kv=.02,jv=.1;function us(n,r,o){const a=Number.isFinite(n)?Math.round(n):r;return Math.min(o,Math.max(r,a))}function Sv({side:n,clientX:r,bounds:o,minWidth:a,maxWidth:d}){const f=n==="left"?r-o.left:o.right-r;return us(f,a,d)}function Cv(n,r,o){const a=o-r;if(a<=0)return 0;const d=(us(n,r,o)-r)/a;return Math.round(d*100)}function bv(n){const{key:r,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:f,side:p}=n,g=C=>us(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 x=n.shiftKey?jv:kv,w=Math.max(1,Math.round((a-o)*x)),R=(r==="ArrowRight"?1:-1)*(p==="left"?1:-1);return g(f+R*w)}function sp({side:n,className:r,minWidth:o,maxWidth:a,defaultWidth:d,label:f,width:p,controls:g,boundsRef:x,resizingScope:w="workbench",onPreview:R,onCommit:C}){const E=m.useRef(us(p??d,o,a)),_=m.useRef(null),A=m.useRef(null),L=m.useRef(null),z=()=>{L.current!==null&&cancelAnimationFrame(L.current),L.current=null},ie=()=>{_.current=null,A.current=null,z(),delete document.documentElement.dataset.panelResizing};m.useEffect(()=>ie,[]),m.useEffect(()=>{p===void 0||_.current!==null||(E.current=us(p,o,a))},[p,o,a]);const F=J=>{E.current=J,A.current=J,L.current===null&&(L.current=requestAnimationFrame(()=>{L.current=null;const G=A.current;A.current=null,G!==null&&R(G)}))},Se=J=>{let G;if(x?.current){const K=x.current.getBoundingClientRect();G={left:K.left,right:K.right}}else G=J.currentTarget.closest(".workbench-shell")?.getBoundingClientRect()??{left:0,right:window.innerWidth};return Sv({side:n,clientX:J.clientX,bounds:G,minWidth:o,maxWidth:a})},se=J=>{if(J.button!==0||_.current!==null)return;J.preventDefault(),_.current=J.pointerId,J.currentTarget.setPointerCapture(J.pointerId);const G=w==="resource-split"?"resource-split":n;document.documentElement.dataset.panelResizing=G,F(Se(J))},re=J=>{_.current===J.pointerId&&F(Se(J))},b=J=>{if(_.current!==J.pointerId)return;J.currentTarget.hasPointerCapture(J.pointerId)&&J.currentTarget.releasePointerCapture(J.pointerId);const G=A.current??E.current;ie(),R(G),C(G)},D=J=>{if(_.current!==J.pointerId)return;const G=A.current??E.current;ie(),R(G),C(G)},te=J=>{E.current=J,R(J),C(J)},Ce=J=>{const G=bv({key:J.key,shiftKey:J.shiftKey,minWidth:o,maxWidth:a,defaultWidth:d,currentWidth:E.current,side:n});G!==null&&(J.preventDefault(),te(G))},xe=Cv(E.current,o,a);return i.jsx("div",{className:`panel-resize-handle panel-resize-handle-${n}${r?` ${r}`:""}`,role:"separator","aria-orientation":"vertical","aria-label":f,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":xe,"aria-valuetext":`${E.current} 像素`,"aria-controls":g,tabIndex:0,title:`${f};方向键调整,Shift 加速,Enter 恢复默认,双击亦可恢复`,onPointerDown:se,onPointerMove:re,onPointerUp:b,onPointerCancel:b,onLostPointerCapture:D,onKeyDown:Ce,onDoubleClick:()=>te(us(d,o,a)),children:i.jsx("span",{})})}const Nv=["ArrowDown","ArrowUp","Home","End","Escape"];function Iv({label:n,items:r,disabled:o=!1}){const[a,d]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),g=m.useRef([]),x=m.useId(),w=()=>{d(!1),p.current?.focus()};m.useEffect(()=>{if(!a)return;const C=E=>{f.current?.contains(E.target)||d(!1)};return document.addEventListener("pointerdown",C),()=>document.removeEventListener("pointerdown",C)},[a]),m.useEffect(()=>{if(!a)return;const C=r.findIndex(E=>!E.disabled);g.current[C>=0?C:0]?.focus()},[a]);const R=C=>{if(!Nv.includes(C.key))return;if(C.preventDefault(),C.key==="Escape"){w();return}const E=r.map((L,z)=>({item:L,index:z})).filter(L=>!L.item.disabled);if(!E.length)return;const _=E.findIndex(L=>g.current[L.index]===document.activeElement);let A=0;if(C.key==="Home")A=0;else if(C.key==="End")A=E.length-1;else{const L=C.key==="ArrowDown"?1:-1;A=_<0?0:(_+L+E.length)%E.length}g.current[E[A].index]?.focus()};return i.jsxs("div",{className:"session-row-menu",ref:f,children:[i.jsx("button",{ref:p,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(X,{name:"more",size:15})}),a?i.jsx("div",{className:"session-menu",role:"menu","aria-label":n,onKeyDown:R,children:r.map((C,E)=>i.jsxs("button",{ref:_=>{g.current[E]=_},type:"button",role:"menuitem",className:`session-menu-item${C.danger?" danger":""}`,tabIndex:-1,disabled:C.disabled,"aria-describedby":C.hint?`${x}-${C.id}`:void 0,onClick:()=>{d(!1),C.onSelect()},children:[C.label,C.hint?i.jsx("span",{id:`${x}-${C.id}`,className:"session-menu-hint",children:C.hint}):null]},C.id))}):null]})}const hc=240,Zo=280,ip=480,lf=48,mc=320,gc=420,op=3200,Ge=48,af=560,lp="orion.web.workbench-layout.v2",_v="orion.web.work-panel.v1",oc=["agent","review","terminal","files","git"],Er=Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({expanded:!0,widthPx:Zo}),workPanel:Object.freeze({expanded:!0,widthPx:gc,activePanel:"agent",agentPanel:"goal"})});function Ro(n,r){const o=Ov(n),a=ap(r.projectNavigation.widthPx),d=ci(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 w=o-af,C=r.projectNavigation.expanded&&w>=hc?"dock":r.projectNavigation.expanded?"drawer":"rail",E=C==="dock"?Math.min(a,w):C==="rail"?lf:0;return Object.freeze({projectNavigation:Object.freeze({mode:C,widthPx:E}),conversationWidthPx:Math.max(0,o-E),workPanel:Object.freeze({mode:"drawer",widthPx:0})})}const f=r.projectNavigation.expanded?a:lf,p=o-f-af,g=r.workPanel.expanded&&p>=mc,x=g?Math.min(d,p):Ge;return Object.freeze({projectNavigation:Object.freeze({mode:r.projectNavigation.expanded?"dock":"rail",widthPx:f}),conversationWidthPx:Math.max(0,o-f-x),workPanel:Object.freeze({mode:g?"dock":"rail",widthPx:x})})}function ap(n){const r=Number.isFinite(n)?Math.round(n):Zo;return Math.min(ip,Math.max(hc,r))}function ci(n){const r=Number.isFinite(n)?Math.round(n):gc;return Math.min(op,Math.max(mc,r))}function Ev(n,r=null){if(!n)return Tv(r);try{const o=JSON.parse(n);if(!Ao(o)||o.schemaVersion!==2)return Er;const a=Ao(o.projectNavigation)?o.projectNavigation:{},d=Ao(o.workPanel)?o.workPanel:{};return cp({schemaVersion:2,projectNavigation:{expanded:typeof a.expanded=="boolean"?a.expanded:!0,widthPx:ap(Number(a.widthPx))},workPanel:{expanded:typeof d.expanded=="boolean"?d.expanded:!0,widthPx:ci(Number(d.widthPx)),activePanel:ui(d.activePanel)?d.activePanel:"agent",agentPanel:dp(d.agentPanel)?d.agentPanel:"goal",order:Mv(d.order)}})}catch{return Er}}function Pv(){const n=up();if(!n)return Er;try{return Ev(n.localStorage.getItem(lp),n.localStorage.getItem(_v))}catch{return Er}}function Rv(n){const r=up();if(r)try{r.localStorage.setItem(lp,JSON.stringify(n))}catch{}}function Tv(n){if(!n)return Er;try{const r=JSON.parse(n);return!Ao(r)||r.schemaVersion!==1?Er:cp({schemaVersion:2,projectNavigation:{expanded:!0,widthPx:Zo},workPanel:{expanded:typeof r.expanded=="boolean"?r.expanded:!0,widthPx:ci(Number(r.widthPx)),activePanel:ui(r.activePanel)?r.activePanel:"agent",agentPanel:dp(r.agentPanel)?r.agentPanel:"goal"}})}catch{return Er}}function cp(n){return Object.freeze({schemaVersion:2,projectNavigation:Object.freeze({...n.projectNavigation}),workPanel:Object.freeze({...n.workPanel})})}function Ov(n){return!Number.isFinite(n)||n<=0?1440:Math.max(320,Math.round(n))}function up(){return globalThis.window??null}function Mv(n){if(!Array.isArray(n)||n.length!==oc.length)return;const r=new Set;for(const o of n){if(!ui(o)||r.has(o))return;r.add(o)}return Object.freeze([...n])}function ui(n){return["agent","review","terminal","files","git"].includes(String(n))}function dp(n){return["goal","activity","integrations","diagnostics"].includes(String(n))}function Ao(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function fp({size:n=20,className:r,pixel:o=!1}){const a=m.useId(),d=`orion-bar-a-${a}`,f=`orion-bar-b-${a}`,p=`orion-bar-c-${a}`;return i.jsx("span",{className:r?`orion-brand-mark ${o?"orion-brand-mark-pixel ":""}${r}`:`orion-brand-mark${o?" orion-brand-mark-pixel":""}`,"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",shapeRendering:o?"crispEdges":void 0,children:[i.jsxs("defs",{children:[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.jsxs("linearGradient",{id:p,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"})]})]}),o?[{x:2,y:9,h:9},{x:8,y:4,h:14},{x:14,y:7,h:11}].map(g=>i.jsxs(m.Fragment,{children:[i.jsx("rect",{x:g.x,y:g.y,width:"4",height:Math.max(1,g.h-1),rx:0,style:{fill:"var(--accent)"}}),g.h>1?i.jsx("rect",{x:g.x,y:g.y+g.h-1,width:"4",height:"1",rx:0,style:{fill:"var(--accent-2)"}}):null]},g.x)):i.jsxs(i.Fragment,{children:[i.jsx("rect",{className:"orion-mark-bar",x:"2",y:"9",width:"4",height:"9",rx:2,fill:`url(#${d})`}),i.jsx("rect",{className:"orion-mark-bar",x:"8",y:"4",width:"4",height:"14",rx:2,fill:`url(#${f})`}),i.jsx("rect",{className:"orion-mark-bar",x:"14",y:"7",width:"4",height:"11",rx:2,fill:`url(#${p})`})]})]})})}const $o=5,cf=7,lc=1,Lv=Object.freeze({c:[".....",".....",".###.","#....","#....","#....",".###."],d:["....#","....#",".####","#...#","#...#","#...#",".####"],e:[".....",".....",".###.","#...#","#####","#....",".###."],i:["..#..",".....","..#..","..#..","..#..","..#..","..#.."],n:[".....",".....","#.##.","##..#","#...#","#...#","#...#"],o:[".....",".....",".###.","#...#","#...#","#...#",".###."],r:[".....",".....","#.##.","##..#","#....","#....","#...."],"-":[".....",".....",".....",".###.",".....",".....","....."]});function Av(n){const r=[];let o=0;for(const a of n.toLocaleLowerCase()){const d=Lv[a];d&&d.forEach((f,p)=>{let g=-1;for(let x=0;x<=$o;x+=1){const w=x<$o&&f[x]==="#";w&&g<0?g=x:!w&&g>=0&&(r.push({x:o+g,y:p,w:x-g}),g=-1)}}),o+=$o+lc}return r}function $v({text:n,scale:r=2,className:o}){const a=m.useMemo(()=>Av(n),[n]),d=n.length*($o+lc)-lc;return a.length?i.jsx("svg",{className:o?`pixel-wordmark ${o}`:"pixel-wordmark",viewBox:`0 0 ${d} ${cf}`,width:d*r,height:cf*r,shapeRendering:"crispEdges",role:"img","aria-label":n,children:a.map(f=>i.jsx("rect",{x:f.x,y:f.y,width:f.w,height:1,style:{fill:"var(--text)"}},`${f.x}-${f.y}`))}):null}const br=40;function Dv({state:n,drawerOpen:r,dockVisible:o,collapsed:a,resizable:d,width:f,onExpand:p,onCollapse:g,onOpenWorkspaceDialog:x,onOpenSettings:w,onLoadMoreWorkspaces:R,onCreateSession:C,onLoadWorkspaceSessions:E,onActivateContext:_,onSetPinned:A,onRemoveWorkspace:L,onRefreshSummary:z,onRenameSession:ie,onSessionTags:F,onArchiveSession:Se,onDeleteSession:se,onRestoreSession:re,onWidthPreview:b,onWidthCommit:D}){const[te,Ce]=m.useState(""),[xe,J]=m.useState(0),[G,K]=m.useState(new Set(n.workspaceId?[n.workspaceId]:[])),be=m.useDeferredValue(te.trim().toLocaleLowerCase()),$=!!n.pendingAction,fe=$||n.processing;m.useEffect(()=>{n.workspaceId&&K(v=>new Set([...v,n.workspaceId]))},[n.workspaceId]),m.useEffect(()=>J(0),[be]);const V=m.useMemo(()=>{const v=[...n.workspaces].sort(zv);return be?v.filter(O=>df(O,be)?!0:(n.workspaceSessions[O.id]?.items??[]).some(ce=>[ce.name,ce.taskSummary,ce.id].filter(pe=>!!pe).some(pe=>pe.toLocaleLowerCase().includes(be)))):v},[be,n.workspaceSessions,n.workspaces]);m.useEffect(()=>{const v=V.findIndex(O=>O.id===n.workspaceId);v<0||J(O=>v<O||v>=O+br?Math.floor(v/br)*br:O)},[V,n.workspaceId]);const W=V.slice(xe,xe+br),ne=!!(be&&(n.workspaceNextCursor||Object.values(n.workspaceSessions).some(v=>!!v.nextCursor))),q=v=>{const O=new Set(G);O.has(v.id)?O.delete(v.id):(O.add(v.id),n.workspaceSessions[v.id]?z(v.id):E(v.id)),K(O)};if(a&&!r){const v=n.workspaces.find(O=>O.id===n.workspaceId);return i.jsxs("aside",{id:"workspace-rail",className:"workspace-rail project-navigator project-navigator-collapsed","aria-label":"项目与会话",hidden:!o,children:[i.jsx("div",{className:"project-rail-brand","aria-hidden":"true",children:i.jsx(fp,{size:22})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"展开项目导航",title:"展开项目导航(⌘/Ctrl+B)",onClick:p,children:i.jsx(X,{name:"sidebar",size:17})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action","aria-label":"新建会话",title:"新建会话",onClick:C,disabled:$||!n.workspaceId,children:i.jsx(X,{name:"add",size:18})}),i.jsx("button",{type:"button",className:"icon-button project-rail-action project-rail-workspace","aria-label":v?`打开项目 ${v.label}`:"打开项目导航",title:v?.label??"打开项目导航",onClick:p,children:i.jsx(X,{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:w,children:i.jsx(X,{name:"settings",size:17})}),i.jsx("span",{className:`connection-dot project-rail-connection ${n.connection}`,"aria-label":Ka(n.connection),title:Ka(n.connection)})]})}return i.jsxs("aside",{id:"workspace-rail",className:`workspace-rail project-navigator ${r?"drawer-open":""}`,"aria-label":"项目与会话",hidden:!o,children:[i.jsxs("div",{className:"project-toolbar",children:[i.jsxs("div",{className:"project-toolbar-brand",children:[i.jsx($v,{text:"orion-code",scale:2}),i.jsx("h2",{className:"sr-only",children:"项目"})]}),i.jsxs("div",{className:"project-toolbar-actions",children:[i.jsx("button",{type:"button",className:"icon-button drawer-close","aria-label":"关闭项目导航",onClick:g,children:i.jsx(X,{name:"close"})}),i.jsx("button",{type:"button",className:"icon-button","aria-label":"收起项目导航",title:"收起项目导航(⌘/Ctrl+B)",onClick:g,children:i.jsx(X,{name:"chevron-left"})}),i.jsx("button",{type:"button",className:"icon-button","aria-label":"选择其他工作区",title:"打开其他项目",onClick:x,disabled:fe,children:i.jsx(X,{name:"add"})})]})]}),i.jsxs("label",{className:"project-search",children:[i.jsx("span",{className:"sr-only",children:"搜索项目和会话"}),i.jsx(X,{name:"search",size:15}),i.jsx("input",{type:"search",value:te,onChange:v=>Ce(v.target.value),placeholder:"搜索项目和会话"}),te?i.jsx("button",{type:"button","aria-label":"清除搜索",onClick:()=>Ce(""),children:i.jsx(X,{name:"close",size:13})}):null]}),i.jsxs("nav",{className:"project-tree","aria-label":"已知项目","aria-description":ne?"搜索仅覆盖已加载的项目和会话;仍有分页内容未加载。":void 0,children:[W.map((v,O)=>{const ce=xe+O,pe=V[ce-1],ye=G.has(v.id)||!!be,Z=n.workspaceSessions[v.id],he=n.workspaceProjectSummaries[v.id],je=df(v,be)?Z?.items??[]:Wv(Z?.items??[],be);return i.jsxs(m.Fragment,{children:[ce===0||pe?.pinnedOrder!==void 0&&v.pinnedOrder===void 0?i.jsx("h3",{className:"project-group-heading",role:"presentation",children:v.pinnedOrder===void 0?"RECENT":"PINNED"}):null,i.jsxs("section",{className:`project-node ${v.active?"active":""} ${v.available?"":"unavailable"}`,children:[i.jsxs("div",{className:"project-row",children:[i.jsxs("button",{id:`project-${v.id}`,type:"button",className:"project-toggle","aria-expanded":ye,"aria-controls":`project-${v.id}-sessions`,"aria-current":v.active?"page":void 0,onClick:()=>q(v),onKeyDown:le=>{if(le.key==="ArrowRight"){le.preventDefault(),ye?le.currentTarget.closest(".project-node")?.querySelector(".project-session-main")?.focus():q(v);return}if(le.key==="ArrowLeft"&&ye){le.preventDefault(),q(v);return}uf(le)},children:[i.jsx(X,{name:"chevron",size:13}),i.jsx("span",{className:"workspace-icon",children:i.jsx(X,{name:"workspace",size:15})}),i.jsxs("span",{className:"project-copy",children:[i.jsx("strong",{children:v.label}),i.jsx("span",{title:v.path,children:he?`${he.detached?he.head||"detached":he.branch||"Git"} · ${he.dirtyCount?`M${he.dirtyCount}`:"clean"}`:Fv(v.path)})]})]}),i.jsx("button",{type:"button",className:"icon-button project-pin","aria-label":`${v.pinnedOrder===void 0?"置顶":"取消置顶"}项目 ${v.label}`,"aria-pressed":v.pinnedOrder!==void 0,onClick:()=>A(v.id,v.pinnedOrder===void 0),disabled:$,children:i.jsx("span",{"aria-hidden":"true",children:v.pinnedOrder===void 0?"○":"●"})}),!v.available&&!v.active?i.jsx("button",{type:"button",className:"icon-button project-remove","aria-label":`移除不可用项目 ${v.label}`,onClick:()=>L(v.id),disabled:$,children:i.jsx(X,{name:"close",size:13})}):i.jsx("button",{type:"button",className:"icon-button project-add-session","aria-label":`在 ${v.label} 新建会话`,disabled:$||!v.available||!v.active,onClick:C,title:v.active?"新建会话":"先激活项目后新建会话",children:i.jsx(X,{name:"add",size:14})})]}),ye?i.jsxs(m.Fragment,{children:[i.jsxs("div",{id:`project-${v.id}-sessions`,className:"project-sessions",role:"list","aria-label":`${v.label} 的会话`,children:[Z?.status==="loading"&&!Z.items.length?i.jsx("p",{className:"project-loading",role:"listitem",children:"正在加载会话…"}):null,Z?.status==="error"?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-load-error",onClick:()=>E(v.id),children:"加载失败,重试"})}):null,je.map(le=>{const Te=v.active&&le.id===n.activeSessionId,Qe=n.sessionRuntimeById[le.id],Je=qv(Qe),It=!v.active&&fe,lt=Hv(Qe?.phase),Lt=le.tags??[];return i.jsxs("div",{className:`project-session-row ${Te?"active":""}`,role:"listitem",children:[i.jsxs("button",{type:"button",className:"project-session-main","aria-current":Te?"page":void 0,"aria-disabled":Te||It||!v.available,onClick:()=>{Te||_(v.id,le.id)},disabled:It||!v.available,onKeyDown:vt=>{if(vt.key==="ArrowLeft"){vt.preventDefault(),document.getElementById(`project-${v.id}`)?.focus();return}uf(vt)},children:[i.jsx("span",{className:`session-state ${Je.tone}`,"aria-hidden":"true"}),i.jsxs("span",{children:[i.jsx("strong",{children:ds(le)}),i.jsxs("small",{children:[ff(le.updatedAt)," · ",le.messageCount," 条"]}),Lt.length>0?i.jsxs("small",{className:"project-session-tags","aria-label":"会话标签",children:[Lt.slice(0,3).map(vt=>i.jsx("span",{className:"session-tag-badge",children:vt},vt)),Lt.length>3?i.jsxs("span",{className:"session-tag-more",children:["+",Lt.length-3]}):null]}):null,Je.label?i.jsx("small",{className:"project-session-status",children:Je.label}):null]})]}),v.active?i.jsx(Iv,{label:`会话 ${ds(le)} 操作`,disabled:$,items:[{id:"rename",label:"重命名…",onSelect:()=>ie(le)},{id:"tags",label:"管理标签…",onSelect:()=>F(le)},{id:"archive",label:"归档",disabled:lt,hint:lt?"会话运行中":void 0,onSelect:()=>Se(le)},{id:"delete",label:"删除…",danger:!0,disabled:lt,hint:lt?"会话运行中":void 0,onSelect:()=>se(le)}]}):null]},le.id)}),Z?.status==="ready"&&!je.length?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"project-empty-session",disabled:fe||!v.available,onClick:()=>_(v.id,null),children:be?"没有匹配会话":"打开项目"})}):null,Z?.nextCursor?i.jsx("div",{role:"listitem",children:i.jsx("button",{type:"button",className:"text-button project-load-more",onClick:()=>E(v.id,!0),children:"加载更多会话"})}):null]}),v.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(le=>i.jsxs("div",{className:"archived-row",role:"listitem",children:[i.jsxs("span",{className:"archived-copy",children:[i.jsx("strong",{children:ds(le)}),i.jsx("small",{children:ff(le.updatedAt)})]}),i.jsx("button",{type:"button",className:"text-button",disabled:$,onClick:()=>re(le),children:"还原"}),i.jsx("button",{type:"button",className:"text-button archived-delete",disabled:$,onClick:()=>se(le),children:"删除"})]},le.id))})]}):null]}):null]})]},v.id)}),V.length?null:i.jsxs("div",{className:"empty-rail",children:[i.jsx(X,{name:"search"}),i.jsx("p",{children:"没有匹配的项目或会话"})]}),xe>0?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>J(v=>Math.max(0,v-br)),children:"上一批项目"}):null,xe+br<V.length?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:()=>J(v=>v+br),children:"下一批项目"}):n.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button project-window-more",onClick:R,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:Bv(n.connection),children:Ka(n.connection)}),i.jsx("button",{type:"button",className:"icon-button rail-settings","aria-label":"打开设置",onClick:w,children:i.jsx(X,{name:"settings",size:14})}),n.bootstrap?.productVersion?i.jsxs("span",{className:"version",children:["v",n.bootstrap.productVersion]}):null]}),d?i.jsx(sp,{side:"left",minWidth:hc,maxWidth:ip,defaultWidth:Zo,label:"拖动或按方向键调整项目导航宽度",width:f,controls:"workspace-rail",onPreview:b,onCommit:D}):null]})}function uf(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 zv(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 df(n,r){return!!(r&&(n.label.toLocaleLowerCase().includes(r)||n.path.toLocaleLowerCase().includes(r)))}function Wv(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 ds(n){return n.name||n.taskSummary||`会话 ${n.id.slice(0,8)}`}function pp(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function Fv(n){return n.length<=31?n:`…${n.slice(-30)}`}function ff(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 Ka(n){return n==="live"?"已连接":n==="offline"?"离线":n==="replay-required"?"事件流需恢复":n==="closed"?"已关闭":n==="connecting"?"正在连接…":"正在重连…"}function Bv(n){return n==="live"?"本地 Web Host 已连接":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重连本地 Web Host"}function qv(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 Uv=new Set(["starting","queued","running","waiting_approval","stopping"]);function Hv(n){return n?Uv.has(n):!1}const Vv={available:"可用",missing:"目录不存在",not_directory:"不是文件夹",unreadable:"无法读取"},pf=["prepare","runtime","session"],Kv={prepare:"准备项目",runtime:"加载本地 Runtime",session:"恢复会话(如有)"};function Gv({candidate:n,busy:r,stage:o="prepare",error:a,onCancel:d,onOpen:f}){const p=n.availability==="available"&&!n.isActive,g=n.isActive?"当前项目":n.availability!=="available"?"不可打开":r?"正在打开…":"打开项目",x=pf.indexOf(o);return i.jsxs("section",{className:"workspace-confirm","aria-label":"已选择本地项目",children:[i.jsxs("header",{className:"workspace-confirm-head",children:[i.jsx("span",{className:"workspace-confirm-name",title:n.canonicalPath,children:n.label}),i.jsxs("span",{className:"workspace-confirm-meta",children:[n.kind==="git"?"Git 项目":"本地文件夹"," ·"," ",Vv[n.availability],typeof n.sessionCount=="number"?` · ${n.sessionCount} 个会话`:n.sessionCountStatus==="deferred"?" · 会话数读取中":""]})]}),i.jsx("p",{className:"workspace-confirm-path",children:n.canonicalPath}),i.jsx("p",{className:"workspace-confirm-note",children:"已解析真实路径;此操作不会读取目录外的文件。"}),r?i.jsx("ol",{className:"workspace-confirm-stages","aria-label":"打开进度",children:pf.map((w,R)=>i.jsx("li",{className:"workspace-confirm-stage","aria-current":w===o?"step":void 0,"data-state":R<x?"done":R===x?"current":"todo",children:Kv[w]},w))}):null,a?i.jsx("p",{className:"field-error",role:"alert",children:a}):null,i.jsxs("footer",{className:"workspace-confirm-actions",children:[i.jsx("button",{type:"button",className:"text-button",onClick:d,disabled:r,children:"取消"}),i.jsx("button",{type:"button",className:"primary-button",onClick:f,disabled:r||!p,"aria-busy":r,children:g})]})]})}const hp=Object.freeze({phase:"browse",candidate:null,pendingPath:null,error:null,pickerReturned:!1});function Qv(n,r){switch(r.type){case"picker-started":return{...n,phase:"picker-pending",error:null,pickerReturned:!1};case"picker-cancelled":return{...n,phase:"browse",error:null,pendingPath:null,pickerReturned:!0};case"picker-unavailable":return{...n,phase:"browse",error:r.reason,pendingPath:null,pickerReturned:!0};case"inspect-started":return{...n,phase:"inspect-pending",pendingPath:r.path,candidate:null,error:null,pickerReturned:!1};case"inspect-succeeded":return{...n,phase:"confirm",candidate:r.candidate,pendingPath:null,error:null};case"activate-started":return n.phase!=="confirm"||!n.candidate?n:{...n,phase:"activate-pending",error:null};case"failed":return{...n,phase:n.candidate?"confirm":"browse",error:r.message,pendingPath:null};case"back-to-browse":return{...n,phase:"browse",candidate:null,pendingPath:null,error:null};case"reset":return hp;default:return n}}function Yv(n){return n.phase==="picker-pending"||n.phase==="inspect-pending"||n.phase==="activate-pending"}function di({open:n,onClose:r,labelledBy:o,describedBy:a,className:d="",children:f}){const p=m.useRef(null);m.useEffect(()=>{const x=p.current;x&&(n&&!x.open&&x.showModal(),!n&&x.open&&x.close())},[n]);const g=x=>{x.target===x.currentTarget&&r()};return i.jsx("dialog",{ref:p,className:`modal ${d}`.trim(),"aria-labelledby":o,"aria-describedby":a,onCancel:x=>{x.preventDefault(),r()},onClose:r,onClick:g,children:f})}function Xv({open:n,onClose:r,state:o,onSelect:a,onLoadMore:d,onPickDirectory:f,onInspect:p}){const[g,x]=m.useState(""),[w,R]=m.useState(!1),[C,E]=m.useState(""),[_,A]=m.useReducer(Qv,hp);m.useEffect(()=>{n&&(x(""),R(!1),E(""),A({type:"reset"}))},[n]);const L=Yv(_),z=!!o.pendingAction||L,F=_.phase==="confirm"||_.phase==="activate-pending"?_.candidate:null,Se=C.trim().toLocaleLowerCase(),se=V=>!Se||V.label.toLocaleLowerCase().includes(Se)||V.path.toLocaleLowerCase().includes(Se),re=o.workspaces.filter(se),b=re.filter(V=>V.pinnedOrder!==void 0),D=re.filter(V=>V.pinnedOrder===void 0),te=3,Ce=w?D:D.slice(0,te),xe=D.length-Ce.length,J=b.length>0||D.length>0,G=async(V,W)=>{A({type:"inspect-started",path:V});try{const ne=await p(V);A({type:"inspect-succeeded",candidate:{...ne,source:W}})}catch(ne){A({type:"failed",message:ne instanceof Error?ne.message:"无法读取该目录。"})}},K=async()=>{A({type:"picker-started"});try{const V=await f();if(V.outcome==="cancelled"){A({type:"picker-cancelled"});return}if(V.outcome!=="selected"||!V.path){A({type:"picker-unavailable",reason:"系统目录选择器不可用,请在高级选项中粘贴绝对路径。"});return}await G(V.path,"picker")}catch(V){A({type:"picker-unavailable",reason:V instanceof Error?V.message:"无法打开系统目录选择器。"})}},be=async V=>{A({type:"activate-started"});try{await a(V.canonicalPath),r()}catch(W){A({type:"failed",message:W instanceof Error?W.message:"工作区切换失败。"})}},$=V=>{G(V.path,V.pinnedOrder!==void 0?"pinned":"recent")},fe=V=>{V.preventDefault();const W=g.trim();W&&G(W,"manual")};return i.jsxs(di,{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(X,{name:"close"})})]}),i.jsxs("div",{className:"workspace-picker",children:[i.jsxs("label",{className:"workspace-search",children:[i.jsx("span",{className:"sr-only",children:"搜索最近项目"}),i.jsx(X,{name:"search",size:15}),i.jsx("input",{type:"search",value:C,onChange:V=>E(V.target.value),placeholder:"搜索最近项目…",disabled:z})]}),i.jsxs("button",{type:"button",className:"workspace-pick-folder primary-button",onClick:()=>{K()},disabled:_.phase==="picker-pending"||z&&!L,"aria-busy":_.phase==="picker-pending",children:[i.jsx(X,{name:"workspace",size:16}),_.phase==="picker-pending"?"正在打开 Finder…":"从 Finder 选择文件夹…"]}),_.error?i.jsx("p",{className:"field-error",role:"alert",children:_.error}):null,_.phase==="inspect-pending"?i.jsxs("p",{className:"workspace-inspect-pending",role:"status",children:["正在解析 ",_.pendingPath,"…"]}):null]}),F?i.jsx(Gv,{candidate:F,busy:_.phase==="activate-pending",stage:_.phase==="activate-pending"?"runtime":"prepare",error:_.error,onCancel:()=>A({type:"back-to-browse"}),onOpen:()=>{be(F)}}):null,i.jsxs("div",{className:"workspace-options",role:"group","aria-label":"常用工作区",children:[b.length>0?i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"workspace-group-heading",children:"固定项目"}),b.map(V=>i.jsx(hf,{workspace:V,locked:z,onOpen:$},V.id))]}):null,D.length>0?i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"workspace-group-heading",children:b.length>0?"最近打开":"最近项目"}),Ce.map(V=>i.jsx(hf,{workspace:V,locked:z,onOpen:$},V.id))]}):null,J?null:i.jsx("p",{className:"workspace-empty",children:"没有匹配的项目。"}),xe>0||w&&D.length>te?i.jsx("button",{type:"button",className:"text-button workspace-toggle-all","aria-expanded":w,onClick:()=>R(V=>!V),children:w?"收起其他项目":`其他项目(${xe})`}):null,o.workspaceNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{d()},disabled:z,children:"加载更多工作区"}):null]}),i.jsxs("details",{className:"workspace-advanced",children:[i.jsx("summary",{children:"高级:粘贴绝对路径"}),i.jsxs("form",{className:"workspace-path-form",onSubmit:fe,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:g,onChange:V=>x(V.target.value),placeholder:"/Users/name/project",spellCheck:!1,autoComplete:"off"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!g.trim()||z,children:"打开"})]})]})]})]})}function hf({workspace:n,locked:r,onOpen:o}){return i.jsxs("button",{type:"button",className:`workspace-option ${n.active?"active":""}`,disabled:n.active||!n.available||r,onClick:()=>o(n),children:[i.jsx("span",{className:"workspace-icon",children:i.jsx(X,{name:"workspace",size:17})}),i.jsxs("span",{children:[i.jsx("strong",{children:n.label||pp(n.path)}),i.jsx("small",{title:n.path,children:n.path})]}),n.active?i.jsx("span",{className:"current-pill",children:"当前"}):n.available?i.jsx(X,{name:"chevron",size:15}):i.jsx("span",{className:"current-pill",children:"不可用"})]})}function Jv({open:n,onClose:r,session:o,pending:a,onRename:d}){const[f,p]=m.useState(""),[g,x]=m.useState(""),w=o?.id;m.useEffect(()=>{n&&o&&(p(ds(o)),x(""))},[n,w]);const R=async C=>{if(C.preventDefault(),!(!o||!f.trim())){x("");try{await d(o.id,f.trim()),r()}catch(E){x(E instanceof Error?E.message:"重命名失败,请重试。")}}};return i.jsx(di,{open:n,onClose:r,labelledBy:"rename-title",className:"rename-modal",children:i.jsxs("form",{onSubmit:R,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(X,{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=>{p(C.target.value),g&&x("")},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 mf=8;function Zv({open:n,onClose:r,session:o,pending:a,onSave:d}){const[f,p]=m.useState(()=>o?.tags?[...o.tags]:[]),[g,x]=m.useState(""),[w,R]=m.useState(""),C=o?.id;m.useEffect(()=>{n&&o&&(p(o.tags??[]),x(""),R(""))},[n,C]);const E=()=>{const L=g.trim().slice(0,32);if(x(""),!!L&&!f.includes(L)){if(f.length>=mf){R(`最多 ${mf} 个标签。`);return}p([...f,L]),R("")}},_=L=>p(f.filter(z=>z!==L)),A=async L=>{if(L.preventDefault(),!!o){R("");try{await d(o.id,f),r()}catch(z){R(z instanceof Error?z.message:"保存标签失败,请重试。")}}};return i.jsx(di,{open:n,onClose:r,labelledBy:"session-tags-title",className:"tags-modal",children:i.jsxs("form",{onSubmit:A,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(X,{name:"close"})})]}),i.jsxs("div",{className:"session-tags-body",children:[o?i.jsx("p",{className:"modal-description",children:ds(o)}):null,i.jsx("div",{className:"session-tags-chips",role:"list","aria-label":"当前标签",children:f.length===0?i.jsx("span",{className:"session-tags-empty",children:"还没有标签,输入后回车添加。"}):f.map(L=>i.jsxs("span",{className:"session-tag-chip",role:"listitem",children:[L,i.jsx("button",{type:"button",className:"icon-button session-tag-remove","aria-label":`移除标签 ${L}`,onClick:()=>_(L),children:i.jsx(X,{name:"close",size:11})})]},L))}),i.jsx("label",{htmlFor:"session-tag-input",children:"新标签"}),i.jsx("input",{id:"session-tag-input",value:g,onChange:L=>{x(L.target.value),w&&R("")},onKeyDown:L=>{(L.key==="Enter"||L.key===","||L.key===",")&&(L.preventDefault(),E())},placeholder:"回车或逗号添加",maxLength:32,autoFocus:!0}),w?i.jsx("p",{className:"field-error",role:"alert",children:w}):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 ey({open:n,onClose:r,title:o,body:a,confirmLabel:d,danger:f=!1,pending:p=!1,onConfirm:g}){const x=m.useId(),w=async()=>{if(!p)try{await g(),r()}catch{}};return i.jsxs(di,{open:n,onClose:r,labelledBy:x,className:"confirm-modal",children:[i.jsxs("header",{className:"modal-header",children:[i.jsx("h2",{id:x,children:o}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭确认窗口",children:i.jsx(X,{name:"close"})})]}),i.jsx("p",{className:"confirm-body",children:a}),i.jsxs("footer",{className:"modal-footer",children:[i.jsx("button",{type:"button",className:"secondary-button",autoFocus:!0,onClick:r,children:"取消"}),i.jsx("button",{type:"button",className:f?"danger-button":"primary-button",disabled:p,onClick:()=>{w()},children:p?"处理中…":d})]})]})}function ty({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(di,{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(X,{name:"close"})})]}),i.jsxs("p",{id:"confirm-delete-description",className:"confirm-delete-body",children:["将永久删除会话",i.jsx("strong",{children:o?`「${ds(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 ny=["appearance.style","appearance.theme","appearance.motion","defaults.model","defaults.effort","permissions.toolConfirmation"];function Bo(n,r){return r==="appearance.style"?n.sections.appearance.style:r==="appearance.theme"?n.sections.appearance.theme:r==="appearance.motion"?n.sections.appearance.motion:r==="defaults.model"?n.sections.defaults.model:r==="defaults.effort"?n.sections.defaults.effort:n.sections.permissions.toolConfirmation}function ry(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 Ir(n){return{openedAtRevision:n.revision,workspace:n.workspace,base:n,values:ly(n),intents:{},serverLatest:null}}function mp(n,r,o){const a=_n(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 gp(n,r){const o=Bo(n.base,r),a={...n.intents};return o.explicitValue===void 0?(delete a[r],{...n,values:{...n.values,[r]:_n(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 gf(n,r){return{...n,serverLatest:r}}function sy(n){const r=n.serverLatest;if(!r)return n;let o=Ir(r);for(const a of Rr(n)){const d=n.intents[a];if(d){if(d.op==="unset"){o=gp(o,a);continue}o=mp(o,a,d.value)}}return o}function Rr(n){return ny.filter(r=>n.intents[r]!==void 0)}function iy(n){return Rr(n).map(r=>{const o=n.intents[r];return o.op==="unset"?{op:"unset",key:r}:{op:"set",key:r,value:o.value}})}function oy(n){return n.serverLatest?Rr(n).filter(r=>{const o=Bo(n.base,r),a=Bo(n.serverLatest,r);return!Object.is(o.effectiveValue,a.effectiveValue)||!Object.is(o.explicitValue,a.explicitValue)||o.overridden!==a.overridden||o.source!==a.source}):[]}function _n(n,r){const o=Bo(n,r);return o.explicitValue??o.effectiveValue}function ly(n){const r=ry(n);return{"appearance.style":_n(n,"appearance.style")??r["appearance.style"],"appearance.theme":_n(n,"appearance.theme")??r["appearance.theme"],"appearance.motion":_n(n,"appearance.motion")??r["appearance.motion"],"defaults.model":_n(n,"defaults.model")??r["defaults.model"],"defaults.effort":_n(n,"defaults.effort")??r["defaults.effort"],"permissions.toolConfirmation":_n(n,"permissions.toolConfirmation")??r["permissions.toolConfirmation"]}}const qo={phase:"closed",section:"general",draft:null,message:null,problemCode:null,confirmDiscard:!1};function ay(n,r){switch(r.type){case"open":return{...qo,phase:"ready",draft:Ir(r.document)};case"close":return qo;case"select_section":return{...n,section:r.section,confirmDiscard:!1};case"set_value":return!n.draft||n.phase==="saving"?n:{...n,phase:"ready",draft:mp(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:gp(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:Ir(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?gf(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:Ir(r.document)};if(n.phase==="saving")return n;if(n.draft.base.revision===r.document.revision){const o=Rr(n.draft).length>0;return{...n,draft:o?{...n.draft,base:r.document}:Ir(r.document)}}return n.draft.workspace!==r.document.workspace||Rr(n.draft).length===0?{...n,phase:"ready",draft:Ir(r.document),message:"已采用 Host 的最新设置。",problemCode:null,confirmDiscard:!1}:{...n,phase:"conflict",draft:gf(n.draft,r.document),message:"Host 设置已更新。你的草稿仍被保留,请选择如何继续。",problemCode:"settings_revision_conflict",confirmDiscard:!1}}case"adopt_server":return n.draft?.serverLatest?{...n,phase:"ready",draft:Ir(n.draft.serverLatest),message:"已采用服务器最新值。",problemCode:null}:n;case"rebase":return n.draft?.serverLatest?{...n,phase:"ready",draft:sy(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 cy=["auto","none","minimal","low","medium","high","xhigh","max"],uy=[{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 dy({open:n,onClose:r,state:o,actions:a,onGoToSessionControls:d}){const f=m.useRef(null),p=m.useRef(null),g=m.useRef(null),x=m.useRef(null),w=m.useRef(null),R=m.useRef(!1),C=m.useRef(null),E=m.useRef(qo.phase),[_,A]=m.useReducer(ay,qo),[L,z]=m.useState(!1),[ie,F]=m.useState(!1),[Se,se]=m.useState(null),re=o.settings??o.settingsMirror.lastGood,b=re&&(!o.workspace||re.workspace===o.workspace)?re:null;m.useEffect(()=>{const $=f.current;$&&(n&&!$.open&&$.showModal(),!n&&$.open&&$.close())},[n]),m.useEffect(()=>{if(n&&!R.current)b&&(A({type:"open",document:b}),w.current=b),z(!1),F(!1),se(null);else if(n&&b&&w.current===null)A({type:"open",document:b}),w.current=b;else if(n&&b&&w.current!==null&&w.current!==b){if(_.phase==="saving")return;w.current=b,A({type:"server_updated",document:b})}else!n&&R.current&&(A({type:"close"}),w.current=null,C.current=null);R.current=n},[b,_.phase,n]),m.useEffect(()=>{_.confirmDiscard&&g.current?.focus()},[_.confirmDiscard]),m.useEffect(()=>{const $=E.current;if(E.current=_.phase,!n||$!=="saving"||_.phase!=="success")return;const fe=wf();f.current?.contains(fe)||p.current?.focus()},[_.phase,n]),m.useEffect(()=>{!n||b||o.settingsMirror.status==="loading"||a.refreshSettings().catch(()=>{})},[a,b,n,o.settingsMirror.status]),m.useEffect(()=>{!n||!_.draft||!o.workspace||_.draft.workspace!==o.workspace&&(A({type:"close"}),w.current=null)},[_.draft,n,o.workspace]);const D=_.draft,te=D?Rr(D):[],Ce=te.length>0,xe=o.processing&&te.some($=>["defaults.effort","permissions.toolConfirmation"].includes($)),J=()=>{if(_.phase!=="saving"){if(Ce){const $=wf();x.current=$ instanceof HTMLElement?$:null,A({type:"request_discard"});return}A({type:"close"}),r()}},G=()=>{A({type:"close"}),r()},K=async $=>{if($.preventDefault(),!D||!Ce||_.phase==="saving"||_.phase==="conflict")return;const fe=iy(D),V=C.current??$e();C.current=V,A({type:"save_started"});try{const W=await a.updateSettings(D.base.revision,fe,V);C.current=null,w.current=W.settings,A({type:"save_succeeded",document:W.settings})}catch(W){const ne=W instanceof Ee?W.code??"settings_rejected":"network";let q;ne==="settings_revision_conflict"?(C.current=null,q=await a.refreshSettings().catch(()=>{}),q&&(w.current=q)):W instanceof Ee&&W.status<500&&(C.current=null);const v=ne==="settings_revision_conflict"&&!q?"settings_recovery_required":ne;A({type:"save_failed",code:v,message:xy(v,W),...q?{latest:q}:{}})}},be=$=>{$.target===$.currentTarget&&J()};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:$=>{$.preventDefault(),J()},onClick:be,children:i.jsxs("form",{onSubmit:K,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:p,type:"button",className:"icon-button",onClick:J,"aria-label":"关闭设置",disabled:_.phase==="saving",children:i.jsx(X,{name:"close"})})]}),i.jsxs("div",{className:"settings-layout",children:[i.jsx("nav",{className:"settings-navigation","aria-label":"设置类别",children:uy.map($=>i.jsxs("button",{type:"button",className:_.section===$.id?"active":"","aria-current":_.section===$.id?"page":void 0,onClick:()=>A({type:"select_section",section:$.id}),children:[i.jsx(X,{name:$.icon,size:16}),i.jsx("span",{children:$.label})]},$.id))}),i.jsxs("div",{className:"settings-content",children:[i.jsx(vy,{state:o}),D?i.jsxs(i.Fragment,{children:[_.phase==="conflict"?i.jsx(yy,{draft:D,onAdopt:()=>{C.current=null,A({type:"adopt_server"})},onRebase:()=>{C.current=null,A({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(X,{name:_.phase==="success"?"check":"info",size:16}),i.jsx("span",{children:_.message})]}):null,_.section==="general"?i.jsx(fy,{document:D.base,draft:D.values,dirtyKeys:te,saving:_.phase==="saving",onSet:($,fe)=>A({type:"set_value",key:$,value:fe}),onReset:$=>A({type:"reset_value",key:$})}):null,_.section==="models"?i.jsx(hy,{document:D.base,draft:D.values,dirtyKeys:te,runtimeBusy:o.processing,saving:_.phase==="saving",onGoToSessionControls:d,onSet:($,fe)=>A({type:"set_value",key:$,value:fe}),onReset:$=>A({type:"reset_value",key:$})}):null,_.section==="permissions"?i.jsx(my,{document:D.base,value:D.values["permissions.toolConfirmation"],dirtyKeys:te,runtimeBusy:o.processing,saving:_.phase==="saving",confirmAllow:L,allowAcknowledged:ie,onAllowRequested:()=>{F(!1),z(!0)},onAllowAcknowledged:F,onConfirmAllow:()=>{A({type:"set_value",key:"permissions.toolConfirmation",value:"allow"}),z(!1),F(!1)},onCancelAllow:()=>{z(!1),F(!1)},onSet:$=>A({type:"set_value",key:"permissions.toolConfirmation",value:$}),onReset:()=>A({type:"reset_value",key:"permissions.toolConfirmation"})}):null,_.section==="advanced"?i.jsx(gy,{state:o,document:D.base,documentAction:Se,onOpenDocument:()=>{se({tone:"status",message:"正在请求 Host 打开设置文件…"}),a.openSettingsDocument().then(()=>se({tone:"status",message:"已交给系统默认编辑器打开。"})).catch($=>se({tone:"error",message:$ instanceof Error?$.message:"无法打开设置文件。"}))},onRefresh:()=>{se({tone:"status",message:"正在重新载入 Host 设置…"}),a.refreshSettings().then(()=>se({tone:"status",message:"已载入最新设置。"})).catch($=>se({tone:"error",message:$ instanceof Error?$.message:"重新载入失败。"}))}}):null]}):i.jsxs("section",{className:"settings-empty","aria-live":"polite",children:[i.jsx(X,{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:["你的 ",te.length," 项草稿尚未写入 Host。"]})]}),i.jsxs("div",{children:[i.jsx("button",{ref:g,type:"button",className:"secondary-button",onClick:()=>{A({type:"cancel_discard"});const $=x.current;requestAnimationFrame(()=>$?.focus())},children:"继续编辑"}),i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:G,children:"放弃更改"})]})]}):null,i.jsxs("footer",{className:"modal-footer settings-footer",children:[i.jsx("span",{className:"settings-dirty-summary","aria-live":"polite",children:Ce?`${te.length} 项未应用`:"没有未应用的更改"}),i.jsx("button",{type:"button",className:"secondary-button",onClick:J,disabled:_.phase==="saving",children:"取消"}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!D||!Ce||_.phase==="saving"||_.phase==="conflict"||xe||D.base.state!=="ready"||!D.base.writable,children:_.phase==="saving"?"应用中…":`应用 ${te.length} 项`})]})]})})}function fy({document:n,draft:r,dirtyKeys:o,saving:a,onSet:d,onReset:f}){const p=n.sections.appearance.style,g=n.sections.appearance.theme,x=n.sections.appearance.motion;return i.jsxs(el,{heading:"通用",detail:"外观偏好由 Host 保存,并在所有 Workbench 窗口保持一致。",children:[i.jsx(fs,{id:"settings-style",label:"视觉风格",description:"选择内置的方块工坊外观,或切回经典工作台。",field:p,dirty:o.includes("appearance.style"),onReset:()=>f("appearance.style"),disabled:a||!rn(n,p),children:i.jsxs("select",{id:"settings-style",value:r["appearance.style"],disabled:a||!rn(n,p),onChange:w=>d("appearance.style",w.target.value),children:[i.jsx("option",{value:"orion-blocksmith",children:"方块工坊(内置,默认)"}),i.jsx("option",{value:"classic",children:"经典"})]})}),i.jsx(fs,{id:"settings-theme",label:"主题",description:"跟随系统或固定使用浅色、深色。",field:g,dirty:o.includes("appearance.theme"),onReset:()=>f("appearance.theme"),disabled:a||!rn(n,g),children:i.jsxs("select",{id:"settings-theme",value:r["appearance.theme"],disabled:a||!rn(n,g),onChange:w=>d("appearance.theme",w.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"?"方块工坊":"经典工作台"},${py(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(fs,{id:"settings-motion",label:"动效",description:"减少非必要动画,保留状态变化。",field:x,dirty:o.includes("appearance.motion"),onReset:()=>f("appearance.motion"),disabled:a||!rn(n,x),children:i.jsxs("select",{id:"settings-motion",value:r["appearance.motion"],disabled:a||!rn(n,x),onChange:w=>d("appearance.motion",w.target.value),children:[i.jsx("option",{value:"system",children:"跟随系统"}),i.jsx("option",{value:"reduced",children:"减少动效"})]})})]})}function py(n){return n==="light"?"浅色":n==="dark"?"深色":"跟随系统"}function hy({document:n,draft:r,dirtyKeys:o,saving:a,runtimeBusy:d,onSet:f,onReset:p,onGoToSessionControls:g}){const x=n.sections.defaults.model,w=n.sections.defaults.effort,R=n.models.some(C=>C.id===r["defaults.model"])?n.models:[{id:r["defaults.model"],label:r["defaults.model"]},...n.models];return i.jsxs(el,{heading:"模型与推理",detail:"项目默认值通常从下一逻辑请求开始生效;当前会话覆盖保持可见。",children:[d?i.jsx(vp,{detail:"当前回合正在运行;项目推理强度暂时锁定,默认模型仍可用于新会话。"}):null,i.jsx(fs,{id:"settings-model",label:"默认模型",description:"仅展示 Host 提供的可用模型标识。",field:x,dirty:o.includes("defaults.model"),onReset:()=>p("defaults.model"),disabled:a||!rn(n,x),children:i.jsx("select",{id:"settings-model",value:r["defaults.model"],disabled:a||!rn(n,x),onChange:C=>f("defaults.model",C.target.value),children:R.map(C=>i.jsxs("option",{value:C.id,children:[C.label,C.provider?` · ${C.provider}`:""]},C.id))})}),i.jsx(fs,{id:"settings-effort",label:"默认推理强度",description:"模型不支持的强度会由 Host 拒绝,不会静默降级。",field:w,dirty:o.includes("defaults.effort"),onReset:()=>p("defaults.effort"),disabled:a||d||!rn(n,w),children:i.jsx("select",{id:"settings-effort",value:r["defaults.effort"],disabled:a||d||!rn(n,w),onChange:C=>f("defaults.effort",C.target.value),children:cy.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(X,{name:"check",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:"凭证始终留在 Host"}),i.jsx("p",{children:"浏览器只接收 ready / missing / unavailable 状态,不提供 API Key 输入框。"})]})]})]})}function my({document:n,value:r,dirtyKeys:o,runtimeBusy:a,saving:d,confirmAllow:f,allowAcknowledged:p,onAllowRequested:g,onAllowAcknowledged:x,onConfirmAllow:w,onCancelAllow:R,onSet:C,onReset:E}){const _=m.useRef(null),A=m.useRef(null),L=n.sections.permissions.toolConfirmation,z=d||a||!rn(n,L);return m.useEffect(()=>{f&&A.current?.focus()},[f]),i.jsxs(el,{heading:"权限",detail:"默认确认策略不改变工作区边界、硬拒绝和高风险保护。",children:[a?i.jsx(vp,{}):null,i.jsx(fs,{id:"settings-tool-confirmation",label:"工具确认",description:"Ask 逐次询问;Deny 默认拒绝;Allow 仍受 Host 安全策略约束。",field:L,labelControl:!1,dirty:o.includes("permissions.toolConfirmation"),onReset:E,disabled:z,children:i.jsxs("fieldset",{id:"settings-tool-confirmation",className:"segmented-field",disabled:z,children:[i.jsx("legend",{className:"sr-only",children:"默认工具确认策略"}),["ask","allow","deny"].map(ie=>i.jsxs("label",{children:[i.jsx("input",{ref:ie==="allow"?_:void 0,type:"radio",name:"settings-permission",value:ie,checked:r===ie,onChange:()=>ie==="allow"?g():C(ie)}),i.jsx("span",{children:ie==="ask"?"Ask":ie==="allow"?"Allow":"Deny"})]},ie))]})}),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:A,type:"checkbox",checked:p,onChange:ie=>x(ie.target.checked)}),i.jsx("span",{children:"我理解这会扩大默认授权范围"})]}),i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{R(),requestAnimationFrame(()=>_.current?.focus())},children:"保持当前策略"}),i.jsx("button",{type:"button",className:"primary-button",disabled:!p,onClick:w,children:"启用 Allow"})]})]}):null,i.jsx("p",{className:"settings-help",children:"Agent 的 BUILD / PLAN / AUTO 模式与工具确认策略互相独立。"})]})}function gy({state:n,document:r,documentAction:o,onOpenDocument:a,onRefresh:d}){return i.jsxs(el,{heading:"高级",detail:"配置状态、凭证可用性和集成清单均为只读摘要。",children:[r.diagnostic?i.jsxs("div",{className:"settings-diagnostic",role:"alert",children:[i.jsx(X,{name:"warning",size:16}),i.jsxs("div",{children:[i.jsx("strong",{children:Pn(r.diagnostic.code)}),i.jsx("p",{children:Pn(r.diagnostic.message)})]})]}):null,i.jsxs("dl",{className:"settings-facts",children:[i.jsxs("div",{children:[i.jsx("dt",{children:"状态"}),i.jsx("dd",{children:Ny(r.state)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"工作区"}),i.jsx("dd",{title:"仅显示目录名",children:pp(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:yf(r.revision)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"Last good"}),i.jsx("dd",{children:n.settingsMirror.lastGood?yf(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(X,{name:"refresh",size:15}),"重新载入设置"]}),i.jsxs("button",{type:"button",className:"secondary-button",onClick:a,children:[i.jsx(X,{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:by(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(vf,{title:"Skills",count:n.skills.length,names:n.skills.map(f=>f.name)}),i.jsx(vf,{title:"MCP",count:n.mcpServers.length,names:n.mcpServers.map(f=>f.name)})]})]})]})}function vy({state:n}){const{settingsMirror:r}=n;return r.status==="loading"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(X,{name:"refresh",size:15})," 正在与 Host 同步设置…"]}):r.error?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(X,{name:"warning",size:15})," 设置同步失败:",r.error," 当前显示上一次可用值。"]}):r.stale?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(X,{name:"refresh",size:15})," Host 已更新设置,正在载入;当前显示上一次可用值。"]}):r.document?.state==="invalid"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(X,{name:"warning",size:15})," 设置文档无效。控件已锁定,并保留上一次可用值供参考。"]}):r.document?.state==="read-only"?i.jsxs("div",{className:"settings-availability",role:"status",children:[i.jsx(X,{name:"info",size:15})," 设置当前为只读状态。"]}):r.document?.state==="unavailable"?i.jsxs("div",{className:"settings-availability error",role:"alert",children:[i.jsx(X,{name:"warning",size:15})," Host 设置暂不可用;当前显示上一次可用值。"]}):null}function el({heading:n,detail:r,children:o}){return i.jsxs("section",{className:"settings-section","aria-labelledby":`settings-${xf(n)}-heading`,children:[i.jsxs("header",{className:"settings-section-heading",children:[i.jsx("h3",{id:`settings-${xf(n)}-heading`,children:n}),i.jsx("p",{children:r})]}),i.jsx("div",{className:"settings-section-fields",children:o})]})}function fs({id:n,label:r,description:o,field:a,labelControl:d=!0,dirty:f,disabled:p,onReset:g,children:x}){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:wy(a.source)}),i.jsx("span",{children:ky(a.scope)}),i.jsx("span",{children:jy(a.applies)}),f?i.jsx("strong",{children:"草稿"}):null]}),a.blockedReason?i.jsx("small",{className:"settings-blocked-reason",children:Sy(a.blockedReason)}):null]}),i.jsxs("div",{className:"settings-field-control",children:[x,i.jsx("button",{type:"button",className:"text-button",onClick:g,disabled:p||a.explicitValue===void 0&&!f,"aria-label":`重置${r}为继承值`,children:"重置"})]})]})}function yy({draft:n,onAdopt:r,onRebase:o}){const a=oy(n),d=Rr(n),f=n.serverLatest;return i.jsxs("div",{className:"settings-conflict",role:"alert",children:[i.jsx(X,{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(p=>i.jsxs("div",{children:[i.jsx("strong",{children:Cy(p)}),i.jsx("span",{"data-label":"服务器最新值",children:String(_n(f,p))}),i.jsxs("span",{"data-label":"我的草稿",children:[String(n.values[p]),n.intents[p]?.op==="unset"?"(重置)":""]})]},p))]}):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 vp({detail:n="当前回合正在运行;相关设置会在 Runtime 空闲后解锁。"}={}){return i.jsxs("div",{className:"settings-busy",role:"status",children:[i.jsx(X,{name:"activity",size:15})," ",n]})}function vf({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 rn(n,r){return n.state==="ready"&&n.writable&&r.writable&&!r.blockedReason}function xy(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 wy(n){return`来源:${n==="internal"?"内置":n==="model"?"模型":n==="global"?"全局":n==="project"?"项目":"会话"}`}function ky(n){return`作用域:${n==="global"?"全局":n==="project"?"项目":"会话"}`}function jy(n){return`生效:${n==="live"?"立即":n==="next-logical-request"?"下次请求":n==="new-session"?"新会话":"重启后"}`}function Sy(n){return n==="runtime_busy"?"Runtime 正在运行,暂不可修改。":n==="read_only"?"此字段来自只读配置。":"设置文档无效,修复前不可修改。"}function Cy(n){return n==="appearance.style"?"视觉风格":n==="appearance.theme"?"主题":n==="appearance.motion"?"动效":n==="defaults.model"?"默认模型":n==="defaults.effort"?"默认推理强度":"工具确认"}function by(n){return n==="environment"?"环境提供":n==="legacy"?"Host 旧配置":"未配置"}function Ny(n){return n==="ready"?"可用":n==="invalid"?"无效":n==="read-only"?"只读":"不可用"}function yf(n){return n.length>24?`${n.slice(0,20)}…`:n}function xf(n){return n.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").toLowerCase()||"section"}function wf(){return typeof document>"u"?null:document.activeElement}const Iy=["导航","面板","编辑","浮层"],yp=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 _y(){if(typeof navigator>"u")return!1;const n=navigator.platform??"";return/mac|iphone|ipad|ipod/i.test(n)||/Mac/i.test(navigator.userAgent??"")}function Ey(n,r=_y()){return n.map(a=>a==="Mod"?r?"⌘":"Ctrl":a==="Shift"?r?"⇧":"Shift":a==="Alt"?r?"⌥":"Alt":a.toUpperCase()).join(r?" ":"+")}function Uo(n,r){let o=!1,a=!1,d=!1,f=null;for(const w of r)w==="Mod"?o=!0:w==="Shift"?a=!0:w==="Alt"?d=!0:f=w;if(o!==(n.metaKey||n.ctrlKey)||a!==n.shiftKey||d!==n.altKey||f===null)return!1;const p=n.code??"";if(/^[a-z]$/i.test(f))return p===`Key${f.toUpperCase()}`;if(/^[0-9]$/.test(f))return p===`Digit${f}`;const x=Object.freeze({esc:"escape"})[f.toLowerCase()]??f.toLowerCase();return n.key.toLowerCase()===x}function Ho(n){return yp.find(r=>r.id===n)}function Py(){return Iy.map(n=>({group:n,items:yp.filter(r=>r.group===n)})).filter(n=>n.items.length>0)}function Ry({open:n,onClose:r}){const o=m.useRef(null),a=m.useRef(null),d="shortcut-help-title";m.useEffect(()=>{const g=o.current;if(g&&(n&&!g.open&&(a.current=document.activeElement,g.showModal()),!n&&g.open)){g.close();const x=a.current;x&&document.contains(x)&&x.focus(),a.current=null}},[n]);const f=g=>{g.target===g.currentTarget&&r()},p=Py();return i.jsxs("dialog",{ref:o,id:"shortcut-help",className:"modal shortcut-help","aria-labelledby":d,onCancel:g=>{g.preventDefault(),r()},onClose:r,onClick:f,children:[i.jsxs("header",{className:"shortcut-help-header",children:[i.jsxs("div",{children:[i.jsx("span",{className:"eyebrow",children:"KEYBOARD"}),i.jsx("h2",{id:d,children:"键盘快捷键"})]}),i.jsx("button",{type:"button",className:"icon-button",onClick:r,"aria-label":"关闭快捷键面板",children:i.jsx(X,{name:"close",size:15})})]}),i.jsx("div",{className:"shortcut-help-body",tabIndex:0,"aria-label":"键盘快捷键列表",children:p.map(({group:g,items:x})=>i.jsxs("section",{className:"shortcut-help-group",children:[i.jsx("h3",{children:g}),i.jsx("dl",{children:x.map(w=>i.jsxs("div",{className:"shortcut-row",children:[i.jsx("dt",{children:w.description}),i.jsx("dd",{children:i.jsx("kbd",{children:Ey(w.tokens)})})]},w.id))})]},g))}),i.jsx("footer",{className:"shortcut-help-footer",children:i.jsxs("p",{children:["按 ",i.jsx("kbd",{children:"Esc"})," 关闭本面板,焦点会回到打开它的位置。"]})})]})}const Ty="modulepreload",Oy=function(n){return"/"+n},kf={},tl=function(r,o,a){let d=Promise.resolve();if(o&&o.length>0){let x=function(w){return Promise.all(w.map(R=>Promise.resolve(R).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),g=p?.nonce||p?.getAttribute("nonce");d=x(o.map(w=>{if(w=Oy(w),w in kf)return;kf[w]=!0;const R=w.endsWith(".css"),C=R?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${w}"]${C}`))return;const E=document.createElement("link");if(E.rel=R?"stylesheet":Ty,R||(E.as="script"),E.crossOrigin="",E.href=w,g&&E.setAttribute("nonce",g),document.head.appendChild(E),R)return new Promise((_,A)=>{E.addEventListener("load",_),E.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${w}`)))})}))}function f(p){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=p,window.dispatchEvent(g),!g.defaultPrevented)throw p}return d.then(p=>{for(const g of p||[])g.status==="rejected"&&f(g.reason);return r().catch(f)})},Nr=[{id:"goal",label:"Goal",icon:"goal"},{id:"activity",label:"活动",icon:"activity"},{id:"integrations",label:"能力",icon:"branch"},{id:"diagnostics",label:"诊断",icon:"diagnostics"}];function My({state:n,actions:r,tab:o,onTabChange:a}){const d=m.useId(),f=p=>{if(p.key!=="ArrowLeft"&&p.key!=="ArrowRight"&&p.key!=="Home"&&p.key!=="End")return;p.preventDefault();const g=Nr.findIndex(w=>w.id===o),x=p.key==="Home"?0:p.key==="End"?Nr.length-1:(g+(p.key==="ArrowRight"?1:-1)+Nr.length)%Nr.length;a(Nr[x].id),requestAnimationFrame(()=>document.getElementById(`${d}-tab-${Nr[x].id}`)?.focus())};return i.jsxs("div",{className:"agent-panel",children:[i.jsx("div",{className:"inspector-tabs",role:"tablist","aria-label":"详情类别",onKeyDown:f,children:Nr.map(p=>i.jsxs("button",{id:`${d}-tab-${p.id}`,type:"button",role:"tab","aria-selected":o===p.id,"aria-controls":`${d}-panel`,tabIndex:o===p.id?0:-1,onClick:()=>a(p.id),children:[i.jsx(X,{name:p.icon,size:15}),i.jsx("span",{children:p.label})]},p.id))}),i.jsxs("div",{id:`${d}-panel`,className:"inspector-body",role:"tabpanel","aria-labelledby":`${d}-tab-${o}`,tabIndex:0,children:[o==="goal"?i.jsx(Ly,{state:n,actions:r}):null,o==="activity"?i.jsx($y,{state:n,actions:r}):null,o==="integrations"?i.jsx(Wy,{state:n,actions:r}):null,o==="diagnostics"?i.jsx(Fy,{state:n,actions:r}):null]})]})}function Ly({state:n,actions:r}){const o=n.goal,a=n.plan?.body??(typeof n.diagnostics?.plan=="string"?n.diagnostics.plan:""),d=!!n.pendingAction,f=d||n.connection!=="live"||!Pr(n),[p,g]=m.useState(!1);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(X,{name:"goal"})}),i.jsx("h3",{children:"没有活动 Goal"}),i.jsx("p",{children:"Goal 会跨回合保存目标、计划、证据和预算状态。"})]}),i.jsx(Ay,{onCreate:w=>r.controlGoal("create",w),disabled:f||!n.activeSessionId}),i.jsx(jf,{mode:n.mode.baseMode,plan:a})]});const x=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 条件完成 ${x}%`}),i.jsxs("div",{className:"goal-breakdown",children:[i.jsxs("span",{children:[x,"% 完成"]}),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:[Sf(o.tokensUsed),o.tokenBudget?` / ${Sf(o.tokenBudget)}`:""]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"用时"}),i.jsx("dd",{children:qy(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((w,R)=>i.jsx("li",{children:w},`${w}-${R}`))})]}):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(X,{name:"pause",size:14}),"暂停"]}):o.status!=="complete"?i.jsxs("button",{type:"button",className:"secondary-button",onClick:()=>{r.controlGoal("resume")},disabled:f,children:[i.jsx(X,{name:"refresh",size:14}),"恢复"]}):null,i.jsx("button",{type:"button",className:"danger-ghost-button",onClick:()=>g(!0),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(w=>i.jsxs("li",{children:[i.jsx("span",{className:`evidence-state ${w.result}`,"aria-hidden":"true",children:i.jsx(X,{name:w.result==="passed"?"check":w.result==="failed"?"close":"more",size:12})}),i.jsxs("div",{children:[i.jsx("strong",{children:w.subject}),i.jsxs("span",{children:[w.kind," · ",w.result]})]})]},w.id))})]}):null,i.jsx(jf,{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((w,R)=>i.jsxs("li",{children:[i.jsx("span",{className:"timeline-pin","aria-hidden":"true"}),i.jsxs("div",{children:[i.jsx("strong",{children:w.type.replace(/_/g," ")}),i.jsx("p",{children:w.message}),i.jsx("time",{children:Uy(w.timestamp)})]})]},`${w.timestamp}-${R}`))})]}):null,i.jsx(ey,{open:p,onClose:()=>g(!1),title:"清除此 Goal?",body:"Goal 的目标与进度会从当前会话移除,会话记录仍会保留。",confirmLabel:"清除 Goal",danger:!0,pending:d,onConfirm:()=>r.controlGoal("clear")})]})}function Ay({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(X,{name:"goal",size:15}),"开始 Goal"]})]})}function jf({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(li,{children:r}):i.jsx("p",{className:"muted-copy",children:"还没有保存的计划。切换到 PLAN 模式后提交任务,Runtime 会生成并保存计划。"})]})}function $y({state:n,actions:r}){const o=m.useMemo(()=>n.tools.filter(a=>By(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(Dy,{tool:a},a.callId))}):i.jsx(Do,{text:"还没有工具活动"})]}),i.jsx(zy,{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(X,{name:"edit",size:14}),i.jsxs("div",{children:[i.jsx("strong",{children:xp(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(X,{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(Do,{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(Do,{text:"还没有子代理或研究活动"}):null]})]})}function Dy({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 zy({state:n,actions:r}){const[o,a]=m.useState(""),[d,f]=m.useState(""),[p,g]=m.useState(),[x,w]=m.useState(0),[R,C]=m.useState(!1),[E,_]=m.useState("");m.useEffect(()=>{a(""),f(""),g(void 0),_("")},[n.activeSessionId]);const A=async(L,z=0)=>{C(!0),_("");try{const ie=await r.readToolDetail(L,z);a(L),f(F=>z===0?ie.content:`${F}${ie.content}`),g(ie.nextOffsetBytes),w(ie.totalBytes)}catch(ie){_(ie instanceof Error?ie.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(X,{name:"refresh",size:13}),"刷新"]})]}),n.toolDetails.length?i.jsx("div",{className:"detail-selector",role:"group","aria-label":"工具输出详情",children:n.toolDetails.slice(-20).reverse().map(L=>i.jsxs("button",{type:"button",className:o&&L.artifactId===o?"active":"",disabled:!L.artifactId||R,onClick:()=>L.artifactId&&void A(L.artifactId),children:[i.jsxs("span",{children:[i.jsx("strong",{children:L.toolName}),i.jsxs("small",{children:["#",L.sequence," · ",Cf(L.outputBytes)]})]}),i.jsx(X,{name:"chevron",size:13})]},`${L.callId}:${L.sequence}`))}):i.jsx(Do,{text:"没有可读取的持久化输出"}),n.toolDetailNextCursor?i.jsx("button",{type:"button",className:"text-button",onClick:()=>{r.loadMoreToolDetails()},disabled:!!n.pendingAction,children:"加载更多输出记录"}):null,E?i.jsx("p",{className:"field-error",role:"alert",children:E}):null,o?i.jsxs("div",{className:"detail-output",children:[i.jsxs("div",{children:[i.jsxs("span",{children:[Cf(x)," · 已脱敏"]}),i.jsx("code",{children:o})]}),i.jsx("pre",{tabIndex:0,children:Pn(d)}),p!==void 0?i.jsx("button",{type:"button",className:"secondary-button",disabled:R,onClick:()=>{A(o,p)},children:R?"读取中…":"加载更多"}):null]}):null]})}function Wy({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(X,{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(X,{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(X,{name:"info",size:16}),i.jsxs("p",{children:[i.jsx("strong",{children:"能力边界由 Runtime 管理。"})," Web 端只展示描述符和状态,不加载外部插件代码,也不会绕过 ToolGateway。"]})]})]})}function Fy({state:n,actions:r}){const o=n.diagnostics,a=Qo(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:Hy(n.connection)})]}),i.jsxs("button",{type:"button",className:"icon-text-button",onClick:()=>{r.refreshDiagnostics()},disabled:!!n.pendingAction,children:[i.jsx(X,{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(Ct,{label:"版本",value:n.bootstrap?.productVersion??"—"}),i.jsx(Ct,{label:"工作区",value:xp(n.workspace)||"—"}),i.jsx(Ct,{label:"会话",value:n.activeSessionId?.slice(0,12)??"未选择"}),i.jsx(Ct,{label:"模式",value:String(o?.agentMode??n.mode.baseMode)}),i.jsx(Ct,{label:"权限",value:String(o?.permissionMode??n.settings?.sections.permissions.toolConfirmation.effectiveValue??"—")}),i.jsx(Ct,{label:"事件游标",value:`${n.lastCursor}`}),i.jsx(Ct,{label:"事件 UUID",value:n.lastEventId?.slice(0,12)??"—"}),i.jsx(Ct,{label:"会话快照",value:a.status}),i.jsx(Ct,{label:"保留事件",value:`${o?.eventStream?.retained??"—"}`}),i.jsx(Ct,{label:"快照请求",value:o?.session?`${o.session.snapshotRequests} 次 / 失败 ${o.session.snapshotFailures}`:"—"}),i.jsx(Ct,{label:"快照时延",value:o?.session?`${o.session.snapshotLastMs} ms(累计 ${o.session.snapshotTotalMs} ms)`:"—"}),i.jsx(Ct,{label:"Session actor",value:o?.session?`${o.session.actors.actorsCreated} 分配 / ${o.session.actors.actorsEvicted} LRU 驱逐`:"—"}),i.jsx(Ct,{label:"control plane",value:o?.session?`${o.session.controlPlaneInstalls} 次装载 / ${o.session.controlPlaneShutdowns} 次关闭`:"—"}),i.jsx(Ct,{label:"浏览器切换",value:`${n.clientTelemetry.sessionSwitches} 次 / 缓存命中 ${n.clientTelemetry.snapshotCacheHits} / 加载 ${n.clientTelemetry.snapshotLoads}`})]})]}),o?.contextUsage?i.jsx(To,{title:"Context usage",value:o.contextUsage}):null,o?.tokenUsage?i.jsx(To,{title:"Token usage",value:o.tokenUsage}):null,o?.harness?i.jsx(To,{title:"Harness",value:o.harness}):null,n.loopStats?i.jsx(To,{title:"Loop statistics",value:n.loopStats}):null,i.jsxs("section",{className:"security-note",children:[i.jsx(X,{name:"check",size:16}),i.jsx("p",{title:"API Key、认证 Header 和环境值不会返回浏览器。",children:"诊断载荷由 Host 脱敏。"})]})]})}function Ct({label:n,value:r}){return i.jsxs("div",{children:[i.jsx("dt",{children:n}),i.jsx("dd",{title:r,children:r})]})}function To({title:n,value:r}){return i.jsxs("details",{className:"json-section",children:[i.jsx("summary",{children:n}),i.jsx("pre",{tabIndex:0,children:uc(r,12e3)})]})}function Do({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 By(n){return/write|edit|patch|delete|move|rename|mkdir|create/i.test(n.name)}function xp(n){const r=n.replace(/[\\/]+$/,"");return r.split(/[\\/]/).filter(Boolean).at(-1)??r}function Sf(n){return new Intl.NumberFormat("zh-CN",{notation:n>99999?"compact":"standard"}).format(n)}function qy(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 Cf(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1048576).toFixed(1)} MB`}function Uy(n){const r=Date.parse(n);return Number.isFinite(r)?new Date(r).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""}function Hy(n){return n==="live"?"本地 Web Host 连接正常":n==="offline"?"浏览器离线":n==="replay-required"?"Web Host 事件流需要恢复":n==="closed"?"本地 Web Host 已关闭":n==="connecting"?"正在连接本地 Web Host":"正在重新连接本地 Web Host"}function Vy({width:n,onPreview:r,onCommit:o,maxWidth:a=op}){return i.jsx(sp,{side:"right",className:"work-panel-resize-handle",minWidth:mc,maxWidth:a,defaultWidth:gc,label:"拖动或按方向键调整工作面板宽度",width:n,controls:"work-panel-detail",onPreview:r,onCommit:o})}const Ky=["agent","review","terminal","files","git"],Gy=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"}}),Qy=new Map(Ky.map(n=>{const r=Gy[n];return[n,Object.freeze({id:n,label:r.label,icon:r.icon,kind:r.kind})]})),Yy=m.lazy(()=>tl(()=>import("./TerminalPanel-CTJtYCLj.js"),__vite__mapDeps([0,1])).then(n=>({default:n.TerminalPanel}))),Xy=m.lazy(()=>tl(()=>import("./FilesPanel-DLMT8aKW.js"),__vite__mapDeps([2,3])).then(n=>({default:n.FilesPanel}))),Jy=m.lazy(()=>tl(()=>import("./GitPanel-DrVyBNCX.js"),__vite__mapDeps([4,3])).then(n=>({default:n.GitPanel}))),Zy=m.lazy(()=>tl(()=>import("./ReviewPanel-BRrUqVPn.js"),__vite__mapDeps([5,3])).then(n=>({default:n.ReviewPanel}))),ex=["focus-work-panel-1","focus-work-panel-2","focus-work-panel-3","focus-work-panel-4","focus-work-panel-5"],bf=Object.freeze(Object.fromEntries([...Qy].map(([n,r])=>[n,{label:r.label,icon:r.icon}]))),tx=new Set(["starting","running","stopping","queued","waiting_approval","interrupted","failed"]);function nx(n,r){return n?tx.has(n)?n==="failed"||n==="interrupted"?"failed":n==="queued"||n==="waiting_approval"?"queued":"running":null:r?"running":null}const Ga=["system","light","dark"],rx={system:"monitor",light:"sun",dark:"moon"},Nf={system:"跟随系统",light:"浅色",dark:"深色"};function sx(n){const r=n??"system",o=Ga.indexOf(r),a=Ga[(o+1)%Ga.length];return{current:r,next:a}}function ix({state:n,actions:r,mode:o,expanded:a,themePreference:d,onCycleTheme:f,onToggleInspector:p,onShowShortcutHelp:g,activePanel:x,panelOrder:w,agentPanel:R,onExpand:C,onCollapse:E,onPanelChange:_,onAgentPanelChange:A,onWidthPreview:L,onWidthCommit:z,width:ie,maxWidthPx:F,revealFileRequest:Se,onRevealInFiles:se,onSendToComposer:re,resourceNavigatorWidths:b,onResourceNavigatorWidthCommit:D}){const te=m.useRef(null),Ce=m.useRef(null),xe=m.useRef(a),J=m.useId(),G=m.useRef(new Set([x]));G.current.add(x);const K=m.useRef(x==="terminal"||G.current.has("terminal"));x==="terminal"&&(K.current=!0);const[be,$]=m.useState(!1),fe=w&&w.length===oc.length?w:oc,V=n.workspaceResourceEpochs[n.workspaceId]??{files:0,git:0,review:0},W=n.sessionRuntimeById[n.activeSessionId??""]?.phase,ne=nx(W,n.processing),q=sx(d);m.useEffect(()=>{const Z=xe.current;if(xe.current=a,!(o!=="dock"||Z===a)){if(!a){requestAnimationFrame(()=>te.current?.querySelector(`[data-work-panel-id="${x}"]`)?.focus());return}be&&($(!1),requestAnimationFrame(()=>Ce.current?.focus()))}},[x,a,o,be]),m.useEffect(()=>{const Z=Ho("toggle-work-panel"),he=je=>{if(Z&&Uo(je,Z.tokens)){je.preventDefault(),a?E():($(!0),C());return}const le=ex.findIndex(Qe=>{const Je=Ho(Qe);return Je?Uo(je,Je.tokens):!1}),Te=fe[le];Te&&(je.preventDefault(),!(a&&x===Te)&&(_(Te),a||C()))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[a,o,E,C,_]);const v=Z=>{if(Z.key==="Escape"&&a&&!Z.target.closest('[role="alertdialog"], .terminal-host, input, textarea, [contenteditable]')){Z.preventDefault(),E();return}if(o!=="overlay"||!a||Z.key!=="Tab")return;const he=ox(te.current);if(!he.length){Z.preventDefault(),te.current?.focus();return}const je=he.indexOf(document.activeElement);Z.shiftKey&&je<=0?(Z.preventDefault(),he.at(-1)?.focus()):!Z.shiftKey&&(je<0||je===he.length-1)&&(Z.preventDefault(),he[0].focus())},O=Z=>{if(o==="overlay"){_(Z),a||($(!0),C());return}if(a&&x===Z){E();return}a||$(!0),_(Z),C()},ce=(Z=!1)=>i.jsxs("nav",{className:Z?"work-panel-rail work-panel-rail-overlay":"work-panel-rail","aria-label":"工作面板快捷入口",children:[fe.map((he,je)=>{const le=bf[he],Te=x===he;return i.jsxs("button",{type:"button",className:"work-panel-rail-button","data-work-panel-id":he,"aria-label":`打开${le.label}面板`,"aria-current":Te?"page":void 0,title:`${le.label} · ⌘⇧${je+1}`,onClick:()=>O(he),children:[i.jsx(X,{name:le.icon,size:17}),he==="terminal"&&ne?i.jsx(dc,{state:ne,className:"rail-status-dot",describe:!1}):null]},he)}),i.jsx("div",{className:"work-panel-rail-spacer"}),i.jsx("button",{type:"button",className:"icon-button shortcut-help-button",onClick:g,"aria-label":"查看键盘快捷键",title:"键盘快捷键(⌘/Ctrl+/)",children:i.jsx(X,{name:"keyboard",size:17})}),i.jsx("button",{type:"button",className:"icon-button theme-cycle-button",onClick:f,"aria-label":`主题:${Nf[q.current]},点击切换为${Nf[q.next]}`,children:i.jsx(X,{name:rx[q.current],size:17})}),i.jsx("button",{type:"button",className:"icon-button inspector-toggle",onClick:p,"aria-label":a?"关闭工作面板":"打开工作面板","aria-controls":"work-panel","aria-expanded":a,children:i.jsx(X,{name:"sidebar",size:17})})]}),pe=Z=>i.jsxs("div",{id:`${J}-${Z}`,className:"work-panel-pane",role:"tabpanel","aria-label":bf[Z].label,hidden:Z!==x,children:[Z==="agent"?i.jsx(My,{state:n,actions:r,tab:R,onTabChange:A}):null,Z==="review"?i.jsx(Zy,{workspaceId:n.workspaceId,refreshEpoch:V.review,actions:r,onSendToComposer:re,navigatorWidthPx:b.review,onNavigatorWidthCommit:he=>D("review",he)}):null,Z==="terminal"?i.jsx(Yy,{workspaceId:n.workspaceId,workspacePath:n.workspace,styleNonce:n.bootstrap?.nonce??"",available:!!n.bootstrap?.capabilities.terminal,actions:r}):null,Z==="files"?i.jsx(Xy,{workspaceId:n.workspaceId,refreshEpoch:V.files,actions:r,revealRequest:Se??null,navigatorWidthPx:b.files,onNavigatorWidthCommit:he=>D("files",he)}):null,Z==="git"?i.jsx(Jy,{workspaceId:n.workspaceId,refreshEpoch:V.git,actions:r,onRevealInFiles:se,onSendToComposer:re,navigatorWidthPx:b.git,onNavigatorWidthCommit:he=>D("git",he)}):null]},Z),ye=x==="terminal"||!K.current?[x]:[x,"terminal"];return i.jsxs("aside",{ref:te,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:v,children:[o==="dock"?i.jsxs("div",{className:"work-panel-dock-body",children:[a?i.jsx("section",{ref:Ce,id:"work-panel-detail",className:"work-panel-detail","aria-label":"工作面板内容",tabIndex:-1,children:i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:ye.map(Z=>pe(Z))})})}):null,ce()]}):i.jsxs("div",{id:"work-panel-detail",className:"work-panel-detail",hidden:!a,children:[ce(!0),i.jsx("div",{className:"work-panel-content",children:i.jsx(m.Suspense,{fallback:i.jsx("p",{className:"resource-loading",children:"正在加载工作面板…"}),children:ye.map(Z=>pe(Z))})})]}),o==="dock"&&a?i.jsx(Vy,{width:ie,maxWidth:F,onPreview:L,onCommit:z}):null]})}function ox(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 wp="orion.web.right-workspace.v3",Vo=4,zo=300,kp=160,jp=420,lx=280,ax=["files","git","review"],Ko=Object.freeze({files:zo,git:zo,review:zo});function Sp(n){return Number.isFinite(n)?Math.min(jp,Math.max(kp,Math.round(n))):zo}function uw(n){const r=Number.isFinite(n)?n:0,o=Math.min(jp,r*.48,r-lx);return Math.max(kp,Math.floor(o))}const Cp=Object.freeze({expanded:!0,activePanel:"agent",detailWidthPx:560,taskSubview:"overview",resourceNavigatorWidthPx:Ko}),cx=Cp;function If(){return Object.freeze({schemaVersion:Vo,projectNavigation:Object.freeze({expanded:!0,widthPx:280}),workPanel:Object.freeze({byWorkspace:Object.freeze({}),fallback:cx})})}function ux(n){const r=vc(n.agentPanel);return Object.freeze({expanded:n.expanded!==!1,activePanel:ui(n.activePanel)?n.activePanel:"agent",detailWidthPx:Math.max(320,ci(Number.isFinite(n.widthPx)?Number(n.widthPx)-Ge:560)),taskSubview:r,resourceNavigatorWidthPx:Ko})}function dx(n,r){return n.workPanel.byWorkspace[r]??n.workPanel.fallback}function bp(n,r,o){const a=n.workPanel.byWorkspace[r]??n.workPanel.fallback,d=Object.freeze({...a,...o,resourceNavigatorWidthPx:o.resourceNavigatorWidthPx??a.resourceNavigatorWidthPx}),f={schemaVersion:Vo,projectNavigation:n.projectNavigation,workPanel:{...n.workPanel,byWorkspace:Object.freeze({...n.workPanel.byWorkspace,[r]:d})}};return Object.freeze(f)}function fx(n,r,o,a){const d=dx(n,r);return bp(n,r,{...d,resourceNavigatorWidthPx:Object.freeze({...d.resourceNavigatorWidthPx,[o]:Sp(a)})})}function px(n){if(!n)return null;try{const r=JSON.parse(n);if(!_r(r))return null;const o=r.schemaVersion;if(o!==3&&o!==Vo)return null;const a=_r(r.projectNavigation)?r.projectNavigation:{},d=_r(r.workPanel)?r.workPanel:{},f=_r(d.byWorkspace)?d.byWorkspace:{},p=_r(d.fallback)?d.fallback:{},g={};for(const[x,w]of Object.entries(f))_r(w)&&(g[x]=_f(w));return Object.freeze({schemaVersion:Vo,projectNavigation:Object.freeze({expanded:a.expanded!==!1,widthPx:ci(Number(a.widthPx)||280)}),workPanel:Object.freeze({byWorkspace:Object.freeze(g),fallback:_f(p)})})}catch{return null}}function _f(n){return Object.freeze({expanded:n.expanded!==!1,activePanel:ui(n.activePanel)?n.activePanel:"agent",detailWidthPx:Np(Number(n.detailWidthPx)),taskSubview:vc(n.taskSubview),resourceNavigatorWidthPx:hx(n.resourceNavigatorWidthPx)})}function hx(n){if(!_r(n))return Ko;const r={...Ko};for(const o of ax){const a=Number(n[o]);Number.isFinite(a)&&(r[o]=Sp(a))}return Object.freeze(r)}function Np(n){return Number.isFinite(n)?Math.min(3200,Math.max(360,Math.round(n))):Cp.detailWidthPx}function vc(n){const r=String(n);return r==="goal"||r==="overview"?"overview":r==="activity"?"activity":r==="integrations"||r==="capabilities"?"capabilities":r==="diagnostics"?"diagnostics":"overview"}function mx(n){switch(n){case"overview":return"goal";case"activity":return"activity";case"capabilities":return"integrations";case"diagnostics":return"diagnostics"}}function _r(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function gx(n){return["agent","review","terminal","files","git"].includes(n)}function vx(){const n=globalThis;try{return px(n.window?.localStorage.getItem(wp)??null)}catch{return null}}function Ef(n){const r=globalThis;try{r.window?.localStorage.setItem(wp,JSON.stringify(n))}catch{}}function yx(n,r){const[o,a]=m.useState(vx),d=n??"__fallback__",f=m.useMemo(()=>ux(r),[]),p=m.useMemo(()=>{const w=o?.workPanel.byWorkspace[d]??o?.workPanel.fallback??f;return{workspaceId:d,expanded:w.expanded,activePanel:gx(w.activePanel)?w.activePanel:"agent",agentPanel:mx(w.taskSubview),detailWidthPx:w.detailWidthPx,resourceNavigatorWidthPx:w.resourceNavigatorWidthPx}},[o,d,f]),g=m.useCallback(w=>{a(R=>{const C=R??If(),E=C.workPanel.byWorkspace[d]??C.workPanel.fallback??f,_={expanded:w.expanded??E.expanded,activePanel:w.activePanel??E.activePanel,detailWidthPx:w.detailWidthPx??E.detailWidthPx,taskSubview:w.agentPanel?vc(w.agentPanel):E.taskSubview,resourceNavigatorWidthPx:E.resourceNavigatorWidthPx},A=bp(C,d,_);return Ef(A),A})},[d,f]),x=m.useCallback((w,R)=>{a(C=>{const E=C??If(),_=fx(E,d,w,R);return Ef(_),_})},[d]);return{value:p,update:g,setResourceNavigatorWidth:x}}const yc=320,Pf=360,xx=1024,wx=768,kx=.8;function Ip(n){return Number.isFinite(n)&&n>0?Math.round(n):1440}function _p(n){const r=Math.floor(n*kx),o=n-yc-Ge;return Math.max(0,Math.min(r,o))}function Rf(n){const r=Ip(n.containerWidth),o=Math.max(0,Math.round(n.leftWidthPx)),a=Math.max(0,r-o);if(r<wx)return Object.freeze({mode:"drawer",detailWidthPx:0,conversationWidthPx:a,canResize:!1});if(r<xx)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:Ge,conversationWidthPx:a-Ge,canResize:!1});const d=_p(a);if(d<Pf)return Object.freeze({mode:"rail",detailWidthPx:Ge,conversationWidthPx:a-Ge,canResize:!1});const f=Math.max(Pf,Math.min(Np(n.storedDetailWidthPx),d)),p=a-f-Ge;return p<yc?Object.freeze({mode:"rail",detailWidthPx:Ge,conversationWidthPx:a-Ge,canResize:!1}):Object.freeze({mode:"dock",detailWidthPx:f,conversationWidthPx:p,canResize:d>f})}function Tf(n){const r=Ip(n.containerWidth),o=n.navigationExpanded?Math.max(240,Math.min(480,Math.round(n.navigationWidthPx))):Ge;let a=Rf({containerWidth:r,leftWidthPx:o,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});const d=Rf({containerWidth:r,leftWidthPx:Ge,expanded:n.workExpanded,storedDetailWidthPx:n.workDetailWidthPx});return n.navigationExpanded&&(a.mode==="dock"&&a.conversationWidthPx<yc||a.mode!=="dock"&&d.mode==="dock")?(a=d,Object.freeze({projectNavigation:Object.freeze({mode:"rail",widthPx:Ge}),conversationWidthPx:a.conversationWidthPx,workPanel:Object.freeze({mode:a.mode,widthPx:a.mode==="dock"?a.detailWidthPx+Ge: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+Ge:a.detailWidthPx})})}function jx(n,r,o){const a=r==="light"||r==="system"&&o;return n==="orion-blocksmith"?a?"#d7d0c1":"#15191b":a?"#f4f5f8":"#090b10"}function tr(n,r){return n.some(o=>o.id===r.id)?n.map(o=>o.id===r.id?r:o):[r,...n]}const Go=1e4,Sx=256,Cx=256,bx=128,Nx=8,Ep=8*1024*1024,Ix=64;function _x(n=Yf,r){switch(r.type){case"baseline_loaded":{const o=n.workspaceId!==r.bootstrap.workspaceId||n.activeSessionId!==r.bootstrap.activeSessionId?ai(n):n,a=Ff(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:$x()?"reconnecting":"offline",announcement:`启动失败:${r.message}`};case"connection_changed":return n.connection==="replay-required"?n:{...n,connection:r.phase,connectionAttempt:r.attempt,announcement:Dx(r.phase,r.attempt)};case"event_received":return Ex(n,r.envelope);case"session_snapshot_started":return n.contextRevision!==r.contextRevision||n.workspaceId!==r.workspaceId?n:Oo(si(n,r.sessionId,{status:r.cached?"refreshing":"loading",requestId:r.requestId}),{snapshotLoads:1});case"session_snapshot_loaded":{const o=r.snapshot.session.id;return!Wf(n,r.contextRevision,r.workspaceId)||!zf(n,o,r.requestId)?n:n.activeSessionId!==o?r.requestId===void 0?n:Df(Mf(n,r.snapshot),o):Df(Of(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?Mf(n,r.snapshot):r.snapshot.runtime.active!==!0?n:Tx(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=Rp(r.snapshot).filter(d=>!o.has(d.id));return{...n,transcript:[...a,...n.transcript].sort((d,f)=>d.order-f.order).slice(-Go),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?er(n.sessions,r.sessions,o=>o.id):r.sessions,sessionNextCursor:r.nextCursor,workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:r.append?er(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?er(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?er(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 Af(n,a=>Ox(a,r.session));case"session_archived":{const o=Lf(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=Af(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],{...Lf(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:r.workspaceId}};case"archived_sessions_loaded":{if(r.workspaceId!==n.workspaceId)return n;const o=r.append?er(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",ownerWorkspaceId:r.workspaceId,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:Ff(r.diagnostics,n.mode)};case"capabilities_loaded":return{...n,skills:r.append?er(n.skills,r.skills,o=>o.id):r.skills,skillNextCursor:r.skillNextCursor,mcpServers:r.append?er(n.mcpServers,r.mcpServers,o=>o.id):r.mcpServers,mcpNextCursor:r.mcpNextCursor};case"tool_details_loaded":return{...n,toolDetails:r.append?er(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(!Wf(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(!zf(n,r.sessionId,r.requestId)||r.sessionId!==n.activeSessionId&&r.requestId===void 0)return n;const o=Oo(si(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,x=Of({...n,activeSessionId:g},n.sessionProjectionById[g],!1);return Oo({...si(x,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={...ai(n),activeSessionId:r.activeSessionId,notice:n.notice?.domain==="session-snapshot"&&n.notice.sessionId!==r.activeSessionId?null:n.notice,statusMessage:r.activeSessionId?"正在加载会话快照…":"请选择会话",announcement:r.activeSessionId?"正在加载会话快照":"会话已清除"},p=r.activeSessionId?si(f,r.activeSessionId,{status:"loading",requestId:n.sessionSync[r.activeSessionId]?.requestId??null}):f;return Oo(p,d)}case"recovering":return{...n,connection:"connecting",replayReason:void 0,notice:null,announcement:"正在重新加载会话状态"}}}function Ex(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?ai(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=rl(o.sessionRuntimeById,a),p=d?nl(o.sessionProjectionById,{...d,sessionRuntime:a}):o.sessionProjectionById;return a.sessionId!==o.activeSessionId?{...o,sessionProjectionById:p,sessionRuntimeById:f}:{...o,sessionProjectionById:p,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:ac(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"?Px(o,r.payload.value):Rx(o,r.payload.value,r.eventId,r.cursor,r.timestamp)}function Px(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 Rx(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:Wo(n.transcript,f,Go)}}case"transcript_update":if(r.contentDelta!==void 0){const f=n.transcript.find(p=>p.id===r.id);if(!f||r.contentStart===void 0||(f.content??"").length!==r.contentStart){const p="流式回复基线已变化,需要重新载入会话。";return{...n,connection:"replay-required",replayReason:p,notice:{id:a,tone:"warning",title:"需要重新载入会话",detail:p},announcement:p}}}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(-Go).map((p,g)=>({...p,eventId:`${o}:${g}`,order:a-1+(g+1)/(f+1),receivedAt:d,live:!1}))}}case"transcript_clear":return{...ai(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:ac(n.tools,f),announcement:`工具 ${f.name} 已开始`}}case"tool_finished":{const f=n.tools.find(g=>g.callId===r.event.callId),p={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:ac(n.tools,p),announcement:`工具 ${p.name} ${p.state==="success"?"已完成":p.state==="skipped"?"已跳过":"失败"}`}}case"edit_preview_requested":{const f={eventId:o,order:a,receivedAt:d,request:r.request};return{...n,edits:Wo(n.edits,f,Sx)}}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:Wo(n.traces,r.event,Cx)};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},p=[...n.subtasks.filter(g=>g.taskId!==f.taskId),f].slice(-256);return{...n,subtasks:p}}case"research_event":return{...n,research:Lx(n.research,r.event,o,a,d)};case"goal_event":return Mx(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 Of(n,r,o=!0){const a=Rp(r).slice(-Go),d=Op(r.runtime.agentMode)?r.runtime.agentMode:n.mode.baseMode,f=r.pendingApprovals[0],p=Tp(r.goal);return{...ai(n),lastCursor:o?Math.max(n.lastCursor,r.eventCursor):n.lastCursor,activeSessionId:r.session.id,sessionProjectionById:nl(n.sessionProjectionById,r),sessionRuntimeById:rl(n.sessionRuntimeById,r.sessionRuntime),sessions:tr(n.sessions,r.session),workspaceSessions:n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:tr(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:p,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 Mf(n,r){const o=n.workspaceId?{...n.workspaceSessions,[n.workspaceId]:{status:"ready",items:tr(n.workspaceSessions[n.workspaceId]?.items??n.sessions,r.session),nextCursor:n.workspaceSessions[n.workspaceId]?.nextCursor??n.sessionNextCursor}}:n.workspaceSessions;return{...n,sessionProjectionById:nl(n.sessionProjectionById,r),sessionRuntimeById:rl(n.sessionRuntimeById,r.sessionRuntime),sessions:tr(n.sessions,r.session),workspaceSessions:o}}function Pp(n,r){const o=n.sessionProjectionById[r.sessionId],a=o?nl(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:rl(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 Tx(n,r){const o=tr(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:tr(a?.items??n.sessions,r.session),nextCursor:a?.nextCursor??n.sessionNextCursor}},goal:Tp(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 Rp(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:Ax(r.timestamp),live:!1}})}function Tp(n){if(!n||!ni(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=ni(r.budget)?r.budget:null,a=ni(r.lastStopDecision)?r.lastStopDecision:null,d=a&&ni(a.reason)?Mo(a.reason.message):Mo(r.stopReason),f=ni(r.criteria)?{passed:nn(r.criteria.passed),total:nn(r.criteria.total),failed:nn(r.criteria.failed),stale:nn(r.criteria.stale)}:void 0;return{goalId:r.goalId,revision:nn(r.revision,nn(r.generation,1)),objective:r.objective,status:r.status,tokenBudget:Qa(r.tokenBudget)??Qa(o?.maxTokens),tokensUsed:nn(r.tokensUsed),timeUsedMs:nn(r.timeUsedMs,nn(r.elapsedMs)),continuationCount:nn(r.continuationCount),updatedAt:nn(r.updatedAt),stopReason:d,criteria:f,planRevision:Qa(r.planRevision),planPhase:Mo(r.planPhase),nextAction:Mo(r.nextAction),auditRemaining:Array.isArray(r.auditRemaining)?r.auditRemaining.filter(p=>typeof p=="string"):void 0}}function er(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 Ox(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 Lf(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 Af(n,r){const o=n.workspaceId,a=o?n.workspaceSessions[o]:void 0,d=a?.items??n.sessions,f=r(d),p=a?.status==="error"?"error":a?.status==="loading"?"loading":"ready";return{...n,sessions:o?f:n.sessions,workspaceSessions:o?{...n.workspaceSessions,[o]:{status:p,items:f,nextCursor:a?.nextCursor??null,error:a?.error}}:n.workspaceSessions}}function Mx(n,r,o){switch(r.type){case"goal_updated":case"goal_restored":return{...n,goal:r.goal,goalActivity:os(n.goalActivity,r.type,"Goal 状态已更新",o)};case"goal_completed":return{...n,goal:r.goal,goalActivity:os(n.goalActivity,r.type,r.audit.verificationSummary,o),announcement:"Goal 已完成并通过运行时审计"};case"goal_cleared":return{...n,goal:null,goalEvidence:[],goalActivity:os(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:os(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:os(n.goalActivity,`${r.type}:${r.phase}`,r.reason,o)};case"goal_audit_failed":return{...n,goalActivity:os(n.goalActivity,r.type,r.summary,o),notice:{id:Date.parse(o),tone:"warning",title:"Goal 审计尚未通过",detail:r.summary}}}}function Lx(n,r,o,a,d){const p=n.find(x=>x.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={...p,eventId:o,order:a,updatedAt:d,objective:r.objective,mode:r.mode,stage:"running"};break;case"research_source":{const x={id:r.sourceId,provider:r.provider,status:r.status,title:r.title,location:r.displayUrl??r.canonicalUrl??r.projectPath,failureReason:r.failureReason};g={...p,eventId:o,order:a,updatedAt:d,sources:[...p.sources.filter(w=>w.id!==x.id),x].slice(-64)};break}case"research_conflict":g={...p,eventId:o,order:a,updatedAt:d,conflicts:[...p.conflicts.filter(x=>x!==r.claimId),r.claimId].slice(-64)};break;case"research_completed":g={...p,eventId:o,order:a,updatedAt:d,stage:r.stage,auditStatus:r.auditStatus,conclusion:r.conclusion,summary:r.summary};break}return[...n.filter(x=>x.packetId!==r.packetId),g].slice(-128)}function ac(n,r){return[...n.filter(o=>o.callId!==r.callId),r].sort((o,a)=>o.order-a.order).slice(-1e3)}function nl(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+$f(f),0);for(;o.length>1&&(o.length>Nx||a>Ep);){const d=o.shift();d&&(a-=$f(d[1]))}return Object.freeze(Object.fromEntries(o))}function rl(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 $f(n){try{return JSON.stringify(n).length*2}catch{return Ep}}function ai(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 si(n,r,o){const a={...n.sessionSync};delete a[r],a[r]=o;const d=Object.keys(a).length-Ix;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 Oo(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 Df(n,r){const o=si(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 zf(n,r,o){return o===void 0||n.sessionSync[r]?.requestId===o}function Wf(n,r,o){return(r===void 0||n.contextRevision===r)&&(o===void 0||n.workspaceId===o)}function os(n,r,o,a){return Wo(n,{type:r,message:o,timestamp:a},bx)}function Wo(n,r,o){const a=[...n,r];return a.length<=o?a:a.slice(a.length-o)}function Ff(n,r){const o=n.agentMode;return Op(o)?{baseMode:o,pendingBaseMode:null}:r}function Op(n){return n==="interactive"||n==="plan"||n==="auto"}function Ax(n){const r=new Date(n);return Number.isFinite(r.getTime())?r.toISOString():new Date(0).toISOString()}function ni(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function nn(n,r=0){return typeof n=="number"&&Number.isFinite(n)?n:r}function Qa(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Mo(n){return typeof n=="string"&&n?n:void 0}function $x(){return typeof navigator>"u"||navigator.onLine}function Dx(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",qf="orion.web.motion";function zx(n){const r=Hf(Bf),o=Hf(qf),a=Wx(r),d=Fx(o),f=[],p=[];return r!==null&&p.push(Bf),o!==null&&p.push(qf),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:p}}function Uf(n){if(!(typeof window>"u"))for(const r of n)try{window.localStorage.removeItem(r)}catch{}}function Hf(n){if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}}function Wx(n){return n==="system"||n==="light"||n==="dark"?n:null}function Fx(n){return n==="system"||n==="reduced"?n:null}class Bx{constructor(r){Ht(this,"read");Ht(this,"snapshot",Object.freeze({status:"idle",document:null,lastGood:null,stale:!1,error:null,generation:0}));Ht(this,"listeners",new Set);Ht(this,"inFlight",null);Ht(this,"rerun",!1);Ht(this,"generation",0);Ht(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 qx(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 Ux=7,Hx=2;function Vx(){const n=m.useMemo(()=>new wg,[]),r=m.useMemo(()=>new Bx(()=>n.settings()),[n]),[o,a]=m.useReducer(_x,Yf),[d,f]=m.useState(0),p=m.useRef(o),g=m.useRef(null),x=m.useRef(0),w=m.useRef(0),R=m.useRef(new Map),C=m.useRef(0),E=m.useRef(0),_=m.useRef(new Map),A=m.useRef(()=>{}),L=m.useRef(!1);p.current=o,m.useEffect(()=>r.subscribe(()=>{a({type:"settings_mirror_changed",snapshot:r.getSnapshot()})}),[r]);const z=m.useCallback((k,N=ve(p.current),M={})=>{const ee=`${N.workspaceId}:${N.expectedContextRevision}:${k}`,ge=_.current.get(ee);if(ge&&!M.force)return ge.promise;const Ae=++E.current;a({type:"session_snapshot_started",sessionId:k,requestId:Ae,cached:!!p.current.sessionProjectionById[k],contextRevision:N.expectedContextRevision,workspaceId:N.workspaceId});const Ze=n.sessionSnapshot(k,N).then(et=>(Vf(et,k,N),a({type:"session_snapshot_loaded",snapshot:et,requestId:Ae,contextRevision:N.expectedContextRevision,workspaceId:N.workspaceId,advanceEventCursor:g.current===null}),et)).catch(et=>{const cn=as(et);throw a({type:"snapshot_failed",sessionId:k,detail:cn,requestId:Ae,contextRevision:N.expectedContextRevision,workspaceId:N.workspaceId}),new Ee(cn,et instanceof Ee?et.status:503,"session_snapshot_sync_failed",et instanceof Ee?et.type:void 0)}).finally(()=>{_.current.get(ee)?.requestId===Ae&&_.current.delete(ee)});return _.current.set(ee,{requestId:Ae,promise:Ze}),Ze},[n]),ie=m.useCallback(async k=>{const N=++w.current;try{const M=await n.bootstrap(),ee={expectedContextRevision:M.contextRevision,workspaceId:M.workspaceId};r.reset(),r.accept(M.settings);const Ae=k!==void 0&&k.activeId!==""&&k.activeId===M.workspaceId?k:void 0,Ze=Ae?Promise.resolve(Ae):n.listWorkspaces(ee),[et,cn,cr]=await Promise.all([Ze,n.listSessions(ee),r.refresh()]),tt=Gx(M.workspaceId,cn.sessions,M.activeSessionId);ri(M.workspaceId,tt);const il=Object.freeze({...M,activeSessionId:tt}),Pt=await Kx(n,r,cr.document??cr.lastGood??M.settings,ee);if(N!==w.current)return;a({type:"baseline_loaded",bootstrap:il,workspaces:et,sessions:cn.sessions,sessionNextCursor:cn.nextCursor,diagnostics:{},settings:Pt,skills:[],skillNextCursor:null,mcpServers:[],mcpNextCursor:null,toolDetails:[],toolDetailNextCursor:null}),tt&&n.sessionSnapshot(tt,ee).then(ct=>{N===w.current&&(Vf(ct,tt,ee),a({type:"session_snapshot_loaded",snapshot:ct,contextRevision:ee.expectedContextRevision,workspaceId:ee.workspaceId}))}).catch(ct=>{N===w.current&&a({type:"snapshot_failed",sessionId:tt,detail:as(ct),contextRevision:ee.expectedContextRevision,workspaceId:ee.workspaceId})}),A.current();const ol=cn.sessions.map(ct=>ct.id).filter(ct=>ct!==tt).slice(0,Ux);A.current=tw(()=>{N===w.current&&nw(ol,Hx,async ct=>{N===w.current&&await z(ct,ee).catch(()=>{})})}),n.workspaceProjectSummary(M.workspaceId,ee).then(ct=>{N===w.current&&a({type:"workspace_project_summary_loaded",summary:ct})}).catch(()=>{}),Promise.all([n.diagnostics(ee).catch(()=>({})),n.skills(ee).catch(()=>({skills:[],nextCursor:null})),n.mcp(ee).catch(()=>({servers:[],nextCursor:null})),n.toolDetails(ee).catch(()=>({details:[],nextCursor:null}))]).then(([ct,Si,ur,dr])=>{N===w.current&&(a({type:"diagnostics_loaded",diagnostics:ct}),a({type:"capabilities_loaded",skills:Si.skills,skillNextCursor:Si.nextCursor,mcpServers:ur.servers,mcpNextCursor:ur.nextCursor}),a({type:"tool_details_loaded",details:dr.details,nextCursor:dr.nextCursor}))})}catch(M){throw M}},[n,z,r]),F=m.useCallback(async k=>{let N;for(let M=0;M<3;M+=1)try{await ie(k);return}catch(ee){if(N=ee,!Zx(ee)||M===2)break;await ew(100*3**M)}throw a({type:"boot_failed",message:as(N)}),N},[ie]);m.useEffect(()=>{if(L.current)return;L.current=!0;let k=!0;return F().catch(()=>{}),()=>{k=!1}},[F]),m.useEffect(()=>()=>{A.current()},[]);const Se=o.bootstrap!==null;m.useEffect(()=>{if(!Se)return;const k=n.connectEvents({cursor:p.current.lastCursor,onEvent:N=>{if(a({type:"event_received",envelope:N}),rw(N)){const M=p.current;if(N.sessionId&&M.contextRevision&&M.workspaceId){const ee=N.sessionId,ge=++C.current;R.current.set(ee,ge);const Ae=M.contextRevision,Ze=M.workspaceId;n.sessionSnapshot(ee,{expectedContextRevision:Ae,workspaceId:Ze}).then(et=>{R.current.get(ee)===ge&&a({type:"durable_session_metadata_loaded",snapshot:et,contextRevision:Ae,workspaceId:Ze})}).catch(()=>{}).finally(()=>{R.current.get(ee)===ge&&R.current.delete(ee)})}}N.type==="settings_invalidated"&&r.invalidate(N.payload.revision,N.payload.state)},onStatus:(N,M)=>a({type:"connection_changed",phase:N,attempt:M}),onProtocolError:N=>a({type:"notice",notice:{id:Date.now(),tone:"error",title:"收到无法识别的 Web Host 事件流消息",detail:N}})});return g.current=k,()=>{k.close(),g.current===k&&(g.current=null)}},[n,Se,r,d]);const se=m.useCallback(()=>{g.current?.close(),g.current=null},[]),re=m.useCallback(()=>{f(k=>k+1)},[]);m.useEffect(()=>{!o.workspace||o.boot!=="ready"||o.pendingAction||o.bootstrap?.workspace!==o.workspace&&(se(),F().catch(k=>Gf(a,"工作区刷新失败",k)).finally(re))},[F,se,re,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&&z(o.activeSessionId).catch(()=>{}))},[z,o.activeSessionId,o.boot,o.bootstrap?.workspace,o.pendingAction,o.sessionSnapshot,o.workspace]);const b=m.useCallback(async(k,N)=>{const M=++x.current;a({type:"pending_action",label:k});try{return await N()}catch(ee){throw Jx(ee)||Gf(a,`${k}失败`,ee),ee}finally{x.current===M&&a({type:"pending_action",label:null})}},[]),D=m.useCallback(async(k,N)=>b(k,async()=>{if(p.current.connection!=="live")throw new Ee("本地 Web Host 连接尚未就绪,请在连接恢复后重试。",409,"session_not_synchronized");const M=p.current.activeSessionId;if(!M)throw new Ee("当前没有可接收命令的活动会话。",409,"active_session_changed");const ee=p.current.sessionSnapshot;if(!ee||!Pr(p.current))throw new Ee("当前会话快照尚未同步,请刷新后重试。",409,"session_runtime_revision_conflict");try{const ge=await n.command({...N,workspaceId:p.current.workspaceId,expectedContextRevision:p.current.contextRevision,expectedSessionId:M,expectedSessionRuntimeRevision:ee.sessionRuntime.runtimeRevision});return Yx(ge),ge}catch(ge){throw ge instanceof Ee&&["context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(ge.code??"")?(a({type:"snapshot_failed",sessionId:M,detail:ge.message,contextRevision:p.current.contextRevision,workspaceId:p.current.workspaceId}),new Ee(ge.message,ge.status,"session_runtime_revision_conflict",ge.type)):ge}}),[n,b]),te=m.useCallback(async(k,N)=>b(k,async()=>{const M=p.current,ee=M.composer;if(M.connection!=="live"||!M.activeSessionId||!Pr(M)||!ee||ee.sessionId!==M.activeSessionId)throw new Ee("Composer 控制状态尚未与活动会话同步。",409,"composer_control_conflict");try{const ge=await n.composerAction(M.activeSessionId,{...N,workspaceId:M.workspaceId,expectedContextRevision:M.contextRevision,expectedSessionId:M.activeSessionId,expectedSessionRuntimeRevision:ee.sessionRuntime.runtimeRevision,expectedControlRevision:ee.controlRevision});return a({type:"composer_loaded",composer:ge.state}),ge}catch(ge){throw ge instanceof Ee&&["composer_control_conflict","context_revision_conflict","active_session_changed","session_runtime_revision_conflict"].includes(ge.code??"")?(a({type:"snapshot_failed",sessionId:M.activeSessionId,detail:ge.message,contextRevision:M.contextRevision,workspaceId:M.workspaceId}),new Ee(ge.message,ge.status,"composer_control_conflict",ge.type)):ge}}),[n,b]),Ce=m.useCallback(()=>b("重新连接",F),[F,b]),xe=m.useCallback(()=>b("刷新诊断",async()=>{const k=++w.current,N=await n.diagnostics(ve(p.current));k===w.current&&a({type:"diagnostics_loaded",diagnostics:N})}),[n,b]),J=m.useCallback(()=>b("刷新工具详情",async()=>{const k=++w.current,N=await n.toolDetails(ve(p.current));k===w.current&&a({type:"tool_details_loaded",details:N.details,nextCursor:N.nextCursor})}),[n,b]),G=m.useCallback(()=>b("加载更多工作区",async()=>{const k=ve(p.current),N=p.current.workspaceNextCursor;if(N)try{const M=await n.listWorkspaces(k,N);a({type:"workspaces_loaded",value:M,append:!0})}catch(M){if(!Lo(M))throw M;a({type:"workspaces_loaded",value:await n.listWorkspaces(k)})}}),[n,b]),K=m.useCallback(()=>b("加载更多会话",async()=>{const k=p.current.sessionNextCursor;if(!k)return;const N=ve(p.current);try{const M=await n.listSessions(N,k);a({type:"sessions_loaded",sessions:M.sessions,nextCursor:M.nextCursor,append:!0})}catch(M){if(!Lo(M))throw M;const ee=await n.listSessions(N);a({type:"sessions_loaded",sessions:ee.sessions,nextCursor:ee.nextCursor})}}),[n,b]),be=m.useCallback(async(k,N=!1)=>{const M=ve(p.current),ee=p.current.workspaceSessions[k],ge=N?ee?.nextCursor:void 0;if(N&&!ge)return;a({type:"workspace_sessions_loading",workspaceId:k});const Ae=n.workspaceProjectSummary(k,M).catch(()=>null);try{const Ze=await n.listWorkspaceSessions(k,M,ge??void 0);a({type:"workspace_sessions_loaded",workspaceId:k,sessions:Ze.sessions,nextCursor:Ze.nextCursor,append:N});const et=await Ae;et&&a({type:"workspace_project_summary_loaded",summary:et})}catch(Ze){throw a({type:"workspace_sessions_failed",workspaceId:k,detail:as(Ze)}),Ze}},[n]),$=m.useCallback(async k=>{const N=await n.workspaceProjectSummary(k,ve(p.current));a({type:"workspace_project_summary_loaded",summary:N})},[n]),fe=m.useCallback(()=>b("加载更多能力",async()=>{const k=ve(p.current),N=p.current.skillNextCursor,M=p.current.mcpNextCursor;if(!(!N&&!M))try{const[ee,ge]=await Promise.all([N?n.skills(k,N):Promise.resolve({skills:[],nextCursor:null}),M?n.mcp(k,M):Promise.resolve({servers:[],nextCursor:null})]);a({type:"capabilities_loaded",skills:ee.skills,skillNextCursor:ee.nextCursor,mcpServers:ge.servers,mcpNextCursor:ge.nextCursor,append:!0})}catch(ee){if(!Lo(ee))throw ee;const[ge,Ae]=await Promise.all([n.skills(k),n.mcp(k)]);a({type:"capabilities_loaded",skills:ge.skills,skillNextCursor:ge.nextCursor,mcpServers:Ae.servers,mcpNextCursor:Ae.nextCursor})}}),[n,b]),V=m.useCallback(()=>b("加载更多工具详情",async()=>{const k=ve(p.current),N=p.current.toolDetailNextCursor;if(N)try{const M=await n.toolDetails(k,N);a({type:"tool_details_loaded",details:M.details,nextCursor:M.nextCursor,append:!0})}catch(M){if(!Lo(M))throw M;const ee=await n.toolDetails(k);a({type:"tool_details_loaded",details:ee.details,nextCursor:ee.nextCursor})}}),[n,b]),W=m.useCallback(async()=>{const k=p.current;if(k.connection!=="replay-required"){if(!k.activeSessionId)return;await z(k.activeSessionId,ve(k),{force:!0});return}await b("恢复本地 Web Host 事件流",async()=>{se(),a({type:"recovering"});try{await F()}finally{re()}})},[F,z,se,re,b]),ne=m.useCallback(k=>b("切换工作区",async()=>{se();try{const N=await n.activateWorkspace(k,ve(p.current));a({type:"workspaces_loaded",value:N}),a({type:"reset_session_view",activeSessionId:null}),await F(N)}finally{re()}}),[n,F,se,re,b]),q=m.useCallback(()=>n.pickDirectory({}),[n]),v=m.useCallback(k=>n.inspectWorkspace(k,"picker"),[n]),O=m.useCallback(k=>{const N=p.current;if(N.activeSessionId===k&&N.sessionSnapshot&&N.sessionSync[k]?.status==="ready")return Promise.resolve();const M=ve(N);return(async()=>{ri(M.workspaceId,k),a({type:"reset_session_view",activeSessionId:k}),await z(k,M)})()},[z]),ce=m.useCallback((k,N)=>k===p.current.workspaceId&&N?O(N):b("切换项目上下文",async()=>{const M=p.current,ee=M.contextRevision;if(!ee)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");if(k===M.workspaceId){ri(k,N),a({type:"reset_session_view",activeSessionId:N}),N&&await z(N,ve(M));return}ri(k,N),se(),++w.current;try{const ge=await n.activateContext({expectedContextRevision:ee,workspaceId:k,sessionId:N});if(ge.contextRevision!==ge.bootstrap.contextRevision||ge.bootstrap.workspaceId!==k)throw new Ee("Host 返回的项目上下文不一致。",502,"context_response_invalid");a({type:"reset_session_view",activeSessionId:N}),await F()}catch(ge){throw ge instanceof Ee&&(ge.code==="context_revision_conflict"||ge.code==="active_session_changed")&&a({type:"snapshot_failed",sessionId:null,detail:ge.message}),ge}finally{re()}}),[n,F,z,se,re,b,O]),pe=m.useCallback((k,N)=>b(N?"置顶项目":"取消置顶",async()=>{await n.setWorkspacePinned(k,N,ve(p.current)),a({type:"workspaces_loaded",value:await n.listWorkspaces(ve(p.current))})}),[n,b]),ye=m.useCallback(k=>b("移除项目",async()=>{const N=p.current;if(!N.contextRevision)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.removeWorkspace(k,ve(N)),Um(k),a({type:"workspaces_loaded",value:await n.listWorkspaces(ve(p.current))})}),[n,b]),Z=m.useCallback(()=>b("创建会话",async()=>{const k=ve(p.current),N=await n.createSession(k);ri(k.workspaceId,N.id),a({type:"sessions_loaded",sessions:tr(p.current.sessions,N),nextCursor:p.current.sessionNextCursor}),a({type:"reset_session_view",activeSessionId:N.id}),await z(N.id,k)}),[n,z,b]),he=O,je=m.useCallback(()=>b("加载更早记录",async()=>{const k=p.current.sessionSnapshot,N=p.current.activeSessionId,M=k?.transcript.nextCursor;if(!(!k||!N||!M))try{const ee=await n.sessionSnapshot(N,ve(p.current),M);if(ee.session.id!==k.session.id||ee.threadId!==k.threadId||ee.threadCursor!==k.threadCursor||ee.projectionDigest!==k.projectionDigest)throw new Ee("加载历史记录时会话快照发生变化,正在恢复最新快照。",409,"transcript_cursor_stale");a({type:"older_transcript_loaded",snapshot:ee})}catch(ee){if(!(ee instanceof Ee)||ee.code!=="transcript_cursor_stale")throw ee;se(),a({type:"recovering"});try{await z(N,ve(p.current),{force:!0})}finally{re()}}}),[n,z,se,re,b]),le=m.useCallback((k,N)=>b("重命名会话",async()=>{const M=await n.renameSession(k,N,ve(p.current)),ee=tr(p.current.sessions,M);a({type:"sessions_loaded",sessions:ee,nextCursor:p.current.sessionNextCursor})}),[n,b]),Te=m.useCallback((k,N)=>b("更新会话标签",async()=>{const M=await n.updateSessionTags(k,N,ve(p.current));a({type:"session_updated",session:M})}),[n,b]),Qe=m.useCallback(k=>b("归档会话",async()=>{const N=await n.archiveSession(k,ve(p.current));a({type:"session_archived",session:N})}),[n,b]),Je=m.useCallback(k=>b("还原会话",async()=>{const N=await n.restoreSession(k,ve(p.current));a({type:"session_restored",session:N})}),[n,b]),It=m.useCallback(k=>b("删除会话",async()=>{await n.deleteSession(k,ve(p.current)),a({type:"session_deleted",sessionId:k})}),[n,b]),lt=m.useCallback(async(k,N=!1)=>{const M=ve(p.current),ee=p.current.archivedSessions,ge=N?ee?.nextCursor:void 0;if(!(N&&!ge)){a({type:"archived_sessions_loading",workspaceId:k});try{const Ae=await n.listArchivedWorkspaceSessions(k,M,ge??void 0);a({type:"archived_sessions_loaded",workspaceId:k,sessions:Ae.sessions,nextCursor:Ae.nextCursor,append:N})}catch(Ae){throw a({type:"archived_sessions_failed",workspaceId:k,detail:as(Ae)}),Ae}}},[n]),Lt=m.useCallback((k,N)=>D("提交任务",{type:"submit",text:k,contextReferences:N}),[D]),vt=m.useCallback((k,N)=>D("加入队列",{type:"queue_followup",text:k,contextReferences:N}),[D]),_t=m.useCallback(async(k,N)=>{await te("移除排队消息",{type:"remove_queue_item",itemId:k,expectedItemRevision:N})},[te]),Et=m.useCallback(async(k,N,M)=>{await te("编辑排队消息",{type:"edit_queue_item",itemId:k,expectedItemRevision:N,text:M})},[te]),at=m.useCallback(async(k,N,M)=>{await te("移动排队消息",{type:"move_queue_item",itemId:k,expectedItemRevision:N,targetIndex:M})},[te]),At=m.useCallback(async()=>{await D("清空队列",{type:"clear_followups"})},[D]),$t=m.useCallback(async()=>{const k=p.current.sessionSnapshot?.sessionRuntime;if(!k||k.phase!=="queued"||!k.queueId)throw new Ee("排队任务已变化,请等待状态同步后重试。",409,"session_queue_conflict");await D("取消排队任务",{type:"cancel_queued_turn",queueId:k.queueId})},[D]),Rn=m.useCallback(async()=>{await D("中断任务",{type:"interrupt"})},[D]),nr=m.useCallback(async k=>{p.current.mode.baseMode===k&&!p.current.mode.pendingBaseMode||await te("切换模式",{type:"set_agent_mode",mode:k})},[te]),rr=m.useCallback(async k=>{await te(k===null?"继承项目权限":"切换会话权限",k===null?{type:"clear_permission_override"}:{type:"set_permission_override",value:k})},[te]),ht=m.useCallback(()=>b("加载模型目录",async()=>{const k=p.current;if(!k.activeSessionId)return;const N=await n.modelCatalog(k.activeSessionId,ve(k));a({type:"model_catalog_loaded",catalog:N})}),[n,b]),sr=m.useCallback(async(k,N)=>{await te("切换会话模型",{type:"select_model",modelId:k,...N?{effort:N}:{}})},[te]),Tn=m.useCallback(async()=>{await te("压缩上下文",{type:"compact_context"})},[te]),Dt=m.useCallback(async(k,N,M)=>{await te("审核计划",{type:"review_plan",planDigest:k,action:N,...M?{feedback:M}:{}})},[te]),On=m.useCallback(async(k,N="once")=>{const M=p.current.permission;M&&(await D(k?"确认工具权限":"拒绝工具权限",{type:"permission_decision",requestPermissionId:M.id,approved:k,scope:N}),a({type:"approval_resolved",requestId:M.id,approved:k}))},[D]),on=m.useCallback(async(k,N)=>{await D("更新 Goal",{type:"goal_control",goalAction:k,objective:N});const M=++w.current;se();try{const ee=p.current.activeSessionId,ge=ve(p.current),[Ae]=await Promise.all([n.diagnostics(ge),ee?z(ee,ge,{force:!0}):Promise.resolve()]);if(M!==w.current)return;a({type:"diagnostics_loaded",diagnostics:Ae})}finally{re()}},[n,z,se,re,D]),Q=m.useCallback(async()=>{const k=await r.refresh(),N=k.document??k.lastGood;if(!N)throw new Ee(k.error??"设置尚不可用。",503);return N},[r]),Ne=m.useCallback(async(k,N,M)=>{if(N.length<1||N.length>20)throw new Ee("设置变更必须包含 1 到 20 个字段。",400,"settings_invalid_operation");const ee=await n.updateSettings(k,N,ve(p.current),M);return r.accept(ee.settings),ee},[n,r]),_e=m.useCallback(async()=>{await n.openSettingsDocument()},[n]),ze=m.useCallback((k,N=0)=>n.readToolDetail(k,ve(p.current),N),[n]),Gt=m.useCallback((k,N)=>n.listFiles(ve(p.current),k,N),[n]),ln=m.useCallback((k,N)=>n.readFileContent(k,ve(p.current),N),[n]),mn=m.useCallback((k,N,M)=>n.writeFileContent(ve(p.current),k,N,M),[n]),Qt=m.useCallback((k,N)=>n.gitStatus(ve(p.current),k,N),[n]),Tr=m.useCallback(k=>n.gitLog(ve(p.current),k),[n]),Or=m.useCallback((k,N)=>n.gitDiff(k,ve(p.current),N),[n]),gn=m.useCallback((k,N,M,ee)=>n.gitDiffDocument(k,ve(p.current),N,M,ee),[n]),Mn=m.useCallback(()=>n.gitRefs(ve(p.current)),[n]),fi=m.useCallback(k=>n.gitCompare(ve(p.current),k),[n]),pi=m.useCallback(k=>n.gitCompareFileDiff(ve(p.current),k),[n]),hi=m.useCallback(k=>n.gitHistory(ve(p.current),k),[n]),mi=m.useCallback((k,N=0)=>n.gitCommitDetail(ve(p.current),k,N),[n]),gi=m.useCallback((k,N=0)=>n.gitCommitFiles(ve(p.current),k,N),[n]),hs=m.useCallback(k=>n.gitCommitDiff(ve(p.current),k),[n]),vi=m.useCallback(k=>n.gitFilesTarget(ve(p.current),k),[n]),ir=m.useCallback((k=200)=>n.gitGraph(ve(p.current),k),[n]),ms=m.useCallback(k=>n.gitConflictVersions(ve(p.current),k),[n]),or=m.useCallback(k=>n.gitBlob(ve(p.current),k),[n]),sl=m.useCallback(()=>n.gitSubmodules(ve(p.current)),[n]),lr=m.useCallback(k=>n.gitBlame(ve(p.current),k),[n]),Mr=m.useCallback(k=>n.gitFileHistory(ve(p.current),k),[n]),ar=m.useCallback(()=>n.gitCommitPreview(ve(p.current)),[n]),Lr=m.useCallback((k,N)=>n.gitStage(ve(p.current),k,N),[n]),yi=m.useCallback((k,N)=>n.gitUnstage(ve(p.current),k,N),[n]),xi=m.useCallback(k=>n.gitApplyPatch(ve(p.current),k),[n]),wi=m.useCallback(k=>n.gitCommit(ve(p.current),k),[n]),an=m.useCallback(()=>n.review(ve(p.current)),[n]),gs=m.useCallback(async()=>(await n.terminals(ve(p.current))).terminals,[n]),vs=m.useCallback(async(k,N)=>{const M=p.current;if(!M.contextRevision||!M.workspaceId)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.createTerminal({expectedContextRevision:M.contextRevision,workspaceId:M.workspaceId,cols:k,rows:N})},[n]),ki=m.useCallback(async k=>{const N=p.current;if(!N.contextRevision||!N.workspaceId)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");return n.terminalAttachTicket(k,{expectedContextRevision:N.contextRevision,workspaceId:N.workspaceId})},[n]),ys=m.useCallback(async k=>{const N=p.current;if(!N.contextRevision||!N.workspaceId)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");await n.closeTerminal(k,{expectedContextRevision:N.contextRevision,workspaceId:N.workspaceId})},[n]),xs=m.useCallback(k=>n.terminalSocket(k),[n]),ws=m.useCallback(()=>a({type:"notice",notice:null}),[]),ji=m.useMemo(()=>({retryBoot:Ce,refreshDiagnostics:xe,refreshToolDetails:J,loadMoreWorkspaces:G,loadMoreSessions:K,loadWorkspaceSessions:be,refreshWorkspaceProjectSummary:$,loadMoreCapabilities:fe,loadMoreToolDetails:V,recoverSession:W,switchWorkspace:ne,pickWorkspaceDirectory:q,inspectWorkspacePath:v,activateContext:ce,setWorkspacePinned:pe,removeWorkspace:ye,createSession:Z,activateSession:he,loadOlderTranscript:je,renameSession:le,updateSessionTags:Te,archiveSession:Qe,restoreSession:Je,deleteSession:It,loadArchivedWorkspaceSessions:lt,submit:Lt,queue:vt,removeQueued:_t,editQueued:Et,moveQueued:at,clearQueue:At,cancelQueuedTurn:$t,interrupt:Rn,setMode:nr,setPermissionOverride:rr,loadModelCatalog:ht,selectModel:sr,compactContext:Tn,reviewPlan:Dt,answerPermission:On,controlGoal:on,refreshSettings:Q,updateSettings:Ne,openSettingsDocument:_e,readToolDetail:ze,listFiles:Gt,readFileContent:ln,writeFileContent:mn,gitStatus:Qt,gitLog:Tr,gitDiff:Or,gitDiffDocument:gn,gitCommitPreview:ar,gitRefs:Mn,gitCompare:fi,gitCompareFileDiff:pi,gitHistory:hi,gitCommitDetail:mi,gitCommitFiles:gi,gitCommitDiff:hs,gitFilesTarget:vi,gitGraph:ir,gitConflictVersions:ms,gitBlob:or,gitSubmodules:sl,gitBlame:lr,gitFileHistory:Mr,gitStage:Lr,gitUnstage:yi,gitApplyPatch:xi,gitCommit:wi,review:an,terminals:gs,createTerminal:vs,terminalAttachTicket:ki,closeTerminal:ys,terminalSocket:xs,dismissNotice:ws}),[he,ce,ys,vs,Or,gn,ar,Lr,yi,xi,wi,Tr,Qt,Gt,je,fe,K,V,G,ht,be,On,At,$t,Tn,Dt,on,Z,ws,Et,Rn,vt,ln,ze,an,W,xe,Q,J,$,_t,ye,le,Je,Te,Qe,It,lt,Ce,nr,rr,sr,pe,Lt,ne,q,v,at,ki,xs,gs,Ne,_e]);return{state:o,actions:ji}}async function Kx(n,r,o,a){let d=o;for(let f=0;f<2;f+=1){const p=zx(d);if(p.keysToClear.length===0||d.state!=="ready"||!d.writable)return d;if(p.operations.length===0)return Uf(p.keysToClear),d;try{const g=await n.updateSettings(d.revision,p.operations,a,$e());return r.accept(g.settings),Uf(p.keysToClear),g.settings}catch(g){if(f===0&&g instanceof Ee&&g.code==="settings_revision_conflict"){const x=await r.refresh(),w=x.document??x.lastGood;if(w){d=w;continue}}return d}}return d}function ve(n){if(!n.contextRevision||!n.workspaceId)throw new Ee("工作区上下文尚未完成同步。",409,"context_revision_conflict");return{expectedContextRevision:n.contextRevision,workspaceId:n.workspaceId}}function Vf(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 Ee("Host 返回的会话快照身份与当前项目上下文不一致。",502,"session_snapshot_identity_mismatch")}const Kf="orion.web.view-id.v1",Mp="orion.web.foreground-session.v1:";function Gx(n,r,o){const a=Lp(`${Mp}${n}`);return qx(a,r,o)}function ri(n,r){Qx();const o=`${Mp}${n}`;try{r?globalThis.sessionStorage?.setItem(o,r):globalThis.sessionStorage?.removeItem(o)}catch{}}function Qx(){const n=Lp(Kf);if(n)return n;const r=globalThis.crypto?.randomUUID?.()??`view-${Date.now().toString(36)}`;try{globalThis.sessionStorage?.setItem(Kf,r)}catch{}return r}function Lp(n){try{return globalThis.sessionStorage?.getItem(n)??null}catch{return null}}function Yx(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 Ee(Xx(n),409)}function Xx(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 Gf(n,r,o,a="error"){n({type:"notice",notice:{id:Date.now(),tone:a,title:r,detail:as(o)}})}function as(n){return n instanceof Ee||n instanceof Error?n.message:"发生未知错误。"}function Lo(n){return n instanceof Ee&&n.code==="collection_cursor_stale"}function Jx(n){return n instanceof Ee&&["composer_control_conflict","session_runtime_revision_conflict","session_snapshot_sync_failed"].includes(n.code??"")}function Zx(n){return n instanceof Ee&&["context_revision_conflict","runtime_busy","active_session_changed"].includes(n.code??"")}function ew(n){return new Promise(r=>{globalThis.setTimeout(r,n)})}function tw(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 nw(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 rw(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 sw=5e3;function iw(n,r){return r||n.tone==="error"?null:sw}function ow({uid:n,notice:r,reconnectNeeded:o,snapshotRetryNeeded:a,pendingAction:d,onDismiss:f,onRecover:p}){const g=o||a,x=!g,w=m.useRef(f);m.useEffect(()=>{w.current=f},[f]);const R=iw(r,g);m.useEffect(()=>{if(R===null)return;const _=window.setTimeout(()=>w.current(n),R);return()=>window.clearTimeout(_)},[R,n]);const C=`notice-${n}`,E=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(X,{name:E,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:()=>p(n),disabled:d,children:"重建连接"}):null,a?i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>p(n),disabled:d,children:"重试同步"}):null,x?i.jsx("button",{type:"button",className:"icon-button",onClick:()=>f(n),"aria-label":"关闭通知",children:i.jsx(X,{name:"close",size:15})}):null]})}function lw(){const{state:n,actions:r}=Vx(),[o,a]=m.useState(!1),[d,f]=m.useState(Pv),{value:p,update:g,setResourceNavigatorWidth:x}=yx(n.workspaceId,d.workPanel),[w,R]=m.useState(!1),[C,E]=m.useState(!1),[_,A]=m.useState(!1),[L,z]=m.useState(null),[ie,F]=m.useState(null),[Se,se]=m.useState(null),[re,b]=m.useState(!1),[D,te]=m.useState([]),Ce=m.useRef(0),xe=m.useRef(n.notice),J=m.useRef(null),[G,K]=m.useState(null),[be,$]=m.useState(null),fe=m.useRef(null),V=m.useRef(!1),W=m.useRef(!1),ne=m.useRef(null),q=aw(ne),v=q>1180,O=v?Tf({containerWidth:q,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:p.expanded,workDetailWidthPx:p.detailWidthPx}):Ro(q,d),ce=O.projectNavigation.mode==="drawer",pe=O.workPanel.mode==="drawer",ye=O.workPanel.mode==="rail"&&p.expanded,Z=pe||ye&&w,he=pe||ye?w:O.workPanel.mode==="dock",je=Z&&w,le=ce&&o,Te=le||je,Qe=n.settings?.state==="ready"?n.settings:n.settingsMirror.lastGood??n.settings,Je=Qe?.sections.appearance.theme.effectiveValue,It=Qe?.sections.appearance.motion.effectiveValue,lt=Qe?.sections.appearance.style.effectiveValue??"orion-blocksmith",Lt=Qo(n),vt=m.useCallback(()=>{if(!n.workspace)return;const Q=Qe?.revision;if(!Q)return;const Ne=Qe?.sections.appearance.theme.effectiveValue??"system",_e=Ne==="system"?"light":Ne==="light"?"dark":"system";r.updateSettings(Q,[{op:"set",key:"appearance.theme",value:_e}],$e()).catch(ze=>{console.warn("[theme] 主题切换写入失败",ze)})},[r,Qe,n.workspace]),_t=m.useCallback(Q=>{f(Ne=>{const _e={...Ne,projectNavigation:{...Ne.projectNavigation,...Q}};return Rv(_e),_e})},[]),Et=m.useCallback(Q=>{g({...Q,detailWidthPx:Q.widthPx===void 0?void 0:Math.max(360,Q.widthPx-Ge)})},[g]),at=m.useCallback(()=>{fe.current=document.activeElement instanceof HTMLElement?document.activeElement:null},[]),At=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector(".project-search input")?.focus())},[]),$t=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector('.workspace-rail [aria-label="打开设置"]')?.focus())},[]),Rn=m.useCallback(()=>{ce&&(at(),R(!1),a(!0)),$t()},[$t,ce,at]),nr=m.useCallback(()=>{V.current=le,le&&(a(!1),R(!1),fe.current=null),E(!0)},[le]),rr=m.useCallback(()=>{E(!1),V.current&&(V.current=!1,W.current=!0,a(!0))},[]),ht=m.useCallback(()=>{a(!1),R(!1),W.current=!1;const Q=fe.current;fe.current=null,Q&&requestAnimationFrame(()=>Q.focus())},[]);m.useLayoutEffect(()=>{document.documentElement.dataset.theme=Je??"system",document.documentElement.dataset.motion=It??"system",document.documentElement.dataset.uiStyle=lt},[It,Je,lt]),m.useEffect(()=>{xe.current=n.notice;const Q=n.notice;Q&&J.current!==Q.id&&(J.current=Q.id,te(Ne=>Ne.some(_e=>_e.notice.id===Q.id)?Ne:[...Ne,{uid:++Ce.current,notice:Q}].slice(-4)))},[n.notice]),m.useEffect(()=>{const Q=n.workspaceId;if(!Q)return;const Ne=n.workspaceSessions[Q],_e=n.archivedSessions;Ne?.status==="ready"&&(_e.ownerWorkspaceId===Q&&_e.status!=="idle"||r.loadArchivedWorkspaceSessions(Q).catch(()=>{}))},[r,n.archivedSessions,n.workspaceId,n.workspaceSessions]);const sr=m.useCallback(Q=>{const Ne=D.find(_e=>_e.uid===Q);Ne&&(xe.current?.id===Ne.notice.id&&r.dismissNotice(),te(_e=>_e.filter(ze=>ze.uid!==Q)))},[r,D]),Tn=m.useCallback(Q=>{const Ne=D.find(_e=>_e.uid===Q);Ne&&(xe.current?.id===Ne.notice.id&&r.dismissNotice(),te(_e=>_e.filter(ze=>ze.uid!==Q)),r.recoverSession())},[r,D]);m.useEffect(()=>{const Q=window.matchMedia("(prefers-color-scheme: light)"),Ne=document.querySelector('meta[name="theme-color"]'),_e=()=>{Ne&&(Ne.content=jx(lt,Je??"system",Q.matches))};return _e(),Q.addEventListener("change",_e),()=>Q.removeEventListener("change",_e)},[Je,lt]),m.useEffect(()=>{a(!1),R(!1),fe.current=null,V.current=!1,W.current=!1},[n.activeSessionId,n.workspace]),m.useLayoutEffect(()=>{a(!1),R(!1),fe.current=null,W.current=!1},[O.projectNavigation.mode,O.workPanel.mode,ce,pe]),m.useEffect(()=>{const Q=Ne=>{const _e=Ho("toggle-project-navigation");if(_e&&Uo(Ne,_e.tokens)){if(Ne.preventDefault(),ce){if(o){ht();return}at(),R(!1),a(!0);return}const ze=!d.projectNavigation.expanded,Gt=!!(!ze&&document.activeElement?.closest(".workspace-rail")),ln=Ro(q,{...d,projectNavigation:{...d.projectNavigation,expanded:ze}});if(ze&&ln.projectNavigation.mode==="drawer"){_t({expanded:ze}),at(),R(!1),a(!0);return}_t({expanded:ze}),ze?At():Gt&&requestAnimationFrame(()=>{(document.querySelector('.project-navigator-collapsed [aria-label="展开项目导航"]')??document.querySelector(".mobile-nav-toggle"))?.focus()})}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[ht,At,o,ce,d.projectNavigation,at,q,_t]),m.useEffect(()=>{const Q=Ho("open-shortcut-help");if(!Q)return;const Ne=_e=>{Uo(_e,Q.tokens)&&(_e.preventDefault(),b(ze=>!ze))};return window.addEventListener("keydown",Ne),()=>window.removeEventListener("keydown",Ne)},[]),m.useEffect(()=>{if(!Te)return;const Q=document.querySelector(".conversation-column"),Ne=document.querySelector(".workspace-rail"),_e=document.querySelector(".work-panel"),ze=document.querySelector(".workbench-notice-stack"),Gt=document.querySelector(".skip-link");Q&&(Q.inert=!0),Ne&&(Ne.inert=je),_e&&(_e.inert=o),ze&&(ze.inert=!0),Gt&&(Gt.inert=!0);const ln=window.setTimeout(()=>{const Qt=je?_e?.querySelector('[aria-label="关闭工作面板"]'):W.current?Ne?.querySelector('[aria-label="打开设置"]'):Ne?.querySelector(".drawer-close");W.current=!1,Qt?.focus()},0),mn=Qt=>{Qt.key==="Escape"&&Te&&!Qt.target?.closest?.('[role="alertdialog"], dialog')&&ht()};return window.addEventListener("keydown",mn),()=>{Q&&(Q.inert=!1),Ne&&(Ne.inert=!1),_e&&(_e.inert=!1),ze&&(ze.inert=!1),Gt&&(Gt.inert=!1),window.clearTimeout(ln),window.removeEventListener("keydown",mn)}},[ht,Te,o,je,n.notice]);const Dt=m.useCallback(()=>{requestAnimationFrame(()=>document.querySelector("#main-content h1")?.focus())},[]),On=()=>{a(!1),r.createSession().then(Dt,Dt)},on=()=>{V.current=!1,W.current=!1,E(!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:ne,className:`workbench-shell project-navigation-${O.projectNavigation.mode} work-panel-mode-${O.workPanel.mode} ${ye&&w?"work-panel-transient-overlay":""}`,style:{"--project-navigation-width":`${O.projectNavigation.widthPx}px`,"--project-navigation-preferred-width":`${d.projectNavigation.widthPx}px`,"--work-panel-width":`${O.workPanel.widthPx}px`,"--work-panel-preferred-width":`${p.detailWidthPx+Ge}px`},"aria-busy":n.boot==="loading",children:[i.jsx(Dv,{state:n,drawerOpen:le,dockVisible:!0,collapsed:O.projectNavigation.mode==="rail",resizable:O.projectNavigation.mode==="dock",width:O.projectNavigation.widthPx,onExpand:()=>{ce?(at(),R(!1),a(!0)):(_t({expanded:!0}),At())},onCollapse:()=>{ce?ht():_t({expanded:!1})},onOpenWorkspaceDialog:()=>A(!0),onOpenSettings:nr,onLoadMoreWorkspaces:()=>{r.loadMoreWorkspaces()},onCreateSession:On,onLoadWorkspaceSessions:(Q,Ne)=>{r.loadWorkspaceSessions(Q,Ne)},onActivateContext:(Q,Ne)=>{a(!1),r.activateContext(Q,Ne).then(Dt,Dt)},onSetPinned:(Q,Ne)=>{r.setWorkspacePinned(Q,Ne)},onRemoveWorkspace:Q=>{r.removeWorkspace(Q)},onRefreshSummary:Q=>{r.refreshWorkspaceProjectSummary(Q)},onRenameSession:z,onSessionTags:F,onArchiveSession:Q=>{r.archiveSession(Q.id)},onDeleteSession:se,onRestoreSession:Q=>{r.restoreSession(Q.id)},onWidthPreview:Q=>{const Ne=Ro(q,{...d,projectNavigation:{...d.projectNavigation,widthPx:Q}});ne.current?.style.setProperty("--project-navigation-width",`${Ne.projectNavigation.widthPx}px`)},onWidthCommit:Q=>_t({widthPx:Q})}),i.jsx(iv,{state:n,actions:r,navigationOpen:le,navigationOverlay:ce,onOpenNavigation:()=>{at(),R(!1),a(!0)},onRevealSettings:Rn,onCreateSession:On,composerInsertion:be}),i.jsx(ix,{state:n,actions:r,mode:Z?"overlay":"dock",expanded:he,themePreference:Je,onCycleTheme:vt,onShowShortcutHelp:()=>b(!0),onToggleInspector:()=>{if(pe||ye){if(w){ht();return}at(),a(!1),R(!0);return}Et({expanded:!p.expanded})},activePanel:p.activePanel,panelOrder:d.workPanel.order,agentPanel:p.agentPanel,onExpand:()=>{pe||ye?(at(),R(!0)):Et({expanded:!0})},onCollapse:()=>{Z?ht():Et({expanded:!1})},onPanelChange:Q=>Et({activePanel:Q}),onAgentPanelChange:Q=>Et({agentPanel:Q}),onWidthPreview:Q=>{const Ne=v?Tf({containerWidth:q,navigationExpanded:d.projectNavigation.expanded,navigationWidthPx:d.projectNavigation.widthPx,workExpanded:!0,workDetailWidthPx:Math.max(360,Q-Ge)}):Ro(q,{...d,workPanel:{...d.workPanel,widthPx:Q}});ne.current?.style.setProperty("--work-panel-width",`${Ne.workPanel.widthPx}px`)},onWidthCommit:Q=>Et({widthPx:Q}),width:O.workPanel.widthPx,maxWidthPx:v?_p(q-(d.projectNavigation.expanded?d.projectNavigation.widthPx:Ge))+Ge:void 0,revealFileRequest:G,onRevealInFiles:Q=>{(pe||ye)&&R(!0),K({id:Date.now(),fileId:Q.filesToken,displayPath:Q.path}),Et({activePanel:"files"})},onSendToComposer:Q=>{$({id:Date.now(),text:Q}),pe&&ht(),requestAnimationFrame(()=>document.querySelector("#orion-composer")?.focus())},resourceNavigatorWidths:p.resourceNavigatorWidthPx,onResourceNavigatorWidthCommit:x}),Te?i.jsx("button",{type:"button",className:"drawer-scrim","aria-label":"关闭侧边面板",tabIndex:-1,onClick:ht}):null,D.length>0?i.jsx("div",{className:"workbench-notice-stack","aria-live":"polite",children:D.map(Q=>i.jsx(ow,{uid:Q.uid,notice:Q.notice,reconnectNeeded:n.connection==="replay-required",snapshotRetryNeeded:Q.notice.domain==="session-snapshot"&&Lt.status==="failed",pendingAction:!!n.pendingAction,onDismiss:sr,onRecover:Tn},Q.uid))}):null,n.boot!=="ready"?i.jsxs("section",{className:"boot-screen",role:n.boot==="error"?"alert":"status",children:[i.jsx(fp,{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(X,{name:"refresh",size:15}),"重新连接"]})]})]}):null,i.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.announcement})]}),i.jsx(dy,{open:C,onClose:rr,state:n,actions:r,onGoToSessionControls:on}),i.jsx(Xv,{open:_,onClose:()=>A(!1),state:n,onSelect:r.switchWorkspace,onLoadMore:r.loadMoreWorkspaces,onPickDirectory:r.pickWorkspaceDirectory,onInspect:r.inspectWorkspacePath}),i.jsx(Jv,{open:!!L,onClose:()=>z(null),session:L,pending:!!n.pendingAction,onRename:r.renameSession}),i.jsx(Zv,{open:!!ie,onClose:()=>F(null),session:ie,pending:!!n.pendingAction,onSave:r.updateSessionTags}),i.jsx(ty,{open:!!Se,onClose:()=>se(null),session:Se,pending:!!n.pendingAction,onConfirm:r.deleteSession}),i.jsx(Ry,{open:re,onClose:()=>b(!1)})]})}function aw(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(p=>p===f?p: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 Ap=document.getElementById("root");if(!Ap)throw new Error("Orion Web root element was not found.");Pm.createRoot(Ap).render(i.jsx(Sm.StrictMode,{children:i.jsx(lw,{})}));export{ey as C,X as I,sp as P,zo as R,Ee as W,$e as a,kp as b,Sp as c,uw as d,i as j,m as r,Pn as s};
|