@jamiexiongr/panda-hub 0.1.19 → 0.1.21
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/README.md +24 -13
- package/dist/{chunk-N5CXOFMD.mjs → chunk-SPTBBMUL.mjs} +350 -27
- package/dist/chunk-YKNCRHVV.mjs +489 -0
- package/dist/cli.mjs +17 -8
- package/dist/index.mjs +4 -2
- package/dist/{src-EGC2EU26.mjs → src-M7W7LPHG.mjs} +1 -1
- package/dist/web/assets/{diagnostics-page-CNt0HQLr.js → diagnostics-page-BKp7IiZk.js} +1 -1
- package/dist/web/assets/index-DhjIbKkn.js +142 -0
- package/dist/web/assets/index-QBVYFqgo.css +1 -0
- package/dist/web/assets/{session-diff-preview-Dy910n6F.js → session-diff-preview-BU4XO0fT.js} +1 -1
- package/dist/web/assets/{web-C7Ef9J6I.js → web-BqX5x67V.js} +1 -1
- package/dist/web/assets/{web-BFlqriRI.js → web-C3EZUi0V.js} +1 -1
- package/dist/web/assets/{web-P7eDOfOq.js → web-CIHpZyzh.js} +1 -1
- package/dist/web/assets/{web-BGzSBKmu.js → web-Ck4th-0Z.js} +1 -1
- package/dist/web/assets/{web-DCi2I8TJ.js → web-HzS7kaoe.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-SKHIQ4LT.mjs +0 -109
- package/dist/web/assets/index-5NBpaOlM.js +0 -142
- package/dist/web/assets/index-CtgLzUhf.css +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-BKp7IiZk.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var hv=e=>{throw TypeError(e)};var W1=(e,t,a)=>t.has(e)||hv("Cannot "+a);var H=(e,t,a)=>(W1(e,t,"read from private field"),a?a.call(e):t.get(e)),gt=(e,t,a)=>t.has(e)?hv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),Ye=(e,t,a,l)=>(W1(e,t,"write to private field"),l?l.call(e,a):t.set(e,a),a),Ft=(e,t,a)=>(W1(e,t,"access private method"),a);var im=(e,t,a,l)=>({set _(o){Ye(e,t,o,a)},get _(){return H(e,t,l)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&l(f)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();const F5="modulepreload",q5=function(e){return"/"+e},mv={},ao=function(t,a,l){let o=Promise.resolve();if(a&&a.length>0){let f=function(g){return Promise.all(g.map(S=>Promise.resolve(S).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=f(a.map(g=>{if(g=q5(g),g in mv)return;mv[g]=!0;const S=g.endsWith(".css"),p=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${p}`))return;const v=document.createElement("link");if(v.rel=S?"stylesheet":F5,S||(v.as="script"),v.crossOrigin="",v.href=g,y&&v.setAttribute("nonce",y),document.head.appendChild(v),S)return new Promise((w,N)=>{v.addEventListener("load",w),v.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return o.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return t().catch(u)})};function W5(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K1={exports:{}},Qd={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var pv;function K5(){if(pv)return Qd;pv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(l,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:e,type:l,key:f,ref:o!==void 0?o:null,props:u}}return Qd.Fragment=t,Qd.jsx=a,Qd.jsxs=a,Qd}var gv;function Q5(){return gv||(gv=1,K1.exports=K5()),K1.exports}var i=Q5(),Q1={exports:{}},Pt={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var _v;function G5(){if(_v)return Pt;_v=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function R(I,ne,U){this.props=I,this.context=ne,this.refs=C,this.updater=U||N}R.prototype.isReactComponent={},R.prototype.setState=function(I,ne){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,ne,"setState")},R.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function z(){}z.prototype=R.prototype;function O(I,ne,U){this.props=I,this.context=ne,this.refs=C,this.updater=U||N}var k=O.prototype=new z;k.constructor=O,j(k,R.prototype),k.isPureReactComponent=!0;var L=Array.isArray;function K(){}var J={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function Y(I,ne,U){var ie=U.ref;return{$$typeof:e,type:I,key:ne,ref:ie!==void 0?ie:null,props:U}}function Q(I,ne){return Y(I.type,ne,I.props)}function G(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function ge(I){var ne={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(U){return ne[U]})}var me=/\/+/g;function Z(I,ne){return typeof I=="object"&&I!==null&&I.key!=null?ge(""+I.key):ne.toString(36)}function he(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(K,K):(I.status="pending",I.then(function(ne){I.status==="pending"&&(I.status="fulfilled",I.value=ne)},function(ne){I.status==="pending"&&(I.status="rejected",I.reason=ne)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,ne,U,ie,Se){var se=typeof I;(se==="undefined"||se==="boolean")&&(I=null);var we=!1;if(I===null)we=!0;else switch(se){case"bigint":case"string":case"number":we=!0;break;case"object":switch(I.$$typeof){case e:case t:we=!0;break;case S:return we=I._init,M(we(I._payload),ne,U,ie,Se)}}if(we)return Se=Se(I),we=ie===""?"."+Z(I,0):ie,L(Se)?(U="",we!=null&&(U=we.replace(me,"$&/")+"/"),M(Se,ne,U,"",function(Le){return Le})):Se!=null&&(G(Se)&&(Se=Q(Se,U+(Se.key==null||I&&I.key===Se.key?"":(""+Se.key).replace(me,"$&/")+"/")+we)),ne.push(Se)),1;we=0;var ye=ie===""?".":ie+":";if(L(I))for(var Oe=0;Oe<I.length;Oe++)ie=I[Oe],se=ye+Z(ie,Oe),we+=M(ie,ne,U,se,Se);else if(Oe=w(I),typeof Oe=="function")for(I=Oe.call(I),Oe=0;!(ie=I.next()).done;)ie=ie.value,se=ye+Z(ie,Oe++),we+=M(ie,ne,U,se,Se);else if(se==="object"){if(typeof I.then=="function")return M(he(I),ne,U,ie,Se);throw ne=String(I),Error("Objects are not valid as a React child (found: "+(ne==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":ne)+"). If you meant to render a collection of children, use an array instead.")}return we}function $(I,ne,U){if(I==null)return I;var ie=[],Se=0;return M(I,ie,"","",function(se){return ne.call(U,se,Se++)}),ie}function ee(I){if(I._status===-1){var ne=I._result;ne=ne(),ne.then(function(U){(I._status===0||I._status===-1)&&(I._status=1,I._result=U)},function(U){(I._status===0||I._status===-1)&&(I._status=2,I._result=U)}),I._status===-1&&(I._status=0,I._result=ne)}if(I._status===1)return I._result.default;throw I._result}var oe=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ne=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(ne))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},ae={map:$,forEach:function(I,ne,U){$(I,function(){ne.apply(this,arguments)},U)},count:function(I){var ne=0;return $(I,function(){ne++}),ne},toArray:function(I){return $(I,function(ne){return ne})||[]},only:function(I){if(!G(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Pt.Activity=p,Pt.Children=ae,Pt.Component=R,Pt.Fragment=a,Pt.Profiler=o,Pt.PureComponent=O,Pt.StrictMode=l,Pt.Suspense=y,Pt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,Pt.__COMPILER_RUNTIME={__proto__:null,c:function(I){return J.H.useMemoCache(I)}},Pt.cache=function(I){return function(){return I.apply(null,arguments)}},Pt.cacheSignal=function(){return null},Pt.cloneElement=function(I,ne,U){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ie=j({},I.props),Se=I.key;if(ne!=null)for(se in ne.key!==void 0&&(Se=""+ne.key),ne)!q.call(ne,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&ne.ref===void 0||(ie[se]=ne[se]);var se=arguments.length-2;if(se===1)ie.children=U;else if(1<se){for(var we=Array(se),ye=0;ye<se;ye++)we[ye]=arguments[ye+2];ie.children=we}return Y(I.type,Se,ie)},Pt.createContext=function(I){return I={$$typeof:f,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:u,_context:I},I},Pt.createElement=function(I,ne,U){var ie,Se={},se=null;if(ne!=null)for(ie in ne.key!==void 0&&(se=""+ne.key),ne)q.call(ne,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(Se[ie]=ne[ie]);var we=arguments.length-2;if(we===1)Se.children=U;else if(1<we){for(var ye=Array(we),Oe=0;Oe<we;Oe++)ye[Oe]=arguments[Oe+2];Se.children=ye}if(I&&I.defaultProps)for(ie in we=I.defaultProps,we)Se[ie]===void 0&&(Se[ie]=we[ie]);return Y(I,se,Se)},Pt.createRef=function(){return{current:null}},Pt.forwardRef=function(I){return{$$typeof:m,render:I}},Pt.isValidElement=G,Pt.lazy=function(I){return{$$typeof:S,_payload:{_status:-1,_result:I},_init:ee}},Pt.memo=function(I,ne){return{$$typeof:g,type:I,compare:ne===void 0?null:ne}},Pt.startTransition=function(I){var ne=J.T,U={};J.T=U;try{var ie=I(),Se=J.S;Se!==null&&Se(U,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(K,oe)}catch(se){oe(se)}finally{ne!==null&&U.types!==null&&(ne.types=U.types),J.T=ne}},Pt.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},Pt.use=function(I){return J.H.use(I)},Pt.useActionState=function(I,ne,U){return J.H.useActionState(I,ne,U)},Pt.useCallback=function(I,ne){return J.H.useCallback(I,ne)},Pt.useContext=function(I){return J.H.useContext(I)},Pt.useDebugValue=function(){},Pt.useDeferredValue=function(I,ne){return J.H.useDeferredValue(I,ne)},Pt.useEffect=function(I,ne){return J.H.useEffect(I,ne)},Pt.useEffectEvent=function(I){return J.H.useEffectEvent(I)},Pt.useId=function(){return J.H.useId()},Pt.useImperativeHandle=function(I,ne,U){return J.H.useImperativeHandle(I,ne,U)},Pt.useInsertionEffect=function(I,ne){return J.H.useInsertionEffect(I,ne)},Pt.useLayoutEffect=function(I,ne){return J.H.useLayoutEffect(I,ne)},Pt.useMemo=function(I,ne){return J.H.useMemo(I,ne)},Pt.useOptimistic=function(I,ne){return J.H.useOptimistic(I,ne)},Pt.useReducer=function(I,ne,U){return J.H.useReducer(I,ne,U)},Pt.useRef=function(I){return J.H.useRef(I)},Pt.useState=function(I){return J.H.useState(I)},Pt.useSyncExternalStore=function(I,ne,U){return J.H.useSyncExternalStore(I,ne,U)},Pt.useTransition=function(){return J.H.useTransition()},Pt.version="19.2.4",Pt}var yv;function Bf(){return yv||(yv=1,Q1.exports=G5()),Q1.exports}var _=Bf();const Fr=W5(_);var G1={exports:{}},Gd={},Y1={exports:{}},V1={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var vv;function Y5(){return vv||(vv=1,(function(e){function t(M,$){var ee=M.length;M.push($);e:for(;0<ee;){var oe=ee-1>>>1,ae=M[oe];if(0<o(ae,$))M[oe]=$,M[ee]=ae,ee=oe;else break e}}function a(M){return M.length===0?null:M[0]}function l(M){if(M.length===0)return null;var $=M[0],ee=M.pop();if(ee!==$){M[0]=ee;e:for(var oe=0,ae=M.length,I=ae>>>1;oe<I;){var ne=2*(oe+1)-1,U=M[ne],ie=ne+1,Se=M[ie];if(0>o(U,ee))ie<ae&&0>o(Se,U)?(M[oe]=Se,M[ie]=ee,oe=ie):(M[oe]=U,M[ne]=ee,oe=ne);else if(ie<ae&&0>o(Se,ee))M[oe]=Se,M[ie]=ee,oe=ie;else break e}}return $}function o(M,$){var ee=M.sortIndex-$.sortIndex;return ee!==0?ee:M.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();e.unstable_now=function(){return f.now()-m}}var y=[],g=[],S=1,p=null,v=3,w=!1,N=!1,j=!1,C=!1,R=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(M){for(var $=a(g);$!==null;){if($.callback===null)l(g);else if($.startTime<=M)l(g),$.sortIndex=$.expirationTime,t(y,$);else break;$=a(g)}}function L(M){if(j=!1,k(M),!N)if(a(y)!==null)N=!0,K||(K=!0,ge());else{var $=a(g);$!==null&&he(L,$.startTime-M)}}var K=!1,J=-1,q=5,Y=-1;function Q(){return C?!0:!(e.unstable_now()-Y<q)}function G(){if(C=!1,K){var M=e.unstable_now();Y=M;var $=!0;try{e:{N=!1,j&&(j=!1,z(J),J=-1),w=!0;var ee=v;try{t:{for(k(M),p=a(y);p!==null&&!(p.expirationTime>M&&Q());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,v=p.priorityLevel;var ae=oe(p.expirationTime<=M);if(M=e.unstable_now(),typeof ae=="function"){p.callback=ae,k(M),$=!0;break t}p===a(y)&&l(y),k(M)}else l(y);p=a(y)}if(p!==null)$=!0;else{var I=a(g);I!==null&&he(L,I.startTime-M),$=!1}}break e}finally{p=null,v=ee,w=!1}$=void 0}}finally{$?ge():K=!1}}}var ge;if(typeof O=="function")ge=function(){O(G)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,Z=me.port2;me.port1.onmessage=G,ge=function(){Z.postMessage(null)}}else ge=function(){R(G,0)};function he(M,$){J=R(function(){M(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(M){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var ee=v;v=$;try{return M()}finally{v=ee}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(M,$){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var ee=v;v=M;try{return $()}finally{v=ee}},e.unstable_scheduleCallback=function(M,$,ee){var oe=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?oe+ee:oe):ee=oe,M){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=ee+ae,M={id:S++,callback:$,priorityLevel:M,startTime:ee,expirationTime:ae,sortIndex:-1},ee>oe?(M.sortIndex=ee,t(g,M),a(y)===null&&M===a(g)&&(j?(z(J),J=-1):j=!0,he(L,ee-oe))):(M.sortIndex=ae,t(y,M),N||w||(N=!0,K||(K=!0,ge()))),M},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(M){var $=v;return function(){var ee=v;v=$;try{return M.apply(this,arguments)}finally{v=ee}}}})(V1)),V1}var bv;function V5(){return bv||(bv=1,Y1.exports=Y5()),Y1.exports}var Z1={exports:{}},Qs={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var xv;function Z5(){if(xv)return Qs;xv=1;var e=Bf();function t(y){var g="https://react.dev/errors/"+y;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)g+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+y+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var l={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(y,g,S){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:y,containerInfo:g,implementation:S}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,g){if(y==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Qs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Qs.createPortal=function(y,g){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return u(y,g,null,S)},Qs.flushSync=function(y){var g=f.T,S=l.p;try{if(f.T=null,l.p=2,y)return y()}finally{f.T=g,l.p=S,l.d.f()}},Qs.preconnect=function(y,g){typeof y=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(y,g))},Qs.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},Qs.preinit=function(y,g){if(typeof y=="string"&&g&&typeof g.as=="string"){var S=g.as,p=m(S,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,w=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;S==="style"?l.d.S(y,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:w}):S==="script"&&l.d.X(y,{crossOrigin:p,integrity:v,fetchPriority:w,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Qs.preinitModule=function(y,g){if(typeof y=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var S=m(g.as,g.crossOrigin);l.d.M(y,{crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(y)},Qs.preload=function(y,g){if(typeof y=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var S=g.as,p=m(S,g.crossOrigin);l.d.L(y,S,{crossOrigin:p,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Qs.preloadModule=function(y,g){if(typeof y=="string")if(g){var S=m(g.as,g.crossOrigin);l.d.m(y,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(y)},Qs.requestFormReset=function(y){l.d.r(y)},Qs.unstable_batchedUpdates=function(y,g){return y(g)},Qs.useFormState=function(y,g,S){return f.H.useFormState(y,g,S)},Qs.useFormStatus=function(){return f.H.useHostTransitionStatus()},Qs.version="19.2.4",Qs}var Sv;function S2(){if(Sv)return Z1.exports;Sv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Z1.exports=Z5(),Z1.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var jv;function X5(){if(jv)return Gd;jv=1;var e=V5(),t=Bf(),a=S2();function l(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var s=n,r=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(r=s.return),n=s.return;while(n)}return s.tag===3?r:null}function f(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function m(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function y(n){if(u(n)!==n)throw Error(l(188))}function g(n){var s=n.alternate;if(!s){if(s=u(n),s===null)throw Error(l(188));return s!==n?null:n}for(var r=n,c=s;;){var d=r.return;if(d===null)break;var h=d.alternate;if(h===null){if(c=d.return,c!==null){r=c;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===r)return y(d),n;if(h===c)return y(d),s;h=h.sibling}throw Error(l(188))}if(r.return!==c.return)r=d,c=h;else{for(var x=!1,E=d.child;E;){if(E===r){x=!0,r=d,c=h;break}if(E===c){x=!0,c=d,r=h;break}E=E.sibling}if(!x){for(E=h.child;E;){if(E===r){x=!0,r=h,c=d;break}if(E===c){x=!0,c=h,r=d;break}E=E.sibling}if(!x)throw Error(l(189))}}if(r.alternate!==c)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?n:s}function S(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=S(n),s!==null)return s;n=n.sibling}return null}var p=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),O=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function ge(n){return n===null||typeof n!="object"?null:(n=G&&n[G]||n["@@iterator"],typeof n=="function"?n:null)}var me=Symbol.for("react.client.reference");function Z(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===me?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case R:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case K:return"SuspenseList";case Y:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case O:return n.displayName||"Context";case z:return(n._context.displayName||"Context")+".Consumer";case k:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case J:return s=n.displayName||null,s!==null?s:Z(n.type)||"Memo";case q:s=n._payload,n=n._init;try{return Z(n(s))}catch{}}return null}var he=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},oe=[],ae=-1;function I(n){return{current:n}}function ne(n){0>ae||(n.current=oe[ae],oe[ae]=null,ae--)}function U(n,s){ae++,oe[ae]=n.current,n.current=s}var ie=I(null),Se=I(null),se=I(null),we=I(null);function ye(n,s){switch(U(se,s),U(Se,n),U(ie,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?L8(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=L8(s),n=P8(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ne(ie),U(ie,n)}function Oe(){ne(ie),ne(Se),ne(se)}function Le(n){n.memoizedState!==null&&U(we,n);var s=ie.current,r=P8(s,n.type);s!==r&&(U(Se,n),U(ie,r))}function _t(n){Se.current===n&&(ne(ie),ne(Se)),we.current===n&&(ne(we),Fd._currentValue=ee)}var Ke,tt;function nn(n){if(Ke===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",tt=-1<r.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Ke+n+tt}var Xt=!1;function jn(n,s){if(!n||Xt)return"";Xt=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(ve){var de=ve}Reflect.construct(n,[],ke)}else{try{ke.call()}catch(ve){de=ve}n.call(ke.prototype)}}else{try{throw Error()}catch(ve){de=ve}(ke=n())&&typeof ke.catch=="function"&&ke.catch(function(){})}}catch(ve){if(ve&&de&&typeof ve.stack=="string")return[ve.stack,de.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=c.DetermineComponentFrameRoot(),x=h[0],E=h[1];if(x&&E){var B=x.split(`
|
|
45
|
+
`),le=E.split(`
|
|
46
|
+
`);for(d=c=0;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;for(;d<le.length&&!le[d].includes("DetermineComponentFrameRoot");)d++;if(c===B.length||d===le.length)for(c=B.length-1,d=le.length-1;1<=c&&0<=d&&B[c]!==le[d];)d--;for(;1<=c&&0<=d;c--,d--)if(B[c]!==le[d]){if(c!==1||d!==1)do if(c--,d--,0>d||B[c]!==le[d]){var xe=`
|
|
47
|
+
`+B[c].replace(" at new "," at ");return n.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",n.displayName)),xe}while(1<=c&&0<=d);break}}}finally{Xt=!1,Error.prepareStackTrace=r}return(r=n?n.displayName||n.name:"")?nn(r):""}function zt(n,s){switch(n.tag){case 26:case 27:case 5:return nn(n.type);case 16:return nn("Lazy");case 13:return n.child!==s&&s!==null?nn("Suspense Fallback"):nn("Suspense");case 19:return nn("SuspenseList");case 0:case 15:return jn(n.type,!1);case 11:return jn(n.type.render,!1);case 1:return jn(n.type,!0);case 31:return nn("Activity");default:return""}}function Bt(n){try{var s="",r=null;do s+=zt(n,r),r=n,n=n.return;while(n);return s}catch(c){return`
|
|
48
|
+
Error generating stack: `+c.message+`
|
|
49
|
+
`+c.stack}}var yt=Object.prototype.hasOwnProperty,bt=e.unstable_scheduleCallback,dt=e.unstable_cancelCallback,cn=e.unstable_shouldYield,Pn=e.unstable_requestPaint,Ee=e.unstable_now,V=e.unstable_getCurrentPriorityLevel,_e=e.unstable_ImmediatePriority,Te=e.unstable_UserBlockingPriority,Ie=e.unstable_NormalPriority,ce=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,qe=e.log,xt=e.unstable_setDisableYieldValue,Dt=null,ue=null;function Me(n){if(typeof qe=="function"&&xt(n),ue&&typeof ue.setStrictMode=="function")try{ue.setStrictMode(Dt,n)}catch{}}var Re=Math.clz32?Math.clz32:Je,We=Math.log,Xe=Math.LN2;function Je(n){return n>>>=0,n===0?32:31-(We(n)/Xe|0)|0}var Tt=256,Wt=262144,ls=4194304;function Nt(n){var s=n&42;if(s!==0)return s;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Un(n,s,r){var c=n.pendingLanes;if(c===0)return 0;var d=0,h=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var E=c&134217727;return E!==0?(c=E&~h,c!==0?d=Nt(c):(x&=E,x!==0?d=Nt(x):r||(r=E&~n,r!==0&&(d=Nt(r))))):(E=c&~h,E!==0?d=Nt(E):x!==0?d=Nt(x):r||(r=c&~n,r!==0&&(d=Nt(r)))),d===0?0:s!==0&&s!==d&&(s&h)===0&&(h=d&-d,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:d}function Cn(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function Dn(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function De(){var n=ls;return ls<<=1,(ls&62914560)===0&&(ls=4194304),n}function Qt(n){for(var s=[],r=0;31>r;r++)s.push(n);return s}function On(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ts(n,s,r,c,d,h){var x=n.pendingLanes;n.pendingLanes=r,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=r,n.entangledLanes&=r,n.errorRecoveryDisabledLanes&=r,n.shellSuspendCounter=0;var E=n.entanglements,B=n.expirationTimes,le=n.hiddenUpdates;for(r=x&~r;0<r;){var xe=31-Re(r),ke=1<<xe;E[xe]=0,B[xe]=-1;var de=le[xe];if(de!==null)for(le[xe]=null,xe=0;xe<de.length;xe++){var ve=de[xe];ve!==null&&(ve.lane&=-536870913)}r&=~ke}c!==0&&Ua(n,c,0),h!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=h&~(x&~s))}function Ua(n,s,r){n.pendingLanes|=s,n.suspendedLanes&=~s;var c=31-Re(s);n.entangledLanes|=s,n.entanglements[c]=n.entanglements[c]|1073741824|r&261930}function Us(n,s){var r=n.entangledLanes|=s;for(n=n.entanglements;r;){var c=31-Re(r),d=1<<c;d&s|n[c]&s&&(n[c]|=s),r&=~d}}function Ci(n,s){var r=s&-s;return r=(r&42)!==0?1:Fn(r),(r&(n.suspendedLanes|s))!==0?0:r}function Fn(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Vs(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function te(){var n=$.p;return n!==0?n:(n=window.event,n===void 0?32:rv(n.type))}function Pe(n,s){var r=$.p;try{return $.p=n,s()}finally{$.p=r}}var $e=Math.random().toString(36).slice(2),at="__reactFiber$"+$e,Ut="__reactProps$"+$e,ft="__reactContainer$"+$e,Mt="__reactEvents$"+$e,qn="__reactListeners$"+$e,jt="__reactHandles$"+$e,zs="__reactResources$"+$e,Kt="__reactMarker$"+$e;function bs(n){delete n[at],delete n[Ut],delete n[Mt],delete n[qn],delete n[jt]}function Wn(n){var s=n[at];if(s)return s;for(var r=n.parentNode;r;){if(s=r[ft]||r[at]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(n=q8(n);n!==null;){if(r=n[at])return r;n=q8(n)}return s}n=r,r=n.parentNode}return null}function P(n){if(n=n[at]||n[ft]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function be(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(l(33))}function Ue(n){var s=n[zs];return s||(s=n[zs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function He(n){n[Kt]=!0}var Ge=new Set,ht={};function mt(n,s){ot(n,s),ot(n+"Capture",s)}function ot(n,s){for(ht[n]=s,n=0;n<s.length;n++)Ge.add(s[n])}var Xn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Jt={},Jn={};function as(n){return yt.call(Jn,n)?!0:yt.call(Jt,n)?!1:Xn.test(n)?Jn[n]=!0:(Jt[n]=!0,!1)}function In(n,s,r){if(as(s))if(r===null)n.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var c=s.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+r)}}function pn(n,s,r){if(r===null)n.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+r)}}function sn(n,s,r,c){if(c===null)n.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttributeNS(s,r,""+c)}}function wn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xs(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function A(n,s,r){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var d=c.get,h=c.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return d.call(this)},set:function(x){r=""+x,h.call(this,x)}}),Object.defineProperty(n,s,{enumerable:c.enumerable}),{getValue:function(){return r},setValue:function(x){r=""+x},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function pe(n){if(!n._valueTracker){var s=xs(n)?"checked":"value";n._valueTracker=A(n,s,""+n[s])}}function et(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var r=s.getValue(),c="";return n&&(c=xs(n)?n.checked?"true":"false":n.value),n=c,n!==r?(s.setValue(n),!0):!1}function Lt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var pt=/[\n"\\]/g;function ct(n){return n.replace(pt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function gn(n,s,r,c,d,h,x,E){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),s!=null?x==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+wn(s)):n.value!==""+wn(s)&&(n.value=""+wn(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?za(n,x,wn(s)):r!=null?za(n,x,wn(r)):c!=null&&n.removeAttribute("value"),d==null&&h!=null&&(n.defaultChecked=!!h),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?n.name=""+wn(E):n.removeAttribute("name")}function zn(n,s,r,c,d,h,x,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(n.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){pe(n);return}r=r!=null?""+wn(r):"",s=s!=null?""+wn(s):r,E||s===n.value||(n.value=s),n.defaultValue=s}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=E?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),pe(n)}function za(n,s,r){s==="number"&&Lt(n.ownerDocument)===n||n.defaultValue===""+r||(n.defaultValue=""+r)}function Bs(n,s,r,c){if(n=n.options,s){s={};for(var d=0;d<r.length;d++)s["$"+r[d]]=!0;for(r=0;r<n.length;r++)d=s.hasOwnProperty("$"+n[r].value),n[r].selected!==d&&(n[r].selected=d),d&&c&&(n[r].defaultSelected=!0)}else{for(r=""+wn(r),s=null,d=0;d<n.length;d++){if(n[d].value===r){n[d].selected=!0,c&&(n[d].defaultSelected=!0);return}s!==null||n[d].disabled||(s=n[d])}s!==null&&(s.selected=!0)}}function Hs(n,s,r){if(s!=null&&(s=""+wn(s),s!==n.value&&(n.value=s),r==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=r!=null?""+wn(r):""}function Zs(n,s,r,c){if(s==null){if(c!=null){if(r!=null)throw Error(l(92));if(he(c)){if(1<c.length)throw Error(l(93));c=c[0]}r=c}r==null&&(r=""),s=r}r=wn(s),n.defaultValue=r,c=n.textContent,c===r&&c!==""&&c!==null&&(n.value=c),pe(n)}function $s(n,s){if(s){var r=n.firstChild;if(r&&r===n.lastChild&&r.nodeType===3){r.nodeValue=s;return}}n.textContent=s}var ri=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ti(n,s,r){var c=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?c?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":c?n.setProperty(s,r):typeof r!="number"||r===0||ri.has(s)?s==="float"?n.cssFloat=r:n[s]=(""+r).trim():n[s]=r+"px"}function er(n,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(n=n.style,r!=null){for(var c in r)!r.hasOwnProperty(c)||s!=null&&s.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var d in s)c=s[d],s.hasOwnProperty(d)&&r[d]!==c&&Ti(n,d,c)}else for(var h in s)s.hasOwnProperty(h)&&Ti(n,h,s[h])}function tr(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var nr=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),sr=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ba(n){return sr.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ms(){}var Ha=null;function ar(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Xs=null,Ss=null;function ir(n){var s=P(n);if(s&&(n=s.stateNode)){var r=n[Ut]||null;e:switch(n=s.stateNode,s.type){case"input":if(gn(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=n;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+ct(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var c=r[s];if(c!==n&&c.form===n.form){var d=c[Ut]||null;if(!d)throw Error(l(90));gn(c,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<r.length;s++)c=r[s],c.form===n.form&&et(c)}break e;case"textarea":Hs(n,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Bs(n,!!r.multiple,s,!1)}}}var rr=!1;function li(n,s,r){if(rr)return n(s,r);rr=!0;try{var c=n(s);return c}finally{if(rr=!1,(Xs!==null||Ss!==null)&&(Ph(),Xs&&(s=Xs,n=Ss,Ss=Xs=null,ir(s),n)))for(s=0;s<n.length;s++)ir(n[s])}}function Mi(n,s){var r=n.stateNode;if(r===null)return null;var c=r[Ut]||null;if(c===null)return null;r=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(Js)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{Yu=!1}var wa=null,lo=null,Ri=null;function lr(){if(Ri)return Ri;var n,s=lo,r=s.length,c,d="value"in wa?wa.value:wa.textContent,h=d.length;for(n=0;n<r&&s[n]===d[n];n++);var x=r-n;for(c=1;c<=x&&s[r-c]===d[h-c];c++);return Ri=d.slice(n,1<c?1-c:void 0)}function Ai(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Di(){return!0}function Vu(){return!1}function os(n){function s(r,c,d,h,x){this._reactName=r,this._targetInst=d,this.type=c,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var E in n)n.hasOwnProperty(E)&&(r=n[E],this[E]=r?r(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Di:Vu,this.isPropagationStopped=Vu,this}return p(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Di)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Di)},persist:function(){},isPersistent:Di}),s}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vr=os(es),ci=p({},es,{view:0,detail:0}),oo=os(ci),$a,fe,on,Rs=p({},ci,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xu,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==on&&(on&&n.type==="mousemove"?($a=n.screenX-on.screenX,fe=n.screenY-on.screenY):fe=$a=0,on=n),$a)},movementY:function(n){return"movementY"in n?n.movementY:fe}}),ui=os(Rs),Na=p({},Rs,{dataTransfer:0}),_n=os(Na),Zr=p({},ci,{relatedTarget:0}),Xr=os(Zr),Yf=p({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),Vf=os(Yf),fc=p({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Zf=os(fc),kp=p({},es,{data:0}),hc=os(kp),ps={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Zu={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"},Ep={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function or(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=Ep[n])?!!s[n]:!1}function Xu(){return or}var bn=p({},ci,{key:function(n){if(n.key){var s=ps[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Ai(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Zu[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xu,charCode:function(n){return n.type==="keypress"?Ai(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ai(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Jr=os(bn),Xf=p({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),co=os(Xf),Ju=p({},ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xu}),Jf=os(Ju),mc=p({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),eh=os(mc),ra=p({},Rs,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),uo=os(ra),Cp=p({},es,{newState:0,oldState:0}),Tp=os(Cp),pc=[9,13,27,32],di=Js&&"CompositionEvent"in window,el=null;Js&&"documentMode"in document&&(el=document.documentMode);var ed=Js&&"TextEvent"in window&&!el,td=Js&&(!di||el&&8<el&&11>=el),th=" ",cr=!1;function ka(n,s){switch(n){case"keyup":return pc.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ur(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var la=!1;function nd(n,s){switch(n){case"compositionend":return ur(s);case"keypress":return s.which!==32?null:(cr=!0,th);case"textInput":return n=s.data,n===th&&cr?null:n;default:return null}}function gc(n,s){if(la)return n==="compositionend"||!di&&ka(n,s)?(n=lr(),Ri=lo=wa=null,la=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return td&&s.locale!=="ko"?null:s.data;default:return null}}var nh={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 tl(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!nh[n.type]:s==="textarea"}function nl(n,s,r,c){Xs?Ss?Ss.push(c):Ss=[c]:Xs=c,s=qh(s,"onChange"),0<s.length&&(r=new Vr("onChange","change",null,r,c),n.push({event:r,listeners:s}))}var sl=null,oa=null;function _c(n){M8(n,0)}function fi(n){var s=be(n);if(et(s))return n}function sd(n,s){if(n==="change")return s}var Fa=!1;if(Js){var Kn;if(Js){var al="oninput"in document;if(!al){var Fs=document.createElement("div");Fs.setAttribute("oninput","return;"),al=typeof Fs.oninput=="function"}Kn=al}else Kn=!1;Fa=Kn&&(!document.documentMode||9<document.documentMode)}function qa(){sl&&(sl.detachEvent("onpropertychange",Wa),oa=sl=null)}function Wa(n){if(n.propertyName==="value"&&fi(oa)){var s=[];nl(s,oa,n,ar(n)),li(_c,s)}}function yc(n,s,r){n==="focusin"?(qa(),sl=s,oa=r,sl.attachEvent("onpropertychange",Wa)):n==="focusout"&&qa()}function vc(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return fi(oa)}function cs(n,s){if(n==="click")return fi(s)}function bc(n,s){if(n==="input"||n==="change")return fi(s)}function sh(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var js=typeof Object.is=="function"?Object.is:sh;function dr(n,s){if(js(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var r=Object.keys(n),c=Object.keys(s);if(r.length!==c.length)return!1;for(c=0;c<r.length;c++){var d=r[c];if(!yt.call(s,d)||!js(n[d],s[d]))return!1}return!0}function ad(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function il(n,s){var r=ad(n);n=0;for(var c;r;){if(r.nodeType===3){if(c=n+r.textContent.length,n<=s&&c>=s)return{node:r,offset:s-n};n=c}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ad(r)}}function fo(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?fo(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function ah(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=Lt(n.document);s instanceof n.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)n=s.contentWindow;else break;s=Lt(n.document)}return s}function xc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var ih=Js&&"documentMode"in document&&11>=document.documentMode,rl=null,ho=null,fr=null,ll=!1;function id(n,s,r){var c=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ll||rl==null||rl!==Lt(c)||(c=rl,"selectionStart"in c&&xc(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),fr&&dr(fr,c)||(fr=c,c=qh(ho,"onSelect"),0<c.length&&(s=new Vr("onSelect","select",null,s,r),n.push({event:s,listeners:c}),s.target=rl)))}function Ka(n,s){var r={};return r[n.toLowerCase()]=s.toLowerCase(),r["Webkit"+n]="webkit"+s,r["Moz"+n]="moz"+s,r}var Oi={animationend:Ka("Animation","AnimationEnd"),animationiteration:Ka("Animation","AnimationIteration"),animationstart:Ka("Animation","AnimationStart"),transitionrun:Ka("Transition","TransitionRun"),transitionstart:Ka("Transition","TransitionStart"),transitioncancel:Ka("Transition","TransitionCancel"),transitionend:Ka("Transition","TransitionEnd")},Sc={},rd={};Js&&(rd=document.createElement("div").style,"AnimationEvent"in window||(delete Oi.animationend.animation,delete Oi.animationiteration.animation,delete Oi.animationstart.animation),"TransitionEvent"in window||delete Oi.transitionend.transition);function hr(n){if(Sc[n])return Sc[n];if(!Oi[n])return n;var s=Oi[n],r;for(r in s)if(s.hasOwnProperty(r)&&r in rd)return Sc[n]=s[r];return n}var Ii=hr("animationend"),rh=hr("animationiteration"),lh=hr("animationstart"),Mp=hr("transitionrun"),oh=hr("transitionstart"),Rp=hr("transitioncancel"),ch=hr("transitionend"),ca=new Map,jc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");jc.push("scrollEnd");function Ea(n,s){ca.set(n,s),mt(s,[n])}var wc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},ua=[],ol=0,ea=0;function Nc(){for(var n=ol,s=ea=ol=0;s<n;){var r=ua[s];ua[s++]=null;var c=ua[s];ua[s++]=null;var d=ua[s];ua[s++]=null;var h=ua[s];if(ua[s++]=null,c!==null&&d!==null){var x=c.pending;x===null?d.next=d:(d.next=x.next,x.next=d),c.pending=d}h!==0&&uh(r,d,h)}}function mo(n,s,r,c){ua[ol++]=n,ua[ol++]=s,ua[ol++]=r,ua[ol++]=c,ea|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function ld(n,s,r,c){return mo(n,s,r,c),po(n)}function mr(n,s){return mo(n,null,null,s),po(n)}function uh(n,s,r){n.lanes|=r;var c=n.alternate;c!==null&&(c.lanes|=r);for(var d=!1,h=n.return;h!==null;)h.childLanes|=r,c=h.alternate,c!==null&&(c.childLanes|=r),h.tag===22&&(n=h.stateNode,n===null||n._visibility&1||(d=!0)),n=h,h=h.return;return n.tag===3?(h=n.stateNode,d&&s!==null&&(d=31-Re(r),n=h.hiddenUpdates,c=n[d],c===null?n[d]=[s]:c.push(s),s.lane=r|536870912),h):null}function po(n){if(50<Ld)throw Ld=0,p1=null,Error(l(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var cl={};function As(n,s,r,c){this.tag=n,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ds(n,s,r,c){return new As(n,s,r,c)}function go(n){return n=n.prototype,!(!n||!n.isReactComponent)}function hi(n,s){var r=n.alternate;return r===null?(r=Ds(n.tag,s,n.key,n.mode),r.elementType=n.elementType,r.type=n.type,r.stateNode=n.stateNode,r.alternate=n,n.alternate=r):(r.pendingProps=s,r.type=n.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=n.flags&65011712,r.childLanes=n.childLanes,r.lanes=n.lanes,r.child=n.child,r.memoizedProps=n.memoizedProps,r.memoizedState=n.memoizedState,r.updateQueue=n.updateQueue,s=n.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=n.sibling,r.index=n.index,r.ref=n.ref,r.refCleanup=n.refCleanup,r}function dh(n,s){n.flags&=65011714;var r=n.alternate;return r===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=r.childLanes,n.lanes=r.lanes,n.child=r.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=r.memoizedProps,n.memoizedState=r.memoizedState,n.updateQueue=r.updateQueue,n.type=r.type,s=r.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function kc(n,s,r,c,d,h){var x=0;if(c=n,typeof n=="function")go(n)&&(x=1);else if(typeof n=="string")x=R5(n,r,ie.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case Y:return n=Ds(31,r,s,d),n.elementType=Y,n.lanes=h,n;case j:return Qa(r.children,d,h,s);case C:x=8,d|=24;break;case R:return n=Ds(12,r,s,d|2),n.elementType=R,n.lanes=h,n;case L:return n=Ds(13,r,s,d),n.elementType=L,n.lanes=h,n;case K:return n=Ds(19,r,s,d),n.elementType=K,n.lanes=h,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case O:x=10;break e;case z:x=9;break e;case k:x=11;break e;case J:x=14;break e;case q:x=16,c=null;break e}x=29,r=Error(l(130,n===null?"null":typeof n,"")),c=null}return s=Ds(x,r,s,d),s.elementType=n,s.type=c,s.lanes=h,s}function Qa(n,s,r,c){return n=Ds(7,n,c,s),n.lanes=r,n}function qs(n,s,r){return n=Ds(6,n,null,s),n.lanes=r,n}function Ca(n){var s=Ds(18,null,null,0);return s.stateNode=n,s}function mi(n,s,r){return s=Ds(4,n.children!==null?n.children:[],n.key,s),s.lanes=r,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var od=new WeakMap;function Ws(n,s){if(typeof n=="object"&&n!==null){var r=od.get(n);return r!==void 0?r:(s={value:n,source:s,stack:Bt(s)},od.set(n,s),s)}return{value:n,source:s,stack:Bt(s)}}var Li=[],pi=0,ul=null,Ta=0,da=[],ws=0,Pi=null,Ma=1,Ga="";function Ya(n,s){Li[pi++]=Ta,Li[pi++]=ul,ul=n,Ta=s}function cd(n,s,r){da[ws++]=Ma,da[ws++]=Ga,da[ws++]=Pi,Pi=n;var c=Ma;n=Ga;var d=32-Re(c)-1;c&=~(1<<d),r+=1;var h=32-Re(s)+d;if(30<h){var x=d-d%5;h=(c&(1<<x)-1).toString(32),c>>=x,d-=x,Ma=1<<32-Re(s)+d|r<<d|c,Ga=h+n}else Ma=1<<h|r<<d|c,Ga=n}function Va(n){n.return!==null&&(Ya(n,1),cd(n,1,0))}function Ec(n){for(;n===ul;)ul=Li[--pi],Li[pi]=null,Ta=Li[--pi],Li[pi]=null;for(;n===Pi;)Pi=da[--ws],da[ws]=null,Ga=da[--ws],da[ws]=null,Ma=da[--ws],da[ws]=null}function ud(n,s){da[ws++]=Ma,da[ws++]=Ga,da[ws++]=Pi,Ma=s.id,Ga=s.overflow,Pi=n}var us=null,Tn=null,Gt=!1,Ui=null,fa=!1,dd=Error(l(519));function gi(n){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _o(Ws(s,n)),dd}function fh(n){var s=n.stateNode,r=n.type,c=n.memoizedProps;switch(s[at]=n,s[Ut]=c,r){case"dialog":Zt("cancel",s),Zt("close",s);break;case"iframe":case"object":case"embed":Zt("load",s);break;case"video":case"audio":for(r=0;r<Ud.length;r++)Zt(Ud[r],s);break;case"source":Zt("error",s);break;case"img":case"image":case"link":Zt("error",s),Zt("load",s);break;case"details":Zt("toggle",s);break;case"input":Zt("invalid",s),zn(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Zt("invalid",s);break;case"textarea":Zt("invalid",s),Zs(s,c.value,c.defaultValue,c.children)}r=c.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||c.suppressHydrationWarning===!0||O8(s.textContent,r)?(c.popover!=null&&(Zt("beforetoggle",s),Zt("toggle",s)),c.onScroll!=null&&Zt("scroll",s),c.onScrollEnd!=null&&Zt("scrollend",s),c.onClick!=null&&(s.onclick=Ms),s=!0):s=!1,s||gi(n,!0)}function hh(n){for(us=n.return;us;)switch(us.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:us=us.return}}function dl(n){if(n!==us)return!1;if(!Gt)return hh(n),Gt=!0,!1;var s=n.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=n.type,r=!(r!=="form"&&r!=="button")||M1(n.type,n.memoizedProps)),r=!r),r&&Tn&&gi(n),hh(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));Tn=F8(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(317));Tn=F8(n)}else s===27?(s=Tn,El(n.type)?(n=I1,I1=null,Tn=n):Tn=s):Tn=us?Ja(n.stateNode.nextSibling):null;return!0}function pr(){Tn=us=null,Gt=!1}function fd(){var n=Ui;return n!==null&&(_a===null?_a=n:_a.push.apply(_a,n),Ui=null),n}function _o(n){Ui===null?Ui=[n]:Ui.push(n)}var hd=I(null),gr=null,_i=null;function ta(n,s,r){U(hd,s._currentValue),s._currentValue=r}function yi(n){n._currentValue=hd.current,ne(hd)}function md(n,s,r){for(;n!==null;){var c=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),n===r)break;n=n.return}}function pd(n,s,r,c){var d=n.child;for(d!==null&&(d.return=n);d!==null;){var h=d.dependencies;if(h!==null){var x=d.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=d;for(var B=0;B<s.length;B++)if(E.context===s[B]){h.lanes|=r,E=h.alternate,E!==null&&(E.lanes|=r),md(h.return,r,n),c||(x=null);break e}h=E.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(l(341));x.lanes|=r,h=x.alternate,h!==null&&(h.lanes|=r),md(x,r,n),x=null}else x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===n){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}function fl(n,s,r,c){n=null;for(var d=s,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var x=d.alternate;if(x===null)throw Error(l(387));if(x=x.memoizedProps,x!==null){var E=d.type;js(d.pendingProps.value,x.value)||(n!==null?n.push(E):n=[E])}}else if(d===we.current){if(x=d.alternate,x===null)throw Error(l(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(Fd):n=[Fd])}d=d.return}n!==null&&pd(s,n,r,c),s.flags|=262144}function Cc(n){for(n=n.firstContext;n!==null;){if(!js(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function _r(n){gr=n,_i=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function gs(n){return mh(gr,n)}function Tc(n,s){return gr===null&&_r(n),mh(n,s)}function mh(n,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},_i===null){if(n===null)throw Error(l(308));_i=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else _i=_i.next=s;return r}var Ap=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(r,c){n.push(c)}};this.abort=function(){s.aborted=!0,n.forEach(function(r){return r()})}},ph=e.unstable_scheduleCallback,gh=e.unstable_NormalPriority,Vn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gd(){return{controller:new Ap,data:new Map,refCount:0}}function hl(n){n.refCount--,n.refCount===0&&ph(gh,function(){n.controller.abort()})}var ml=null,Mc=0,yr=0,vr=null;function _h(n,s){if(ml===null){var r=ml=[];Mc=0,yr=x1(),vr={status:"pending",value:void 0,then:function(c){r.push(c)}}}return Mc++,s.then(_d,_d),s}function _d(){if(--Mc===0&&ml!==null){vr!==null&&(vr.status="fulfilled");var n=ml;ml=null,yr=0,vr=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function Dp(n,s){var r=[],c={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return n.then(function(){c.status="fulfilled",c.value=s;for(var d=0;d<r.length;d++)(0,r[d])(s)},function(d){for(c.status="rejected",c.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),c}var yh=M.S;M.S=function(n,s){a8=Ee(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&_h(n,s),yh!==null&&yh(n,s)};var br=I(null);function Rc(){var n=br.current;return n!==null?n:An.pooledCache}function yo(n,s){s===null?U(br,br.current):U(br,s.pool)}function vh(){var n=Rc();return n===null?null:{parent:Vn._currentValue,pool:n}}var pl=Error(l(460)),yd=Error(l(474)),vo=Error(l(542)),bo={then:function(){}};function vd(n){return n=n.status,n==="fulfilled"||n==="rejected"}function xo(n,s,r){switch(r=n[r],r===void 0?n.push(s):r!==s&&(s.then(Ms,Ms),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,xd(n),n;default:if(typeof s.status=="string")s.then(Ms,Ms);else{if(n=An,n!==null&&100<n.shellSuspendCounter)throw Error(l(482));n=s,n.status="pending",n.then(function(c){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=c}},function(c){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=c}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,xd(n),n}throw Bi=s,pl}}function zi(n){try{var s=n._init;return s(n._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Bi=r,pl):r}}var Bi=null;function bd(){if(Bi===null)throw Error(l(459));var n=Bi;return Bi=null,n}function xd(n){if(n===pl||n===vo)throw Error(l(483))}var xr=null,gl=0;function So(n){var s=gl;return gl+=1,xr===null&&(xr=[]),xo(xr,n,s)}function _l(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function jo(n,s){throw s.$$typeof===v?Error(l(525)):(n=Object.prototype.toString.call(s),Error(l(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function Sd(n){function s(X,W){if(n){var re=X.deletions;re===null?(X.deletions=[W],X.flags|=16):re.push(W)}}function r(X,W){if(!n)return null;for(;W!==null;)s(X,W),W=W.sibling;return null}function c(X){for(var W=new Map;X!==null;)X.key!==null?W.set(X.key,X):W.set(X.index,X),X=X.sibling;return W}function d(X,W){return X=hi(X,W),X.index=0,X.sibling=null,X}function h(X,W,re){return X.index=re,n?(re=X.alternate,re!==null?(re=re.index,re<W?(X.flags|=67108866,W):re):(X.flags|=67108866,W)):(X.flags|=1048576,W)}function x(X){return n&&X.alternate===null&&(X.flags|=67108866),X}function E(X,W,re,Ne){return W===null||W.tag!==6?(W=qs(re,X.mode,Ne),W.return=X,W):(W=d(W,re),W.return=X,W)}function B(X,W,re,Ne){var vt=re.type;return vt===j?xe(X,W,re.props.children,Ne,re.key):W!==null&&(W.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===q&&zi(vt)===W.type)?(W=d(W,re.props),_l(W,re),W.return=X,W):(W=kc(re.type,re.key,re.props,null,X.mode,Ne),_l(W,re),W.return=X,W)}function le(X,W,re,Ne){return W===null||W.tag!==4||W.stateNode.containerInfo!==re.containerInfo||W.stateNode.implementation!==re.implementation?(W=mi(re,X.mode,Ne),W.return=X,W):(W=d(W,re.children||[]),W.return=X,W)}function xe(X,W,re,Ne,vt){return W===null||W.tag!==7?(W=Qa(re,X.mode,Ne,vt),W.return=X,W):(W=d(W,re),W.return=X,W)}function ke(X,W,re){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=qs(""+W,X.mode,re),W.return=X,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return re=kc(W.type,W.key,W.props,null,X.mode,re),_l(re,W),re.return=X,re;case N:return W=mi(W,X.mode,re),W.return=X,W;case q:return W=zi(W),ke(X,W,re)}if(he(W)||ge(W))return W=Qa(W,X.mode,re,null),W.return=X,W;if(typeof W.then=="function")return ke(X,So(W),re);if(W.$$typeof===O)return ke(X,Tc(X,W),re);jo(X,W)}return null}function de(X,W,re,Ne){var vt=W!==null?W.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return vt!==null?null:E(X,W,""+re,Ne);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return re.key===vt?B(X,W,re,Ne):null;case N:return re.key===vt?le(X,W,re,Ne):null;case q:return re=zi(re),de(X,W,re,Ne)}if(he(re)||ge(re))return vt!==null?null:xe(X,W,re,Ne,null);if(typeof re.then=="function")return de(X,W,So(re),Ne);if(re.$$typeof===O)return de(X,W,Tc(X,re),Ne);jo(X,re)}return null}function ve(X,W,re,Ne,vt){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return X=X.get(re)||null,E(W,X,""+Ne,vt);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case w:return X=X.get(Ne.key===null?re:Ne.key)||null,B(W,X,Ne,vt);case N:return X=X.get(Ne.key===null?re:Ne.key)||null,le(W,X,Ne,vt);case q:return Ne=zi(Ne),ve(X,W,re,Ne,vt)}if(he(Ne)||ge(Ne))return X=X.get(re)||null,xe(W,X,Ne,vt,null);if(typeof Ne.then=="function")return ve(X,W,re,So(Ne),vt);if(Ne.$$typeof===O)return ve(X,W,re,Tc(W,Ne),vt);jo(W,Ne)}return null}function nt(X,W,re,Ne){for(var vt=null,fn=null,lt=W,Ht=W=0,tn=null;lt!==null&&Ht<re.length;Ht++){lt.index>Ht?(tn=lt,lt=null):tn=lt.sibling;var hn=de(X,lt,re[Ht],Ne);if(hn===null){lt===null&&(lt=tn);break}n&<&&hn.alternate===null&&s(X,lt),W=h(hn,W,Ht),fn===null?vt=hn:fn.sibling=hn,fn=hn,lt=tn}if(Ht===re.length)return r(X,lt),Gt&&Ya(X,Ht),vt;if(lt===null){for(;Ht<re.length;Ht++)lt=ke(X,re[Ht],Ne),lt!==null&&(W=h(lt,W,Ht),fn===null?vt=lt:fn.sibling=lt,fn=lt);return Gt&&Ya(X,Ht),vt}for(lt=c(lt);Ht<re.length;Ht++)tn=ve(lt,X,Ht,re[Ht],Ne),tn!==null&&(n&&tn.alternate!==null&<.delete(tn.key===null?Ht:tn.key),W=h(tn,W,Ht),fn===null?vt=tn:fn.sibling=tn,fn=tn);return n&<.forEach(function(Al){return s(X,Al)}),Gt&&Ya(X,Ht),vt}function wt(X,W,re,Ne){if(re==null)throw Error(l(151));for(var vt=null,fn=null,lt=W,Ht=W=0,tn=null,hn=re.next();lt!==null&&!hn.done;Ht++,hn=re.next()){lt.index>Ht?(tn=lt,lt=null):tn=lt.sibling;var Al=de(X,lt,hn.value,Ne);if(Al===null){lt===null&&(lt=tn);break}n&<&&Al.alternate===null&&s(X,lt),W=h(Al,W,Ht),fn===null?vt=Al:fn.sibling=Al,fn=Al,lt=tn}if(hn.done)return r(X,lt),Gt&&Ya(X,Ht),vt;if(lt===null){for(;!hn.done;Ht++,hn=re.next())hn=ke(X,hn.value,Ne),hn!==null&&(W=h(hn,W,Ht),fn===null?vt=hn:fn.sibling=hn,fn=hn);return Gt&&Ya(X,Ht),vt}for(lt=c(lt);!hn.done;Ht++,hn=re.next())hn=ve(lt,X,Ht,hn.value,Ne),hn!==null&&(n&&hn.alternate!==null&<.delete(hn.key===null?Ht:hn.key),W=h(hn,W,Ht),fn===null?vt=hn:fn.sibling=hn,fn=hn);return n&<.forEach(function($5){return s(X,$5)}),Gt&&Ya(X,Ht),vt}function Rn(X,W,re,Ne){if(typeof re=="object"&&re!==null&&re.type===j&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case w:e:{for(var vt=re.key;W!==null;){if(W.key===vt){if(vt=re.type,vt===j){if(W.tag===7){r(X,W.sibling),Ne=d(W,re.props.children),Ne.return=X,X=Ne;break e}}else if(W.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===q&&zi(vt)===W.type){r(X,W.sibling),Ne=d(W,re.props),_l(Ne,re),Ne.return=X,X=Ne;break e}r(X,W);break}else s(X,W);W=W.sibling}re.type===j?(Ne=Qa(re.props.children,X.mode,Ne,re.key),Ne.return=X,X=Ne):(Ne=kc(re.type,re.key,re.props,null,X.mode,Ne),_l(Ne,re),Ne.return=X,X=Ne)}return x(X);case N:e:{for(vt=re.key;W!==null;){if(W.key===vt)if(W.tag===4&&W.stateNode.containerInfo===re.containerInfo&&W.stateNode.implementation===re.implementation){r(X,W.sibling),Ne=d(W,re.children||[]),Ne.return=X,X=Ne;break e}else{r(X,W);break}else s(X,W);W=W.sibling}Ne=mi(re,X.mode,Ne),Ne.return=X,X=Ne}return x(X);case q:return re=zi(re),Rn(X,W,re,Ne)}if(he(re))return nt(X,W,re,Ne);if(ge(re)){if(vt=ge(re),typeof vt!="function")throw Error(l(150));return re=vt.call(re),wt(X,W,re,Ne)}if(typeof re.then=="function")return Rn(X,W,So(re),Ne);if(re.$$typeof===O)return Rn(X,W,Tc(X,re),Ne);jo(X,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,W!==null&&W.tag===6?(r(X,W.sibling),Ne=d(W,re),Ne.return=X,X=Ne):(r(X,W),Ne=qs(re,X.mode,Ne),Ne.return=X,X=Ne),x(X)):r(X,W)}return function(X,W,re,Ne){try{gl=0;var vt=Rn(X,W,re,Ne);return xr=null,vt}catch(lt){if(lt===pl||lt===vo)throw lt;var fn=Ds(29,lt,null,X.mode);return fn.lanes=Ne,fn.return=X,fn}finally{}}}var Hi=Sd(!0),jd=Sd(!1),vi=!1;function Ac(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dc(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function bi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function xi(n,s,r){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(vn&2)!==0){var d=c.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),c.pending=s,s=po(n),uh(n,null,r),s}return mo(n,c,s,r),po(n)}function yl(n,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var c=s.lanes;c&=n.pendingLanes,r|=c,s.lanes=r,Us(n,r)}}function b(n,s){var r=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,r===c)){var d=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var x={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?d=h=x:h=h.next=x,r=r.next}while(r!==null);h===null?d=h=s:h=h.next=s}else d=h=s;r={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:c.shared,callbacks:c.callbacks},n.updateQueue=r;return}n=r.lastBaseUpdate,n===null?r.firstBaseUpdate=s:n.next=s,r.lastBaseUpdate=s}var D=!1;function F(){if(D){var n=vr;if(n!==null)throw n}}function je(n,s,r,c){D=!1;var d=n.updateQueue;vi=!1;var h=d.firstBaseUpdate,x=d.lastBaseUpdate,E=d.shared.pending;if(E!==null){d.shared.pending=null;var B=E,le=B.next;B.next=null,x===null?h=le:x.next=le,x=B;var xe=n.alternate;xe!==null&&(xe=xe.updateQueue,E=xe.lastBaseUpdate,E!==x&&(E===null?xe.firstBaseUpdate=le:E.next=le,xe.lastBaseUpdate=B))}if(h!==null){var ke=d.baseState;x=0,xe=le=B=null,E=h;do{var de=E.lane&-536870913,ve=de!==E.lane;if(ve?(en&de)===de:(c&de)===de){de!==0&&de===yr&&(D=!0),xe!==null&&(xe=xe.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var nt=n,wt=E;de=s;var Rn=r;switch(wt.tag){case 1:if(nt=wt.payload,typeof nt=="function"){ke=nt.call(Rn,ke,de);break e}ke=nt;break e;case 3:nt.flags=nt.flags&-65537|128;case 0:if(nt=wt.payload,de=typeof nt=="function"?nt.call(Rn,ke,de):nt,de==null)break e;ke=p({},ke,de);break e;case 2:vi=!0}}de=E.callback,de!==null&&(n.flags|=64,ve&&(n.flags|=8192),ve=d.callbacks,ve===null?d.callbacks=[de]:ve.push(de))}else ve={lane:de,tag:E.tag,payload:E.payload,callback:E.callback,next:null},xe===null?(le=xe=ve,B=ke):xe=xe.next=ve,x|=de;if(E=E.next,E===null){if(E=d.shared.pending,E===null)break;ve=E,E=ve.next,ve.next=null,d.lastBaseUpdate=ve,d.shared.pending=null}}while(!0);xe===null&&(B=ke),d.baseState=B,d.firstBaseUpdate=le,d.lastBaseUpdate=xe,h===null&&(d.shared.lanes=0),Sl|=x,n.lanes=x,n.memoizedState=ke}}function Fe(n,s){if(typeof n!="function")throw Error(l(191,n));n.call(s)}function kt(n,s){var r=n.callbacks;if(r!==null)for(n.callbacks=null,n=0;n<r.length;n++)Fe(r[n],s)}var Ve=I(null),un=I(0);function Os(n,s){n=Mr,U(un,n),U(Ve,s),Mr=n|s.baseLanes}function dn(){U(un,Mr),U(Ve,Ve.current)}function ds(){Mr=un.current,ne(Ve),ne(un)}var Ln=I(null),ze=null;function Bn(n){var s=n.alternate;U(Qn,Qn.current&1),U(Ln,n),ze===null&&(s===null||Ve.current!==null||s.memoizedState!==null)&&(ze=n)}function Ns(n){U(Qn,Qn.current),U(Ln,n),ze===null&&(ze=n)}function an(n){n.tag===22?(U(Qn,Qn.current),U(Ln,n),ze===null&&(ze=n)):Za()}function Za(){U(Qn,Qn.current),U(Ln,Ln.current)}function Ks(n){ne(Ln),ze===n&&(ze=null),ne(Qn)}var Qn=I(0);function wo(n){for(var s=n;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||D1(r)||O1(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Xa=0,Ot=null,yn=null,Zn=null,No=!1,Sr=!1,$i=!1,ko=0,vl=0,jr=null,bh=0;function Hn(){throw Error(l(321))}function Oc(n,s){if(s===null)return!1;for(var r=0;r<s.length&&r<n.length;r++)if(!js(n[r],s[r]))return!1;return!0}function Ic(n,s,r,c,d,h){return Xa=h,Ot=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=n===null||n.memoizedState===null?py:qp,$i=!1,h=r(c,d),$i=!1,Sr&&(h=Nd(s,r,c,d)),wd(n),h}function wd(n){M.H=Ed;var s=yn!==null&&yn.next!==null;if(Xa=0,Zn=yn=Ot=null,No=!1,vl=0,jr=null,s)throw Error(l(300));n===null||fs||(n=n.dependencies,n!==null&&Cc(n)&&(fs=!0))}function Nd(n,s,r,c){Ot=n;var d=0;do{if(Sr&&(jr=null),vl=0,Sr=!1,25<=d)throw Error(l(301));if(d+=1,Zn=yn=null,n.updateQueue!=null){var h=n.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}M.H=gy,h=s(r,c)}while(Sr);return h}function xh(){var n=M.H,s=n.useState()[0];return s=typeof s.then=="function"?Nn(s):s,n=n.useState()[0],(yn!==null?yn.memoizedState:null)!==n&&(Ot.flags|=1024),s}function Lc(){var n=ko!==0;return ko=0,n}function Pc(n,s,r){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~r}function it(n){if(No){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}No=!1}Xa=0,Zn=yn=Ot=null,Sr=!1,vl=ko=0,jr=null}function Et(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zn===null?Ot.memoizedState=Zn=n:Zn=Zn.next=n,Zn}function Ct(){if(yn===null){var n=Ot.alternate;n=n!==null?n.memoizedState:null}else n=yn.next;var s=Zn===null?Ot.memoizedState:Zn.next;if(s!==null)Zn=s,yn=n;else{if(n===null)throw Ot.alternate===null?Error(l(467)):Error(l(310));yn=n,n={memoizedState:yn.memoizedState,baseState:yn.baseState,baseQueue:yn.baseQueue,queue:yn.queue,next:null},Zn===null?Ot.memoizedState=Zn=n:Zn=Zn.next=n}return Zn}function Yt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nn(n){var s=vl;return vl+=1,jr===null&&(jr=[]),n=xo(jr,n,s),s=Ot,(Zn===null?s.memoizedState:Zn.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?py:qp),n}function ha(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Nn(n);if(n.$$typeof===O)return gs(n)}throw Error(l(438,String(n)))}function Eo(n){var s=null,r=Ot.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var c=Ot.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(s={data:c.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=Yt(),Ot.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(n),c=0;c<n;c++)r[c]=Q;return s.index++,r}function Ra(n,s){return typeof s=="function"?s(n):s}function Sh(n){var s=Ct();return Op(s,yn,n)}function Op(n,s,r){var c=n.queue;if(c===null)throw Error(l(311));c.lastRenderedReducer=r;var d=n.baseQueue,h=c.pending;if(h!==null){if(d!==null){var x=d.next;d.next=h.next,h.next=x}s.baseQueue=d=h,c.pending=null}if(h=n.baseState,d===null)n.memoizedState=h;else{s=d.next;var E=x=null,B=null,le=s,xe=!1;do{var ke=le.lane&-536870913;if(ke!==le.lane?(en&ke)===ke:(Xa&ke)===ke){var de=le.revertLane;if(de===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),ke===yr&&(xe=!0);else if((Xa&de)===de){le=le.next,de===yr&&(xe=!0);continue}else ke={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},B===null?(E=B=ke,x=h):B=B.next=ke,Ot.lanes|=de,Sl|=de;ke=le.action,$i&&r(h,ke),h=le.hasEagerState?le.eagerState:r(h,ke)}else de={lane:ke,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},B===null?(E=B=de,x=h):B=B.next=de,Ot.lanes|=ke,Sl|=ke;le=le.next}while(le!==null&&le!==s);if(B===null?x=h:B.next=E,!js(h,n.memoizedState)&&(fs=!0,xe&&(r=vr,r!==null)))throw r;n.memoizedState=h,n.baseState=x,n.baseQueue=B,c.lastRenderedState=h}return d===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Ip(n){var s=Ct(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=n;var c=r.dispatch,d=r.pending,h=s.memoizedState;if(d!==null){r.pending=null;var x=d=d.next;do h=n(h,x.action),x=x.next;while(x!==d);js(h,s.memoizedState)||(fs=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,c]}function I_(n,s,r){var c=Ot,d=Ct(),h=Gt;if(h){if(r===void 0)throw Error(l(407));r=r()}else r=s();var x=!js((yn||d).memoizedState,r);if(x&&(d.memoizedState=r,fs=!0),d=d.queue,Up(U_.bind(null,c,d,n),[n]),d.getSnapshot!==s||x||Zn!==null&&Zn.memoizedState.tag&1){if(c.flags|=2048,Uc(9,{destroy:void 0},P_.bind(null,c,d,r,s),null),An===null)throw Error(l(349));h||(Xa&127)!==0||L_(c,s,r)}return r}function L_(n,s,r){n.flags|=16384,n={getSnapshot:s,value:r},s=Ot.updateQueue,s===null?(s=Yt(),Ot.updateQueue=s,s.stores=[n]):(r=s.stores,r===null?s.stores=[n]:r.push(n))}function P_(n,s,r,c){s.value=r,s.getSnapshot=c,z_(s)&&B_(n)}function U_(n,s,r){return r(function(){z_(s)&&B_(n)})}function z_(n){var s=n.getSnapshot;n=n.value;try{var r=s();return!js(n,r)}catch{return!0}}function B_(n){var s=mr(n,2);s!==null&&ya(s,n,2)}function Lp(n){var s=Et();if(typeof n=="function"){var r=n;if(n=r(),$i){Me(!0);try{r()}finally{Me(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:n},s}function H_(n,s,r,c){return n.baseState=r,Op(n,yn,typeof c=="function"?c:Ra)}function Ox(n,s,r,c,d){if(Nh(n))throw Error(l(485));if(n=s.action,n!==null){var h={payload:d,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};M.T!==null?r(!0):h.isTransition=!1,c(h),r=s.pending,r===null?(h.next=s.pending=h,$_(s,h)):(h.next=r.next,s.pending=r.next=h)}}function $_(n,s){var r=s.action,c=s.payload,d=n.state;if(s.isTransition){var h=M.T,x={};M.T=x;try{var E=r(d,c),B=M.S;B!==null&&B(x,E),F_(n,s,E)}catch(le){Pp(n,s,le)}finally{h!==null&&x.types!==null&&(h.types=x.types),M.T=h}}else try{h=r(d,c),F_(n,s,h)}catch(le){Pp(n,s,le)}}function F_(n,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(c){q_(n,s,c)},function(c){return Pp(n,s,c)}):q_(n,s,r)}function q_(n,s,r){s.status="fulfilled",s.value=r,W_(s),n.state=r,s=n.pending,s!==null&&(r=s.next,r===s?n.pending=null:(r=r.next,s.next=r,$_(n,r)))}function Pp(n,s,r){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=r,W_(s),s=s.next;while(s!==c)}n.action=null}function W_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function K_(n,s){return s}function Q_(n,s){if(Gt){var r=An.formState;if(r!==null){e:{var c=Ot;if(Gt){if(Tn){t:{for(var d=Tn,h=fa;d.nodeType!==8;){if(!h){d=null;break t}if(d=Ja(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){Tn=Ja(d.nextSibling),c=d.data==="F!";break e}}gi(c)}c=!1}c&&(s=r[0])}}return r=Et(),r.memoizedState=r.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:K_,lastRenderedState:s},r.queue=c,r=fy.bind(null,Ot,c),c.dispatch=r,c=Lp(!1),h=Fp.bind(null,Ot,!1,c.queue),c=Et(),d={state:s,dispatch:null,action:n,pending:null},c.queue=d,r=Ox.bind(null,Ot,d,h,r),d.dispatch=r,c.memoizedState=n,[s,r,!1]}function G_(n){var s=Ct();return Y_(s,yn,n)}function Y_(n,s,r){if(s=Op(n,s,K_)[0],n=Sh(Ra)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=Nn(s)}catch(x){throw x===pl?vo:x}else c=s;s=Ct();var d=s.queue,h=d.dispatch;return r!==s.memoizedState&&(Ot.flags|=2048,Uc(9,{destroy:void 0},Ix.bind(null,d,r),null)),[c,h,n]}function Ix(n,s){n.action=s}function V_(n){var s=Ct(),r=yn;if(r!==null)return Y_(s,r,n);Ct(),s=s.memoizedState,r=Ct();var c=r.queue.dispatch;return r.memoizedState=n,[s,c,!1]}function Uc(n,s,r,c){return n={tag:n,create:r,deps:c,inst:s,next:null},s=Ot.updateQueue,s===null&&(s=Yt(),Ot.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=n.next=n:(c=r.next,r.next=n,n.next=c,s.lastEffect=n),n}function Z_(){return Ct().memoizedState}function jh(n,s,r,c){var d=Et();Ot.flags|=n,d.memoizedState=Uc(1|s,{destroy:void 0},r,c===void 0?null:c)}function wh(n,s,r,c){var d=Ct();c=c===void 0?null:c;var h=d.memoizedState.inst;yn!==null&&c!==null&&Oc(c,yn.memoizedState.deps)?d.memoizedState=Uc(s,h,r,c):(Ot.flags|=n,d.memoizedState=Uc(1|s,h,r,c))}function X_(n,s){jh(8390656,8,n,s)}function Up(n,s){wh(2048,8,n,s)}function Lx(n){Ot.flags|=4;var s=Ot.updateQueue;if(s===null)s=Yt(),Ot.updateQueue=s,s.events=[n];else{var r=s.events;r===null?s.events=[n]:r.push(n)}}function J_(n){var s=Ct().memoizedState;return Lx({ref:s,nextImpl:n}),function(){if((vn&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function ey(n,s){return wh(4,2,n,s)}function ty(n,s){return wh(4,4,n,s)}function ny(n,s){if(typeof s=="function"){n=n();var r=s(n);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function sy(n,s,r){r=r!=null?r.concat([n]):null,wh(4,4,ny.bind(null,s,n),r)}function zp(){}function ay(n,s){var r=Ct();s=s===void 0?null:s;var c=r.memoizedState;return s!==null&&Oc(s,c[1])?c[0]:(r.memoizedState=[n,s],n)}function iy(n,s){var r=Ct();s=s===void 0?null:s;var c=r.memoizedState;if(s!==null&&Oc(s,c[1]))return c[0];if(c=n(),$i){Me(!0);try{n()}finally{Me(!1)}}return r.memoizedState=[c,s],c}function Bp(n,s,r){return r===void 0||(Xa&1073741824)!==0&&(en&261930)===0?n.memoizedState=s:(n.memoizedState=r,n=r8(),Ot.lanes|=n,Sl|=n,r)}function ry(n,s,r,c){return js(r,s)?r:Ve.current!==null?(n=Bp(n,r,c),js(n,s)||(fs=!0),n):(Xa&42)===0||(Xa&1073741824)!==0&&(en&261930)===0?(fs=!0,n.memoizedState=r):(n=r8(),Ot.lanes|=n,Sl|=n,s)}function ly(n,s,r,c,d){var h=$.p;$.p=h!==0&&8>h?h:8;var x=M.T,E={};M.T=E,Fp(n,!1,s,r);try{var B=d(),le=M.S;if(le!==null&&le(E,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var xe=Dp(B,c);kd(n,s,xe,Oa(n))}else kd(n,s,c,Oa(n))}catch(ke){kd(n,s,{then:function(){},status:"rejected",reason:ke},Oa())}finally{$.p=h,x!==null&&E.types!==null&&(x.types=E.types),M.T=x}}function Px(){}function Hp(n,s,r,c){if(n.tag!==5)throw Error(l(476));var d=oy(n).queue;ly(n,d,s,ee,r===null?Px:function(){return cy(n),r(c)})}function oy(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:ee},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:r},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function cy(n){var s=oy(n);s.next===null&&(s=n.alternate.memoizedState),kd(n,s.next.queue,{},Oa())}function $p(){return gs(Fd)}function uy(){return Ct().memoizedState}function dy(){return Ct().memoizedState}function Ux(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var r=Oa();n=bi(r);var c=xi(s,n,r);c!==null&&(ya(c,s,r),yl(c,s,r)),s={cache:gd()},n.payload=s;return}s=s.return}}function zx(n,s,r){var c=Oa();r={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Nh(n)?hy(s,r):(r=ld(n,s,r,c),r!==null&&(ya(r,n,c),my(r,s,c)))}function fy(n,s,r){var c=Oa();kd(n,s,r,c)}function kd(n,s,r,c){var d={lane:c,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Nh(n))hy(s,d);else{var h=n.alternate;if(n.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var x=s.lastRenderedState,E=h(x,r);if(d.hasEagerState=!0,d.eagerState=E,js(E,x))return mo(n,s,d,0),An===null&&Nc(),!1}catch{}finally{}if(r=ld(n,s,d,c),r!==null)return ya(r,n,c),my(r,s,c),!0}return!1}function Fp(n,s,r,c){if(c={lane:2,revertLane:x1(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Nh(n)){if(s)throw Error(l(479))}else s=ld(n,r,c,2),s!==null&&ya(s,n,2)}function Nh(n){var s=n.alternate;return n===Ot||s!==null&&s===Ot}function hy(n,s){Sr=No=!0;var r=n.pending;r===null?s.next=s:(s.next=r.next,r.next=s),n.pending=s}function my(n,s,r){if((r&4194048)!==0){var c=s.lanes;c&=n.pendingLanes,r|=c,s.lanes=r,Us(n,r)}}var Ed={readContext:gs,use:ha,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useLayoutEffect:Hn,useInsertionEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useSyncExternalStore:Hn,useId:Hn,useHostTransitionStatus:Hn,useFormState:Hn,useActionState:Hn,useOptimistic:Hn,useMemoCache:Hn,useCacheRefresh:Hn};Ed.useEffectEvent=Hn;var py={readContext:gs,use:ha,useCallback:function(n,s){return Et().memoizedState=[n,s===void 0?null:s],n},useContext:gs,useEffect:X_,useImperativeHandle:function(n,s,r){r=r!=null?r.concat([n]):null,jh(4194308,4,ny.bind(null,s,n),r)},useLayoutEffect:function(n,s){return jh(4194308,4,n,s)},useInsertionEffect:function(n,s){jh(4,2,n,s)},useMemo:function(n,s){var r=Et();s=s===void 0?null:s;var c=n();if($i){Me(!0);try{n()}finally{Me(!1)}}return r.memoizedState=[c,s],c},useReducer:function(n,s,r){var c=Et();if(r!==void 0){var d=r(s);if($i){Me(!0);try{r(s)}finally{Me(!1)}}}else d=s;return c.memoizedState=c.baseState=d,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:d},c.queue=n,n=n.dispatch=zx.bind(null,Ot,n),[c.memoizedState,n]},useRef:function(n){var s=Et();return n={current:n},s.memoizedState=n},useState:function(n){n=Lp(n);var s=n.queue,r=fy.bind(null,Ot,s);return s.dispatch=r,[n.memoizedState,r]},useDebugValue:zp,useDeferredValue:function(n,s){var r=Et();return Bp(r,n,s)},useTransition:function(){var n=Lp(!1);return n=ly.bind(null,Ot,n.queue,!0,!1),Et().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,r){var c=Ot,d=Et();if(Gt){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),An===null)throw Error(l(349));(en&127)!==0||L_(c,s,r)}d.memoizedState=r;var h={value:r,getSnapshot:s};return d.queue=h,X_(U_.bind(null,c,h,n),[n]),c.flags|=2048,Uc(9,{destroy:void 0},P_.bind(null,c,h,r,s),null),r},useId:function(){var n=Et(),s=An.identifierPrefix;if(Gt){var r=Ga,c=Ma;r=(c&~(1<<32-Re(c)-1)).toString(32)+r,s="_"+s+"R_"+r,r=ko++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=bh++,s="_"+s+"r_"+r.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:$p,useFormState:Q_,useActionState:Q_,useOptimistic:function(n){var s=Et();s.memoizedState=s.baseState=n;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Fp.bind(null,Ot,!0,r),r.dispatch=s,[n,s]},useMemoCache:Eo,useCacheRefresh:function(){return Et().memoizedState=Ux.bind(null,Ot)},useEffectEvent:function(n){var s=Et(),r={impl:n};return s.memoizedState=r,function(){if((vn&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},qp={readContext:gs,use:ha,useCallback:ay,useContext:gs,useEffect:Up,useImperativeHandle:sy,useInsertionEffect:ey,useLayoutEffect:ty,useMemo:iy,useReducer:Sh,useRef:Z_,useState:function(){return Sh(Ra)},useDebugValue:zp,useDeferredValue:function(n,s){var r=Ct();return ry(r,yn.memoizedState,n,s)},useTransition:function(){var n=Sh(Ra)[0],s=Ct().memoizedState;return[typeof n=="boolean"?n:Nn(n),s]},useSyncExternalStore:I_,useId:uy,useHostTransitionStatus:$p,useFormState:G_,useActionState:G_,useOptimistic:function(n,s){var r=Ct();return H_(r,yn,n,s)},useMemoCache:Eo,useCacheRefresh:dy};qp.useEffectEvent=J_;var gy={readContext:gs,use:ha,useCallback:ay,useContext:gs,useEffect:Up,useImperativeHandle:sy,useInsertionEffect:ey,useLayoutEffect:ty,useMemo:iy,useReducer:Ip,useRef:Z_,useState:function(){return Ip(Ra)},useDebugValue:zp,useDeferredValue:function(n,s){var r=Ct();return yn===null?Bp(r,n,s):ry(r,yn.memoizedState,n,s)},useTransition:function(){var n=Ip(Ra)[0],s=Ct().memoizedState;return[typeof n=="boolean"?n:Nn(n),s]},useSyncExternalStore:I_,useId:uy,useHostTransitionStatus:$p,useFormState:V_,useActionState:V_,useOptimistic:function(n,s){var r=Ct();return yn!==null?H_(r,yn,n,s):(r.baseState=n,[n,r.queue.dispatch])},useMemoCache:Eo,useCacheRefresh:dy};gy.useEffectEvent=J_;function Wp(n,s,r,c){s=n.memoizedState,r=r(c,s),r=r==null?s:p({},s,r),n.memoizedState=r,n.lanes===0&&(n.updateQueue.baseState=r)}var Kp={enqueueSetState:function(n,s,r){n=n._reactInternals;var c=Oa(),d=bi(c);d.payload=s,r!=null&&(d.callback=r),s=xi(n,d,c),s!==null&&(ya(s,n,c),yl(s,n,c))},enqueueReplaceState:function(n,s,r){n=n._reactInternals;var c=Oa(),d=bi(c);d.tag=1,d.payload=s,r!=null&&(d.callback=r),s=xi(n,d,c),s!==null&&(ya(s,n,c),yl(s,n,c))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var r=Oa(),c=bi(r);c.tag=2,s!=null&&(c.callback=s),s=xi(n,c,r),s!==null&&(ya(s,n,r),yl(s,n,r))}};function _y(n,s,r,c,d,h,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,h,x):s.prototype&&s.prototype.isPureReactComponent?!dr(r,c)||!dr(d,h):!0}function yy(n,s,r,c){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,c),s.state!==n&&Kp.enqueueReplaceState(s,s.state,null)}function Co(n,s){var r=s;if("ref"in s){r={};for(var c in s)c!=="ref"&&(r[c]=s[c])}if(n=n.defaultProps){r===s&&(r=p({},r));for(var d in n)r[d]===void 0&&(r[d]=n[d])}return r}function vy(n){wc(n)}function by(n){console.error(n)}function xy(n){wc(n)}function kh(n,s){try{var r=n.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function Sy(n,s,r){try{var c=n.onCaughtError;c(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Qp(n,s,r){return r=bi(r),r.tag=3,r.payload={element:null},r.callback=function(){kh(n,s)},r}function jy(n){return n=bi(n),n.tag=3,n}function wy(n,s,r,c){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var h=c.value;n.payload=function(){return d(h)},n.callback=function(){Sy(s,r,c)}}var x=r.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){Sy(s,r,c),typeof d!="function"&&(jl===null?jl=new Set([this]):jl.add(this));var E=c.stack;this.componentDidCatch(c.value,{componentStack:E!==null?E:""})})}function Bx(n,s,r,c,d){if(r.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=r.alternate,s!==null&&fl(s,r,d,!0),r=Ln.current,r!==null){switch(r.tag){case 31:case 13:return ze===null?Uh():r.alternate===null&&ts===0&&(ts=3),r.flags&=-257,r.flags|=65536,r.lanes=d,c===bo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([c]):s.add(c),y1(n,c,d)),!1;case 22:return r.flags|=65536,c===bo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([c])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([c]):r.add(c)),y1(n,c,d)),!1}throw Error(l(435,r.tag))}return y1(n,c,d),Uh(),!1}if(Gt)return s=Ln.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,c!==dd&&(n=Error(l(422),{cause:c}),_o(Ws(n,r)))):(c!==dd&&(s=Error(l(423),{cause:c}),_o(Ws(s,r))),n=n.current.alternate,n.flags|=65536,d&=-d,n.lanes|=d,c=Ws(c,r),d=Qp(n.stateNode,c,d),b(n,d),ts!==4&&(ts=2)),!1;var h=Error(l(520),{cause:c});if(h=Ws(h,r),Id===null?Id=[h]:Id.push(h),ts!==4&&(ts=2),s===null)return!0;c=Ws(c,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,n=d&-d,r.lanes|=n,n=Qp(r.stateNode,c,n),b(r,n),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(jl===null||!jl.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=jy(d),wy(d,n,r,c),b(r,d),!1}r=r.return}while(r!==null);return!1}var Gp=Error(l(461)),fs=!1;function Is(n,s,r,c){s.child=n===null?jd(s,null,r,c):Hi(s,n.child,r,c)}function Ny(n,s,r,c,d){r=r.render;var h=s.ref;if("ref"in c){var x={};for(var E in c)E!=="ref"&&(x[E]=c[E])}else x=c;return _r(s),c=Ic(n,s,r,x,h,d),E=Lc(),n!==null&&!fs?(Pc(n,s,d),wr(n,s,d)):(Gt&&E&&Va(s),s.flags|=1,Is(n,s,c,d),s.child)}function ky(n,s,r,c,d){if(n===null){var h=r.type;return typeof h=="function"&&!go(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,Ey(n,s,h,c,d)):(n=kc(r.type,null,c,s,s.mode,d),n.ref=s.ref,n.return=s,s.child=n)}if(h=n.child,!n1(n,d)){var x=h.memoizedProps;if(r=r.compare,r=r!==null?r:dr,r(x,c)&&n.ref===s.ref)return wr(n,s,d)}return s.flags|=1,n=hi(h,c),n.ref=s.ref,n.return=s,s.child=n}function Ey(n,s,r,c,d){if(n!==null){var h=n.memoizedProps;if(dr(h,c)&&n.ref===s.ref)if(fs=!1,s.pendingProps=c=h,n1(n,d))(n.flags&131072)!==0&&(fs=!0);else return s.lanes=n.lanes,wr(n,s,d)}return Yp(n,s,r,c,d)}function Cy(n,s,r,c){var d=c.children,h=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,n!==null){for(c=s.child=n.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;c=d&~h}else c=0,s.child=null;return Ty(n,s,h,r,c)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&yo(s,h!==null?h.cachePool:null),h!==null?Os(s,h):dn(),an(s);else return c=s.lanes=536870912,Ty(n,s,h!==null?h.baseLanes|r:r,r,c)}else h!==null?(yo(s,h.cachePool),Os(s,h),Za(),s.memoizedState=null):(n!==null&&yo(s,null),dn(),Za());return Is(n,s,d,r),s.child}function Cd(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Ty(n,s,r,c,d){var h=Rc();return h=h===null?null:{parent:Vn._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},n!==null&&yo(s,null),dn(),an(s),n!==null&&fl(n,s,c,!0),s.childLanes=d,null}function Eh(n,s){return s=Th({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function My(n,s,r){return Hi(s,n.child,null,r),n=Eh(s,s.pendingProps),n.flags|=2,Ks(s),s.memoizedState=null,n}function Hx(n,s,r){var c=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Gt){if(c.mode==="hidden")return n=Eh(s,c),s.lanes=536870912,Cd(null,n);if(Ns(s),(n=Tn)?(n=$8(n,fa),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:Pi!==null?{id:Ma,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},r=Ca(n),r.return=s,s.child=r,us=s,Tn=null)):n=null,n===null)throw gi(s);return s.lanes=536870912,null}return Eh(s,c)}var h=n.memoizedState;if(h!==null){var x=h.dehydrated;if(Ns(s),d)if(s.flags&256)s.flags&=-257,s=My(n,s,r);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(l(558));else if(fs||fl(n,s,r,!1),d=(r&n.childLanes)!==0,fs||d){if(c=An,c!==null&&(x=Ci(c,r),x!==0&&x!==h.retryLane))throw h.retryLane=x,mr(n,x),ya(c,n,x),Gp;Uh(),s=My(n,s,r)}else n=h.treeContext,Tn=Ja(x.nextSibling),us=s,Gt=!0,Ui=null,fa=!1,n!==null&&ud(s,n),s=Eh(s,c),s.flags|=4096;return s}return n=hi(n.child,{mode:c.mode,children:c.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Ch(n,s){var r=s.ref;if(r===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(n===null||n.ref!==r)&&(s.flags|=4194816)}}function Yp(n,s,r,c,d){return _r(s),r=Ic(n,s,r,c,void 0,d),c=Lc(),n!==null&&!fs?(Pc(n,s,d),wr(n,s,d)):(Gt&&c&&Va(s),s.flags|=1,Is(n,s,r,d),s.child)}function Ry(n,s,r,c,d,h){return _r(s),s.updateQueue=null,r=Nd(s,c,r,d),wd(n),c=Lc(),n!==null&&!fs?(Pc(n,s,h),wr(n,s,h)):(Gt&&c&&Va(s),s.flags|=1,Is(n,s,r,h),s.child)}function Ay(n,s,r,c,d){if(_r(s),s.stateNode===null){var h=cl,x=r.contextType;typeof x=="object"&&x!==null&&(h=gs(x)),h=new r(c,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Kp,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=c,h.state=s.memoizedState,h.refs={},Ac(s),x=r.contextType,h.context=typeof x=="object"&&x!==null?gs(x):cl,h.state=s.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(Wp(s,r,x,c),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Kp.enqueueReplaceState(h,h.state,null),je(s,c,h,d),F(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(n===null){h=s.stateNode;var E=s.memoizedProps,B=Co(r,E);h.props=B;var le=h.context,xe=r.contextType;x=cl,typeof xe=="object"&&xe!==null&&(x=gs(xe));var ke=r.getDerivedStateFromProps;xe=typeof ke=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=s.pendingProps!==E,xe||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||le!==x)&&yy(s,h,c,x),vi=!1;var de=s.memoizedState;h.state=de,je(s,c,h,d),F(),le=s.memoizedState,E||de!==le||vi?(typeof ke=="function"&&(Wp(s,r,ke,c),le=s.memoizedState),(B=vi||_y(s,r,B,c,de,le,x))?(xe||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"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=le),h.props=c,h.state=le,h.context=x,c=B):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{h=s.stateNode,Dc(n,s),x=s.memoizedProps,xe=Co(r,x),h.props=xe,ke=s.pendingProps,de=h.context,le=r.contextType,B=cl,typeof le=="object"&&le!==null&&(B=gs(le)),E=r.getDerivedStateFromProps,(le=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ke||de!==B)&&yy(s,h,c,B),vi=!1,de=s.memoizedState,h.state=de,je(s,c,h,d),F();var ve=s.memoizedState;x!==ke||de!==ve||vi||n!==null&&n.dependencies!==null&&Cc(n.dependencies)?(typeof E=="function"&&(Wp(s,r,E,c),ve=s.memoizedState),(xe=vi||_y(s,r,xe,c,de,ve,B)||n!==null&&n.dependencies!==null&&Cc(n.dependencies))?(le||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(c,ve,B),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(c,ve,B)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&de===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&de===n.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ve),h.props=c,h.state=ve,h.context=B,c=xe):(typeof h.componentDidUpdate!="function"||x===n.memoizedProps&&de===n.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&de===n.memoizedState||(s.flags|=1024),c=!1)}return h=c,Ch(n,s),c=(s.flags&128)!==0,h||c?(h=s.stateNode,r=c&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,n!==null&&c?(s.child=Hi(s,n.child,null,d),s.child=Hi(s,null,r,d)):Is(n,s,r,d),s.memoizedState=h.state,n=s.child):n=wr(n,s,d),n}function Dy(n,s,r,c){return pr(),s.flags|=256,Is(n,s,r,c),s.child}var Vp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zp(n){return{baseLanes:n,cachePool:vh()}}function Xp(n,s,r){return n=n!==null?n.childLanes&~r:0,s&&(n|=Da),n}function Oy(n,s,r){var c=s.pendingProps,d=!1,h=(s.flags&128)!==0,x;if((x=h)||(x=n!==null&&n.memoizedState===null?!1:(Qn.current&2)!==0),x&&(d=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Gt){if(d?Bn(s):Za(),(n=Tn)?(n=$8(n,fa),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:Pi!==null?{id:Ma,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},r=Ca(n),r.return=s,s.child=r,us=s,Tn=null)):n=null,n===null)throw gi(s);return O1(n)?s.lanes=32:s.lanes=536870912,null}var E=c.children;return c=c.fallback,d?(Za(),d=s.mode,E=Th({mode:"hidden",children:E},d),c=Qa(c,d,r,null),E.return=s,c.return=s,E.sibling=c,s.child=E,c=s.child,c.memoizedState=Zp(r),c.childLanes=Xp(n,x,r),s.memoizedState=Vp,Cd(null,c)):(Bn(s),Jp(s,E))}var B=n.memoizedState;if(B!==null&&(E=B.dehydrated,E!==null)){if(h)s.flags&256?(Bn(s),s.flags&=-257,s=e1(n,s,r)):s.memoizedState!==null?(Za(),s.child=n.child,s.flags|=128,s=null):(Za(),E=c.fallback,d=s.mode,c=Th({mode:"visible",children:c.children},d),E=Qa(E,d,r,null),E.flags|=2,c.return=s,E.return=s,c.sibling=E,s.child=c,Hi(s,n.child,null,r),c=s.child,c.memoizedState=Zp(r),c.childLanes=Xp(n,x,r),s.memoizedState=Vp,s=Cd(null,c));else if(Bn(s),O1(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var le=x.dgst;x=le,c=Error(l(419)),c.stack="",c.digest=x,_o({value:c,source:null,stack:null}),s=e1(n,s,r)}else if(fs||fl(n,s,r,!1),x=(r&n.childLanes)!==0,fs||x){if(x=An,x!==null&&(c=Ci(x,r),c!==0&&c!==B.retryLane))throw B.retryLane=c,mr(n,c),ya(x,n,c),Gp;D1(E)||Uh(),s=e1(n,s,r)}else D1(E)?(s.flags|=192,s.child=n.child,s=null):(n=B.treeContext,Tn=Ja(E.nextSibling),us=s,Gt=!0,Ui=null,fa=!1,n!==null&&ud(s,n),s=Jp(s,c.children),s.flags|=4096);return s}return d?(Za(),E=c.fallback,d=s.mode,B=n.child,le=B.sibling,c=hi(B,{mode:"hidden",children:c.children}),c.subtreeFlags=B.subtreeFlags&65011712,le!==null?E=hi(le,E):(E=Qa(E,d,r,null),E.flags|=2),E.return=s,c.return=s,c.sibling=E,s.child=c,Cd(null,c),c=s.child,E=n.child.memoizedState,E===null?E=Zp(r):(d=E.cachePool,d!==null?(B=Vn._currentValue,d=d.parent!==B?{parent:B,pool:B}:d):d=vh(),E={baseLanes:E.baseLanes|r,cachePool:d}),c.memoizedState=E,c.childLanes=Xp(n,x,r),s.memoizedState=Vp,Cd(n.child,c)):(Bn(s),r=n.child,n=r.sibling,r=hi(r,{mode:"visible",children:c.children}),r.return=s,r.sibling=null,n!==null&&(x=s.deletions,x===null?(s.deletions=[n],s.flags|=16):x.push(n)),s.child=r,s.memoizedState=null,r)}function Jp(n,s){return s=Th({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Th(n,s){return n=Ds(22,n,null,s),n.lanes=0,n}function e1(n,s,r){return Hi(s,n.child,null,r),n=Jp(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function Iy(n,s,r){n.lanes|=s;var c=n.alternate;c!==null&&(c.lanes|=s),md(n.return,s,r)}function t1(n,s,r,c,d,h){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:r,tailMode:d,treeForkCount:h}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=r,x.tailMode=d,x.treeForkCount=h)}function Ly(n,s,r){var c=s.pendingProps,d=c.revealOrder,h=c.tail;c=c.children;var x=Qn.current,E=(x&2)!==0;if(E?(x=x&1|2,s.flags|=128):x&=1,U(Qn,x),Is(n,s,c,r),c=Gt?Ta:0,!E&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Iy(n,r,s);else if(n.tag===19)Iy(n,r,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(d){case"forwards":for(r=s.child,d=null;r!==null;)n=r.alternate,n!==null&&wo(n)===null&&(d=r),r=r.sibling;r=d,r===null?(d=s.child,s.child=null):(d=r.sibling,r.sibling=null),t1(s,!1,d,r,h,c);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=s.child,s.child=null;d!==null;){if(n=d.alternate,n!==null&&wo(n)===null){s.child=d;break}n=d.sibling,d.sibling=r,r=d,d=n}t1(s,!0,r,null,h,c);break;case"together":t1(s,!1,null,null,void 0,c);break;default:s.memoizedState=null}return s.child}function wr(n,s,r){if(n!==null&&(s.dependencies=n.dependencies),Sl|=s.lanes,(r&s.childLanes)===0)if(n!==null){if(fl(n,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(l(153));if(s.child!==null){for(n=s.child,r=hi(n,n.pendingProps),s.child=r,r.return=s;n.sibling!==null;)n=n.sibling,r=r.sibling=hi(n,n.pendingProps),r.return=s;r.sibling=null}return s.child}function n1(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&Cc(n)))}function $x(n,s,r){switch(s.tag){case 3:ye(s,s.stateNode.containerInfo),ta(s,Vn,n.memoizedState.cache),pr();break;case 27:case 5:Le(s);break;case 4:ye(s,s.stateNode.containerInfo);break;case 10:ta(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Ns(s),null;break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(Bn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Oy(n,s,r):(Bn(s),n=wr(n,s,r),n!==null?n.sibling:null);Bn(s);break;case 19:var d=(n.flags&128)!==0;if(c=(r&s.childLanes)!==0,c||(fl(n,s,r,!1),c=(r&s.childLanes)!==0),d){if(c)return Ly(n,s,r);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),U(Qn,Qn.current),c)break;return null;case 22:return s.lanes=0,Cy(n,s,r,s.pendingProps);case 24:ta(s,Vn,n.memoizedState.cache)}return wr(n,s,r)}function Py(n,s,r){if(n!==null)if(n.memoizedProps!==s.pendingProps)fs=!0;else{if(!n1(n,r)&&(s.flags&128)===0)return fs=!1,$x(n,s,r);fs=(n.flags&131072)!==0}else fs=!1,Gt&&(s.flags&1048576)!==0&&cd(s,Ta,s.index);switch(s.lanes=0,s.tag){case 16:e:{var c=s.pendingProps;if(n=zi(s.elementType),s.type=n,typeof n=="function")go(n)?(c=Co(n,c),s.tag=1,s=Ay(null,s,n,c,r)):(s.tag=0,s=Yp(null,s,n,c,r));else{if(n!=null){var d=n.$$typeof;if(d===k){s.tag=11,s=Ny(null,s,n,c,r);break e}else if(d===J){s.tag=14,s=ky(null,s,n,c,r);break e}}throw s=Z(n)||n,Error(l(306,s,""))}}return s;case 0:return Yp(n,s,s.type,s.pendingProps,r);case 1:return c=s.type,d=Co(c,s.pendingProps),Ay(n,s,c,d,r);case 3:e:{if(ye(s,s.stateNode.containerInfo),n===null)throw Error(l(387));c=s.pendingProps;var h=s.memoizedState;d=h.element,Dc(n,s),je(s,c,null,r);var x=s.memoizedState;if(c=x.cache,ta(s,Vn,c),c!==h.cache&&pd(s,[Vn],r,!0),F(),c=x.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:x.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=Dy(n,s,c,r);break e}else if(c!==d){d=Ws(Error(l(424)),s),_o(d),s=Dy(n,s,c,r);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Tn=Ja(n.firstChild),us=s,Gt=!0,Ui=null,fa=!0,r=jd(s,null,c,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(pr(),c===d){s=wr(n,s,r);break e}Is(n,s,c,r)}s=s.child}return s;case 26:return Ch(n,s),n===null?(r=G8(s.type,null,s.pendingProps,null))?s.memoizedState=r:Gt||(r=s.type,n=s.pendingProps,c=Wh(se.current).createElement(r),c[at]=s,c[Ut]=n,Ls(c,r,n),He(c),s.stateNode=c):s.memoizedState=G8(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Le(s),n===null&&Gt&&(c=s.stateNode=W8(s.type,s.pendingProps,se.current),us=s,fa=!0,d=Tn,El(s.type)?(I1=d,Tn=Ja(c.firstChild)):Tn=d),Is(n,s,s.pendingProps.children,r),Ch(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Gt&&((d=c=Tn)&&(c=y5(c,s.type,s.pendingProps,fa),c!==null?(s.stateNode=c,us=s,Tn=Ja(c.firstChild),fa=!1,d=!0):d=!1),d||gi(s)),Le(s),d=s.type,h=s.pendingProps,x=n!==null?n.memoizedProps:null,c=h.children,M1(d,h)?c=null:x!==null&&M1(d,x)&&(s.flags|=32),s.memoizedState!==null&&(d=Ic(n,s,xh,null,null,r),Fd._currentValue=d),Ch(n,s),Is(n,s,c,r),s.child;case 6:return n===null&&Gt&&((n=r=Tn)&&(r=v5(r,s.pendingProps,fa),r!==null?(s.stateNode=r,us=s,Tn=null,n=!0):n=!1),n||gi(s)),null;case 13:return Oy(n,s,r);case 4:return ye(s,s.stateNode.containerInfo),c=s.pendingProps,n===null?s.child=Hi(s,null,c,r):Is(n,s,c,r),s.child;case 11:return Ny(n,s,s.type,s.pendingProps,r);case 7:return Is(n,s,s.pendingProps,r),s.child;case 8:return Is(n,s,s.pendingProps.children,r),s.child;case 12:return Is(n,s,s.pendingProps.children,r),s.child;case 10:return c=s.pendingProps,ta(s,s.type,c.value),Is(n,s,c.children,r),s.child;case 9:return d=s.type._context,c=s.pendingProps.children,_r(s),d=gs(d),c=c(d),s.flags|=1,Is(n,s,c,r),s.child;case 14:return ky(n,s,s.type,s.pendingProps,r);case 15:return Ey(n,s,s.type,s.pendingProps,r);case 19:return Ly(n,s,r);case 31:return Hx(n,s,r);case 22:return Cy(n,s,r,s.pendingProps);case 24:return _r(s),c=gs(Vn),n===null?(d=Rc(),d===null&&(d=An,h=gd(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),s.memoizedState={parent:c,cache:d},Ac(s),ta(s,Vn,d)):((n.lanes&r)!==0&&(Dc(n,s),je(s,null,null,r),F()),d=n.memoizedState,h=s.memoizedState,d.parent!==c?(d={parent:c,cache:c},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),ta(s,Vn,c)):(c=h.cache,ta(s,Vn,c),c!==d.cache&&pd(s,[Vn],r,!0))),Is(n,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Nr(n){n.flags|=4}function s1(n,s,r,c,d){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(d&335544128)===d)if(n.stateNode.complete)n.flags|=8192;else if(u8())n.flags|=8192;else throw Bi=bo,yd}else n.flags&=-16777217}function Uy(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!J8(s))if(u8())n.flags|=8192;else throw Bi=bo,yd}function Mh(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?De():536870912,n.lanes|=s,$c|=s)}function Td(n,s){if(!Gt)switch(n.tailMode){case"hidden":s=n.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?n.tail=null:r.sibling=null;break;case"collapsed":r=n.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function $n(n){var s=n.alternate!==null&&n.alternate.child===n.child,r=0,c=0;if(s)for(var d=n.child;d!==null;)r|=d.lanes|d.childLanes,c|=d.subtreeFlags&65011712,c|=d.flags&65011712,d.return=n,d=d.sibling;else for(d=n.child;d!==null;)r|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=n,d=d.sibling;return n.subtreeFlags|=c,n.childLanes=r,s}function Fx(n,s,r){var c=s.pendingProps;switch(Ec(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $n(s),null;case 1:return $n(s),null;case 3:return r=s.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),yi(Vn),Oe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(dl(s)?Nr(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,fd())),$n(s),null;case 26:var d=s.type,h=s.memoizedState;return n===null?(Nr(s),h!==null?($n(s),Uy(s,h)):($n(s),s1(s,d,null,c,r))):h?h!==n.memoizedState?(Nr(s),$n(s),Uy(s,h)):($n(s),s.flags&=-16777217):(n=n.memoizedProps,n!==c&&Nr(s),$n(s),s1(s,d,n,c,r)),null;case 27:if(_t(s),r=se.current,d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return $n(s),null}n=ie.current,dl(s)?fh(s):(n=W8(d,c,r),s.stateNode=n,Nr(s))}return $n(s),null;case 5:if(_t(s),d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(!c){if(s.stateNode===null)throw Error(l(166));return $n(s),null}if(h=ie.current,dl(s))fh(s);else{var x=Wh(se.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof c.is=="string"?x.createElement("select",{is:c.is}):x.createElement("select"),c.multiple?h.multiple=!0:c.size&&(h.size=c.size);break;default:h=typeof c.is=="string"?x.createElement(d,{is:c.is}):x.createElement(d)}}h[at]=s,h[Ut]=c;e:for(x=s.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===s)break e;for(;x.sibling===null;){if(x.return===null||x.return===s)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}s.stateNode=h;e:switch(Ls(h,d,c),d){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Nr(s)}}return $n(s),s1(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,r),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==c&&Nr(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(l(166));if(n=se.current,dl(s)){if(n=s.stateNode,r=s.memoizedProps,c=null,d=us,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}n[at]=s,n=!!(n.nodeValue===r||c!==null&&c.suppressHydrationWarning===!0||O8(n.nodeValue,r)),n||gi(s,!0)}else n=Wh(n).createTextNode(c),n[at]=s,s.stateNode=n}return $n(s),null;case 31:if(r=s.memoizedState,n===null||n.memoizedState!==null){if(c=dl(s),r!==null){if(n===null){if(!c)throw Error(l(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(l(557));n[at]=s}else pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;$n(s),n=!1}else r=fd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=r),n=!0;if(!n)return s.flags&256?(Ks(s),s):(Ks(s),null);if((s.flags&128)!==0)throw Error(l(558))}return $n(s),null;case 13:if(c=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=dl(s),c!==null&&c.dehydrated!==null){if(n===null){if(!d)throw Error(l(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(l(317));d[at]=s}else pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;$n(s),d=!1}else d=fd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Ks(s),s):(Ks(s),null)}return Ks(s),(s.flags&128)!==0?(s.lanes=r,s):(r=c!==null,n=n!==null&&n.memoizedState!==null,r&&(c=s.child,d=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(d=c.alternate.memoizedState.cachePool.pool),h=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(h=c.memoizedState.cachePool.pool),h!==d&&(c.flags|=2048)),r!==n&&r&&(s.child.flags|=8192),Mh(s,s.updateQueue),$n(s),null);case 4:return Oe(),n===null&&N1(s.stateNode.containerInfo),$n(s),null;case 10:return yi(s.type),$n(s),null;case 19:if(ne(Qn),c=s.memoizedState,c===null)return $n(s),null;if(d=(s.flags&128)!==0,h=c.rendering,h===null)if(d)Td(c,!1);else{if(ts!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(h=wo(n),h!==null){for(s.flags|=128,Td(c,!1),n=h.updateQueue,s.updateQueue=n,Mh(s,n),s.subtreeFlags=0,n=r,r=s.child;r!==null;)dh(r,n),r=r.sibling;return U(Qn,Qn.current&1|2),Gt&&Ya(s,c.treeForkCount),s.child}n=n.sibling}c.tail!==null&&Ee()>Ih&&(s.flags|=128,d=!0,Td(c,!1),s.lanes=4194304)}else{if(!d)if(n=wo(h),n!==null){if(s.flags|=128,d=!0,n=n.updateQueue,s.updateQueue=n,Mh(s,n),Td(c,!0),c.tail===null&&c.tailMode==="hidden"&&!h.alternate&&!Gt)return $n(s),null}else 2*Ee()-c.renderingStartTime>Ih&&r!==536870912&&(s.flags|=128,d=!0,Td(c,!1),s.lanes=4194304);c.isBackwards?(h.sibling=s.child,s.child=h):(n=c.last,n!==null?n.sibling=h:s.child=h,c.last=h)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=Ee(),n.sibling=null,r=Qn.current,U(Qn,d?r&1|2:r&1),Gt&&Ya(s,c.treeForkCount),n):($n(s),null);case 22:case 23:return Ks(s),ds(),c=s.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(s.flags|=8192):c&&(s.flags|=8192),c?(r&536870912)!==0&&(s.flags&128)===0&&($n(s),s.subtreeFlags&6&&(s.flags|=8192)):$n(s),r=s.updateQueue,r!==null&&Mh(s,r.retryQueue),r=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(r=n.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==r&&(s.flags|=2048),n!==null&&ne(br),null;case 24:return r=null,n!==null&&(r=n.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),yi(Vn),$n(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function qx(n,s){switch(Ec(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return yi(Vn),Oe(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return _t(s),null;case 31:if(s.memoizedState!==null){if(Ks(s),s.alternate===null)throw Error(l(340));pr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Ks(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(l(340));pr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return ne(Qn),null;case 4:return Oe(),null;case 10:return yi(s.type),null;case 22:case 23:return Ks(s),ds(),n!==null&&ne(br),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return yi(Vn),null;case 25:return null;default:return null}}function zy(n,s){switch(Ec(s),s.tag){case 3:yi(Vn),Oe();break;case 26:case 27:case 5:_t(s);break;case 4:Oe();break;case 31:s.memoizedState!==null&&Ks(s);break;case 13:Ks(s);break;case 19:ne(Qn);break;case 10:yi(s.type);break;case 22:case 23:Ks(s),ds(),n!==null&&ne(br);break;case 24:yi(Vn)}}function Md(n,s){try{var r=s.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var d=c.next;r=d;do{if((r.tag&n)===n){c=void 0;var h=r.create,x=r.inst;c=h(),x.destroy=c}r=r.next}while(r!==d)}}catch(E){En(s,s.return,E)}}function bl(n,s,r){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var h=d.next;c=h;do{if((c.tag&n)===n){var x=c.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,d=s;var B=r,le=E;try{le()}catch(xe){En(d,B,xe)}}}c=c.next}while(c!==h)}}catch(xe){En(s,s.return,xe)}}function By(n){var s=n.updateQueue;if(s!==null){var r=n.stateNode;try{kt(s,r)}catch(c){En(n,n.return,c)}}}function Hy(n,s,r){r.props=Co(n.type,n.memoizedProps),r.state=n.memoizedState;try{r.componentWillUnmount()}catch(c){En(n,s,c)}}function Rd(n,s){try{var r=n.ref;if(r!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof r=="function"?n.refCleanup=r(c):r.current=c}}catch(d){En(n,s,d)}}function Fi(n,s){var r=n.ref,c=n.refCleanup;if(r!==null)if(typeof c=="function")try{c()}catch(d){En(n,s,d)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){En(n,s,d)}else r.current=null}function $y(n){var s=n.type,r=n.memoizedProps,c=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&c.focus();break e;case"img":r.src?c.src=r.src:r.srcSet&&(c.srcset=r.srcSet)}}catch(d){En(n,n.return,d)}}function a1(n,s,r){try{var c=n.stateNode;f5(c,n.type,r,s),c[Ut]=s}catch(d){En(n,n.return,d)}}function Fy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&El(n.type)||n.tag===4}function i1(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Fy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&El(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function r1(n,s,r){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(n,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(n),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Ms));else if(c!==4&&(c===27&&El(n.type)&&(r=n.stateNode,s=null),n=n.child,n!==null))for(r1(n,s,r),n=n.sibling;n!==null;)r1(n,s,r),n=n.sibling}function Rh(n,s,r){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?r.insertBefore(n,s):r.appendChild(n);else if(c!==4&&(c===27&&El(n.type)&&(r=n.stateNode),n=n.child,n!==null))for(Rh(n,s,r),n=n.sibling;n!==null;)Rh(n,s,r),n=n.sibling}function qy(n){var s=n.stateNode,r=n.memoizedProps;try{for(var c=n.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Ls(s,c,r),s[at]=n,s[Ut]=r}catch(h){En(n,n.return,h)}}var kr=!1,hs=!1,l1=!1,Wy=typeof WeakSet=="function"?WeakSet:Set,ks=null;function Wx(n,s){if(n=n.containerInfo,C1=Xh,n=ah(n),xc(n)){if("selectionStart"in n)var r={start:n.selectionStart,end:n.selectionEnd};else e:{r=(r=n.ownerDocument)&&r.defaultView||window;var c=r.getSelection&&r.getSelection();if(c&&c.rangeCount!==0){r=c.anchorNode;var d=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var x=0,E=-1,B=-1,le=0,xe=0,ke=n,de=null;t:for(;;){for(var ve;ke!==r||d!==0&&ke.nodeType!==3||(E=x+d),ke!==h||c!==0&&ke.nodeType!==3||(B=x+c),ke.nodeType===3&&(x+=ke.nodeValue.length),(ve=ke.firstChild)!==null;)de=ke,ke=ve;for(;;){if(ke===n)break t;if(de===r&&++le===d&&(E=x),de===h&&++xe===c&&(B=x),(ve=ke.nextSibling)!==null)break;ke=de,de=ke.parentNode}ke=ve}r=E===-1||B===-1?null:{start:E,end:B}}else r=null}r=r||{start:0,end:0}}else r=null;for(T1={focusedElem:n,selectionRange:r},Xh=!1,ks=s;ks!==null;)if(s=ks,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,ks=n;else for(;ks!==null;){switch(s=ks,h=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(r=0;r<n.length;r++)d=n[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&h!==null){n=void 0,r=s,d=h.memoizedProps,h=h.memoizedState,c=r.stateNode;try{var nt=Co(r.type,d);n=c.getSnapshotBeforeUpdate(nt,h),c.__reactInternalSnapshotBeforeUpdate=n}catch(wt){En(r,r.return,wt)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,r=n.nodeType,r===9)A1(n);else if(r===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":A1(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(l(163))}if(n=s.sibling,n!==null){n.return=s.return,ks=n;break}ks=s.return}}function Ky(n,s,r){var c=r.flags;switch(r.tag){case 0:case 11:case 15:Cr(n,r),c&4&&Md(5,r);break;case 1:if(Cr(n,r),c&4)if(n=r.stateNode,s===null)try{n.componentDidMount()}catch(x){En(r,r.return,x)}else{var d=Co(r.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(d,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){En(r,r.return,x)}}c&64&&By(r),c&512&&Rd(r,r.return);break;case 3:if(Cr(n,r),c&64&&(n=r.updateQueue,n!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{kt(n,s)}catch(x){En(r,r.return,x)}}break;case 27:s===null&&c&4&&qy(r);case 26:case 5:Cr(n,r),s===null&&c&4&&$y(r),c&512&&Rd(r,r.return);break;case 12:Cr(n,r);break;case 31:Cr(n,r),c&4&&Yy(n,r);break;case 13:Cr(n,r),c&4&&Vy(n,r),c&64&&(n=r.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(r=e5.bind(null,r),b5(n,r))));break;case 22:if(c=r.memoizedState!==null||kr,!c){s=s!==null&&s.memoizedState!==null||hs,d=kr;var h=hs;kr=c,(hs=s)&&!h?Tr(n,r,(r.subtreeFlags&8772)!==0):Cr(n,r),kr=d,hs=h}break;case 30:break;default:Cr(n,r)}}function Qy(n){var s=n.alternate;s!==null&&(n.alternate=null,Qy(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&bs(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gn=null,ma=!1;function Er(n,s,r){for(r=r.child;r!==null;)Gy(n,s,r),r=r.sibling}function Gy(n,s,r){if(ue&&typeof ue.onCommitFiberUnmount=="function")try{ue.onCommitFiberUnmount(Dt,r)}catch{}switch(r.tag){case 26:hs||Fi(r,s),Er(n,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:hs||Fi(r,s);var c=Gn,d=ma;El(r.type)&&(Gn=r.stateNode,ma=!1),Er(n,s,r),Bd(r.stateNode),Gn=c,ma=d;break;case 5:hs||Fi(r,s);case 6:if(c=Gn,d=ma,Gn=null,Er(n,s,r),Gn=c,ma=d,Gn!==null)if(ma)try{(Gn.nodeType===9?Gn.body:Gn.nodeName==="HTML"?Gn.ownerDocument.body:Gn).removeChild(r.stateNode)}catch(h){En(r,s,h)}else try{Gn.removeChild(r.stateNode)}catch(h){En(r,s,h)}break;case 18:Gn!==null&&(ma?(n=Gn,B8(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,r.stateNode),Vc(n)):B8(Gn,r.stateNode));break;case 4:c=Gn,d=ma,Gn=r.stateNode.containerInfo,ma=!0,Er(n,s,r),Gn=c,ma=d;break;case 0:case 11:case 14:case 15:bl(2,r,s),hs||bl(4,r,s),Er(n,s,r);break;case 1:hs||(Fi(r,s),c=r.stateNode,typeof c.componentWillUnmount=="function"&&Hy(r,s,c)),Er(n,s,r);break;case 21:Er(n,s,r);break;case 22:hs=(c=hs)||r.memoizedState!==null,Er(n,s,r),hs=c;break;default:Er(n,s,r)}}function Yy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Vc(n)}catch(r){En(s,s.return,r)}}}function Vy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Vc(n)}catch(r){En(s,s.return,r)}}function Kx(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new Wy),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new Wy),s;default:throw Error(l(435,n.tag))}}function Ah(n,s){var r=Kx(n);s.forEach(function(c){if(!r.has(c)){r.add(c);var d=t5.bind(null,n,c);c.then(d,d)}})}function pa(n,s){var r=s.deletions;if(r!==null)for(var c=0;c<r.length;c++){var d=r[c],h=n,x=s,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(El(E.type)){Gn=E.stateNode,ma=!1;break e}break;case 5:Gn=E.stateNode,ma=!1;break e;case 3:case 4:Gn=E.stateNode.containerInfo,ma=!0;break e}E=E.return}if(Gn===null)throw Error(l(160));Gy(h,x,d),Gn=null,ma=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Zy(s,n),s=s.sibling}var Si=null;function Zy(n,s){var r=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:pa(s,n),ga(n),c&4&&(bl(3,n,n.return),Md(3,n),bl(5,n,n.return));break;case 1:pa(s,n),ga(n),c&512&&(hs||r===null||Fi(r,r.return)),c&64&&kr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(r=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=r===null?c:r.concat(c))));break;case 26:var d=Si;if(pa(s,n),ga(n),c&512&&(hs||r===null||Fi(r,r.return)),c&4){var h=r!==null?r.memoizedState:null;if(c=n.memoizedState,r===null)if(c===null)if(n.stateNode===null){e:{c=n.type,r=n.memoizedProps,d=d.ownerDocument||d;t:switch(c){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Kt]||h[at]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(c),d.head.insertBefore(h,d.querySelector("head > title"))),Ls(h,c,r),h[at]=n,He(h),c=h;break e;case"link":var x=Z8("link","href",d).get(c+(r.href||""));if(x){for(var E=0;E<x.length;E++)if(h=x[E],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){x.splice(E,1);break t}}h=d.createElement(c),Ls(h,c,r),d.head.appendChild(h);break;case"meta":if(x=Z8("meta","content",d).get(c+(r.content||""))){for(E=0;E<x.length;E++)if(h=x[E],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){x.splice(E,1);break t}}h=d.createElement(c),Ls(h,c,r),d.head.appendChild(h);break;default:throw Error(l(468,c))}h[at]=n,He(h),c=h}n.stateNode=c}else X8(d,n.type,n.stateNode);else n.stateNode=V8(d,c,n.memoizedProps);else h!==c?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,c===null?X8(d,n.type,n.stateNode):V8(d,c,n.memoizedProps)):c===null&&n.stateNode!==null&&a1(n,n.memoizedProps,r.memoizedProps)}break;case 27:pa(s,n),ga(n),c&512&&(hs||r===null||Fi(r,r.return)),r!==null&&c&4&&a1(n,n.memoizedProps,r.memoizedProps);break;case 5:if(pa(s,n),ga(n),c&512&&(hs||r===null||Fi(r,r.return)),n.flags&32){d=n.stateNode;try{$s(d,"")}catch(nt){En(n,n.return,nt)}}c&4&&n.stateNode!=null&&(d=n.memoizedProps,a1(n,d,r!==null?r.memoizedProps:d)),c&1024&&(l1=!0);break;case 6:if(pa(s,n),ga(n),c&4){if(n.stateNode===null)throw Error(l(162));c=n.memoizedProps,r=n.stateNode;try{r.nodeValue=c}catch(nt){En(n,n.return,nt)}}break;case 3:if(Gh=null,d=Si,Si=Kh(s.containerInfo),pa(s,n),Si=d,ga(n),c&4&&r!==null&&r.memoizedState.isDehydrated)try{Vc(s.containerInfo)}catch(nt){En(n,n.return,nt)}l1&&(l1=!1,Xy(n));break;case 4:c=Si,Si=Kh(n.stateNode.containerInfo),pa(s,n),ga(n),Si=c;break;case 12:pa(s,n),ga(n);break;case 31:pa(s,n),ga(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Ah(n,c)));break;case 13:pa(s,n),ga(n),n.child.flags&8192&&n.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Oh=Ee()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Ah(n,c)));break;case 22:d=n.memoizedState!==null;var B=r!==null&&r.memoizedState!==null,le=kr,xe=hs;if(kr=le||d,hs=xe||B,pa(s,n),hs=xe,kr=le,ga(n),c&8192)e:for(s=n.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(r===null||B||kr||hs||To(n)),r=null,s=n;;){if(s.tag===5||s.tag===26){if(r===null){B=r=s;try{if(h=B.stateNode,d)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=B.stateNode;var ke=B.memoizedProps.style,de=ke!=null&&ke.hasOwnProperty("display")?ke.display:null;E.style.display=de==null||typeof de=="boolean"?"":(""+de).trim()}}catch(nt){En(B,B.return,nt)}}}else if(s.tag===6){if(r===null){B=s;try{B.stateNode.nodeValue=d?"":B.memoizedProps}catch(nt){En(B,B.return,nt)}}}else if(s.tag===18){if(r===null){B=s;try{var ve=B.stateNode;d?H8(ve,!0):H8(B.stateNode,!1)}catch(nt){En(B,B.return,nt)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}c&4&&(c=n.updateQueue,c!==null&&(r=c.retryQueue,r!==null&&(c.retryQueue=null,Ah(n,r))));break;case 19:pa(s,n),ga(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Ah(n,c)));break;case 30:break;case 21:break;default:pa(s,n),ga(n)}}function ga(n){var s=n.flags;if(s&2){try{for(var r,c=n.return;c!==null;){if(Fy(c)){r=c;break}c=c.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var d=r.stateNode,h=i1(n);Rh(n,h,d);break;case 5:var x=r.stateNode;r.flags&32&&($s(x,""),r.flags&=-33);var E=i1(n);Rh(n,E,x);break;case 3:case 4:var B=r.stateNode.containerInfo,le=i1(n);r1(n,le,B);break;default:throw Error(l(161))}}catch(xe){En(n,n.return,xe)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function Xy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;Xy(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Cr(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ky(n,s.alternate,s),s=s.sibling}function To(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:bl(4,s,s.return),To(s);break;case 1:Fi(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Hy(s,s.return,r),To(s);break;case 27:Bd(s.stateNode);case 26:case 5:Fi(s,s.return),To(s);break;case 22:s.memoizedState===null&&To(s);break;case 30:To(s);break;default:To(s)}n=n.sibling}}function Tr(n,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var c=s.alternate,d=n,h=s,x=h.flags;switch(h.tag){case 0:case 11:case 15:Tr(d,h,r),Md(4,h);break;case 1:if(Tr(d,h,r),c=h,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(le){En(c,c.return,le)}if(c=h,d=c.updateQueue,d!==null){var E=c.stateNode;try{var B=d.shared.hiddenCallbacks;if(B!==null)for(d.shared.hiddenCallbacks=null,d=0;d<B.length;d++)Fe(B[d],E)}catch(le){En(c,c.return,le)}}r&&x&64&&By(h),Rd(h,h.return);break;case 27:qy(h);case 26:case 5:Tr(d,h,r),r&&c===null&&x&4&&$y(h),Rd(h,h.return);break;case 12:Tr(d,h,r);break;case 31:Tr(d,h,r),r&&x&4&&Yy(d,h);break;case 13:Tr(d,h,r),r&&x&4&&Vy(d,h);break;case 22:h.memoizedState===null&&Tr(d,h,r),Rd(h,h.return);break;case 30:break;default:Tr(d,h,r)}s=s.sibling}}function o1(n,s){var r=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(r=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==r&&(n!=null&&n.refCount++,r!=null&&hl(r))}function c1(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hl(n))}function ji(n,s,r,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Jy(n,s,r,c),s=s.sibling}function Jy(n,s,r,c){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ji(n,s,r,c),d&2048&&Md(9,s);break;case 1:ji(n,s,r,c);break;case 3:ji(n,s,r,c),d&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&hl(n)));break;case 12:if(d&2048){ji(n,s,r,c),n=s.stateNode;try{var h=s.memoizedProps,x=h.id,E=h.onPostCommit;typeof E=="function"&&E(x,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(B){En(s,s.return,B)}}else ji(n,s,r,c);break;case 31:ji(n,s,r,c);break;case 13:ji(n,s,r,c);break;case 23:break;case 22:h=s.stateNode,x=s.alternate,s.memoizedState!==null?h._visibility&2?ji(n,s,r,c):Ad(n,s):h._visibility&2?ji(n,s,r,c):(h._visibility|=2,zc(n,s,r,c,(s.subtreeFlags&10256)!==0||!1)),d&2048&&o1(x,s);break;case 24:ji(n,s,r,c),d&2048&&c1(s.alternate,s);break;default:ji(n,s,r,c)}}function zc(n,s,r,c,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=n,x=s,E=r,B=c,le=x.flags;switch(x.tag){case 0:case 11:case 15:zc(h,x,E,B,d),Md(8,x);break;case 23:break;case 22:var xe=x.stateNode;x.memoizedState!==null?xe._visibility&2?zc(h,x,E,B,d):Ad(h,x):(xe._visibility|=2,zc(h,x,E,B,d)),d&&le&2048&&o1(x.alternate,x);break;case 24:zc(h,x,E,B,d),d&&le&2048&&c1(x.alternate,x);break;default:zc(h,x,E,B,d)}s=s.sibling}}function Ad(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=n,c=s,d=c.flags;switch(c.tag){case 22:Ad(r,c),d&2048&&o1(c.alternate,c);break;case 24:Ad(r,c),d&2048&&c1(c.alternate,c);break;default:Ad(r,c)}s=s.sibling}}var Dd=8192;function Bc(n,s,r){if(n.subtreeFlags&Dd)for(n=n.child;n!==null;)e8(n,s,r),n=n.sibling}function e8(n,s,r){switch(n.tag){case 26:Bc(n,s,r),n.flags&Dd&&n.memoizedState!==null&&A5(r,Si,n.memoizedState,n.memoizedProps);break;case 5:Bc(n,s,r);break;case 3:case 4:var c=Si;Si=Kh(n.stateNode.containerInfo),Bc(n,s,r),Si=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Dd,Dd=16777216,Bc(n,s,r),Dd=c):Bc(n,s,r));break;default:Bc(n,s,r)}}function t8(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Od(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var c=s[r];ks=c,s8(c,n)}t8(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)n8(n),n=n.sibling}function n8(n){switch(n.tag){case 0:case 11:case 15:Od(n),n.flags&2048&&bl(9,n,n.return);break;case 3:Od(n);break;case 12:Od(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Dh(n)):Od(n);break;default:Od(n)}}function Dh(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var c=s[r];ks=c,s8(c,n)}t8(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:bl(8,s,s.return),Dh(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Dh(s));break;default:Dh(s)}n=n.sibling}}function s8(n,s){for(;ks!==null;){var r=ks;switch(r.tag){case 0:case 11:case 15:bl(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var c=r.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:hl(r.memoizedState.cache)}if(c=r.child,c!==null)c.return=r,ks=c;else e:for(r=n;ks!==null;){c=ks;var d=c.sibling,h=c.return;if(Qy(c),c===r){ks=null;break e}if(d!==null){d.return=h,ks=d;break e}ks=h}}}var Qx={getCacheForType:function(n){var s=gs(Vn),r=s.data.get(n);return r===void 0&&(r=n(),s.data.set(n,r)),r},cacheSignal:function(){return gs(Vn).controller.signal}},Gx=typeof WeakMap=="function"?WeakMap:Map,vn=0,An=null,Vt=null,en=0,kn=0,Aa=null,xl=!1,Hc=!1,u1=!1,Mr=0,ts=0,Sl=0,Mo=0,d1=0,Da=0,$c=0,Id=null,_a=null,f1=!1,Oh=0,a8=0,Ih=1/0,Lh=null,jl=null,_s=0,wl=null,Fc=null,Rr=0,h1=0,m1=null,i8=null,Ld=0,p1=null;function Oa(){return(vn&2)!==0&&en!==0?en&-en:M.T!==null?x1():te()}function r8(){if(Da===0)if((en&536870912)===0||Gt){var n=Wt;Wt<<=1,(Wt&3932160)===0&&(Wt=262144),Da=n}else Da=536870912;return n=Ln.current,n!==null&&(n.flags|=32),Da}function ya(n,s,r){(n===An&&(kn===2||kn===9)||n.cancelPendingCommit!==null)&&(qc(n,0),Nl(n,en,Da,!1)),On(n,r),((vn&2)===0||n!==An)&&(n===An&&((vn&2)===0&&(Mo|=r),ts===4&&Nl(n,en,Da,!1)),qi(n))}function l8(n,s,r){if((vn&6)!==0)throw Error(l(327));var c=!r&&(s&127)===0&&(s&n.expiredLanes)===0||Cn(n,s),d=c?Zx(n,s):_1(n,s,!0),h=c;do{if(d===0){Hc&&!c&&Nl(n,s,0,!1);break}else{if(r=n.current.alternate,h&&!Yx(r)){d=_1(n,s,!1),h=!1;continue}if(d===2){if(h=s,n.errorRecoveryDisabledLanes&h)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){s=x;e:{var E=n;d=Id;var B=E.current.memoizedState.isDehydrated;if(B&&(qc(E,x).flags|=256),x=_1(E,x,!1),x!==2){if(u1&&!B){E.errorRecoveryDisabledLanes|=h,Mo|=h,d=4;break e}h=_a,_a=d,h!==null&&(_a===null?_a=h:_a.push.apply(_a,h))}d=x}if(h=!1,d!==2)continue}}if(d===1){qc(n,0),Nl(n,s,0,!0);break}e:{switch(c=n,h=d,h){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:Nl(c,s,Da,!xl);break e;case 2:_a=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(d=Oh+300-Ee(),10<d)){if(Nl(c,s,Da,!xl),Un(c,0,!0)!==0)break e;Rr=s,c.timeoutHandle=U8(o8.bind(null,c,r,_a,Lh,f1,s,Da,Mo,$c,xl,h,"Throttled",-0,0),d);break e}o8(c,r,_a,Lh,f1,s,Da,Mo,$c,xl,h,null,-0,0)}}break}while(!0);qi(n)}function o8(n,s,r,c,d,h,x,E,B,le,xe,ke,de,ve){if(n.timeoutHandle=-1,ke=s.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ms},e8(s,h,ke);var nt=(h&62914560)===h?Oh-Ee():(h&4194048)===h?a8-Ee():0;if(nt=D5(ke,nt),nt!==null){Rr=h,n.cancelPendingCommit=nt(g8.bind(null,n,s,h,r,c,d,x,E,B,xe,ke,null,de,ve)),Nl(n,h,x,!le);return}}g8(n,s,h,r,c,d,x,E,B)}function Yx(n){for(var s=n;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var c=0;c<r.length;c++){var d=r[c],h=d.getSnapshot;d=d.value;try{if(!js(h(),d))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Nl(n,s,r,c){s&=~d1,s&=~Mo,n.suspendedLanes|=s,n.pingedLanes&=~s,c&&(n.warmLanes|=s),c=n.expirationTimes;for(var d=s;0<d;){var h=31-Re(d),x=1<<h;c[h]=-1,d&=~x}r!==0&&Ua(n,r,s)}function Ph(){return(vn&6)===0?(Pd(0),!1):!0}function g1(){if(Vt!==null){if(kn===0)var n=Vt.return;else n=Vt,_i=gr=null,it(n),xr=null,gl=0,n=Vt;for(;n!==null;)zy(n.alternate,n),n=n.return;Vt=null}}function qc(n,s){var r=n.timeoutHandle;r!==-1&&(n.timeoutHandle=-1,p5(r)),r=n.cancelPendingCommit,r!==null&&(n.cancelPendingCommit=null,r()),Rr=0,g1(),An=n,Vt=r=hi(n.current,null),en=s,kn=0,Aa=null,xl=!1,Hc=Cn(n,s),u1=!1,$c=Da=d1=Mo=Sl=ts=0,_a=Id=null,f1=!1,(s&8)!==0&&(s|=s&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=s;0<c;){var d=31-Re(c),h=1<<d;s|=n[d],c&=~h}return Mr=s,Nc(),r}function c8(n,s){Ot=null,M.H=Ed,s===pl||s===vo?(s=bd(),kn=3):s===yd?(s=bd(),kn=4):kn=s===Gp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Aa=s,Vt===null&&(ts=1,kh(n,Ws(s,n.current)))}function u8(){var n=Ln.current;return n===null?!0:(en&4194048)===en?ze===null:(en&62914560)===en||(en&536870912)!==0?n===ze:!1}function d8(){var n=M.H;return M.H=Ed,n===null?Ed:n}function f8(){var n=M.A;return M.A=Qx,n}function Uh(){ts=4,xl||(en&4194048)!==en&&Ln.current!==null||(Hc=!0),(Sl&134217727)===0&&(Mo&134217727)===0||An===null||Nl(An,en,Da,!1)}function _1(n,s,r){var c=vn;vn|=2;var d=d8(),h=f8();(An!==n||en!==s)&&(Lh=null,qc(n,s)),s=!1;var x=ts;e:do try{if(kn!==0&&Vt!==null){var E=Vt,B=Aa;switch(kn){case 8:g1(),x=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(s=!0);var le=kn;if(kn=0,Aa=null,Wc(n,E,B,le),r&&Hc){x=0;break e}break;default:le=kn,kn=0,Aa=null,Wc(n,E,B,le)}}Vx(),x=ts;break}catch(xe){c8(n,xe)}while(!0);return s&&n.shellSuspendCounter++,_i=gr=null,vn=c,M.H=d,M.A=h,Vt===null&&(An=null,en=0,Nc()),x}function Vx(){for(;Vt!==null;)h8(Vt)}function Zx(n,s){var r=vn;vn|=2;var c=d8(),d=f8();An!==n||en!==s?(Lh=null,Ih=Ee()+500,qc(n,s)):Hc=Cn(n,s);e:do try{if(kn!==0&&Vt!==null){s=Vt;var h=Aa;t:switch(kn){case 1:kn=0,Aa=null,Wc(n,s,h,1);break;case 2:case 9:if(vd(h)){kn=0,Aa=null,m8(s);break}s=function(){kn!==2&&kn!==9||An!==n||(kn=7),qi(n)},h.then(s,s);break e;case 3:kn=7;break e;case 4:kn=5;break e;case 7:vd(h)?(kn=0,Aa=null,m8(s)):(kn=0,Aa=null,Wc(n,s,h,7));break;case 5:var x=null;switch(Vt.tag){case 26:x=Vt.memoizedState;case 5:case 27:var E=Vt;if(x?J8(x):E.stateNode.complete){kn=0,Aa=null;var B=E.sibling;if(B!==null)Vt=B;else{var le=E.return;le!==null?(Vt=le,zh(le)):Vt=null}break t}}kn=0,Aa=null,Wc(n,s,h,5);break;case 6:kn=0,Aa=null,Wc(n,s,h,6);break;case 8:g1(),ts=6;break e;default:throw Error(l(462))}}Xx();break}catch(xe){c8(n,xe)}while(!0);return _i=gr=null,M.H=c,M.A=d,vn=r,Vt!==null?0:(An=null,en=0,Nc(),ts)}function Xx(){for(;Vt!==null&&!cn();)h8(Vt)}function h8(n){var s=Py(n.alternate,n,Mr);n.memoizedProps=n.pendingProps,s===null?zh(n):Vt=s}function m8(n){var s=n,r=s.alternate;switch(s.tag){case 15:case 0:s=Ry(r,s,s.pendingProps,s.type,void 0,en);break;case 11:s=Ry(r,s,s.pendingProps,s.type.render,s.ref,en);break;case 5:it(s);default:zy(r,s),s=Vt=dh(s,Mr),s=Py(r,s,Mr)}n.memoizedProps=n.pendingProps,s===null?zh(n):Vt=s}function Wc(n,s,r,c){_i=gr=null,it(s),xr=null,gl=0;var d=s.return;try{if(Bx(n,d,s,r,en)){ts=1,kh(n,Ws(r,n.current)),Vt=null;return}}catch(h){if(d!==null)throw Vt=d,h;ts=1,kh(n,Ws(r,n.current)),Vt=null;return}s.flags&32768?(Gt||c===1?n=!0:Hc||(en&536870912)!==0?n=!1:(xl=n=!0,(c===2||c===9||c===3||c===6)&&(c=Ln.current,c!==null&&c.tag===13&&(c.flags|=16384))),p8(s,n)):zh(s)}function zh(n){var s=n;do{if((s.flags&32768)!==0){p8(s,xl);return}n=s.return;var r=Fx(s.alternate,s,Mr);if(r!==null){Vt=r;return}if(s=s.sibling,s!==null){Vt=s;return}Vt=s=n}while(s!==null);ts===0&&(ts=5)}function p8(n,s){do{var r=qx(n.alternate,n);if(r!==null){r.flags&=32767,Vt=r;return}if(r=n.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(n=n.sibling,n!==null)){Vt=n;return}Vt=n=r}while(n!==null);ts=6,Vt=null}function g8(n,s,r,c,d,h,x,E,B){n.cancelPendingCommit=null;do Bh();while(_s!==0);if((vn&6)!==0)throw Error(l(327));if(s!==null){if(s===n.current)throw Error(l(177));if(h=s.lanes|s.childLanes,h|=ea,Ts(n,r,h,x,E,B),n===An&&(Vt=An=null,en=0),Fc=s,wl=n,Rr=r,h1=h,m1=d,i8=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,n5(Ie,function(){return x8(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=M.T,M.T=null,d=$.p,$.p=2,x=vn,vn|=4;try{Wx(n,s,r)}finally{vn=x,$.p=d,M.T=c}}_s=1,_8(),y8(),v8()}}function _8(){if(_s===1){_s=0;var n=wl,s=Fc,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var c=$.p;$.p=2;var d=vn;vn|=4;try{Zy(s,n);var h=T1,x=ah(n.containerInfo),E=h.focusedElem,B=h.selectionRange;if(x!==E&&E&&E.ownerDocument&&fo(E.ownerDocument.documentElement,E)){if(B!==null&&xc(E)){var le=B.start,xe=B.end;if(xe===void 0&&(xe=le),"selectionStart"in E)E.selectionStart=le,E.selectionEnd=Math.min(xe,E.value.length);else{var ke=E.ownerDocument||document,de=ke&&ke.defaultView||window;if(de.getSelection){var ve=de.getSelection(),nt=E.textContent.length,wt=Math.min(B.start,nt),Rn=B.end===void 0?wt:Math.min(B.end,nt);!ve.extend&&wt>Rn&&(x=Rn,Rn=wt,wt=x);var X=il(E,wt),W=il(E,Rn);if(X&&W&&(ve.rangeCount!==1||ve.anchorNode!==X.node||ve.anchorOffset!==X.offset||ve.focusNode!==W.node||ve.focusOffset!==W.offset)){var re=ke.createRange();re.setStart(X.node,X.offset),ve.removeAllRanges(),wt>Rn?(ve.addRange(re),ve.extend(W.node,W.offset)):(re.setEnd(W.node,W.offset),ve.addRange(re))}}}}for(ke=[],ve=E;ve=ve.parentNode;)ve.nodeType===1&&ke.push({element:ve,left:ve.scrollLeft,top:ve.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ke.length;E++){var Ne=ke[E];Ne.element.scrollLeft=Ne.left,Ne.element.scrollTop=Ne.top}}Xh=!!C1,T1=C1=null}finally{vn=d,$.p=c,M.T=r}}n.current=s,_s=2}}function y8(){if(_s===2){_s=0;var n=wl,s=Fc,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var c=$.p;$.p=2;var d=vn;vn|=4;try{Ky(n,s.alternate,s)}finally{vn=d,$.p=c,M.T=r}}_s=3}}function v8(){if(_s===4||_s===3){_s=0,Pn();var n=wl,s=Fc,r=Rr,c=i8;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?_s=5:(_s=0,Fc=wl=null,b8(n,n.pendingLanes));var d=n.pendingLanes;if(d===0&&(jl=null),Vs(r),s=s.stateNode,ue&&typeof ue.onCommitFiberRoot=="function")try{ue.onCommitFiberRoot(Dt,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=M.T,d=$.p,$.p=2,M.T=null;try{for(var h=n.onRecoverableError,x=0;x<c.length;x++){var E=c[x];h(E.value,{componentStack:E.stack})}}finally{M.T=s,$.p=d}}(Rr&3)!==0&&Bh(),qi(n),d=n.pendingLanes,(r&261930)!==0&&(d&42)!==0?n===p1?Ld++:(Ld=0,p1=n):Ld=0,Pd(0)}}function b8(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,hl(s)))}function Bh(){return _8(),y8(),v8(),x8()}function x8(){if(_s!==5)return!1;var n=wl,s=h1;h1=0;var r=Vs(Rr),c=M.T,d=$.p;try{$.p=32>r?32:r,M.T=null,r=m1,m1=null;var h=wl,x=Rr;if(_s=0,Fc=wl=null,Rr=0,(vn&6)!==0)throw Error(l(331));var E=vn;if(vn|=4,n8(h.current),Jy(h,h.current,x,r),vn=E,Pd(0,!1),ue&&typeof ue.onPostCommitFiberRoot=="function")try{ue.onPostCommitFiberRoot(Dt,h)}catch{}return!0}finally{$.p=d,M.T=c,b8(n,s)}}function S8(n,s,r){s=Ws(r,s),s=Qp(n.stateNode,s,2),n=xi(n,s,2),n!==null&&(On(n,2),qi(n))}function En(n,s,r){if(n.tag===3)S8(n,n,r);else for(;s!==null;){if(s.tag===3){S8(s,n,r);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(jl===null||!jl.has(c))){n=Ws(r,n),r=jy(2),c=xi(s,r,2),c!==null&&(wy(r,c,s,n),On(c,2),qi(c));break}}s=s.return}}function y1(n,s,r){var c=n.pingCache;if(c===null){c=n.pingCache=new Gx;var d=new Set;c.set(s,d)}else d=c.get(s),d===void 0&&(d=new Set,c.set(s,d));d.has(r)||(u1=!0,d.add(r),n=Jx.bind(null,n,s,r),s.then(n,n))}function Jx(n,s,r){var c=n.pingCache;c!==null&&c.delete(s),n.pingedLanes|=n.suspendedLanes&r,n.warmLanes&=~r,An===n&&(en&r)===r&&(ts===4||ts===3&&(en&62914560)===en&&300>Ee()-Oh?(vn&2)===0&&qc(n,0):d1|=r,$c===en&&($c=0)),qi(n)}function j8(n,s){s===0&&(s=De()),n=mr(n,s),n!==null&&(On(n,s),qi(n))}function e5(n){var s=n.memoizedState,r=0;s!==null&&(r=s.retryLane),j8(n,r)}function t5(n,s){var r=0;switch(n.tag){case 31:case 13:var c=n.stateNode,d=n.memoizedState;d!==null&&(r=d.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(s),j8(n,r)}function n5(n,s){return bt(n,s)}var Hh=null,Kc=null,v1=!1,$h=!1,b1=!1,kl=0;function qi(n){n!==Kc&&n.next===null&&(Kc===null?Hh=Kc=n:Kc=Kc.next=n),$h=!0,v1||(v1=!0,a5())}function Pd(n,s){if(!b1&&$h){b1=!0;do for(var r=!1,c=Hh;c!==null;){if(n!==0){var d=c.pendingLanes;if(d===0)var h=0;else{var x=c.suspendedLanes,E=c.pingedLanes;h=(1<<31-Re(42|n)+1)-1,h&=d&~(x&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,E8(c,h))}else h=en,h=Un(c,c===An?h:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(h&3)===0||Cn(c,h)||(r=!0,E8(c,h));c=c.next}while(r);b1=!1}}function s5(){w8()}function w8(){$h=v1=!1;var n=0;kl!==0&&m5()&&(n=kl);for(var s=Ee(),r=null,c=Hh;c!==null;){var d=c.next,h=N8(c,s);h===0?(c.next=null,r===null?Hh=d:r.next=d,d===null&&(Kc=r)):(r=c,(n!==0||(h&3)!==0)&&($h=!0)),c=d}_s!==0&&_s!==5||Pd(n),kl!==0&&(kl=0)}function N8(n,s){for(var r=n.suspendedLanes,c=n.pingedLanes,d=n.expirationTimes,h=n.pendingLanes&-62914561;0<h;){var x=31-Re(h),E=1<<x,B=d[x];B===-1?((E&r)===0||(E&c)!==0)&&(d[x]=Dn(E,s)):B<=s&&(n.expiredLanes|=E),h&=~E}if(s=An,r=en,r=Un(n,n===s?r:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,r===0||n===s&&(kn===2||kn===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&dt(c),n.callbackNode=null,n.callbackPriority=0;if((r&3)===0||Cn(n,r)){if(s=r&-r,s===n.callbackPriority)return s;switch(c!==null&&dt(c),Vs(r)){case 2:case 8:r=Te;break;case 32:r=Ie;break;case 268435456:r=Ae;break;default:r=Ie}return c=k8.bind(null,n),r=bt(r,c),n.callbackPriority=s,n.callbackNode=r,s}return c!==null&&c!==null&&dt(c),n.callbackPriority=2,n.callbackNode=null,2}function k8(n,s){if(_s!==0&&_s!==5)return n.callbackNode=null,n.callbackPriority=0,null;var r=n.callbackNode;if(Bh()&&n.callbackNode!==r)return null;var c=en;return c=Un(n,n===An?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(l8(n,c,s),N8(n,Ee()),n.callbackNode!=null&&n.callbackNode===r?k8.bind(null,n):null)}function E8(n,s){if(Bh())return null;l8(n,s,!0)}function a5(){g5(function(){(vn&6)!==0?bt(_e,s5):w8()})}function x1(){if(kl===0){var n=yr;n===0&&(n=Tt,Tt<<=1,(Tt&261888)===0&&(Tt=256)),kl=n}return kl}function C8(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Ba(""+n)}function T8(n,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,n.id&&r.setAttribute("form",n.id),s.parentNode.insertBefore(r,s),n=new FormData(n),r.parentNode.removeChild(r),n}function i5(n,s,r,c,d){if(s==="submit"&&r&&r.stateNode===d){var h=C8((d[Ut]||null).action),x=c.submitter;x&&(s=(s=x[Ut]||null)?C8(s.formAction):x.getAttribute("formAction"),s!==null&&(h=s,x=null));var E=new Vr("action","action",null,c,d);n.push({event:E,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(kl!==0){var B=x?T8(d,x):new FormData(d);Hp(r,{pending:!0,data:B,method:d.method,action:h},null,B)}}else typeof h=="function"&&(E.preventDefault(),B=x?T8(d,x):new FormData(d),Hp(r,{pending:!0,data:B,method:d.method,action:h},h,B))},currentTarget:d}]})}}for(var S1=0;S1<jc.length;S1++){var j1=jc[S1],r5=j1.toLowerCase(),l5=j1[0].toUpperCase()+j1.slice(1);Ea(r5,"on"+l5)}Ea(Ii,"onAnimationEnd"),Ea(rh,"onAnimationIteration"),Ea(lh,"onAnimationStart"),Ea("dblclick","onDoubleClick"),Ea("focusin","onFocus"),Ea("focusout","onBlur"),Ea(Mp,"onTransitionRun"),Ea(oh,"onTransitionStart"),Ea(Rp,"onTransitionCancel"),Ea(ch,"onTransitionEnd"),ot("onMouseEnter",["mouseout","mouseover"]),ot("onMouseLeave",["mouseout","mouseover"]),ot("onPointerEnter",["pointerout","pointerover"]),ot("onPointerLeave",["pointerout","pointerover"]),mt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mt("onBeforeInput",["compositionend","keypress","textInput","paste"]),mt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ud="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(" "),o5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ud));function M8(n,s){s=(s&4)!==0;for(var r=0;r<n.length;r++){var c=n[r],d=c.event;c=c.listeners;e:{var h=void 0;if(s)for(var x=c.length-1;0<=x;x--){var E=c[x],B=E.instance,le=E.currentTarget;if(E=E.listener,B!==h&&d.isPropagationStopped())break e;h=E,d.currentTarget=le;try{h(d)}catch(xe){wc(xe)}d.currentTarget=null,h=B}else for(x=0;x<c.length;x++){if(E=c[x],B=E.instance,le=E.currentTarget,E=E.listener,B!==h&&d.isPropagationStopped())break e;h=E,d.currentTarget=le;try{h(d)}catch(xe){wc(xe)}d.currentTarget=null,h=B}}}}function Zt(n,s){var r=s[Mt];r===void 0&&(r=s[Mt]=new Set);var c=n+"__bubble";r.has(c)||(R8(s,n,2,!1),r.add(c))}function w1(n,s,r){var c=0;s&&(c|=4),R8(r,n,c,s)}var Fh="_reactListening"+Math.random().toString(36).slice(2);function N1(n){if(!n[Fh]){n[Fh]=!0,Ge.forEach(function(r){r!=="selectionchange"&&(o5.has(r)||w1(r,!1,n),w1(r,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Fh]||(s[Fh]=!0,w1("selectionchange",!1,s))}}function R8(n,s,r,c){switch(rv(s)){case 2:var d=L5;break;case 8:d=P5;break;default:d=B1}r=d.bind(null,s,r,n),d=void 0,!Yu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),c?d!==void 0?n.addEventListener(s,r,{capture:!0,passive:d}):n.addEventListener(s,r,!0):d!==void 0?n.addEventListener(s,r,{passive:d}):n.addEventListener(s,r,!1)}function k1(n,s,r,c,d){var h=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var E=c.stateNode.containerInfo;if(E===d)break;if(x===4)for(x=c.return;x!==null;){var B=x.tag;if((B===3||B===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;E!==null;){if(x=Wn(E),x===null)return;if(B=x.tag,B===5||B===6||B===26||B===27){c=h=x;continue e}E=E.parentNode}}c=c.return}li(function(){var le=h,xe=ar(r),ke=[];e:{var de=ca.get(n);if(de!==void 0){var ve=Vr,nt=n;switch(n){case"keypress":if(Ai(r)===0)break e;case"keydown":case"keyup":ve=Jr;break;case"focusin":nt="focus",ve=Xr;break;case"focusout":nt="blur",ve=Xr;break;case"beforeblur":case"afterblur":ve=Xr;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=ui;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=_n;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=Jf;break;case Ii:case rh:case lh:ve=Vf;break;case ch:ve=eh;break;case"scroll":case"scrollend":ve=oo;break;case"wheel":ve=uo;break;case"copy":case"cut":case"paste":ve=Zf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=co;break;case"toggle":case"beforetoggle":ve=Tp}var wt=(s&4)!==0,Rn=!wt&&(n==="scroll"||n==="scrollend"),X=wt?de!==null?de+"Capture":null:de;wt=[];for(var W=le,re;W!==null;){var Ne=W;if(re=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||re===null||X===null||(Ne=Mi(W,X),Ne!=null&&wt.push(zd(W,Ne,re))),Rn)break;W=W.return}0<wt.length&&(de=new ve(de,nt,null,r,xe),ke.push({event:de,listeners:wt}))}}if((s&7)===0){e:{if(de=n==="mouseover"||n==="pointerover",ve=n==="mouseout"||n==="pointerout",de&&r!==Ha&&(nt=r.relatedTarget||r.fromElement)&&(Wn(nt)||nt[ft]))break e;if((ve||de)&&(de=xe.window===xe?xe:(de=xe.ownerDocument)?de.defaultView||de.parentWindow:window,ve?(nt=r.relatedTarget||r.toElement,ve=le,nt=nt?Wn(nt):null,nt!==null&&(Rn=u(nt),wt=nt.tag,nt!==Rn||wt!==5&&wt!==27&&wt!==6)&&(nt=null)):(ve=null,nt=le),ve!==nt)){if(wt=ui,Ne="onMouseLeave",X="onMouseEnter",W="mouse",(n==="pointerout"||n==="pointerover")&&(wt=co,Ne="onPointerLeave",X="onPointerEnter",W="pointer"),Rn=ve==null?de:be(ve),re=nt==null?de:be(nt),de=new wt(Ne,W+"leave",ve,r,xe),de.target=Rn,de.relatedTarget=re,Ne=null,Wn(xe)===le&&(wt=new wt(X,W+"enter",nt,r,xe),wt.target=re,wt.relatedTarget=Rn,Ne=wt),Rn=Ne,ve&&nt)t:{for(wt=c5,X=ve,W=nt,re=0,Ne=X;Ne;Ne=wt(Ne))re++;Ne=0;for(var vt=W;vt;vt=wt(vt))Ne++;for(;0<re-Ne;)X=wt(X),re--;for(;0<Ne-re;)W=wt(W),Ne--;for(;re--;){if(X===W||W!==null&&X===W.alternate){wt=X;break t}X=wt(X),W=wt(W)}wt=null}else wt=null;ve!==null&&A8(ke,de,ve,wt,!1),nt!==null&&Rn!==null&&A8(ke,Rn,nt,wt,!0)}}e:{if(de=le?be(le):window,ve=de.nodeName&&de.nodeName.toLowerCase(),ve==="select"||ve==="input"&&de.type==="file")var fn=sd;else if(tl(de))if(Fa)fn=bc;else{fn=vc;var lt=yc}else ve=de.nodeName,!ve||ve.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?le&&tr(le.elementType)&&(fn=sd):fn=cs;if(fn&&(fn=fn(n,le))){nl(ke,fn,r,xe);break e}lt&<(n,de,le),n==="focusout"&&le&&de.type==="number"&&le.memoizedProps.value!=null&&za(de,"number",de.value)}switch(lt=le?be(le):window,n){case"focusin":(tl(lt)||lt.contentEditable==="true")&&(rl=lt,ho=le,fr=null);break;case"focusout":fr=ho=rl=null;break;case"mousedown":ll=!0;break;case"contextmenu":case"mouseup":case"dragend":ll=!1,id(ke,r,xe);break;case"selectionchange":if(ih)break;case"keydown":case"keyup":id(ke,r,xe)}var Ht;if(di)e:{switch(n){case"compositionstart":var tn="onCompositionStart";break e;case"compositionend":tn="onCompositionEnd";break e;case"compositionupdate":tn="onCompositionUpdate";break e}tn=void 0}else la?ka(n,r)&&(tn="onCompositionEnd"):n==="keydown"&&r.keyCode===229&&(tn="onCompositionStart");tn&&(td&&r.locale!=="ko"&&(la||tn!=="onCompositionStart"?tn==="onCompositionEnd"&&la&&(Ht=lr()):(wa=xe,lo="value"in wa?wa.value:wa.textContent,la=!0)),lt=qh(le,tn),0<lt.length&&(tn=new hc(tn,n,null,r,xe),ke.push({event:tn,listeners:lt}),Ht?tn.data=Ht:(Ht=ur(r),Ht!==null&&(tn.data=Ht)))),(Ht=ed?nd(n,r):gc(n,r))&&(tn=qh(le,"onBeforeInput"),0<tn.length&&(lt=new hc("onBeforeInput","beforeinput",null,r,xe),ke.push({event:lt,listeners:tn}),lt.data=Ht)),i5(ke,n,le,r,xe)}M8(ke,s)})}function zd(n,s,r){return{instance:n,listener:s,currentTarget:r}}function qh(n,s){for(var r=s+"Capture",c=[];n!==null;){var d=n,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Mi(n,r),d!=null&&c.unshift(zd(n,d,h)),d=Mi(n,s),d!=null&&c.push(zd(n,d,h))),n.tag===3)return c;n=n.return}return[]}function c5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function A8(n,s,r,c,d){for(var h=s._reactName,x=[];r!==null&&r!==c;){var E=r,B=E.alternate,le=E.stateNode;if(E=E.tag,B!==null&&B===c)break;E!==5&&E!==26&&E!==27||le===null||(B=le,d?(le=Mi(r,h),le!=null&&x.unshift(zd(r,le,B))):d||(le=Mi(r,h),le!=null&&x.push(zd(r,le,B)))),r=r.return}x.length!==0&&n.push({event:s,listeners:x})}var u5=/\r\n?/g,d5=/\u0000|\uFFFD/g;function D8(n){return(typeof n=="string"?n:""+n).replace(u5,`
|
|
50
|
+
`).replace(d5,"")}function O8(n,s){return s=D8(s),D8(n)===s}function Mn(n,s,r,c,d,h){switch(r){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||$s(n,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&$s(n,""+c);break;case"className":pn(n,"class",c);break;case"tabIndex":pn(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":pn(n,r,c);break;case"style":er(n,c,h);break;case"data":if(s!=="object"){pn(n,"data",c);break}case"src":case"href":if(c===""&&(s!=="a"||r!=="href")){n.removeAttribute(r);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(r);break}c=Ba(""+c),n.setAttribute(r,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(s!=="input"&&Mn(n,s,"name",d.name,d,null),Mn(n,s,"formEncType",d.formEncType,d,null),Mn(n,s,"formMethod",d.formMethod,d,null),Mn(n,s,"formTarget",d.formTarget,d,null)):(Mn(n,s,"encType",d.encType,d,null),Mn(n,s,"method",d.method,d,null),Mn(n,s,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(r);break}c=Ba(""+c),n.setAttribute(r,c);break;case"onClick":c!=null&&(n.onclick=Ms);break;case"onScroll":c!=null&&Zt("scroll",n);break;case"onScrollEnd":c!=null&&Zt("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(r=c.__html,r!=null){if(d.children!=null)throw Error(l(60));n.innerHTML=r}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}r=Ba(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(r,""+c):n.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(r,""):n.removeAttribute(r);break;case"capture":case"download":c===!0?n.setAttribute(r,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(r,c):n.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(r,c):n.removeAttribute(r);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(r):n.setAttribute(r,c);break;case"popover":Zt("beforetoggle",n),Zt("toggle",n),In(n,"popover",c);break;case"xlinkActuate":sn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":sn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":sn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":sn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":sn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":sn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":sn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":sn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":sn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":In(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=nr.get(r)||r,In(n,r,c))}}function E1(n,s,r,c,d,h){switch(r){case"style":er(n,c,h);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(r=c.__html,r!=null){if(d.children!=null)throw Error(l(60));n.innerHTML=r}}break;case"children":typeof c=="string"?$s(n,c):(typeof c=="number"||typeof c=="bigint")&&$s(n,""+c);break;case"onScroll":c!=null&&Zt("scroll",n);break;case"onScrollEnd":c!=null&&Zt("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Ms);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ht.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),s=r.slice(2,d?r.length-7:void 0),h=n[Ut]||null,h=h!=null?h[r]:null,typeof h=="function"&&n.removeEventListener(s,h,d),typeof c=="function")){typeof h!="function"&&h!==null&&(r in n?n[r]=null:n.hasAttribute(r)&&n.removeAttribute(r)),n.addEventListener(s,c,d);break e}r in n?n[r]=c:c===!0?n.setAttribute(r,""):In(n,r,c)}}}function Ls(n,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zt("error",n),Zt("load",n);var c=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var x=r[h];if(x!=null)switch(h){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Mn(n,s,h,x,r,null)}}d&&Mn(n,s,"srcSet",r.srcSet,r,null),c&&Mn(n,s,"src",r.src,r,null);return;case"input":Zt("invalid",n);var E=h=x=d=null,B=null,le=null;for(c in r)if(r.hasOwnProperty(c)){var xe=r[c];if(xe!=null)switch(c){case"name":d=xe;break;case"type":x=xe;break;case"checked":B=xe;break;case"defaultChecked":le=xe;break;case"value":h=xe;break;case"defaultValue":E=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(l(137,s));break;default:Mn(n,s,c,xe,r,null)}}zn(n,h,E,B,le,x,d,!1);return;case"select":Zt("invalid",n),c=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(E=r[d],E!=null))switch(d){case"value":h=E;break;case"defaultValue":x=E;break;case"multiple":c=E;default:Mn(n,s,d,E,r,null)}s=h,r=x,n.multiple=!!c,s!=null?Bs(n,!!c,s,!1):r!=null&&Bs(n,!!c,r,!0);return;case"textarea":Zt("invalid",n),h=d=c=null;for(x in r)if(r.hasOwnProperty(x)&&(E=r[x],E!=null))switch(x){case"value":c=E;break;case"defaultValue":d=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(l(91));break;default:Mn(n,s,x,E,r,null)}Zs(n,c,d,h);return;case"option":for(B in r)if(r.hasOwnProperty(B)&&(c=r[B],c!=null))switch(B){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Mn(n,s,B,c,r,null)}return;case"dialog":Zt("beforetoggle",n),Zt("toggle",n),Zt("cancel",n),Zt("close",n);break;case"iframe":case"object":Zt("load",n);break;case"video":case"audio":for(c=0;c<Ud.length;c++)Zt(Ud[c],n);break;case"image":Zt("error",n),Zt("load",n);break;case"details":Zt("toggle",n);break;case"embed":case"source":case"link":Zt("error",n),Zt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in r)if(r.hasOwnProperty(le)&&(c=r[le],c!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Mn(n,s,le,c,r,null)}return;default:if(tr(s)){for(xe in r)r.hasOwnProperty(xe)&&(c=r[xe],c!==void 0&&E1(n,s,xe,c,r,void 0));return}}for(E in r)r.hasOwnProperty(E)&&(c=r[E],c!=null&&Mn(n,s,E,c,r,null))}function f5(n,s,r,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,x=null,E=null,B=null,le=null,xe=null;for(ve in r){var ke=r[ve];if(r.hasOwnProperty(ve)&&ke!=null)switch(ve){case"checked":break;case"value":break;case"defaultValue":B=ke;default:c.hasOwnProperty(ve)||Mn(n,s,ve,null,c,ke)}}for(var de in c){var ve=c[de];if(ke=r[de],c.hasOwnProperty(de)&&(ve!=null||ke!=null))switch(de){case"type":h=ve;break;case"name":d=ve;break;case"checked":le=ve;break;case"defaultChecked":xe=ve;break;case"value":x=ve;break;case"defaultValue":E=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(l(137,s));break;default:ve!==ke&&Mn(n,s,de,ve,c,ke)}}gn(n,x,E,B,le,xe,h,d);return;case"select":ve=x=E=de=null;for(h in r)if(B=r[h],r.hasOwnProperty(h)&&B!=null)switch(h){case"value":break;case"multiple":ve=B;default:c.hasOwnProperty(h)||Mn(n,s,h,null,c,B)}for(d in c)if(h=c[d],B=r[d],c.hasOwnProperty(d)&&(h!=null||B!=null))switch(d){case"value":de=h;break;case"defaultValue":E=h;break;case"multiple":x=h;default:h!==B&&Mn(n,s,d,h,c,B)}s=E,r=x,c=ve,de!=null?Bs(n,!!r,de,!1):!!c!=!!r&&(s!=null?Bs(n,!!r,s,!0):Bs(n,!!r,r?[]:"",!1));return;case"textarea":ve=de=null;for(E in r)if(d=r[E],r.hasOwnProperty(E)&&d!=null&&!c.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Mn(n,s,E,null,c,d)}for(x in c)if(d=c[x],h=r[x],c.hasOwnProperty(x)&&(d!=null||h!=null))switch(x){case"value":de=d;break;case"defaultValue":ve=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(l(91));break;default:d!==h&&Mn(n,s,x,d,c,h)}Hs(n,de,ve);return;case"option":for(var nt in r)if(de=r[nt],r.hasOwnProperty(nt)&&de!=null&&!c.hasOwnProperty(nt))switch(nt){case"selected":n.selected=!1;break;default:Mn(n,s,nt,null,c,de)}for(B in c)if(de=c[B],ve=r[B],c.hasOwnProperty(B)&&de!==ve&&(de!=null||ve!=null))switch(B){case"selected":n.selected=de&&typeof de!="function"&&typeof de!="symbol";break;default:Mn(n,s,B,de,c,ve)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var wt in r)de=r[wt],r.hasOwnProperty(wt)&&de!=null&&!c.hasOwnProperty(wt)&&Mn(n,s,wt,null,c,de);for(le in c)if(de=c[le],ve=r[le],c.hasOwnProperty(le)&&de!==ve&&(de!=null||ve!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(l(137,s));break;default:Mn(n,s,le,de,c,ve)}return;default:if(tr(s)){for(var Rn in r)de=r[Rn],r.hasOwnProperty(Rn)&&de!==void 0&&!c.hasOwnProperty(Rn)&&E1(n,s,Rn,void 0,c,de);for(xe in c)de=c[xe],ve=r[xe],!c.hasOwnProperty(xe)||de===ve||de===void 0&&ve===void 0||E1(n,s,xe,de,c,ve);return}}for(var X in r)de=r[X],r.hasOwnProperty(X)&&de!=null&&!c.hasOwnProperty(X)&&Mn(n,s,X,null,c,de);for(ke in c)de=c[ke],ve=r[ke],!c.hasOwnProperty(ke)||de===ve||de==null&&ve==null||Mn(n,s,ke,de,c,ve)}function I8(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function h5(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,r=performance.getEntriesByType("resource"),c=0;c<r.length;c++){var d=r[c],h=d.transferSize,x=d.initiatorType,E=d.duration;if(h&&E&&I8(x)){for(x=0,E=d.responseEnd,c+=1;c<r.length;c++){var B=r[c],le=B.startTime;if(le>E)break;var xe=B.transferSize,ke=B.initiatorType;xe&&I8(ke)&&(B=B.responseEnd,x+=xe*(B<E?1:(E-le)/(B-le)))}if(--c,s+=8*(h+x)/(d.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var C1=null,T1=null;function Wh(n){return n.nodeType===9?n:n.ownerDocument}function L8(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function P8(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function M1(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var R1=null;function m5(){var n=window.event;return n&&n.type==="popstate"?n===R1?!1:(R1=n,!0):(R1=null,!1)}var U8=typeof setTimeout=="function"?setTimeout:void 0,p5=typeof clearTimeout=="function"?clearTimeout:void 0,z8=typeof Promise=="function"?Promise:void 0,g5=typeof queueMicrotask=="function"?queueMicrotask:typeof z8<"u"?function(n){return z8.resolve(null).then(n).catch(_5)}:U8;function _5(n){setTimeout(function(){throw n})}function El(n){return n==="head"}function B8(n,s){var r=s,c=0;do{var d=r.nextSibling;if(n.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(c===0){n.removeChild(d),Vc(s);return}c--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")c++;else if(r==="html")Bd(n.ownerDocument.documentElement);else if(r==="head"){r=n.ownerDocument.head,Bd(r);for(var h=r.firstChild;h;){var x=h.nextSibling,E=h.nodeName;h[Kt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&Bd(n.ownerDocument.body);r=d}while(r);Vc(s)}function H8(n,s){var r=n;n=0;do{var c=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),c&&c.nodeType===8)if(r=c.data,r==="/$"){if(n===0)break;n--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||n++;r=c}while(r)}function A1(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":A1(r),bs(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}n.removeChild(r)}}function y5(n,s,r,c){for(;n.nodeType===1;){var d=r;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[Kt])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(h=n.getAttribute("rel"),h==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(h!==d.rel||n.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||n.getAttribute("title")!==(d.title==null?null:d.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(h=n.getAttribute("src"),(h!==(d.src==null?null:d.src)||n.getAttribute("type")!==(d.type==null?null:d.type)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&n.getAttribute("name")===h)return n}else return n;if(n=Ja(n.nextSibling),n===null)break}return null}function v5(n,s,r){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Ja(n.nextSibling),n===null))return null;return n}function $8(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Ja(n.nextSibling),n===null))return null;return n}function D1(n){return n.data==="$?"||n.data==="$~"}function O1(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function b5(n,s){var r=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||r.readyState!=="loading")s();else{var c=function(){s(),r.removeEventListener("DOMContentLoaded",c)};r.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Ja(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var I1=null;function F8(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var r=n.data;if(r==="/$"||r==="/&"){if(s===0)return Ja(n.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}n=n.nextSibling}return null}function q8(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var r=n.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return n;s--}else r!=="/$"&&r!=="/&"||s++}n=n.previousSibling}return null}function W8(n,s,r){switch(s=Wh(r),n){case"html":if(n=s.documentElement,!n)throw Error(l(452));return n;case"head":if(n=s.head,!n)throw Error(l(453));return n;case"body":if(n=s.body,!n)throw Error(l(454));return n;default:throw Error(l(451))}}function Bd(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);bs(n)}var ei=new Map,K8=new Set;function Kh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ar=$.d;$.d={f:x5,r:S5,D:j5,C:w5,L:N5,m:k5,X:C5,S:E5,M:T5};function x5(){var n=Ar.f(),s=Ph();return n||s}function S5(n){var s=P(n);s!==null&&s.tag===5&&s.type==="form"?cy(s):Ar.r(n)}var Qc=typeof document>"u"?null:document;function Q8(n,s,r){var c=Qc;if(c&&typeof s=="string"&&s){var d=ct(s);d='link[rel="'+n+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),K8.has(d)||(K8.add(d),n={rel:n,crossOrigin:r,href:s},c.querySelector(d)===null&&(s=c.createElement("link"),Ls(s,"link",n),He(s),c.head.appendChild(s)))}}function j5(n){Ar.D(n),Q8("dns-prefetch",n,null)}function w5(n,s){Ar.C(n,s),Q8("preconnect",n,s)}function N5(n,s,r){Ar.L(n,s,r);var c=Qc;if(c&&n&&s){var d='link[rel="preload"][as="'+ct(s)+'"]';s==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+ct(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+ct(r.imageSizes)+'"]')):d+='[href="'+ct(n)+'"]';var h=d;switch(s){case"style":h=Gc(n);break;case"script":h=Yc(n)}ei.has(h)||(n=p({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:n,as:s},r),ei.set(h,n),c.querySelector(d)!==null||s==="style"&&c.querySelector(Hd(h))||s==="script"&&c.querySelector($d(h))||(s=c.createElement("link"),Ls(s,"link",n),He(s),c.head.appendChild(s)))}}function k5(n,s){Ar.m(n,s);var r=Qc;if(r&&n){var c=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+ct(c)+'"][href="'+ct(n)+'"]',h=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Yc(n)}if(!ei.has(h)&&(n=p({rel:"modulepreload",href:n},s),ei.set(h,n),r.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector($d(h)))return}c=r.createElement("link"),Ls(c,"link",n),He(c),r.head.appendChild(c)}}}function E5(n,s,r){Ar.S(n,s,r);var c=Qc;if(c&&n){var d=Ue(c).hoistableStyles,h=Gc(n);s=s||"default";var x=d.get(h);if(!x){var E={loading:0,preload:null};if(x=c.querySelector(Hd(h)))E.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":s},r),(r=ei.get(h))&&L1(n,r);var B=x=c.createElement("link");He(B),Ls(B,"link",n),B._p=new Promise(function(le,xe){B.onload=le,B.onerror=xe}),B.addEventListener("load",function(){E.loading|=1}),B.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Qh(x,s,c)}x={type:"stylesheet",instance:x,count:1,state:E},d.set(h,x)}}}function C5(n,s){Ar.X(n,s);var r=Qc;if(r&&n){var c=Ue(r).hoistableScripts,d=Yc(n),h=c.get(d);h||(h=r.querySelector($d(d)),h||(n=p({src:n,async:!0},s),(s=ei.get(d))&&P1(n,s),h=r.createElement("script"),He(h),Ls(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function T5(n,s){Ar.M(n,s);var r=Qc;if(r&&n){var c=Ue(r).hoistableScripts,d=Yc(n),h=c.get(d);h||(h=r.querySelector($d(d)),h||(n=p({src:n,async:!0,type:"module"},s),(s=ei.get(d))&&P1(n,s),h=r.createElement("script"),He(h),Ls(h,"link",n),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},c.set(d,h))}}function G8(n,s,r,c){var d=(d=se.current)?Kh(d):null;if(!d)throw Error(l(446));switch(n){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Gc(r.href),r=Ue(d).hoistableStyles,c=r.get(s),c||(c={type:"style",instance:null,count:0,state:null},r.set(s,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){n=Gc(r.href);var h=Ue(d).hoistableStyles,x=h.get(n);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(n,x),(h=d.querySelector(Hd(n)))&&!h._p&&(x.instance=h,x.state.loading=5),ei.has(n)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ei.set(n,r),h||M5(d,n,r,x.state))),s&&c===null)throw Error(l(528,""));return x}if(s&&c!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Yc(r),r=Ue(d).hoistableScripts,c=r.get(s),c||(c={type:"script",instance:null,count:0,state:null},r.set(s,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,n))}}function Gc(n){return'href="'+ct(n)+'"'}function Hd(n){return'link[rel="stylesheet"]['+n+"]"}function Y8(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function M5(n,s,r,c){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?c.loading=1:(s=n.createElement("link"),c.preload=s,s.addEventListener("load",function(){return c.loading|=1}),s.addEventListener("error",function(){return c.loading|=2}),Ls(s,"link",r),He(s),n.head.appendChild(s))}function Yc(n){return'[src="'+ct(n)+'"]'}function $d(n){return"script[async]"+n}function V8(n,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var c=n.querySelector('style[data-href~="'+ct(r.href)+'"]');if(c)return s.instance=c,He(c),c;var d=p({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),He(c),Ls(c,"style",d),Qh(c,r.precedence,n),s.instance=c;case"stylesheet":d=Gc(r.href);var h=n.querySelector(Hd(d));if(h)return s.state.loading|=4,s.instance=h,He(h),h;c=Y8(r),(d=ei.get(d))&&L1(c,d),h=(n.ownerDocument||n).createElement("link"),He(h);var x=h;return x._p=new Promise(function(E,B){x.onload=E,x.onerror=B}),Ls(h,"link",c),s.state.loading|=4,Qh(h,r.precedence,n),s.instance=h;case"script":return h=Yc(r.src),(d=n.querySelector($d(h)))?(s.instance=d,He(d),d):(c=r,(d=ei.get(h))&&(c=p({},r),P1(c,d)),n=n.ownerDocument||n,d=n.createElement("script"),He(d),Ls(d,"link",c),n.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(c=s.instance,s.state.loading|=4,Qh(c,r.precedence,n));return s.instance}function Qh(n,s,r){for(var c=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,h=d,x=0;x<c.length;x++){var E=c[x];if(E.dataset.precedence===s)h=E;else if(h!==d)break}h?h.parentNode.insertBefore(n,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(n,s.firstChild))}function L1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function P1(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Gh=null;function Z8(n,s,r){if(Gh===null){var c=new Map,d=Gh=new Map;d.set(r,c)}else d=Gh,c=d.get(r),c||(c=new Map,d.set(r,c));if(c.has(n))return c;for(c.set(n,null),r=r.getElementsByTagName(n),d=0;d<r.length;d++){var h=r[d];if(!(h[Kt]||h[at]||n==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(s)||"";x=n+x;var E=c.get(x);E?E.push(h):c.set(x,[h])}}return c}function X8(n,s,r){n=n.ownerDocument||n,n.head.insertBefore(r,s==="title"?n.querySelector("head > title"):null)}function R5(n,s,r){if(r===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function J8(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function A5(n,s,r,c){if(r.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=Gc(c.href),h=s.querySelector(Hd(d));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Yh.bind(n),s.then(n,n)),r.state.loading|=4,r.instance=h,He(h);return}h=s.ownerDocument||s,c=Y8(c),(d=ei.get(d))&&L1(c,d),h=h.createElement("link"),He(h);var x=h;x._p=new Promise(function(E,B){x.onload=E,x.onerror=B}),Ls(h,"link",c),r.instance=h}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(n.count++,r=Yh.bind(n),s.addEventListener("load",r),s.addEventListener("error",r))}}var U1=0;function D5(n,s){return n.stylesheets&&n.count===0&&Zh(n,n.stylesheets),0<n.count||0<n.imgCount?function(r){var c=setTimeout(function(){if(n.stylesheets&&Zh(n,n.stylesheets),n.unsuspend){var h=n.unsuspend;n.unsuspend=null,h()}},6e4+s);0<n.imgBytes&&U1===0&&(U1=62500*h5());var d=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Zh(n,n.stylesheets),n.unsuspend)){var h=n.unsuspend;n.unsuspend=null,h()}},(n.imgBytes>U1?50:800)+s);return n.unsuspend=r,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(d)}}:null}function Yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Vh=null;function Zh(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Vh=new Map,s.forEach(O5,n),Vh=null,Yh.call(n))}function O5(n,s){if(!(s.state.loading&4)){var r=Vh.get(n);if(r)var c=r.get(null);else{r=new Map,Vh.set(n,r);for(var d=n.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var x=d[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(r.set(x.dataset.precedence,x),c=x)}c&&r.set(null,c)}d=s.instance,x=d.getAttribute("data-precedence"),h=r.get(x)||c,h===c&&r.set(null,d),r.set(x,d),this.count++,c=Yh.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),h?h.parentNode.insertBefore(d,h.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(d,n.firstChild)),s.state.loading|=4}}var Fd={$$typeof:O,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function I5(n,s,r,c,d,h,x,E,B){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Qt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qt(0),this.hiddenUpdates=Qt(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.incompleteTransitions=new Map}function ev(n,s,r,c,d,h,x,E,B,le,xe,ke){return n=new I5(n,s,r,x,B,le,xe,ke,E),s=1,h===!0&&(s|=24),h=Ds(3,null,null,s),n.current=h,h.stateNode=n,s=gd(),s.refCount++,n.pooledCache=s,s.refCount++,h.memoizedState={element:c,isDehydrated:r,cache:s},Ac(h),n}function tv(n){return n?(n=cl,n):cl}function nv(n,s,r,c,d,h){d=tv(d),c.context===null?c.context=d:c.pendingContext=d,c=bi(s),c.payload={element:r},h=h===void 0?null:h,h!==null&&(c.callback=h),r=xi(n,c,s),r!==null&&(ya(r,n,s),yl(r,n,s))}function sv(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var r=n.retryLane;n.retryLane=r!==0&&r<s?r:s}}function z1(n,s){sv(n,s),(n=n.alternate)&&sv(n,s)}function av(n){if(n.tag===13||n.tag===31){var s=mr(n,67108864);s!==null&&ya(s,n,67108864),z1(n,67108864)}}function iv(n){if(n.tag===13||n.tag===31){var s=Oa();s=Fn(s);var r=mr(n,s);r!==null&&ya(r,n,s),z1(n,s)}}var Xh=!0;function L5(n,s,r,c){var d=M.T;M.T=null;var h=$.p;try{$.p=2,B1(n,s,r,c)}finally{$.p=h,M.T=d}}function P5(n,s,r,c){var d=M.T;M.T=null;var h=$.p;try{$.p=8,B1(n,s,r,c)}finally{$.p=h,M.T=d}}function B1(n,s,r,c){if(Xh){var d=H1(c);if(d===null)k1(n,s,c,Jh,r),lv(n,c);else if(z5(d,n,s,r,c))c.stopPropagation();else if(lv(n,c),s&4&&-1<U5.indexOf(n)){for(;d!==null;){var h=P(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Nt(h.pendingLanes);if(x!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var B=1<<31-Re(x);E.entanglements[1]|=B,x&=~B}qi(h),(vn&6)===0&&(Ih=Ee()+500,Pd(0))}}break;case 31:case 13:E=mr(h,2),E!==null&&ya(E,h,2),Ph(),z1(h,2)}if(h=H1(c),h===null&&k1(n,s,c,Jh,r),h===d)break;d=h}d!==null&&c.stopPropagation()}else k1(n,s,c,null,r)}}function H1(n){return n=ar(n),$1(n)}var Jh=null;function $1(n){if(Jh=null,n=Wn(n),n!==null){var s=u(n);if(s===null)n=null;else{var r=s.tag;if(r===13){if(n=f(s),n!==null)return n;n=null}else if(r===31){if(n=m(s),n!==null)return n;n=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return Jh=n,null}function rv(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(V()){case _e:return 2;case Te:return 8;case Ie:case ce:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var F1=!1,Cl=null,Tl=null,Ml=null,qd=new Map,Wd=new Map,Rl=[],U5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function lv(n,s){switch(n){case"focusin":case"focusout":Cl=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Ml=null;break;case"pointerover":case"pointerout":qd.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wd.delete(s.pointerId)}}function Kd(n,s,r,c,d,h){return n===null||n.nativeEvent!==h?(n={blockedOn:s,domEventName:r,eventSystemFlags:c,nativeEvent:h,targetContainers:[d]},s!==null&&(s=P(s),s!==null&&av(s)),n):(n.eventSystemFlags|=c,s=n.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),n)}function z5(n,s,r,c,d){switch(s){case"focusin":return Cl=Kd(Cl,n,s,r,c,d),!0;case"dragenter":return Tl=Kd(Tl,n,s,r,c,d),!0;case"mouseover":return Ml=Kd(Ml,n,s,r,c,d),!0;case"pointerover":var h=d.pointerId;return qd.set(h,Kd(qd.get(h)||null,n,s,r,c,d)),!0;case"gotpointercapture":return h=d.pointerId,Wd.set(h,Kd(Wd.get(h)||null,n,s,r,c,d)),!0}return!1}function ov(n){var s=Wn(n.target);if(s!==null){var r=u(s);if(r!==null){if(s=r.tag,s===13){if(s=f(r),s!==null){n.blockedOn=s,Pe(n.priority,function(){iv(r)});return}}else if(s===31){if(s=m(r),s!==null){n.blockedOn=s,Pe(n.priority,function(){iv(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){n.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}n.blockedOn=null}function em(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var r=H1(n.nativeEvent);if(r===null){r=n.nativeEvent;var c=new r.constructor(r.type,r);Ha=c,r.target.dispatchEvent(c),Ha=null}else return s=P(r),s!==null&&av(s),n.blockedOn=r,!1;s.shift()}return!0}function cv(n,s,r){em(n)&&r.delete(s)}function B5(){F1=!1,Cl!==null&&em(Cl)&&(Cl=null),Tl!==null&&em(Tl)&&(Tl=null),Ml!==null&&em(Ml)&&(Ml=null),qd.forEach(cv),Wd.forEach(cv)}function tm(n,s){n.blockedOn===s&&(n.blockedOn=null,F1||(F1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,B5)))}var nm=null;function uv(n){nm!==n&&(nm=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nm===n&&(nm=null);for(var s=0;s<n.length;s+=3){var r=n[s],c=n[s+1],d=n[s+2];if(typeof c!="function"){if($1(c||r)===null)continue;break}var h=P(r);h!==null&&(n.splice(s,3),s-=3,Hp(h,{pending:!0,data:d,method:r.method,action:c},c,d))}}))}function Vc(n){function s(B){return tm(B,n)}Cl!==null&&tm(Cl,n),Tl!==null&&tm(Tl,n),Ml!==null&&tm(Ml,n),qd.forEach(s),Wd.forEach(s);for(var r=0;r<Rl.length;r++){var c=Rl[r];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Rl.length&&(r=Rl[0],r.blockedOn===null);)ov(r),r.blockedOn===null&&Rl.shift();if(r=(n.ownerDocument||n).$$reactFormReplay,r!=null)for(c=0;c<r.length;c+=3){var d=r[c],h=r[c+1],x=d[Ut]||null;if(typeof h=="function")x||uv(r);else if(x){var E=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[Ut]||null)E=x.formAction;else if($1(d)!==null)continue}else E=x.action;typeof E=="function"?r[c+1]=E:(r.splice(c,3),c-=3),uv(r)}}}function dv(){function n(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),c||setTimeout(r,20)}function r(){if(!c&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,d=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function q1(n){this._internalRoot=n}sm.prototype.render=q1.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,c=Oa();nv(r,c,n,s,null,null)},sm.prototype.unmount=q1.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;nv(n.current,2,null,n,null,null),Ph(),s[ft]=null}};function sm(n){this._internalRoot=n}sm.prototype.unstable_scheduleHydration=function(n){if(n){var s=te();n={blockedOn:null,target:n,priority:s};for(var r=0;r<Rl.length&&s!==0&&s<Rl[r].priority;r++);Rl.splice(r,0,n),r===0&&ov(n)}};var fv=t.version;if(fv!=="19.2.4")throw Error(l(527,fv,"19.2.4"));$.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(l(188)):(n=Object.keys(n).join(","),Error(l(268,n)));return n=g(s),n=n!==null?S(n):null,n=n===null?null:n.stateNode,n};var H5={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var am=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!am.isDisabled&&am.supportsFiber)try{Dt=am.inject(H5),ue=am}catch{}}return Gd.createRoot=function(n,s){if(!o(n))throw Error(l(299));var r=!1,c="",d=vy,h=by,x=xy;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=ev(n,1,!1,null,null,r,c,null,d,h,x,dv),n[ft]=s.current,N1(n),new q1(s)},Gd.hydrateRoot=function(n,s,r){if(!o(n))throw Error(l(299));var c=!1,d="",h=vy,x=by,E=xy,B=null;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(E=r.onRecoverableError),r.formState!==void 0&&(B=r.formState)),s=ev(n,1,!0,s,r??null,c,d,B,h,x,E,dv),s.context=tv(null),r=s.current,c=Oa(),c=Fn(c),d=bi(c),d.callback=null,xi(r,d,c),r=c,s.current.lanes=r,On(s,r),qi(s),n[ft]=s.current,N1(n),new sm(s)},Gd.version="19.2.4",Gd}var wv;function J5(){if(wv)return G1.exports;wv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),G1.exports=X5(),G1.exports}var e9=J5(),Fu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},t9={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hl,I0,u2,n9=(u2=class{constructor(){gt(this,Hl,t9);gt(this,I0,!1)}setTimeoutProvider(e){Ye(this,Hl,e)}setTimeout(e,t){return H(this,Hl).setTimeout(e,t)}clearTimeout(e){H(this,Hl).clearTimeout(e)}setInterval(e,t){return H(this,Hl).setInterval(e,t)}clearInterval(e){H(this,Hl).clearInterval(e)}},Hl=new WeakMap,I0=new WeakMap,u2),Uo=new n9;function s9(e){setTimeout(e,0)}var nc=typeof window>"u"||"Deno"in globalThis;function ys(){}function a9(e,t){return typeof e=="function"?e(t):e}function Dg(e){return typeof e=="number"&&e>=0&&e!==1/0}function j2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xl(e,t){return typeof e=="function"?e(t):e}function ni(e,t){return typeof e=="function"?e(t):e}function Nv(e,t){const{type:a="all",exact:l,fetchStatus:o,predicate:u,queryKey:f,stale:m}=e;if(f){if(l){if(t.queryHash!==L0(f,t.options))return!1}else if(!bf(t.queryKey,f))return!1}if(a!=="all"){const y=t.isActive();if(a==="active"&&!y||a==="inactive"&&y)return!1}return!(typeof m=="boolean"&&t.isStale()!==m||o&&o!==t.state.fetchStatus||u&&!u(t))}function kv(e,t){const{exact:a,status:l,predicate:o,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(a){if(sc(t.options.mutationKey)!==sc(u))return!1}else if(!bf(t.options.mutationKey,u))return!1}return!(l&&t.state.status!==l||o&&!o(t))}function L0(e,t){return((t==null?void 0:t.queryKeyHashFn)||sc)(e)}function sc(e){return JSON.stringify(e,(t,a)=>Og(a)?Object.keys(a).sort().reduce((l,o)=>(l[o]=a[o],l),{}):a)}function bf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(a=>bf(e[a],t[a])):!1}var i9=Object.prototype.hasOwnProperty;function w2(e,t,a=0){if(e===t)return e;if(a>500)return t;const l=Ev(e)&&Ev(t);if(!l&&!(Og(e)&&Og(t)))return t;const u=(l?e:Object.keys(e)).length,f=l?t:Object.keys(t),m=f.length,y=l?new Array(m):{};let g=0;for(let S=0;S<m;S++){const p=l?S:f[S],v=e[p],w=t[p];if(v===w){y[p]=v,(l?S<u:i9.call(e,p))&&g++;continue}if(v===null||w===null||typeof v!="object"||typeof w!="object"){y[p]=w;continue}const N=w2(v,w,a+1);y[p]=N,N===v&&g++}return u===m&&g===u?e:y}function Im(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function Ev(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Og(e){if(!Cv(e))return!1;const t=e.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!Cv(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Cv(e){return Object.prototype.toString.call(e)==="[object Object]"}function r9(e){return new Promise(t=>{Uo.setTimeout(t,e)})}function Ig(e,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(e,t):a.structuralSharing!==!1?w2(e,t):t}function l9(e){return e}function o9(e,t,a=0){const l=[...e,t];return a&&l.length>a?l.slice(1):l}function c9(e,t,a=0){const l=[t,...e];return a&&l.length>a?l.slice(0,-1):l}var P0=Symbol();function N2(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===P0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function U0(e,t){return typeof e=="function"?e(...t):!!e}function u9(e,t,a){let l=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),l||(l=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),e}var $o,$l,gu,d2,d9=(d2=class extends Fu{constructor(){super();gt(this,$o);gt(this,$l);gt(this,gu);Ye(this,gu,t=>{if(!nc&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){H(this,$l)||this.setEventListener(H(this,gu))}onUnsubscribe(){var t;this.hasListeners()||((t=H(this,$l))==null||t.call(this),Ye(this,$l,void 0))}setEventListener(t){var a;Ye(this,gu,t),(a=H(this,$l))==null||a.call(this),Ye(this,$l,t(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(t){H(this,$o)!==t&&(Ye(this,$o,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof H(this,$o)=="boolean"?H(this,$o):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},$o=new WeakMap,$l=new WeakMap,gu=new WeakMap,d2),z0=new d9;function Lg(){let e,t;const a=new Promise((o,u)=>{e=o,t=u});a.status="pending",a.catch(()=>{});function l(o){Object.assign(a,o),delete a.resolve,delete a.reject}return a.resolve=o=>{l({status:"fulfilled",value:o}),e(o)},a.reject=o=>{l({status:"rejected",reason:o}),t(o)},a}function f9(e){var a;let t;if((a=e.then(l=>(t=l,l),ys))==null||a.catch(ys),t!==void 0)return{data:t}}function k2(e){return e}function h9(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function m9(e,t,a){const l=()=>{var u;const o=(u=e.promise)==null?void 0:u.then(t).catch(f=>a(f)?Promise.reject(new Error("redacted")):Promise.reject(f));return o==null||o.catch(ys),o};return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status==="pending"&&{promise:l()},...e.meta&&{meta:e.meta}}}function p9(e){return e.state.isPaused}function g9(e){return e.state.status==="success"}function _9(e){return!0}function y9(e,t={}){var y,g,S,p;const a=t.shouldDehydrateMutation??((y=e.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??p9,l=e.getMutationCache().getAll().flatMap(v=>a(v)?[h9(v)]:[]),o=t.shouldDehydrateQuery??((g=e.getDefaultOptions().dehydrate)==null?void 0:g.shouldDehydrateQuery)??g9,u=t.shouldRedactErrors??((S=e.getDefaultOptions().dehydrate)==null?void 0:S.shouldRedactErrors)??_9,f=t.serializeData??((p=e.getDefaultOptions().dehydrate)==null?void 0:p.serializeData)??k2,m=e.getQueryCache().getAll().flatMap(v=>o(v)?[m9(v,f,u)]:[]);return{mutations:l,queries:m}}function v9(e,t,a){var y;if(typeof t!="object"||t===null)return;const l=e.getMutationCache(),o=e.getQueryCache(),u=((y=e.getDefaultOptions().hydrate)==null?void 0:y.deserializeData)??k2,f=t.mutations||[],m=t.queries||[];f.forEach(({state:g,...S})=>{var p,v;l.build(e,{...(p=e.getDefaultOptions().hydrate)==null?void 0:p.mutations,...(v=a==null?void 0:a.defaultOptions)==null?void 0:v.mutations,...S},g)}),m.forEach(({queryKey:g,state:S,queryHash:p,meta:v,promise:w,dehydratedAt:N})=>{var L,K;const j=w?f9(w):void 0,C=S.data===void 0?j==null?void 0:j.data:S.data,R=C===void 0?C:u(C);let z=o.get(p);const O=(z==null?void 0:z.state.status)==="pending",k=(z==null?void 0:z.state.fetchStatus)==="fetching";if(z){const J=j&&N!==void 0&&N>z.state.dataUpdatedAt;if(S.dataUpdatedAt>z.state.dataUpdatedAt||J){const{fetchStatus:q,...Y}=S;z.setState({...Y,data:R})}}else z=o.build(e,{...(L=e.getDefaultOptions().hydrate)==null?void 0:L.queries,...(K=a==null?void 0:a.defaultOptions)==null?void 0:K.queries,queryKey:g,queryHash:p,meta:v},{...S,data:R,fetchStatus:"idle",status:R!==void 0?"success":S.status});w&&!O&&!k&&(N===void 0||N>z.state.dataUpdatedAt)&&z.fetch(void 0,{initialPromise:Promise.resolve(w).then(u)}).catch(ys)})}var b9=s9;function x9(){let e=[],t=0,a=m=>{m()},l=m=>{m()},o=b9;const u=m=>{t?e.push(m):o(()=>{a(m)})},f=()=>{const m=e;e=[],m.length&&o(()=>{l(()=>{m.forEach(y=>{a(y)})})})};return{batch:m=>{let y;t++;try{y=m()}finally{t--,t||f()}return y},batchCalls:m=>(...y)=>{u(()=>{m(...y)})},schedule:u,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{o=m}}}var vs=x9(),_u,Fl,yu,f2,S9=(f2=class extends Fu{constructor(){super();gt(this,_u,!0);gt(this,Fl);gt(this,yu);Ye(this,yu,t=>{if(!nc&&window.addEventListener){const a=()=>t(!0),l=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",l)}}})}onSubscribe(){H(this,Fl)||this.setEventListener(H(this,yu))}onUnsubscribe(){var t;this.hasListeners()||((t=H(this,Fl))==null||t.call(this),Ye(this,Fl,void 0))}setEventListener(t){var a;Ye(this,yu,t),(a=H(this,Fl))==null||a.call(this),Ye(this,Fl,t(this.setOnline.bind(this)))}setOnline(t){H(this,_u)!==t&&(Ye(this,_u,t),this.listeners.forEach(l=>{l(t)}))}isOnline(){return H(this,_u)}},_u=new WeakMap,Fl=new WeakMap,yu=new WeakMap,f2),Lm=new S9;function j9(e){return Math.min(1e3*2**e,3e4)}function E2(e){return(e??"online")==="online"?Lm.isOnline():!0}var Pg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function C2(e){let t=!1,a=0,l;const o=Lg(),u=()=>o.status!=="pending",f=j=>{var C;if(!u()){const R=new Pg(j);v(R),(C=e.onCancel)==null||C.call(e,R)}},m=()=>{t=!0},y=()=>{t=!1},g=()=>z0.isFocused()&&(e.networkMode==="always"||Lm.isOnline())&&e.canRun(),S=()=>E2(e.networkMode)&&e.canRun(),p=j=>{u()||(l==null||l(),o.resolve(j))},v=j=>{u()||(l==null||l(),o.reject(j))},w=()=>new Promise(j=>{var C;l=R=>{(u()||g())&&j(R)},(C=e.onPause)==null||C.call(e)}).then(()=>{var j;l=void 0,u()||(j=e.onContinue)==null||j.call(e)}),N=()=>{if(u())return;let j;const C=a===0?e.initialPromise:void 0;try{j=C??e.fn()}catch(R){j=Promise.reject(R)}Promise.resolve(j).then(p).catch(R=>{var K;if(u())return;const z=e.retry??(nc?0:3),O=e.retryDelay??j9,k=typeof O=="function"?O(a,R):O,L=z===!0||typeof z=="number"&&a<z||typeof z=="function"&&z(a,R);if(t||!L){v(R);return}a++,(K=e.onFail)==null||K.call(e,a,R),r9(k).then(()=>g()?void 0:w()).then(()=>{t?v(R):N()})})};return{promise:o,status:()=>o.status,cancel:f,continue:()=>(l==null||l(),o),cancelRetry:m,continueRetry:y,canStart:S,start:()=>(S()?N():w().then(N),o)}}var Fo,h2,T2=(h2=class{constructor(){gt(this,Fo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Dg(this.gcTime)&&Ye(this,Fo,Uo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nc?1/0:300*1e3))}clearGcTimeout(){H(this,Fo)&&(Uo.clearTimeout(H(this,Fo)),Ye(this,Fo,void 0))}},Fo=new WeakMap,h2),qo,vu,ti,Wo,Cs,If,Ko,wi,Or,m2,w9=(m2=class extends T2{constructor(t){super();gt(this,wi);gt(this,qo);gt(this,vu);gt(this,ti);gt(this,Wo);gt(this,Cs);gt(this,If);gt(this,Ko);Ye(this,Ko,!1),Ye(this,If,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ye(this,Wo,t.client),Ye(this,ti,H(this,Wo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ye(this,qo,Mv(this.options)),this.state=t.state??H(this,qo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=H(this,Cs))==null?void 0:t.promise}setOptions(t){if(this.options={...H(this,If),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=Mv(this.options);a.data!==void 0&&(this.setState(Tv(a.data,a.dataUpdatedAt)),Ye(this,qo,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&H(this,ti).remove(this)}setData(t,a){const l=Ig(this.state.data,t,this.options);return Ft(this,wi,Or).call(this,{data:l,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),l}setState(t,a){Ft(this,wi,Or).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var l,o;const a=(l=H(this,Cs))==null?void 0:l.promise;return(o=H(this,Cs))==null||o.cancel(t),a?a.then(ys).catch(ys):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(H(this,qo))}isActive(){return this.observers.some(t=>ni(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===P0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Xl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!j2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(l=>l.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=H(this,Cs))==null||a.continue()}onOnline(){var a;const t=this.observers.find(l=>l.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=H(this,Cs))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),H(this,ti).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(H(this,Cs)&&(H(this,Ko)?H(this,Cs).cancel({revert:!0}):H(this,Cs).cancelRetry()),this.scheduleGc()),H(this,ti).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ft(this,wi,Or).call(this,{type:"invalidate"})}async fetch(t,a){var y,g,S,p,v,w,N,j,C,R,z,O;if(this.state.fetchStatus!=="idle"&&((y=H(this,Cs))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(H(this,Cs))return H(this,Cs).continueRetry(),H(this,Cs).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(L=>L.options.queryFn);k&&this.setOptions(k.options)}const l=new AbortController,o=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(Ye(this,Ko,!0),l.signal)})},u=()=>{const k=N2(this.options,a),K=(()=>{const J={client:H(this,Wo),queryKey:this.queryKey,meta:this.meta};return o(J),J})();return Ye(this,Ko,!1),this.options.persister?this.options.persister(k,K,this):k(K)},m=(()=>{const k={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:H(this,Wo),state:this.state,fetchFn:u};return o(k),k})();(g=this.options.behavior)==null||g.onFetch(m,this),Ye(this,vu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((S=m.fetchOptions)==null?void 0:S.meta))&&Ft(this,wi,Or).call(this,{type:"fetch",meta:(p=m.fetchOptions)==null?void 0:p.meta}),Ye(this,Cs,C2({initialPromise:a==null?void 0:a.initialPromise,fn:m.fetchFn,onCancel:k=>{k instanceof Pg&&k.revert&&this.setState({...H(this,vu),fetchStatus:"idle"}),l.abort()},onFail:(k,L)=>{Ft(this,wi,Or).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{Ft(this,wi,Or).call(this,{type:"pause"})},onContinue:()=>{Ft(this,wi,Or).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const k=await H(this,Cs).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(w=(v=H(this,ti).config).onSuccess)==null||w.call(v,k,this),(j=(N=H(this,ti).config).onSettled)==null||j.call(N,k,this.state.error,this),k}catch(k){if(k instanceof Pg){if(k.silent)return H(this,Cs).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Ft(this,wi,Or).call(this,{type:"error",error:k}),(R=(C=H(this,ti).config).onError)==null||R.call(C,k,this),(O=(z=H(this,ti).config).onSettled)==null||O.call(z,this.state.data,k,this),k}finally{this.scheduleGc()}}},qo=new WeakMap,vu=new WeakMap,ti=new WeakMap,Wo=new WeakMap,Cs=new WeakMap,If=new WeakMap,Ko=new WeakMap,wi=new WeakSet,Or=function(t){const a=l=>{switch(t.type){case"failed":return{...l,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...M2(l.data,this.options),fetchMeta:t.meta??null};case"success":const o={...l,...Tv(t.data,t.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ye(this,vu,t.manual?o:void 0),o;case"error":const u=t.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...t.state}}};this.state=a(this.state),vs.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),H(this,ti).notify({query:this,type:"updated",action:t})})},m2);function M2(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:E2(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Tv(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Mv(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,a=t!==void 0,l=a?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var ba,rn,Lf,na,Qo,bu,Pr,ql,Pf,xu,Su,Go,Yo,Wl,ju,Sn,af,Ug,zg,Bg,Hg,$g,Fg,qg,R2,p2,N9=(p2=class extends Fu{constructor(t,a){super();gt(this,Sn);gt(this,ba);gt(this,rn);gt(this,Lf);gt(this,na);gt(this,Qo);gt(this,bu);gt(this,Pr);gt(this,ql);gt(this,Pf);gt(this,xu);gt(this,Su);gt(this,Go);gt(this,Yo);gt(this,Wl);gt(this,ju,new Set);this.options=a,Ye(this,ba,t),Ye(this,ql,null),Ye(this,Pr,Lg()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(H(this,rn).addObserver(this),Rv(H(this,rn),this.options)?Ft(this,Sn,af).call(this):this.updateResult(),Ft(this,Sn,Hg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wg(H(this,rn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wg(H(this,rn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ft(this,Sn,$g).call(this),Ft(this,Sn,Fg).call(this),H(this,rn).removeObserver(this)}setOptions(t){const a=this.options,l=H(this,rn);if(this.options=H(this,ba).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ni(this.options.enabled,H(this,rn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ft(this,Sn,qg).call(this),H(this,rn).setOptions(this.options),a._defaulted&&!Im(this.options,a)&&H(this,ba).getQueryCache().notify({type:"observerOptionsUpdated",query:H(this,rn),observer:this});const o=this.hasListeners();o&&Av(H(this,rn),l,this.options,a)&&Ft(this,Sn,af).call(this),this.updateResult(),o&&(H(this,rn)!==l||ni(this.options.enabled,H(this,rn))!==ni(a.enabled,H(this,rn))||Xl(this.options.staleTime,H(this,rn))!==Xl(a.staleTime,H(this,rn)))&&Ft(this,Sn,Ug).call(this);const u=Ft(this,Sn,zg).call(this);o&&(H(this,rn)!==l||ni(this.options.enabled,H(this,rn))!==ni(a.enabled,H(this,rn))||u!==H(this,Wl))&&Ft(this,Sn,Bg).call(this,u)}getOptimisticResult(t){const a=H(this,ba).getQueryCache().build(H(this,ba),t),l=this.createResult(a,t);return E9(this,l)&&(Ye(this,na,l),Ye(this,bu,this.options),Ye(this,Qo,H(this,rn).state)),l}getCurrentResult(){return H(this,na)}trackResult(t,a){return new Proxy(t,{get:(l,o)=>(this.trackProp(o),a==null||a(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&H(this,Pr).status==="pending"&&H(this,Pr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,o))})}trackProp(t){H(this,ju).add(t)}getCurrentQuery(){return H(this,rn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=H(this,ba).defaultQueryOptions(t),l=H(this,ba).getQueryCache().build(H(this,ba),a);return l.fetch().then(()=>this.createResult(l,a))}fetch(t){return Ft(this,Sn,af).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),H(this,na)))}createResult(t,a){var Y;const l=H(this,rn),o=this.options,u=H(this,na),f=H(this,Qo),m=H(this,bu),g=t!==l?t.state:H(this,Lf),{state:S}=t;let p={...S},v=!1,w;if(a._optimisticResults){const Q=this.hasListeners(),G=!Q&&Rv(t,a),ge=Q&&Av(t,l,a,o);(G||ge)&&(p={...p,...M2(S.data,t.options)}),a._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:N,errorUpdatedAt:j,status:C}=p;w=p.data;let R=!1;if(a.placeholderData!==void 0&&w===void 0&&C==="pending"){let Q;u!=null&&u.isPlaceholderData&&a.placeholderData===(m==null?void 0:m.placeholderData)?(Q=u.data,R=!0):Q=typeof a.placeholderData=="function"?a.placeholderData((Y=H(this,Su))==null?void 0:Y.state.data,H(this,Su)):a.placeholderData,Q!==void 0&&(C="success",w=Ig(u==null?void 0:u.data,Q,a),v=!0)}if(a.select&&w!==void 0&&!R)if(u&&w===(f==null?void 0:f.data)&&a.select===H(this,Pf))w=H(this,xu);else try{Ye(this,Pf,a.select),w=a.select(w),w=Ig(u==null?void 0:u.data,w,a),Ye(this,xu,w),Ye(this,ql,null)}catch(Q){Ye(this,ql,Q)}H(this,ql)&&(N=H(this,ql),w=H(this,xu),j=Date.now(),C="error");const z=p.fetchStatus==="fetching",O=C==="pending",k=C==="error",L=O&&z,K=w!==void 0,q={status:C,fetchStatus:p.fetchStatus,isPending:O,isSuccess:C==="success",isError:k,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:N,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>g.dataUpdateCount||p.errorUpdateCount>g.errorUpdateCount,isFetching:z,isRefetching:z&&!O,isLoadingError:k&&!K,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:k&&K,isStale:B0(t,a),refetch:this.refetch,promise:H(this,Pr),isEnabled:ni(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Q=q.data!==void 0,G=q.status==="error"&&!Q,ge=he=>{G?he.reject(q.error):Q&&he.resolve(q.data)},me=()=>{const he=Ye(this,Pr,q.promise=Lg());ge(he)},Z=H(this,Pr);switch(Z.status){case"pending":t.queryHash===l.queryHash&&ge(Z);break;case"fulfilled":(G||q.data!==Z.value)&&me();break;case"rejected":(!G||q.error!==Z.reason)&&me();break}}return q}updateResult(){const t=H(this,na),a=this.createResult(H(this,rn),this.options);if(Ye(this,Qo,H(this,rn).state),Ye(this,bu,this.options),H(this,Qo).data!==void 0&&Ye(this,Su,H(this,rn)),Im(a,t))return;Ye(this,na,a);const l=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,u=typeof o=="function"?o():o;if(u==="all"||!u&&!H(this,ju).size)return!0;const f=new Set(u??H(this,ju));return this.options.throwOnError&&f.add("error"),Object.keys(H(this,na)).some(m=>{const y=m;return H(this,na)[y]!==t[y]&&f.has(y)})};Ft(this,Sn,R2).call(this,{listeners:l()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ft(this,Sn,Hg).call(this)}},ba=new WeakMap,rn=new WeakMap,Lf=new WeakMap,na=new WeakMap,Qo=new WeakMap,bu=new WeakMap,Pr=new WeakMap,ql=new WeakMap,Pf=new WeakMap,xu=new WeakMap,Su=new WeakMap,Go=new WeakMap,Yo=new WeakMap,Wl=new WeakMap,ju=new WeakMap,Sn=new WeakSet,af=function(t){Ft(this,Sn,qg).call(this);let a=H(this,rn).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(ys)),a},Ug=function(){Ft(this,Sn,$g).call(this);const t=Xl(this.options.staleTime,H(this,rn));if(nc||H(this,na).isStale||!Dg(t))return;const l=j2(H(this,na).dataUpdatedAt,t)+1;Ye(this,Go,Uo.setTimeout(()=>{H(this,na).isStale||this.updateResult()},l))},zg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(H(this,rn)):this.options.refetchInterval)??!1},Bg=function(t){Ft(this,Sn,Fg).call(this),Ye(this,Wl,t),!(nc||ni(this.options.enabled,H(this,rn))===!1||!Dg(H(this,Wl))||H(this,Wl)===0)&&Ye(this,Yo,Uo.setInterval(()=>{(this.options.refetchIntervalInBackground||z0.isFocused())&&Ft(this,Sn,af).call(this)},H(this,Wl)))},Hg=function(){Ft(this,Sn,Ug).call(this),Ft(this,Sn,Bg).call(this,Ft(this,Sn,zg).call(this))},$g=function(){H(this,Go)&&(Uo.clearTimeout(H(this,Go)),Ye(this,Go,void 0))},Fg=function(){H(this,Yo)&&(Uo.clearInterval(H(this,Yo)),Ye(this,Yo,void 0))},qg=function(){const t=H(this,ba).getQueryCache().build(H(this,ba),this.options);if(t===H(this,rn))return;const a=H(this,rn);Ye(this,rn,t),Ye(this,Lf,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},R2=function(t){vs.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(H(this,na))}),H(this,ba).getQueryCache().notify({query:H(this,rn),type:"observerResultsUpdated"})})},p2);function k9(e,t){return ni(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Rv(e,t){return k9(e,t)||e.state.data!==void 0&&Wg(e,t,t.refetchOnMount)}function Wg(e,t,a){if(ni(t.enabled,e)!==!1&&Xl(t.staleTime,e)!=="static"){const l=typeof a=="function"?a(e):a;return l==="always"||l!==!1&&B0(e,t)}return!1}function Av(e,t,a,l){return(e!==t||ni(l.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&B0(e,a)}function B0(e,t){return ni(t.enabled,e)!==!1&&e.isStaleByTime(Xl(t.staleTime,e))}function E9(e,t){return!Im(e.getCurrentResult(),t)}function Dv(e){return{onFetch:(t,a)=>{var S,p,v,w,N;const l=t.options,o=(v=(p=(S=t.fetchOptions)==null?void 0:S.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,u=((w=t.state.data)==null?void 0:w.pages)||[],f=((N=t.state.data)==null?void 0:N.pageParams)||[];let m={pages:[],pageParams:[]},y=0;const g=async()=>{let j=!1;const C=O=>{u9(O,()=>t.signal,()=>j=!0)},R=N2(t.options,t.fetchOptions),z=async(O,k,L)=>{if(j)return Promise.reject();if(k==null&&O.pages.length)return Promise.resolve(O);const J=(()=>{const G={client:t.client,queryKey:t.queryKey,pageParam:k,direction:L?"backward":"forward",meta:t.options.meta};return C(G),G})(),q=await R(J),{maxPages:Y}=t.options,Q=L?c9:o9;return{pages:Q(O.pages,q,Y),pageParams:Q(O.pageParams,k,Y)}};if(o&&u.length){const O=o==="backward",k=O?C9:Ov,L={pages:u,pageParams:f},K=k(l,L);m=await z(L,K,O)}else{const O=e??u.length;do{const k=y===0?f[0]??l.initialPageParam:Ov(l,m);if(y>0&&k==null)break;m=await z(m,k),y++}while(y<O)}return m};t.options.persister?t.fetchFn=()=>{var j,C;return(C=(j=t.options).persister)==null?void 0:C.call(j,g,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=g}}}function Ov(e,{pages:t,pageParams:a}){const l=t.length-1;return t.length>0?e.getNextPageParam(t[l],t,a[l],a):void 0}function C9(e,{pages:t,pageParams:a}){var l;return t.length>0?(l=e.getPreviousPageParam)==null?void 0:l.call(e,t[0],t,a[0],a):void 0}var Uf,Qi,Gs,Vo,Gi,Pl,g2,T9=(g2=class extends T2{constructor(t){super();gt(this,Gi);gt(this,Uf);gt(this,Qi);gt(this,Gs);gt(this,Vo);Ye(this,Uf,t.client),this.mutationId=t.mutationId,Ye(this,Gs,t.mutationCache),Ye(this,Qi,[]),this.state=t.state||A2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){H(this,Qi).includes(t)||(H(this,Qi).push(t),this.clearGcTimeout(),H(this,Gs).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ye(this,Qi,H(this,Qi).filter(a=>a!==t)),this.scheduleGc(),H(this,Gs).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){H(this,Qi).length||(this.state.status==="pending"?this.scheduleGc():H(this,Gs).remove(this))}continue(){var t;return((t=H(this,Vo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var f,m,y,g,S,p,v,w,N,j,C,R,z,O,k,L,K,J;const a=()=>{Ft(this,Gi,Pl).call(this,{type:"continue"})},l={client:H(this,Uf),meta:this.options.meta,mutationKey:this.options.mutationKey};Ye(this,Vo,C2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,l):Promise.reject(new Error("No mutationFn found")),onFail:(q,Y)=>{Ft(this,Gi,Pl).call(this,{type:"failed",failureCount:q,error:Y})},onPause:()=>{Ft(this,Gi,Pl).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>H(this,Gs).canRun(this)}));const o=this.state.status==="pending",u=!H(this,Vo).canStart();try{if(o)a();else{Ft(this,Gi,Pl).call(this,{type:"pending",variables:t,isPaused:u}),H(this,Gs).config.onMutate&&await H(this,Gs).config.onMutate(t,this,l);const Y=await((m=(f=this.options).onMutate)==null?void 0:m.call(f,t,l));Y!==this.state.context&&Ft(this,Gi,Pl).call(this,{type:"pending",context:Y,variables:t,isPaused:u})}const q=await H(this,Vo).start();return await((g=(y=H(this,Gs).config).onSuccess)==null?void 0:g.call(y,q,t,this.state.context,this,l)),await((p=(S=this.options).onSuccess)==null?void 0:p.call(S,q,t,this.state.context,l)),await((w=(v=H(this,Gs).config).onSettled)==null?void 0:w.call(v,q,null,this.state.variables,this.state.context,this,l)),await((j=(N=this.options).onSettled)==null?void 0:j.call(N,q,null,t,this.state.context,l)),Ft(this,Gi,Pl).call(this,{type:"success",data:q}),q}catch(q){try{await((R=(C=H(this,Gs).config).onError)==null?void 0:R.call(C,q,t,this.state.context,this,l))}catch(Y){Promise.reject(Y)}try{await((O=(z=this.options).onError)==null?void 0:O.call(z,q,t,this.state.context,l))}catch(Y){Promise.reject(Y)}try{await((L=(k=H(this,Gs).config).onSettled)==null?void 0:L.call(k,void 0,q,this.state.variables,this.state.context,this,l))}catch(Y){Promise.reject(Y)}try{await((J=(K=this.options).onSettled)==null?void 0:J.call(K,void 0,q,t,this.state.context,l))}catch(Y){Promise.reject(Y)}throw Ft(this,Gi,Pl).call(this,{type:"error",error:q}),q}finally{H(this,Gs).runNext(this)}}},Uf=new WeakMap,Qi=new WeakMap,Gs=new WeakMap,Vo=new WeakMap,Gi=new WeakSet,Pl=function(t){const a=l=>{switch(t.type){case"failed":return{...l,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...l,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:t.error,failureCount:l.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),vs.batch(()=>{H(this,Qi).forEach(l=>{l.onMutationUpdate(t)}),H(this,Gs).notify({mutation:this,type:"updated",action:t})})},g2);function A2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ur,Ni,zf,_2,M9=(_2=class extends Fu{constructor(t={}){super();gt(this,Ur);gt(this,Ni);gt(this,zf);this.config=t,Ye(this,Ur,new Set),Ye(this,Ni,new Map),Ye(this,zf,0)}build(t,a,l){const o=new T9({client:t,mutationCache:this,mutationId:++im(this,zf)._,options:t.defaultMutationOptions(a),state:l});return this.add(o),o}add(t){H(this,Ur).add(t);const a=rm(t);if(typeof a=="string"){const l=H(this,Ni).get(a);l?l.push(t):H(this,Ni).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(H(this,Ur).delete(t)){const a=rm(t);if(typeof a=="string"){const l=H(this,Ni).get(a);if(l)if(l.length>1){const o=l.indexOf(t);o!==-1&&l.splice(o,1)}else l[0]===t&&H(this,Ni).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=rm(t);if(typeof a=="string"){const l=H(this,Ni).get(a),o=l==null?void 0:l.find(u=>u.state.status==="pending");return!o||o===t}else return!0}runNext(t){var l;const a=rm(t);if(typeof a=="string"){const o=(l=H(this,Ni).get(a))==null?void 0:l.find(u=>u!==t&&u.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){vs.batch(()=>{H(this,Ur).forEach(t=>{this.notify({type:"removed",mutation:t})}),H(this,Ur).clear(),H(this,Ni).clear()})}getAll(){return Array.from(H(this,Ur))}find(t){const a={exact:!0,...t};return this.getAll().find(l=>kv(a,l))}findAll(t={}){return this.getAll().filter(a=>kv(t,a))}notify(t){vs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return vs.batch(()=>Promise.all(t.map(a=>a.continue().catch(ys))))}},Ur=new WeakMap,Ni=new WeakMap,zf=new WeakMap,_2);function rm(e){var t;return(t=e.options.scope)==null?void 0:t.id}var zr,Kl,xa,Br,Gr,Sm,Kg,y2,R9=(y2=class extends Fu{constructor(a,l){super();gt(this,Gr);gt(this,zr);gt(this,Kl);gt(this,xa);gt(this,Br);Ye(this,zr,a),this.setOptions(l),this.bindMethods(),Ft(this,Gr,Sm).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var o;const l=this.options;this.options=H(this,zr).defaultMutationOptions(a),Im(this.options,l)||H(this,zr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:H(this,xa),observer:this}),l!=null&&l.mutationKey&&this.options.mutationKey&&sc(l.mutationKey)!==sc(this.options.mutationKey)?this.reset():((o=H(this,xa))==null?void 0:o.state.status)==="pending"&&H(this,xa).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=H(this,xa))==null||a.removeObserver(this)}onMutationUpdate(a){Ft(this,Gr,Sm).call(this),Ft(this,Gr,Kg).call(this,a)}getCurrentResult(){return H(this,Kl)}reset(){var a;(a=H(this,xa))==null||a.removeObserver(this),Ye(this,xa,void 0),Ft(this,Gr,Sm).call(this),Ft(this,Gr,Kg).call(this)}mutate(a,l){var o;return Ye(this,Br,l),(o=H(this,xa))==null||o.removeObserver(this),Ye(this,xa,H(this,zr).getMutationCache().build(H(this,zr),this.options)),H(this,xa).addObserver(this),H(this,xa).execute(a)}},zr=new WeakMap,Kl=new WeakMap,xa=new WeakMap,Br=new WeakMap,Gr=new WeakSet,Sm=function(){var l;const a=((l=H(this,xa))==null?void 0:l.state)??A2();Ye(this,Kl,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},Kg=function(a){vs.batch(()=>{var l,o,u,f,m,y,g,S;if(H(this,Br)&&this.hasListeners()){const p=H(this,Kl).variables,v=H(this,Kl).context,w={client:H(this,zr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(o=(l=H(this,Br)).onSuccess)==null||o.call(l,a.data,p,v,w)}catch(N){Promise.reject(N)}try{(f=(u=H(this,Br)).onSettled)==null||f.call(u,a.data,null,p,v,w)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(m=H(this,Br)).onError)==null||y.call(m,a.error,p,v,w)}catch(N){Promise.reject(N)}try{(S=(g=H(this,Br)).onSettled)==null||S.call(g,void 0,a.error,p,v,w)}catch(N){Promise.reject(N)}}}this.listeners.forEach(p=>{p(H(this,Kl))})})},y2),Yi,v2,A9=(v2=class extends Fu{constructor(t={}){super();gt(this,Yi);this.config=t,Ye(this,Yi,new Map)}build(t,a,l){const o=a.queryKey,u=a.queryHash??L0(o,a);let f=this.get(u);return f||(f=new w9({client:t,queryKey:o,queryHash:u,options:t.defaultQueryOptions(a),state:l,defaultOptions:t.getQueryDefaults(o)}),this.add(f)),f}add(t){H(this,Yi).has(t.queryHash)||(H(this,Yi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=H(this,Yi).get(t.queryHash);a&&(t.destroy(),a===t&&H(this,Yi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){vs.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return H(this,Yi).get(t)}getAll(){return[...H(this,Yi).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(l=>Nv(a,l))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(l=>Nv(t,l)):a}notify(t){vs.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){vs.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){vs.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Yi=new WeakMap,v2),ns,Ql,Gl,wu,Nu,Yl,ku,Eu,b2,D9=(b2=class{constructor(e={}){gt(this,ns);gt(this,Ql);gt(this,Gl);gt(this,wu);gt(this,Nu);gt(this,Yl);gt(this,ku);gt(this,Eu);Ye(this,ns,e.queryCache||new A9),Ye(this,Ql,e.mutationCache||new M9),Ye(this,Gl,e.defaultOptions||{}),Ye(this,wu,new Map),Ye(this,Nu,new Map),Ye(this,Yl,0)}mount(){im(this,Yl)._++,H(this,Yl)===1&&(Ye(this,ku,z0.subscribe(async e=>{e&&(await this.resumePausedMutations(),H(this,ns).onFocus())})),Ye(this,Eu,Lm.subscribe(async e=>{e&&(await this.resumePausedMutations(),H(this,ns).onOnline())})))}unmount(){var e,t;im(this,Yl)._--,H(this,Yl)===0&&((e=H(this,ku))==null||e.call(this),Ye(this,ku,void 0),(t=H(this,Eu))==null||t.call(this),Ye(this,Eu,void 0))}isFetching(e){return H(this,ns).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return H(this,Ql).findAll({...e,status:"pending"}).length}getQueryData(e){var a;const t=this.defaultQueryOptions({queryKey:e});return(a=H(this,ns).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),a=H(this,ns).build(this,t),l=a.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime(Xl(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return H(this,ns).findAll(e).map(({queryKey:t,state:a})=>{const l=a.data;return[t,l]})}setQueryData(e,t,a){const l=this.defaultQueryOptions({queryKey:e}),o=H(this,ns).get(l.queryHash),u=o==null?void 0:o.state.data,f=a9(t,u);if(f!==void 0)return H(this,ns).build(this,l).setData(f,{...a,manual:!0})}setQueriesData(e,t,a){return vs.batch(()=>H(this,ns).findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,t,a)]))}getQueryState(e){var a;const t=this.defaultQueryOptions({queryKey:e});return(a=H(this,ns).get(t.queryHash))==null?void 0:a.state}removeQueries(e){const t=H(this,ns);vs.batch(()=>{t.findAll(e).forEach(a=>{t.remove(a)})})}resetQueries(e,t){const a=H(this,ns);return vs.batch(()=>(a.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const a={revert:!0,...t},l=vs.batch(()=>H(this,ns).findAll(e).map(o=>o.cancel(a)));return Promise.all(l).then(ys).catch(ys)}invalidateQueries(e,t={}){return vs.batch(()=>(H(this,ns).findAll(e).forEach(a=>{a.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},l=vs.batch(()=>H(this,ns).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let u=o.fetch(void 0,a);return a.throwOnError||(u=u.catch(ys)),o.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(ys)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const a=H(this,ns).build(this,t);return a.isStaleByTime(Xl(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ys).catch(ys)}fetchInfiniteQuery(e){return e.behavior=Dv(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ys).catch(ys)}ensureInfiniteQueryData(e){return e.behavior=Dv(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Lm.isOnline()?H(this,Ql).resumePausedMutations():Promise.resolve()}getQueryCache(){return H(this,ns)}getMutationCache(){return H(this,Ql)}getDefaultOptions(){return H(this,Gl)}setDefaultOptions(e){Ye(this,Gl,e)}setQueryDefaults(e,t){H(this,wu).set(sc(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...H(this,wu).values()],a={};return t.forEach(l=>{bf(e,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(e,t){H(this,Nu).set(sc(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...H(this,Nu).values()],a={};return t.forEach(l=>{bf(e,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;const t={...H(this,Gl).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=L0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===P0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...H(this,Gl).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){H(this,ns).clear(),H(this,Ql).clear()}},ns=new WeakMap,Ql=new WeakMap,Gl=new WeakMap,wu=new WeakMap,Nu=new WeakMap,Yl=new WeakMap,ku=new WeakMap,Eu=new WeakMap,b2),D2=_.createContext(void 0),Pa=e=>{const t=_.useContext(D2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},O9=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(D2.Provider,{value:e,children:t})),O2=_.createContext(!1),I9=()=>_.useContext(O2);O2.Provider;function L9(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var P9=_.createContext(L9()),U9=()=>_.useContext(P9),z9=(e,t,a)=>{const l=a!=null&&a.state.error&&typeof e.throwOnError=="function"?U0(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(t.isReset()||(e.retryOnMount=!1))},B9=e=>{_.useEffect(()=>{e.clearReset()},[e])},H9=({result:e,errorResetBoundary:t,throwOnError:a,query:l,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(o&&e.data===void 0||U0(a,[e.error,l])),$9=e=>{if(e.suspense){const a=o=>o==="static"?o:Math.max(o??1e3,1e3),l=e.staleTime;e.staleTime=typeof l=="function"?(...o)=>a(l(...o)):a(l),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},F9=(e,t)=>e.isLoading&&e.isFetching&&!t,q9=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Iv=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function W9(e,t,a){var v,w,N,j;const l=I9(),o=U9(),u=Pa(),f=u.defaultQueryOptions(e);(w=(v=u.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||w.call(v,f);const m=u.getQueryCache().get(f.queryHash);f._optimisticResults=l?"isRestoring":"optimistic",$9(f),z9(f,o,m),B9(o);const y=!u.getQueryCache().get(f.queryHash),[g]=_.useState(()=>new t(u,f)),S=g.getOptimisticResult(f),p=!l&&e.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(C=>{const R=p?g.subscribe(vs.batchCalls(C)):ys;return g.updateResult(),R},[g,p]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),_.useEffect(()=>{g.setOptions(f)},[f,g]),q9(f,S))throw Iv(f,g,o);if(H9({result:S,errorResetBoundary:o,throwOnError:f.throwOnError,query:m,suspense:f.suspense}))throw S.error;if((j=(N=u.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||j.call(N,f,S),f.experimental_prefetchInRender&&!nc&&F9(S,l)){const C=y?Iv(f,g,o):m==null?void 0:m.promise;C==null||C.catch(ys).finally(()=>{g.updateResult()})}return f.notifyOnChangeProps?S:g.trackResult(S)}function is(e,t){return W9(e,N9)}function ss(e,t){const a=Pa(),[l]=_.useState(()=>new R9(a,e));_.useEffect(()=>{l.setOptions(e)},[l,e]);const o=_.useSyncExternalStore(_.useCallback(f=>l.subscribe(vs.batchCalls(f)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=_.useCallback((f,m)=>{l.mutate(f,m).catch(ys)},[l]);if(o.error&&U0(l.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:u,mutateAsync:o.mutate}}var lm=typeof window<"u"?_.useLayoutEffect:_.useEffect;function X1(e){const t=_.useRef({value:e,prev:null}),a=t.current.value;return e!==a&&(t.current={value:e,prev:a}),t.current.prev}function K9(e,t,a={},l={}){_.useEffect(()=>{if(!e.current||l.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([u])=>{t(u)},a);return o.observe(e.current),()=>{o.disconnect()}},[t,a,l.disabled,e])}function Q9(e){const t=_.useRef(null);return _.useImperativeHandle(e,()=>t.current,[]),t}var G9=!1;function xf(e){return e[e.length-1]}function Y9(e){return typeof e=="function"}function Vl(e,t){return Y9(e)?e(t):e}var V9=Object.prototype.hasOwnProperty,Lv=Object.prototype.propertyIsEnumerable,Z9=()=>Object.create(null),Ro=(e,t)=>zo(e,t,Z9);function zo(e,t,a=()=>({}),l=0){if(e===t)return e;if(l>500)return t;const o=t,u=zv(e)&&zv(o);if(!u&&!(Pm(e)&&Pm(o)))return o;const f=u?e:Pv(e);if(!f)return o;const m=u?o:Pv(o);if(!m)return o;const y=f.length,g=m.length,S=u?new Array(g):a();let p=0;for(let v=0;v<g;v++){const w=u?v:m[v],N=e[w],j=o[w];if(N===j){S[w]=N,(u?v<y:V9.call(e,w))&&p++;continue}if(N===null||j===null||typeof N!="object"||typeof j!="object"){S[w]=j;continue}const C=zo(N,j,a,l+1);S[w]=C,C===N&&p++}return y===g&&p===y?e:S}function Pv(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!Lv.call(e,o))return!1;const a=Object.getOwnPropertySymbols(e);if(a.length===0)return t;const l=t;for(const o of a){if(!Lv.call(e,o))return!1;l.push(o)}return l}function Pm(e){if(!Uv(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!Uv(a)||!a.hasOwnProperty("isPrototypeOf"))}function Uv(e){return Object.prototype.toString.call(e)==="[object Object]"}function zv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zo(e,t,a){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let l=0,o=e.length;l<o;l++)if(!Zo(e[l],t[l],a))return!1;return!0}if(Pm(e)&&Pm(t)){const l=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const f in t)if((!l||t[f]!==void 0)&&!Zo(e[f],t[f],a))return!1;return!0}let o=0;if(!l)o=Object.keys(e).length;else for(const f in e)e[f]!==void 0&&o++;let u=0;for(const f in t)if((!l||t[f]!==void 0)&&(u++,u>o||!Zo(e[f],t[f],a)))return!1;return o===u}return!1}function Cu(e){let t,a;const l=new Promise((o,u)=>{t=o,a=u});return l.status="pending",l.resolve=o=>{l.status="resolved",l.value=o,t(o),e==null||e(o)},l.reject=o=>{l.status="rejected",a(o)},l}function Sf(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function X9(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Bv(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return X9(t)}var J9=["http:","https:","mailto:","tel:"];function Um(e,t){if(!e)return!1;try{const a=new URL(e);return!t.has(a.protocol)}catch{return!1}}function Yd(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,l="",o;for(;(o=t.exec(e))!==null;)l+=Bv(e.slice(a,o.index))+o[0],a=t.lastIndex;l=l+Bv(a?e.slice(a):e);let u=!1;return l.startsWith("//")&&(u=!0,l="/"+l.replace(/^\/+/,"")),{path:l,handledProtocolRelativeURL:u}}function eS(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function zm(e){const t=new Map;let a,l;const o=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,l&&(l.next=u,u.prev=l)):(u.next.prev=void 0,a=u.next,u.next=void 0,l&&(u.prev=l,l.next=u)),l=u)};return{get(u){const f=t.get(u);if(f)return o(f),f.value},set(u,f){if(t.size>=e&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===l&&(l=void 0)}const m=t.get(u);if(m)m.value=f,o(m);else{const y={key:u,value:f,prev:l};l&&(l.next=y),l=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,l=void 0}}}var tS="Invariant failed";function no(e,t){if(!e)throw new Error(tS)}var Bo=4,I2=5;function nS(e){const t=e.indexOf("{");if(t===-1)return null;const a=e.indexOf("}",t);return a===-1||t+1>=e.length?null:[t,a]}function H0(e,t,a=new Uint16Array(6)){const l=e.indexOf("/",t),o=l===-1?e.length:l,u=e.substring(t,o);if(!u||!u.includes("$"))return a[0]=0,a[1]=t,a[2]=t,a[3]=o,a[4]=o,a[5]=o,a;if(u==="$"){const m=e.length;return a[0]=2,a[1]=t,a[2]=t,a[3]=m,a[4]=m,a[5]=m,a}if(u.charCodeAt(0)===36)return a[0]=1,a[1]=t,a[2]=t+1,a[3]=o,a[4]=o,a[5]=o,a;const f=nS(u);if(f){const[m,y]=f,g=u.charCodeAt(m+1);if(g===45){if(m+2<u.length&&u.charCodeAt(m+2)===36){const S=m+3,p=y;if(S<p)return a[0]=3,a[1]=t+m,a[2]=t+S,a[3]=t+p,a[4]=t+y+1,a[5]=o,a}}else if(g===36){const S=m+1,p=m+2;return p===y?(a[0]=2,a[1]=t+m,a[2]=t+S,a[3]=t+p,a[4]=t+y+1,a[5]=e.length,a):(a[0]=1,a[1]=t+m,a[2]=t+p,a[3]=t+y,a[4]=t+y+1,a[5]=o,a)}}return a[0]=0,a[1]=t,a[2]=t,a[3]=o,a[4]=o,a[5]=o,a}function hp(e,t,a,l,o,u,f){var y,g,S,p,v,w,N,j,C,R,z,O,k;f==null||f(a);let m=l;{const L=a.fullPath??a.from,K=L.length,J=((y=a.options)==null?void 0:y.caseSensitive)??e,q=!!((S=(g=a.options)==null?void 0:g.params)!=null&&S.parse&&((v=(p=a.options)==null?void 0:p.skipRouteOnParseError)!=null&&v.params));for(;m<K;){const Q=H0(L,m,t);let G;const ge=m,me=Q[5];switch(m=me+1,u++,Q[0]){case 0:{const Z=L.substring(Q[2],Q[3]);if(J){const he=(w=o.static)==null?void 0:w.get(Z);if(he)G=he;else{o.static??(o.static=new Map);const M=Ho(a.fullPath??a.from);M.parent=o,M.depth=u,G=M,o.static.set(Z,M)}}else{const he=Z.toLowerCase(),M=(N=o.staticInsensitive)==null?void 0:N.get(he);if(M)G=M;else{o.staticInsensitive??(o.staticInsensitive=new Map);const $=Ho(a.fullPath??a.from);$.parent=o,$.depth=u,G=$,o.staticInsensitive.set(he,$)}}break}case 1:{const Z=L.substring(ge,Q[1]),he=L.substring(Q[4],me),M=J&&!!(Z||he),$=Z?M?Z:Z.toLowerCase():void 0,ee=he?M?he:he.toLowerCase():void 0,oe=!q&&((j=o.dynamic)==null?void 0:j.find(ae=>!ae.skipOnParamError&&ae.caseSensitive===M&&ae.prefix===$&&ae.suffix===ee));if(oe)G=oe;else{const ae=eg(1,a.fullPath??a.from,M,$,ee);G=ae,ae.depth=u,ae.parent=o,o.dynamic??(o.dynamic=[]),o.dynamic.push(ae)}break}case 3:{const Z=L.substring(ge,Q[1]),he=L.substring(Q[4],me),M=J&&!!(Z||he),$=Z?M?Z:Z.toLowerCase():void 0,ee=he?M?he:he.toLowerCase():void 0,oe=!q&&((C=o.optional)==null?void 0:C.find(ae=>!ae.skipOnParamError&&ae.caseSensitive===M&&ae.prefix===$&&ae.suffix===ee));if(oe)G=oe;else{const ae=eg(3,a.fullPath??a.from,M,$,ee);G=ae,ae.parent=o,ae.depth=u,o.optional??(o.optional=[]),o.optional.push(ae)}break}case 2:{const Z=L.substring(ge,Q[1]),he=L.substring(Q[4],me),M=J&&!!(Z||he),$=Z?M?Z:Z.toLowerCase():void 0,ee=he?M?he:he.toLowerCase():void 0,oe=eg(2,a.fullPath??a.from,M,$,ee);G=oe,oe.parent=o,oe.depth=u,o.wildcard??(o.wildcard=[]),o.wildcard.push(oe)}}o=G}if(q&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Q=Ho(a.fullPath??a.from);Q.kind=I2,Q.parent=o,u++,Q.depth=u,o.pathless??(o.pathless=[]),o.pathless.push(Q),o=Q}const Y=(a.path||!a.children)&&!a.isRoot;if(Y&&L.endsWith("/")){const Q=Ho(a.fullPath??a.from);Q.kind=Bo,Q.parent=o,u++,Q.depth=u,o.index=Q,o=Q}o.parse=((z=(R=a.options)==null?void 0:R.params)==null?void 0:z.parse)??null,o.skipOnParamError=q,o.parsingPriority=((k=(O=a.options)==null?void 0:O.skipRouteOnParseError)==null?void 0:k.priority)??0,Y&&!o.route&&(o.route=a,o.fullPath=a.fullPath??a.from)}if(a.children)for(const L of a.children)hp(e,t,L,m,o,u,f)}function J1(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ul(e){var t,a,l;if(e.pathless)for(const o of e.pathless)Ul(o);if(e.static)for(const o of e.static.values())Ul(o);if(e.staticInsensitive)for(const o of e.staticInsensitive.values())Ul(o);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(J1);for(const o of e.dynamic)Ul(o)}if((a=e.optional)!=null&&a.length){e.optional.sort(J1);for(const o of e.optional)Ul(o)}if((l=e.wildcard)!=null&&l.length){e.wildcard.sort(J1);for(const o of e.wildcard)Ul(o)}}function Ho(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function eg(e,t,a,l,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:a,prefix:l,suffix:o}}function sS(e,t){const a=Ho("/"),l=new Uint16Array(6);for(const o of e)hp(!1,l,o,1,a,0);Ul(a),t.masksTree=a,t.flatCache=zm(1e3)}function aS(e,t){e||(e="/");const a=t.flatCache.get(e);if(a)return a;const l=$0(e,t.masksTree);return t.flatCache.set(e,l),l}function iS(e,t,a,l,o){e||(e="/"),l||(l="/");const u=t?`case\0${e}`:e;let f=o.singleCache.get(u);return f||(f=Ho("/"),hp(t,new Uint16Array(6),{from:e},1,f,0),o.singleCache.set(u,f)),$0(l,f,a)}function rS(e,t,a=!1){const l=a?e:`nofuzz\0${e}`,o=t.matchCache.get(l);if(o!==void 0)return o;e||(e="/");let u;try{u=$0(e,t.segmentTree,a)}catch(f){if(f instanceof URIError)u=null;else throw f}return u&&(u.branch=cS(u.route)),t.matchCache.set(l,u),u}function lS(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function oS(e,t=!1,a){const l=Ho(e.fullPath),o=new Uint16Array(6),u={},f={};let m=0;return hp(t,o,e,1,l,0,y=>{if(a==null||a(y,m),no(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,m!==0&&y.path){const g=lS(y.fullPath);(!f[g]||y.fullPath.endsWith("/"))&&(f[g]=y)}m++}),Ul(l),{processedTree:{segmentTree:l,singleCache:zm(1e3),matchCache:zm(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:f}}function $0(e,t,a=!1){const l=e.split("/"),o=dS(e,l,t,a);if(!o)return null;const[u]=L2(e,l,o);return{route:o.node.route,rawParams:u,parsedParams:o.parsedParams}}function L2(e,t,a){var S,p,v,w,N,j,C,R,z,O;const l=uS(a.node);let o=null;const u=Object.create(null);let f=((S=a.extract)==null?void 0:S.part)??0,m=((p=a.extract)==null?void 0:p.node)??0,y=((v=a.extract)==null?void 0:v.path)??0,g=((w=a.extract)==null?void 0:w.segment)??0;for(;m<l.length;f++,m++,y++,g++){const k=l[m];if(k.kind===Bo)break;if(k.kind===I2){g--,f--,y--;continue}const L=t[f],K=y;if(L&&(y+=L.length),k.kind===1){o??(o=a.node.fullPath.split("/"));const J=o[g],q=((N=k.prefix)==null?void 0:N.length)??0;if(J.charCodeAt(q)===123){const Y=((j=k.suffix)==null?void 0:j.length)??0,Q=J.substring(q+2,J.length-Y-1),G=L.substring(q,L.length-Y);u[Q]=decodeURIComponent(G)}else{const Y=J.substring(1);u[Y]=decodeURIComponent(L)}}else if(k.kind===3){if(a.skipped&1<<m){f--,y=K-1;continue}o??(o=a.node.fullPath.split("/"));const J=o[g],q=((C=k.prefix)==null?void 0:C.length)??0,Y=((R=k.suffix)==null?void 0:R.length)??0,Q=J.substring(q+3,J.length-Y-1),G=k.suffix||k.prefix?L.substring(q,L.length-Y):L;G&&(u[Q]=decodeURIComponent(G))}else if(k.kind===2){const J=k,q=e.substring(K+(((z=J.prefix)==null?void 0:z.length)??0),e.length-(((O=J.suffix)==null?void 0:O.length)??0)),Y=decodeURIComponent(q);u["*"]=Y,u._splat=Y;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:f,node:m,path:y,segment:g}]}function cS(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function uS(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function dS(e,t,a,l){if(e==="/"&&a.index)return{node:a.index,skipped:0};const o=!xf(t),u=o&&e!=="/",f=t.length-(o?1:0),m=[{node:a,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let y=null,g=null,S=null;for(;m.length;){const p=m.pop(),{node:v,index:w,skipped:N,depth:j,statics:C,dynamics:R,optionals:z}=p;let{extract:O,rawParams:k,parsedParams:L}=p;if(v.skipOnParamError){if(!tg(e,t,p))continue;k=p.rawParams,O=p.extract,L=p.parsedParams}l&&v.route&&v.kind!==Bo&&Vd(g,p)&&(g=p);const K=w===f;if(K&&(v.route&&!u&&Vd(S,p)&&(S=p),!v.optional&&!v.wildcard&&!v.index&&!v.pathless))continue;const J=K?void 0:t[w];let q;if(K&&v.index){const Y={node:v.index,index:w,skipped:N,depth:j+1,statics:C,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L};let Q=!0;if(v.index.skipOnParamError&&(tg(e,t,Y)||(Q=!1)),Q){if(C===f&&!R&&!z&&!N)return Y;Vd(S,Y)&&(S=Y)}}if(v.wildcard&&Vd(y,p))for(const Y of v.wildcard){const{prefix:Q,suffix:G}=Y;if(Q&&(K||!(Y.caseSensitive?J:q??(q=J.toLowerCase())).startsWith(Q)))continue;if(G){if(K)continue;const me=t.slice(w).join("/").slice(-G.length);if((Y.caseSensitive?me:me.toLowerCase())!==G)continue}const ge={node:Y,index:f,skipped:N,depth:j,statics:C,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L};if(!(Y.skipOnParamError&&!tg(e,t,ge))){y=ge;break}}if(v.optional){const Y=N|1<<j,Q=j+1;for(let G=v.optional.length-1;G>=0;G--){const ge=v.optional[G];m.push({node:ge,index:w,skipped:Y,depth:Q,statics:C,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L})}if(!K)for(let G=v.optional.length-1;G>=0;G--){const ge=v.optional[G],{prefix:me,suffix:Z}=ge;if(me||Z){const he=ge.caseSensitive?J:q??(q=J.toLowerCase());if(me&&!he.startsWith(me)||Z&&!he.endsWith(Z))continue}m.push({node:ge,index:w+1,skipped:N,depth:Q,statics:C,dynamics:R,optionals:z+1,extract:O,rawParams:k,parsedParams:L})}}if(!K&&v.dynamic&&J)for(let Y=v.dynamic.length-1;Y>=0;Y--){const Q=v.dynamic[Y],{prefix:G,suffix:ge}=Q;if(G||ge){const me=Q.caseSensitive?J:q??(q=J.toLowerCase());if(G&&!me.startsWith(G)||ge&&!me.endsWith(ge))continue}m.push({node:Q,index:w+1,skipped:N,depth:j+1,statics:C,dynamics:R+1,optionals:z,extract:O,rawParams:k,parsedParams:L})}if(!K&&v.staticInsensitive){const Y=v.staticInsensitive.get(q??(q=J.toLowerCase()));Y&&m.push({node:Y,index:w+1,skipped:N,depth:j+1,statics:C+1,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L})}if(!K&&v.static){const Y=v.static.get(J);Y&&m.push({node:Y,index:w+1,skipped:N,depth:j+1,statics:C+1,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L})}if(v.pathless){const Y=j+1;for(let Q=v.pathless.length-1;Q>=0;Q--){const G=v.pathless[Q];m.push({node:G,index:w,skipped:N,depth:Y,statics:C,dynamics:R,optionals:z,extract:O,rawParams:k,parsedParams:L})}}}if(S&&y)return Vd(y,S)?S:y;if(S)return S;if(y)return y;if(l&&g){let p=g.index;for(let w=0;w<g.index;w++)p+=t[w].length;const v=p===e.length?"/":e.slice(p);return g.rawParams??(g.rawParams=Object.create(null)),g.rawParams["**"]=decodeURIComponent(v),g}return null}function tg(e,t,a){try{const[l,o]=L2(e,t,a);a.rawParams=l,a.extract=o;const u=a.node.parse(l);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function Vd(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Bo)>(e.node.kind===Bo)||t.node.kind===Bo==(e.node.kind===Bo)&&t.depth>e.depth))):!0}function jm(e){return F0(e.filter(t=>t!==void 0).join("/"))}function F0(e){return e.replace(/\/{2,}/g,"/")}function P2(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Jl(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function U2(e){return Jl(P2(e))}function Bm(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function fS(e,t,a){return Bm(e,a)===Bm(t,a)}function hS({base:e,to:t,trailingSlash:a="never",cache:l}){const o=t.startsWith("/"),u=!o&&t===".";let f;if(l){f=o?t:u?e:e+"\0"+t;const p=l.get(f);if(p)return p}let m;if(u)m=e.split("/");else if(o)m=t.split("/");else{for(m=e.split("/");m.length>1&&xf(m)==="";)m.pop();const p=t.split("/");for(let v=0,w=p.length;v<w;v++){const N=p[v];N===""?v?v===w-1&&m.push(N):m=[N]:N===".."?m.pop():N==="."||m.push(N)}}m.length>1&&(xf(m)===""?a==="never"&&m.pop():a==="always"&&m.push(""));let y,g="";for(let p=0;p<m.length;p++){p>0&&(g+="/");const v=m[p];if(!v)continue;y=H0(v,0,y);const w=y[0];if(w===0){g+=v;continue}const N=y[5],j=v.substring(0,y[1]),C=v.substring(y[4],N),R=v.substring(y[2],y[3]);w===1?g+=j||C?`${j}{$${R}}${C}`:`$${R}`:w===2?g+=j||C?`${j}{$}${C}`:"$":g+=`${j}{-$${R}}${C}`}g=F0(g);const S=g||"/";return f&&l&&l.set(f,S),S}function mS(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),a=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),l=new RegExp(a,"g");return o=>o.replace(l,u=>t.get(u)??u)}function ng(e,t,a){const l=t[e];return typeof l!="string"?l:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(l)?l:l.split("/").map(o=>$v(o,a)).join("/"):$v(l,a)}function Hv({path:e,params:t,decoder:a,...l}){let o=!1;const u=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:u,isMissingParams:o};const f=e.length;let m=0,y,g="";for(;m<f;){const S=m;y=H0(e,S,y);const p=y[5];if(m=p+1,S===p)continue;const v=y[0];if(v===0){g+="/"+e.substring(S,p);continue}if(v===2){const w=t._splat;u._splat=w,u["*"]=w;const N=e.substring(S,y[1]),j=e.substring(y[4],p);if(!w){o=!0,(N||j)&&(g+="/"+N+j);continue}const C=ng("_splat",t,a);g+="/"+N+C+j;continue}if(v===1){const w=e.substring(y[2],y[3]);!o&&!(w in t)&&(o=!0),u[w]=t[w];const N=e.substring(S,y[1]),j=e.substring(y[4],p),C=ng(w,t,a)??"undefined";g+="/"+N+C+j;continue}if(v===3){const w=e.substring(y[2],y[3]),N=t[w];if(N==null)continue;u[w]=N;const j=e.substring(S,y[1]),C=e.substring(y[4],p),R=ng(w,t,a)??"";g+="/"+j+R+C;continue}}return e.endsWith("/")&&(g+="/"),{usedParams:u,interpolatedPath:g||"/",isMissingParams:o}}function $v(e,t){const a=encodeURIComponent(e);return(t==null?void 0:t(a))??a}function aa(e){return!!(e!=null&&e.isNotFound)}function pS(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var Qg="tsr-scroll-restoration-v1_3",gS=(e,t)=>{let a;return(...l)=>{a||(a=setTimeout(()=>{e(...l),a=null},t))}};function _S(){const e=pS();if(!e)return null;const t=e.getItem(Qg);let a=t?JSON.parse(t):{};return{state:a,set:l=>{a=Vl(l,a)||a;try{e.setItem(Qg,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var om=_S(),yS=e=>e.state.__TSR_key||e.href;function vS(e){const t=[];let a;for(;a=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,e)+1})`),e=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Hm=!1;function bS({storageKey:e,key:t,behavior:a,shouldScrollRestoration:l,scrollToTopSelectors:o,location:u}){var g,S;let f;try{f=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(p){console.error(p);return}const m=t||((g=window.history.state)==null?void 0:g.__TSR_key),y=f[m];Hm=!0;e:{if(l&&y&&Object.keys(y).length>0){for(const w in y){const N=y[w];if(w==="window")window.scrollTo({top:N.scrollY,left:N.scrollX,behavior:a});else if(w){const j=document.querySelector(w);j&&(j.scrollLeft=N.scrollX,j.scrollTop=N.scrollY)}}break e}const p=(u??window.location).hash.split("#",2)[1];if(p){const w=((S=window.history.state)==null?void 0:S.__hashScrollIntoViewOptions)??!0;if(w){const N=document.getElementById(p);N&&N.scrollIntoView(w)}break e}const v={top:0,left:0,behavior:a};if(window.scrollTo(v),o)for(const w of o){if(w==="window")continue;const N=typeof w=="function"?w():document.querySelector(w);N&&N.scrollTo(v)}}Hm=!1}function xS(e,t){if(!om||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!om))return;e.isScrollRestorationSetup=!0,Hm=!1;const a=e.options.getScrollRestorationKey||yS;window.history.scrollRestoration="manual";const l=o=>{if(Hm||!e.isScrollRestoring)return;let u="";if(o.target===document||o.target===window)u="window";else{const m=o.target.getAttribute("data-scroll-restoration-id");m?u=`[data-scroll-restoration-id="${m}"]`:u=vS(o.target)}const f=a(e.state.location);om.set(m=>{const y=m[f]||(m[f]={}),g=y[u]||(y[u]={});if(u==="window")g.scrollX=window.scrollX||0,g.scrollY=window.scrollY||0;else if(u){const S=document.querySelector(u);S&&(g.scrollX=S.scrollLeft||0,g.scrollY=S.scrollTop||0)}return m})};typeof document<"u"&&document.addEventListener("scroll",gS(l,100),!0),e.subscribe("onRendered",o=>{const u=a(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(bS({storageKey:Qg,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&om.set(f=>(f[u]||(f[u]={}),f)))})}function SS(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const a=document.getElementById(e.state.location.hash);a&&a.scrollIntoView(t)}}}function jS(e,t=String){const a=new URLSearchParams;for(const l in e){const o=e[l];o!==void 0&&a.set(l,t(o))}return a.toString()}function sg(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function wS(e){const t=new URLSearchParams(e),a=Object.create(null);for(const[l,o]of t.entries()){const u=a[l];u==null?a[l]=sg(o):Array.isArray(u)?u.push(sg(o)):a[l]=[u,sg(o)]}return a}var NS=ES(JSON.parse),kS=CS(JSON.stringify,JSON.parse);function ES(e){return t=>{t[0]==="?"&&(t=t.substring(1));const a=wS(t);for(const l in a){const o=a[l];if(typeof o=="string")try{a[l]=e(o)}catch{}}return a}}function CS(e,t){const a=typeof t=="function";function l(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(a&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const u=jS(o,l);return u?`?${u}`:""}}var Xo="__root__";function TS(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const a=new Response(null,{status:e.statusCode,headers:t});if(a.options=e,e.throw)throw a;return a}function ja(e){return e instanceof Response&&!!e.options}function MS(e){return{input:({url:t})=>{for(const a of e)t=Gg(a,t);return t},output:({url:t})=>{for(let a=e.length-1;a>=0;a--)t=z2(e[a],t);return t}}}function RS(e){const t=U2(e.basepath),a=`/${t}`,l=`${a}/`,o=e.caseSensitive?a:a.toLowerCase(),u=e.caseSensitive?l:l.toLowerCase();return{input:({url:f})=>{const m=e.caseSensitive?f.pathname:f.pathname.toLowerCase();return m===o?f.pathname="/":m.startsWith(u)&&(f.pathname=f.pathname.slice(a.length)),f},output:({url:f})=>(f.pathname=jm(["/",t,f.pathname]),f)}}function Gg(e,t){var l;const a=(l=e==null?void 0:e.input)==null?void 0:l.call(e,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function z2(e,t){var l;const a=(l=e==null?void 0:e.output)==null?void 0:l.call(e,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var Yn=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(Yn||{});function B2({update:e,notify:t,unwatched:a}){return{link:l,unlink:o,propagate:u,checkDirty:f,shallowPropagate:m};function l(g,S,p){const v=S.depsTail;if(v!==void 0&&v.dep===g)return;const w=v!==void 0?v.nextDep:S.deps;if(w!==void 0&&w.dep===g){w.version=p,S.depsTail=w;return}const N=g.subsTail;if(N!==void 0&&N.version===p&&N.sub===S)return;const j=S.depsTail=g.subsTail={version:p,dep:g,sub:S,prevDep:v,nextDep:w,prevSub:N,nextSub:void 0};w!==void 0&&(w.prevDep=j),v!==void 0?v.nextDep=j:S.deps=j,N!==void 0?N.nextSub=j:g.subs=j}function o(g,S=g.sub){const p=g.dep,v=g.prevDep,w=g.nextDep,N=g.nextSub,j=g.prevSub;return w!==void 0?w.prevDep=v:S.depsTail=v,v!==void 0?v.nextDep=w:S.deps=w,N!==void 0?N.prevSub=j:p.subsTail=j,j!==void 0?j.nextSub=N:(p.subs=N)===void 0&&a(p),w}function u(g){let S=g.nextSub,p;e:do{const v=g.sub;let w=v.flags;if(w&60?w&12?w&4?!(w&48)&&y(g,v)?(v.flags=w|40,w&=1):w=0:v.flags=w&-9|32:w=0:v.flags=w|32,w&2&&t(v),w&1){const N=v.subs;if(N!==void 0){const j=(g=N).nextSub;j!==void 0&&(p={value:S,prev:p},S=j);continue}}if((g=S)!==void 0){S=g.nextSub;continue}for(;p!==void 0;)if(g=p.value,p=p.prev,g!==void 0){S=g.nextSub;continue e}break}while(!0)}function f(g,S){let p,v=0,w=!1;e:do{const N=g.dep,j=N.flags;if(S.flags&16)w=!0;else if((j&17)===17){if(e(N)){const C=N.subs;C.nextSub!==void 0&&m(C),w=!0}}else if((j&33)===33){(g.nextSub!==void 0||g.prevSub!==void 0)&&(p={value:g,prev:p}),g=N.deps,S=N,++v;continue}if(!w){const C=g.nextDep;if(C!==void 0){g=C;continue}}for(;v--;){const C=S.subs,R=C.nextSub!==void 0;if(R?(g=p.value,p=p.prev):g=C,w){if(e(S)){R&&m(C),S=g.sub;continue}w=!1}else S.flags&=-33;S=g.sub;const z=g.nextDep;if(z!==void 0){g=z;continue e}}return w}while(!0)}function m(g){do{const S=g.sub,p=S.flags;(p&48)===32&&(S.flags=p|16,(p&6)===2&&t(S))}while((g=g.nextSub)!==void 0)}function y(g,S){let p=S.depsTail;for(;p!==void 0;){if(p===g)return!0;p=p.prevDep}return!1}}let q0=0,Ao=0,pf=0;const Hr=[],{link:cD,unlink:H2,propagate:uD,checkDirty:AS,shallowPropagate:dD}=B2({update(e){return e.depsTail!==void 0?LS(e):PS(e)},notify(e){var l;let t=pf,a=t;do if(Hr[t++]=e,e.flags&=-3,e=(l=e.subs)==null?void 0:l.sub,e===void 0||!(e.flags&2))break;while(!0);for(pf=t;a<--t;){const o=Hr[a];Hr[a++]=Hr[t],Hr[t]=o}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,mp(e)):BS.call(e)}});function DS(){return q0}function OS(){++q0}function IS(){--q0||zS()}function LS(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,mp(e)}}function PS(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function US(e){const t=e.flags;if(t&16||t&32&&AS(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,mp(e)}}else e.flags=2}function zS(){try{for(;Ao<pf;){const e=Hr[Ao];Hr[Ao++]=void 0,US(e)}}finally{for(;Ao<pf;){const e=Hr[Ao];Hr[Ao++]=void 0,e.flags|=10}Ao=0,pf=0}}function BS(){this.depsTail=void 0,this.flags=0,mp(this);const e=this.subs;e!==void 0&&H2(e)}function mp(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=H2(a,e)}function W0(e,t,a){var u,f,m;const l=typeof e=="object",o=l?e:void 0;return{next:(u=l?e.next:e)==null?void 0:u.bind(o),error:(f=l?e.error:t)==null?void 0:f.bind(o),complete:(m=l?e.complete:a)==null?void 0:m.bind(o)}}const Yg=[];let wm=0;const{link:Fv,unlink:HS,propagate:$S,checkDirty:$2,shallowPropagate:qv}=B2({update(e){return e._update()},notify(e){Yg[Vg++]=e,e.flags&=~Yn.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Yn.Mutable|Yn.Dirty,$m(e))}});let cm=0,Vg=0,Wi;function $m(e){const t=e.depsTail;let a=t!==void 0?t.nextDep:e.deps;for(;a!==void 0;)a=HS(a,e)}function F2(){if(!(DS()>0)){for(;cm<Vg;){const e=Yg[cm];Yg[cm++]=void 0,e.notify()}cm=0,Vg=0}}function q2(e,t){const a=typeof e=="function",l=e,o={_snapshot:a?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?Yn.None:Yn.Mutable,get(){return Wi!==void 0&&Fv(o,Wi,wm),o._snapshot},subscribe(u){const f=W0(u),m={current:!1},y=FS(()=>{var g;o.get(),m.current?(g=f.next)==null||g.call(f,o._snapshot):m.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const f=Wi,m=Object.is;if(a)Wi=o,++wm,o.depsTail=void 0;else if(u===void 0)return!1;a&&(o.flags=Yn.Mutable|Yn.RecursedCheck);try{const y=o._snapshot,g=typeof u=="function"?u(y):u===void 0&&a?l(y):u;return y===void 0||!m(y,g)?(o._snapshot=g,!0):!1}finally{Wi=f,a&&(o.flags&=~Yn.RecursedCheck),$m(o)}}};return a?(o.flags=Yn.Mutable|Yn.Dirty,o.get=function(){const u=o.flags;if(u&Yn.Dirty||u&Yn.Pending&&$2(o.deps,o)){if(o._update()){const f=o.subs;f!==void 0&&qv(f)}}else u&Yn.Pending&&(o.flags=u&~Yn.Pending);return Wi!==void 0&&Fv(o,Wi,wm),o._snapshot}):o.set=function(u){if(o._update(u)){const f=o.subs;f!==void 0&&($S(f),qv(f),F2())}},o}function FS(e){const t=()=>{const l=Wi;Wi=a,++wm,a.depsTail=void 0,a.flags=Yn.Watching|Yn.RecursedCheck;try{return e()}finally{Wi=l,a.flags&=~Yn.RecursedCheck,$m(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Yn.Watching|Yn.RecursedCheck,notify(){const l=this.flags;l&Yn.Dirty||l&Yn.Pending&&$2(this.deps,this)?t():this.flags=Yn.Watching},stop(){this.flags=Yn.None,this.depsTail=void 0,$m(this)}};return t(),a}class qS{constructor(t){this.atom=q2(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(W0(t))}}class WS{constructor(t){this.atom=q2(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(W0(t))}}function KS(e){return typeof e=="function"?new WS(e):new qS(e)}function QS(e){try{OS(),e()}finally{IS(),F2()}}function gf(e){let t;return QS(()=>{t=e()}),t}var Zg=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},pp=(e,t)=>!!(e.preload&&!e.router.state.matches.some(a=>a.id===t)),Jo=(e,t,a=!0)=>{const l={...e.router.options.context??{}},o=a?t:t-1;for(let u=0;u<=o;u++){const f=e.matches[u];if(!f)continue;const m=e.router.getMatch(f.id);m&&Object.assign(l,m.__routeContext,m.__beforeLoadContext)}return l},Wv=(e,t)=>{if(!e.matches.length)return;const a=t.routeId,l=e.matches.findIndex(f=>f.routeId===e.router.routeTree.id),o=l>=0?l:0;let u=a?e.matches.findIndex(f=>f.routeId===a):e.firstBadMatchIndex??e.matches.length-1;u<0&&(u=o);for(let f=u;f>=0;f--){const m=e.matches[f];if(e.router.looseRoutesById[m.routeId].options.notFoundComponent)return f}return a?u:o},Zl=(e,t,a)=>{var l,o,u;if(!(!ja(a)&&!aa(a)))throw ja(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((l=t._nonReactive.beforeLoadPromise)==null||l.resolve(),(o=t._nonReactive.loaderPromise)==null||o.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,e.updateMatch(t.id,f=>({...f,status:ja(a)?"redirected":f.status==="pending"?"success":f.status,context:Jo(e,t.index),isFetching:!1,error:a})),aa(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),ja(a)&&(e.rendered=!0,a.options._fromLocation=e.location,a.redirectHandled=!0,a=e.router.resolveRedirect(a))),a},W2=(e,t)=>{const a=e.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},Kv=(e,t,a)=>{const l=Jo(e,a);e.updateMatch(t,o=>({...o,context:l}))},Zd=(e,t,a,l)=>{var m,y;const{id:o,routeId:u}=e.matches[t],f=e.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=l,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),Zl(e,e.router.getMatch(o),a);try{(y=(m=f.options).onError)==null||y.call(m,a)}catch(g){a=g,Zl(e,e.router.getMatch(o),a)}e.updateMatch(o,g=>{var S,p;return(S=g._nonReactive.beforeLoadPromise)==null||S.resolve(),g._nonReactive.beforeLoadPromise=void 0,(p=g._nonReactive.loadPromise)==null||p.resolve(),{...g,error:a,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!ja(a)&&!aa(a)&&(e.serialError??(e.serialError=a))},K2=(e,t,a,l)=>{var u;if(l._nonReactive.pendingTimeout!==void 0)return;const o=a.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!pp(e,t)&&(a.options.loader||a.options.beforeLoad||G2(a))&&typeof o=="number"&&o!==1/0&&(a.options.pendingComponent??((u=e.router.options)==null?void 0:u.defaultPendingComponent))){const f=setTimeout(()=>{Zg(e)},o);l._nonReactive.pendingTimeout=f}},GS=(e,t,a)=>{const l=e.router.getMatch(t);if(!l._nonReactive.beforeLoadPromise&&!l._nonReactive.loaderPromise)return;K2(e,t,a,l);const o=()=>{const u=e.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&Zl(e,u,u.error)};return l._nonReactive.beforeLoadPromise?l._nonReactive.beforeLoadPromise.then(o):o()},YS=(e,t,a,l)=>{const o=e.router.getMatch(t);let u=o._nonReactive.loadPromise;o._nonReactive.loadPromise=Cu(()=>{u==null||u.resolve(),u=void 0});const{paramsError:f,searchError:m}=o;f&&Zd(e,a,f,"PARSE_PARAMS"),m&&Zd(e,a,m,"VALIDATE_SEARCH"),K2(e,t,l,o);const y=new AbortController;let g=!1;const S=()=>{g||(g=!0,e.updateMatch(t,k=>({...k,isFetching:"beforeLoad",fetchCount:k.fetchCount+1,abortController:y})))},p=()=>{var k;(k=o._nonReactive.beforeLoadPromise)==null||k.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,L=>({...L,isFetching:!1}))};if(!l.options.beforeLoad){gf(()=>{S(),p()});return}o._nonReactive.beforeLoadPromise=Cu();const v={...Jo(e,a,!1),...o.__routeContext},{search:w,params:N,cause:j}=o,C=pp(e,t),R={search:w,abortController:y,params:N,preload:C,context:v,location:e.location,navigate:k=>e.router.navigate({...k,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:C?"preload":j,matches:e.matches,routeId:l.id,...e.router.options.additionalContext},z=k=>{if(k===void 0){gf(()=>{S(),p()});return}(ja(k)||aa(k))&&(S(),Zd(e,a,k,"BEFORE_LOAD")),gf(()=>{S(),e.updateMatch(t,L=>({...L,__beforeLoadContext:k})),p()})};let O;try{if(O=l.options.beforeLoad(R),Sf(O))return S(),O.catch(k=>{Zd(e,a,k,"BEFORE_LOAD")}).then(z)}catch(k){S(),Zd(e,a,k,"BEFORE_LOAD")}z(O)},VS=(e,t)=>{const{id:a,routeId:l}=e.matches[t],o=e.router.looseRoutesById[l],u=()=>m(),f=()=>YS(e,a,t,o),m=()=>{if(W2(e,a))return;const y=GS(e,a,o);return Sf(y)?y.then(f):f()};return u()},ZS=(e,t,a)=>{var u,f,m,y,g,S;const l=e.router.getMatch(t);if(!l||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:l,params:l.params,loaderData:l.loaderData};return Promise.all([(f=(u=a.options).head)==null?void 0:f.call(u,o),(y=(m=a.options).scripts)==null?void 0:y.call(m,o),(S=(g=a.options).headers)==null?void 0:S.call(g,o)]).then(([p,v,w])=>({meta:p==null?void 0:p.meta,links:p==null?void 0:p.links,headScripts:p==null?void 0:p.scripts,headers:w,scripts:v,styles:p==null?void 0:p.styles}))},Q2=(e,t,a,l,o)=>{const u=t[l-1],{params:f,loaderDeps:m,abortController:y,cause:g}=e.router.getMatch(a),S=Jo(e,l),p=pp(e,a);return{params:f,deps:m,preload:!!p,parentMatchPromise:u,abortController:y,context:S,location:e.location,navigate:v=>e.router.navigate({...v,_fromLocation:e.location}),cause:p?"preload":g,route:o,...e.router.options.additionalContext}},Qv=async(e,t,a,l,o)=>{var u,f,m,y,g;try{const S=e.router.getMatch(a);try{(!(G9??e.router.isServer)||S.ssr===!0)&&jf(o);const p=o.options.loader,v=typeof p=="function"?p:p==null?void 0:p.handler,w=v==null?void 0:v(Q2(e,t,a,l,o)),N=!!v&&Sf(w);if((N||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||S._nonReactive.minPendingPromise)&&e.updateMatch(a,C=>({...C,isFetching:"loader"})),v){const C=N?await w:w;Zl(e,e.router.getMatch(a),C),C!==void 0&&e.updateMatch(a,R=>({...R,loaderData:C}))}o._lazyPromise&&await o._lazyPromise;const j=S._nonReactive.minPendingPromise;j&&await j,o._componentsPromise&&await o._componentsPromise,e.updateMatch(a,C=>({...C,error:void 0,context:Jo(e,l),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(p){let v=p;if((v==null?void 0:v.name)==="AbortError"){if(S.abortController.signal.aborted){(u=S._nonReactive.loaderPromise)==null||u.resolve(),S._nonReactive.loaderPromise=void 0;return}e.updateMatch(a,N=>({...N,status:N.status==="pending"?"success":N.status,isFetching:!1,context:Jo(e,l)}));return}const w=S._nonReactive.minPendingPromise;w&&await w,aa(p)&&await((m=(f=o.options.notFoundComponent)==null?void 0:f.preload)==null?void 0:m.call(f)),Zl(e,e.router.getMatch(a),p);try{(g=(y=o.options).onError)==null||g.call(y,p)}catch(N){v=N,Zl(e,e.router.getMatch(a),N)}!ja(v)&&!aa(v)&&await jf(o,["errorComponent"]),e.updateMatch(a,N=>({...N,error:v,context:Jo(e,l),status:"error",isFetching:!1}))}}catch(S){const p=e.router.getMatch(a);p&&(p._nonReactive.loaderPromise=void 0),Zl(e,p,S)}},XS=async(e,t,a)=>{var w,N,j,C;async function l(R,z,O,k,L){const K=Date.now()-z.updatedAt,J=R?L.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:L.options.staleTime??e.router.options.defaultStaleTime??0,q=L.options.shouldReload,Y=typeof q=="function"?q(Q2(e,t,o,a,L)):q,{status:Q,invalid:G}=k,ge=K>J&&(!!e.forceStaleReload||k.cause==="enter"||O!==void 0&&O!==k.id);f=Q==="success"&&(G||(Y??ge)),R&&L.options.preload===!1||(f&&!e.sync&&S?(m=!0,(async()=>{var me,Z;try{await Qv(e,t,o,a,L);const he=e.router.getMatch(o);(me=he._nonReactive.loaderPromise)==null||me.resolve(),(Z=he._nonReactive.loadPromise)==null||Z.resolve(),he._nonReactive.loaderPromise=void 0,he._nonReactive.loadPromise=void 0}catch(he){ja(he)&&await e.router.navigate(he.options)}})()):Q!=="success"||f?await Qv(e,t,o,a,L):Kv(e,o,a))}const{id:o,routeId:u}=e.matches[a];let f=!1,m=!1;const y=e.router.looseRoutesById[u],g=y.options.loader,S=((typeof g=="function"||g==null?void 0:g.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(W2(e,o)){if(!e.router.getMatch(o))return e.matches[a];Kv(e,o,a)}else{const R=e.router.getMatch(o),z=((w=e.router.state.matches[a])==null?void 0:w.routeId)===u?e.router.state.matches[a].id:(N=e.router.state.matches.find(k=>k.routeId===u))==null?void 0:N.id,O=pp(e,o);if(R._nonReactive.loaderPromise){if(R.status==="success"&&!e.sync&&!R.preload&&S)return R;await R._nonReactive.loaderPromise;const k=e.router.getMatch(o),L=k._nonReactive.error||k.error;L&&Zl(e,k,L),k.status==="pending"&&await l(O,R,z,k,y)}else{const k=O&&!e.router.state.matches.some(K=>K.id===o),L=e.router.getMatch(o);L._nonReactive.loaderPromise=Cu(),k!==L.preload&&e.updateMatch(o,K=>({...K,preload:k})),await l(O,R,z,L,y)}}const p=e.router.getMatch(o);m||((j=p._nonReactive.loaderPromise)==null||j.resolve(),(C=p._nonReactive.loadPromise)==null||C.resolve(),p._nonReactive.loadPromise=void 0),clearTimeout(p._nonReactive.pendingTimeout),p._nonReactive.pendingTimeout=void 0,m||(p._nonReactive.loaderPromise=void 0),p._nonReactive.dehydrated=void 0;const v=m?p.isFetching:!1;return v!==p.isFetching||p.invalid!==!1?(e.updateMatch(o,R=>({...R,isFetching:v,invalid:!1})),e.router.getMatch(o)):p};async function Gv(e){var v,w;const t=e,a=[];t.router.state.matches.some(N=>N._forcePending)&&Zg(t);let l;for(let N=0;N<t.matches.length;N++){try{const j=VS(t,N);Sf(j)&&await j}catch(j){if(ja(j))throw j;if(aa(j))l=j;else if(!t.preload)throw j;break}if(t.serialError)break}const o=t.firstBadMatchIndex??t.matches.length,u=l&&!t.preload?Wv(t,l):void 0,f=l&&t.preload?0:u!==void 0?Math.min(u+1,o):o;let m,y;for(let N=0;N<f;N++)a.push(XS(t,a,N));try{await Promise.all(a)}catch{const N=await Promise.allSettled(a);for(const j of N){if(j.status!=="rejected")continue;const C=j.reason;if(ja(C))throw C;aa(C)?m??(m=C):y??(y=C)}if(y!==void 0)throw y}const g=m??(l&&!t.preload?l:void 0);let S=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!g&&l&&t.preload)return t.matches;if(g){const N=Wv(t,g);no(N!==void 0);const j=t.matches[N],C=t.router.looseRoutesById[j.routeId],R=(v=t.router.options)==null?void 0:v.defaultNotFoundComponent;!C.options.notFoundComponent&&R&&(C.options.notFoundComponent=R),g.routeId=j.routeId;const z=j.routeId===t.router.routeTree.id;t.updateMatch(j.id,O=>({...O,...z?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:g},isFetching:!1})),S=N,await jf(C,["notFoundComponent"])}else if(!t.preload){const N=t.matches[0];N.globalNotFound||(w=t.router.getMatch(N.id))!=null&&w.globalNotFound&&t.updateMatch(N.id,j=>({...j,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const N=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await jf(N,["errorComponent"])}for(let N=0;N<=S;N++){const{id:j,routeId:C}=t.matches[N],R=t.router.looseRoutesById[C];try{const z=ZS(t,j,R);if(z){const O=await z;t.updateMatch(j,k=>({...k,...O}))}}catch(z){console.error(`Error executing head for route ${C}:`,z)}}const p=Zg(t);if(Sf(p)&&await p,g)throw g;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Yv(e,t){const a=t.map(l=>{var o,u;return(u=(o=e.options[l])==null?void 0:o.preload)==null?void 0:u.call(o)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function jf(e,t=Nm){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(l=>{const{id:o,...u}=l.options;Object.assign(e.options,u),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const a=()=>e._componentsLoaded?void 0:t===Nm?(()=>{if(e._componentsPromise===void 0){const l=Yv(e,Nm);l?e._componentsPromise=l.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Yv(e,t);return e._lazyPromise?e._lazyPromise.then(a):a()}function G2(e){var t;for(const a of Nm)if((t=e.options[a])!=null&&t.preload)return!0;return!1}var Nm=["component","errorComponent","pendingComponent","notFoundComponent"],eo="__TSR_index",Vv="popstate",Zv="beforeunload";function JS(e){let t=e.getLocation();const a=new Set,l=f=>{t=e.getLocation(),a.forEach(m=>m({location:t,action:f}))},o=f=>{e.notifyOnIndexChange??!0?l(f):t=e.getLocation()},u=async({task:f,navigateOpts:m,...y})=>{var p,v;if((m==null?void 0:m.ignoreBlocker)??!1){f();return}const g=((p=e.getBlockers)==null?void 0:p.call(e))??[],S=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&g.length&&S)for(const w of g){const N=Fm(y.path,y.state);if(await w.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(v=e.onBlocked)==null||v.call(e);return}}f()};return{get location(){return t},get length(){return e.getLength()},subscribers:a,subscribe:f=>(a.add(f),()=>{a.delete(f)}),push:(f,m,y)=>{const g=t.state[eo];m=Xv(g+1,m),u({task:()=>{e.pushState(f,m),l({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:f,state:m})},replace:(f,m,y)=>{const g=t.state[eo];m=Xv(g,m),u({task:()=>{e.replaceState(f,m),l({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:f,state:m})},go:(f,m)=>{u({task:()=>{e.go(f),o({type:"GO",index:f})},navigateOpts:m,type:"GO"})},back:f=>{u({task:()=>{e.back((f==null?void 0:f.ignoreBlocker)??!1),o({type:"BACK"})},navigateOpts:f,type:"BACK"})},forward:f=>{u({task:()=>{e.forward((f==null?void 0:f.ignoreBlocker)??!1),o({type:"FORWARD"})},navigateOpts:f,type:"FORWARD"})},canGoBack:()=>t.state[eo]!==0,createHref:f=>e.createHref(f),block:f=>{var y;if(!e.setBlockers)return()=>{};const m=((y=e.getBlockers)==null?void 0:y.call(e))??[];return e.setBlockers([...m,f]),()=>{var S,p;const g=((S=e.getBlockers)==null?void 0:S.call(e))??[];(p=e.setBlockers)==null||p.call(e,g.filter(v=>v!==f))}},flush:()=>{var f;return(f=e.flush)==null?void 0:f.call(e)},destroy:()=>{var f;return(f=e.destroy)==null?void 0:f.call(e)},notify:l}}function Xv(e,t){t||(t={});const a=K0();return{...t,key:a,__TSR_key:a,[eo]:e}}function e7(e){var q,Y;const t=typeof document<"u"?window:void 0,a=t.history.pushState,l=t.history.replaceState;let o=[];const u=()=>o,f=Q=>o=Q,m=(Q=>Q),y=(()=>Fm(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((q=t.history.state)!=null&&q.__TSR_key)&&!((Y=t.history.state)!=null&&Y.key)){const Q=K0();t.history.replaceState({[eo]:0,key:Q,__TSR_key:Q},"")}let g=y(),S,p=!1,v=!1,w=!1,N=!1;const j=()=>g;let C,R;const z=()=>{C&&(J._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),J._ignoreSubscribers=!1,C=void 0,R=void 0,S=void 0)},O=(Q,G,ge)=>{const me=m(G);R||(S=g),g=Fm(G,ge),C={href:me,state:ge,isPush:(C==null?void 0:C.isPush)||Q==="push"},R||(R=Promise.resolve().then(()=>z()))},k=Q=>{g=y(),J.notify({type:Q})},L=async()=>{if(v){v=!1;return}const Q=y(),G=Q.state[eo]-g.state[eo],ge=G===1,me=G===-1,Z=!ge&&!me||p;p=!1;const he=Z?"GO":me?"BACK":"FORWARD",M=Z?{type:"GO",index:G}:{type:me?"BACK":"FORWARD"};if(w)w=!1;else{const $=u();if(typeof document<"u"&&$.length){for(const ee of $)if(await ee.blockerFn({currentLocation:g,nextLocation:Q,action:he})){v=!0,t.history.go(1),J.notify(M);return}}}g=y(),J.notify(M)},K=Q=>{if(N){N=!1;return}let G=!1;const ge=u();if(typeof document<"u"&&ge.length)for(const me of ge){const Z=me.enableBeforeUnload??!0;if(Z===!0){G=!0;break}if(typeof Z=="function"&&Z()===!0){G=!0;break}}if(G)return Q.preventDefault(),Q.returnValue=""},J=JS({getLocation:j,getLength:()=>t.history.length,pushState:(Q,G)=>O("push",Q,G),replaceState:(Q,G)=>O("replace",Q,G),back:Q=>(Q&&(w=!0),N=!0,t.history.back()),forward:Q=>{Q&&(w=!0),N=!0,t.history.forward()},go:Q=>{p=!0,t.history.go(Q)},createHref:Q=>m(Q),flush:z,destroy:()=>{t.history.pushState=a,t.history.replaceState=l,t.removeEventListener(Zv,K,{capture:!0}),t.removeEventListener(Vv,L)},onBlocked:()=>{S&&g!==S&&(g=S)},getBlockers:u,setBlockers:f,notifyOnIndexChange:!1});return t.addEventListener(Zv,K,{capture:!0}),t.addEventListener(Vv,L),t.history.pushState=function(...Q){const G=a.apply(t.history,Q);return J._ignoreSubscribers||k("PUSH"),G},t.history.replaceState=function(...Q){const G=l.apply(t.history,Q);return J._ignoreSubscribers||k("REPLACE"),G},J}function t7(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Fm(e,t){const a=t7(e),l=a.indexOf("#"),o=a.indexOf("?"),u=K0();return{href:a,pathname:a.substring(0,l>0?o>0?Math.min(l,o):l:o>0?o:a.length),hash:l>-1?a.substring(l):"",search:o>-1?a.slice(o,l===-1?void 0:l):"",state:t||{[eo]:0,key:u,__TSR_key:u}}}function K0(){return(Math.random()+1).toString(36).substring(7)}function ec(e){const t=e.resolvedLocation,a=e.location;return{fromLocation:t,toLocation:a,pathChanged:(t==null?void 0:t.pathname)!==a.pathname,hrefChanged:(t==null?void 0:t.href)!==a.href,hashChanged:(t==null?void 0:t.hash)!==a.hash}}function n7(e){const t=e.filter(a=>a.status!=="redirected");return t.length===e.length?e:t}var s7=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{var g;const a=this.options,l=this.basepath??(a==null?void 0:a.basepath)??"/",o=this.basepath===void 0,u=a==null?void 0:a.rewrite;if(this.options={...a,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=mS(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=e7()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let S;this.resolvePathCache=zm(1e3),S=this.buildRouteTree(),this.setRoutes(S)}!this.__store&&this.latestLocation&&(this.__store=KS(i7(this.latestLocation)),xS(this));let f=!1;const m=this.options.basepath??"/",y=this.options.rewrite;if(o||l!==m||u!==y){this.basepath=m;const S=[],p=U2(m);p&&p!=="/"&&S.push(RS({basepath:m})),y&&S.push(y),this.rewrite=S.length===0?void 0:S.length===1?S[0]:MS(S),this.history&&this.updateLatestLocation(),f=!0}f&&this.__store&&this.__store.setState(S=>({...S,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((g=window.CSS)==null?void 0:g.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=oS(this.routeTree,this.options.caseSensitive,(a,l)=>{a.init({originalIndex:l})});return this.options.routeMasks&&sS(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const l={eventType:t,fn:a};return this.subscribers.add(l),()=>{this.subscribers.delete(l)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const l=({pathname:m,search:y,hash:g,href:S,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(m)){const C=this.options.parseSearch(y),R=this.options.stringifySearch(C);return{href:m+R+g,publicHref:S,pathname:Yd(m).path,external:!1,searchStr:R,search:Ro(a==null?void 0:a.search,C),hash:Yd(g.slice(1)).path,state:zo(a==null?void 0:a.state,p)}}const v=new URL(S,this.origin),w=Gg(this.rewrite,v),N=this.options.parseSearch(w.search),j=this.options.stringifySearch(N);return w.search=j,{href:w.href.replace(w.origin,""),publicHref:S,pathname:Yd(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:j,search:Ro(a==null?void 0:a.search,N),hash:Yd(w.hash.slice(1)).path,state:zo(a==null?void 0:a.state,p)}},o=l(t),{__tempLocation:u,__tempKey:f}=o.state;if(u&&(!f||f===this.tempLocationKey)){const m=l(u);return m.state.key=o.state.key,m.state.__TSR_key=o.state.__TSR_key,delete m.state.__tempLocation,{...m,maskedLocation:o}}return o},this.resolvePathWithBase=(t,a)=>hS({base:t,to:F0(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,l)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},l):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>r7({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const a=this.getMatch(t);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(l=>l.status==="pending"),a=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=t=>{const a=(o={})=>{var Y,Q;const u=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);o.from;const m=o.unsafeRelative==="path"?u.pathname:o.from??f.fullPath,y=this.resolvePathWithBase(m,"."),g=f.search,S=Object.assign(Object.create(null),f.params),p=o.to?this.resolvePathWithBase(y,`${o.to}`):this.resolvePathWithBase(y,"."),v=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?S:Object.assign(S,Vl(o.params,S)),w=this.getMatchedRoutes(p);let N=w.matchedRoutes;if((!w.foundRoute||w.foundRoute.path!=="/"&&w.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(v).length>0)for(const G of N){const ge=((Y=G.options.params)==null?void 0:Y.stringify)??G.options.stringifyParams;if(ge)try{Object.assign(v,ge(v))}catch{}}const j=t.leaveParams?p:Yd(Hv({path:p,params:v,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=g;if(t._includeValidateSearch&&((Q=this.options.search)!=null&&Q.strict)){const G={};N.forEach(ge=>{if(ge.options.validateSearch)try{Object.assign(G,km(ge.options.validateSearch,{...G,...C}))}catch{}}),C=G}C=l7({search:C,dest:o,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=Ro(g,C);const R=this.options.stringifySearch(C),z=o.hash===!0?u.hash:o.hash?Vl(o.hash,u.hash):void 0,O=z?`#${z}`:"";let k=o.state===!0?u.state:o.state?Vl(o.state,u.state):{};k=zo(u.state,k);const L=`${j}${R}${O}`;let K,J,q=!1;if(this.rewrite){const G=new URL(L,this.origin),ge=z2(this.rewrite,G);K=G.href.replace(G.origin,""),ge.origin!==this.origin?(J=ge.href,q=!0):J=ge.pathname+ge.search+ge.hash}else K=eS(L),J=K;return{publicHref:J,href:K,pathname:j,search:C,searchStr:R,state:k,hash:z??"",external:q,unmaskOnReload:o.unmaskOnReload}},l=(o={},u)=>{const f=a(o);let m=u?a(u):void 0;if(!m){const y=Object.create(null);if(this.options.routeMasks){const g=aS(f.pathname,this.processedTree);if(g){Object.assign(y,g.rawParams);const{from:S,params:p,...v}=g.route,w=p===!1||p===null?Object.create(null):(p??!0)===!0?y:Object.assign(y,Vl(p,y));u={from:t.from,...v,params:w},m=a(u)}}}return m&&(f.maskedLocation=m),f};return t.mask?l(t,{from:t.from,...t.mask}):l(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...l})=>{const o=()=>{const m=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];m.forEach(g=>{l.state[g]=this.latestLocation.state[g]});const y=Zo(l.state,this.latestLocation.state);return m.forEach(g=>{delete l.state[g]}),y},u=Jl(this.latestLocation.href)===Jl(l.href);let f=this.commitLocationPromise;if(this.commitLocationPromise=Cu(()=>{f==null||f.resolve(),f=void 0}),u&&o())this.load();else{let{maskedLocation:m,hashScrollIntoView:y,...g}=l;m&&(g={...m,state:{...m.state,__tempKey:void 0,__tempLocation:{...g,search:g.searchStr,state:{...g.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(g.unmaskOnReload??this.options.unmaskOnReload??!1)&&(g.state.__tempKey=this.tempLocationKey)),g.state.__hashScrollIntoViewOptions=y??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[l.replace?"replace":"push"](g.publicHref,g.state,{ignoreBlocker:a})}return this.resetNextScroll=l.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:l,viewTransition:o,ignoreBlocker:u,href:f,...m}={})=>{if(f){const S=this.history.location.state.__TSR_index,p=Fm(f,{__TSR_index:t?S:S+1}),v=new URL(p.pathname,this.origin);m.to=Gg(this.rewrite,v).pathname,m.search=this.options.parseSearch(p.search),m.hash=p.hash.slice(1)}const y=this.buildLocation({...m,_includeValidateSearch:!0});this.pendingBuiltLocation=y;const g=this.commitLocation({...y,viewTransition:o,replace:t,resetScroll:a,hashScrollIntoView:l,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),g},this.navigate=async({to:t,reloadDocument:a,href:l,publicHref:o,...u})=>{var m,y;let f=!1;if(l)try{new URL(`${l}`),f=!0}catch{}if(f&&!a&&(a=!0),a){if(t!==void 0||!l){const S=this.buildLocation({to:t,...u});l=l??S.publicHref,o=o??S.publicHref}const g=!f&&o?o:l;if(Um(g,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const S=((y=(m=this.history).getBlockers)==null?void 0:y.call(m))??[];for(const p of S)if(p!=null&&p.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(g):window.location.href=g,Promise.resolve()}return this.buildAndCommitLocation({...u,href:l,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(a=>({...a,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:a.cachedMatches.filter(l=>!t.some(o=>o.id===l.id))}))},this.load=async t=>{let a,l,o;const u=this.state.resolvedLocation??this.state.location;for(o=new Promise(m=>{this.startTransition(async()=>{var y;try{this.beforeLoad();const g=this.latestLocation,S=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...ec({resolvedLocation:S,location:g})}),this.emit({type:"onBeforeLoad",...ec({resolvedLocation:S,location:g})}),await Gv({router:this,sync:t==null?void 0:t.sync,forceStaleReload:u.href===g.href,matches:this.state.pendingMatches,location:g,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let p=[],v=[],w=[],N=[];gf(()=>{this.__store.setState(j=>{const C=j.matches,R=j.pendingMatches||j.matches;return p=C.filter(z=>!R.some(O=>O.id===z.id)),v=C.filter(z=>!R.some(O=>O.routeId===z.routeId)),w=R.filter(z=>!C.some(O=>O.routeId===z.routeId)),N=R.filter(z=>C.some(O=>O.routeId===z.routeId)),{...j,isLoading:!1,loadedAt:Date.now(),matches:R,pendingMatches:void 0,cachedMatches:[...j.cachedMatches,...p.filter(z=>z.status!=="error"&&z.status!=="notFound"&&z.status!=="redirected")]}}),this.clearExpiredCache()}),[[v,"onLeave"],[w,"onEnter"],[N,"onStay"]].forEach(([j,C])=>{j.forEach(R=>{var z,O;(O=(z=this.looseRoutesById[R.routeId].options)[C])==null||O.call(z,R)})})})})}})}catch(g){ja(g)?(a=g,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):aa(g)&&(l=g),this.__store.setState(S=>({...S,statusCode:a?a.status:l?404:S.matches.some(p=>p.status==="error")?500:200,redirect:a}))}this.latestLoadPromise===o&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let f;this.hasNotFoundMatch()?f=404:this.__store.state.matches.some(m=>m.status==="error")&&(f=500),f!==void 0&&this.__store.setState(m=>({...m,statusCode:f}))},this.startViewTransition=t=>{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let l;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,u=this.state.resolvedLocation,f=typeof a.types=="function"?a.types(ec({resolvedLocation:u,location:o})):a.types;if(f===!1){t();return}l={update:t,types:f}}else l=t;document.startViewTransition(l)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var o;const l=(o=this.state.pendingMatches)!=null&&o.some(u=>u.id===t)?"pendingMatches":this.state.matches.some(u=>u.id===t)?"matches":this.state.cachedMatches.some(u=>u.id===t)?"cachedMatches":"";l&&(l==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:n7(u.cachedMatches.map(f=>f.id===t?a(f):f))})):this.__store.setState(u=>{var f;return{...u,[l]:(f=u[l])==null?void 0:f.map(m=>m.id===t?a(m):m)}}))})},this.getMatch=t=>{var l;const a=o=>o.id===t;return this.state.cachedMatches.find(a)??((l=this.state.pendingMatches)==null?void 0:l.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=l=>{var o;return((o=t==null?void 0:t.filter)==null?void 0:o.call(t,l))??!0?{...l,invalid:!0,...t!=null&&t.forcePending||l.status==="error"||l.status==="notFound"?{status:"pending",error:void 0}:void 0}:l};return this.__store.setState(l=>{var o;return{...l,matches:l.matches.map(a),cachedMatches:l.cachedMatches.map(a),pendingMatches:(o=l.pendingMatches)==null?void 0:o.map(a)}}),this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const a=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const l=t.options._builtLocation??this.buildLocation(t.options),o=this.getParsedLocationHref(l);t.options.href=o,t.headers.set("Location",o)}else if(a)try{const l=new URL(a);if(this.origin&&l.origin===this.origin){const o=l.pathname+l.search+l.hash;t.options.href=o,t.headers.set("Location",o)}}catch{}if(t.options.href&&!t.options._builtLocation&&Um(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const a=t==null?void 0:t.filter;a!==void 0?this.__store.setState(l=>({...l,cachedMatches:l.cachedMatches.filter(o=>!a(o))})):this.__store.setState(l=>({...l,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const l=this.looseRoutesById[a.routeId];if(!l.options.loader)return!0;const o=(a.preload?l.options.preloadGcTime??this.options.defaultPreloadGcTime:l.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=o};this.clearCache({filter:t})},this.loadRouteChunk=jf,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let l=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(f=>f.id)),u=new Set([...o,...this.state.cachedMatches.map(f=>f.id)]);gf(()=>{l.forEach(f=>{u.has(f.id)||this.__store.setState(m=>({...m,cachedMatches:[...m.cachedMatches,f]}))})});try{return l=await Gv({router:this,matches:l,location:a,preload:!0,updateMatch:(f,m)=>{o.has(f)?l=l.map(y=>y.id===f?m(y):y):this.updateMatch(f,m)}}),l}catch(f){if(ja(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:a});aa(f)||console.error(f);return}},this.matchRoute=(t,a)=>{const l={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},o=this.buildLocation(l);if(a!=null&&a.pending&&this.state.status!=="pending")return!1;const u=((a==null?void 0:a.pending)===void 0?!this.state.isLoading:a.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,f=iS(o.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!f||t.params&&!Zo(f.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?Zo(u.search,o.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??kS,parseSearch:e.parseSearch??NS,protocolAllowlist:e.protocolAllowlist??J9}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:a}){this.routesById=e,this.routesByPath=t,this.processedTree=a;const l=this.options.notFoundRoute;l&&(l.init({originalIndex:99999999999}),this.routesById[l.id]=l)}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var p,v;const a=this.getMatchedRoutes(e.pathname),{foundRoute:l,routeParams:o,parsedParams:u}=a;let{matchedRoutes:f}=a,m=!1;(l?l.path!=="/"&&o["**"]:Jl(e.pathname))&&(this.options.notFoundRoute?f=[...f,this.options.notFoundRoute]:m=!0);const y=m?c7(this.options.notFoundMode,f):void 0,g=new Array(f.length),S=new Map(this.state.matches.map(w=>[w.routeId,w]));for(let w=0;w<f.length;w++){const N=f[w],j=g[w-1];let C,R,z;{const he=(j==null?void 0:j.search)??e.search,M=(j==null?void 0:j._strictSearch)??void 0;try{const $=km(N.options.validateSearch,{...he})??void 0;C={...he,...$},R={...M,...$},z=void 0}catch($){let ee=$;if($ instanceof qm||(ee=new qm($.message,{cause:$})),t!=null&&t.throwOnError)throw ee;C=he,R={},z=ee}}const O=((v=(p=N.options).loaderDeps)==null?void 0:v.call(p,{search:C}))??"",k=O?JSON.stringify(O):"",{interpolatedPath:L,usedParams:K}=Hv({path:N.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),J=N.id+L+k,q=this.getMatch(J),Y=S.get(N.id),Q=(q==null?void 0:q._strictParams)??K;let G;if(!q)try{Jv(N,K,u,Q)}catch(he){if(aa(he)||ja(he)?G=he:G=new a7(he.message,{cause:he}),t!=null&&t.throwOnError)throw G}Object.assign(o,Q);const ge=Y?"stay":"enter";let me;if(q)me={...q,cause:ge,params:(Y==null?void 0:Y.params)??o,_strictParams:Q,search:Ro(Y?Y.search:q.search,C),_strictSearch:R};else{const he=N.options.loader||N.options.beforeLoad||N.lazyFn||G2(N)?"pending":"success";me={id:J,ssr:N.options.ssr,index:w,routeId:N.id,params:(Y==null?void 0:Y.params)??o,_strictParams:Q,pathname:L,updatedAt:Date.now(),search:Y?Ro(Y.search,C):C,_strictSearch:R,searchError:void 0,status:he,isFetching:!1,error:void 0,paramsError:G,__routeContext:void 0,_nonReactive:{loadPromise:Cu()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:ge,loaderDeps:Y?zo(Y.loaderDeps,O):O,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:N.options.staticData||{},fullPath:N.fullPath}}t!=null&&t.preload||(me.globalNotFound=y===N.id),me.searchError=z;const Z=this.getParentContext(j);me.context={...Z,...me.__routeContext,...me.__beforeLoadContext},g[w]=me}for(let w=0;w<g.length;w++){const N=g[w],j=this.looseRoutesById[N.routeId],C=this.getMatch(N.id),R=S.get(N.routeId);if(N.params=R?Ro(R.params,o):o,!C){const z=g[w-1],O=this.getParentContext(z);if(j.options.context){const k={deps:N.loaderDeps,params:N.params,context:O??{},location:e,navigate:L=>this.navigate({...L,_fromLocation:e}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:g,routeId:j.id};N.__routeContext=j.options.context(k)??void 0}N.context={...O,...N.__routeContext,...N.__beforeLoadContext}}}return g}matchRoutesLightweight(e){const{matchedRoutes:t,routeParams:a,parsedParams:l}=this.getMatchedRoutes(e.pathname),o=xf(t),u={...e.search};for(const g of t)try{Object.assign(u,km(g.options.validateSearch,u))}catch{}const f=xf(this.state.matches),m=f&&f.routeId===o.id&&e.pathname===this.state.location.pathname;let y;if(m)y=f.params;else{const g=Object.assign(Object.create(null),a);for(const S of t)try{Jv(S,a,l??{},g)}catch{}y=g}return{matchedRoutes:t,fullPath:o.fullPath,search:u,params:y}}},qm=class extends Error{},a7=class extends Error{};function i7(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function km(e,t){if(e==null)return{};if("~standard"in e){const a=e["~standard"].validate(t);if(a instanceof Promise)throw new qm("Async validation not supported");if(a.issues)throw new qm(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function r7({pathname:e,routesById:t,processedTree:a}){const l=Object.create(null),o=Jl(e);let u,f;const m=rS(o,a,!0);return m&&(u=m.route,Object.assign(l,m.rawParams),f=Object.assign(Object.create(null),m.parsedParams)),{matchedRoutes:(m==null?void 0:m.branch)||[t.__root__],routeParams:l,foundRoute:u,parsedParams:f}}function l7({search:e,dest:t,destRoutes:a,_includeValidateSearch:l}){return o7(a)(e,t,l??!1)}function o7(e){var o;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of e){if("search"in u.options)(o=u.options.search)!=null&&o.middlewares&&t.middlewares.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const f=({search:m,next:y})=>{let g=m;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(g=u.options.preSearchFilters.reduce((p,v)=>v(p),m));const S=y(g);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((p,v)=>v(p),S):S};t.middlewares.push(f)}if(u.options.validateSearch){const f=({search:m,next:y})=>{const g=y(m);if(!t._includeValidateSearch)return g;try{return{...g,...km(u.options.validateSearch,g)??void 0}}catch{return g}};t.middlewares.push(f)}}const a=({search:u})=>{const f=t.dest;return f.search?f.search===!0?u:Vl(f.search,u):{}};t.middlewares.push(a);const l=(u,f,m)=>{if(u>=m.length)return f;const y=m[u];return y({search:f,next:S=>l(u+1,S,m)})};return function(f,m,y){return t.dest=m,t._includeValidateSearch=y,l(0,f,t.middlewares)}}function c7(e,t){if(e!=="root")for(let a=t.length-1;a>=0;a--){const l=t[a];if(l.children)return l.id}return Xo}function Jv(e,t,a,l){var u;const o=((u=e.options.params)==null?void 0:u.parse)??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const f in t)f in a&&(l[f]=a[f]);else{const f=o(l);Object.assign(l,f)}}var u7="Error preloading route! ☝️",Y2=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var y,g;this.originalIndex=t.originalIndex;const a=this.options,l=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(g=(y=this.options).getParentRoute)==null?void 0:g.call(y),l?this._path=Xo:this.parentRoute||no(!1);let o=l?Xo:a==null?void 0:a.path;o&&o!=="/"&&(o=P2(o));const u=(a==null?void 0:a.id)||o;let f=l?Xo:jm([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);o==="__root__"&&(o="/"),f!=="__root__"&&(f=jm(["/",f]));const m=f==="__root__"?"/":jm([this.parentRoute.fullPath,o]);this._path=o,this._id=f,this._fullPath=m,this._to=Jl(m)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>TS({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},d7=class extends Y2{constructor(e){super(e)}};function Q0(e){const t=e.errorComponent??G0;return i.jsx(f7,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:a,reset:l})=>a?_.createElement(t,{error:a,reset:l}):e.children})}var f7=class extends _.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function G0({error:e}){const[t,a]=_.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(l=>!l),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function h7({children:e,fallback:t=null}){return V2()?i.jsx(Fr.Fragment,{children:e}):i.jsx(Fr.Fragment,{children:t})}function V2(){return Fr.useSyncExternalStore(m7,()=>!0,()=>!1)}function m7(){return()=>{}}var Z2=_.createContext(null);function ai(e){const t=_.useContext(Z2);return e==null||e.warn,t}var ag={exports:{}},ig={},rg={exports:{}},lg={};/**
|
|
51
|
+
* @license React
|
|
52
|
+
* use-sync-external-store-shim.production.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/var e4;function p7(){if(e4)return lg;e4=1;var e=Bf();function t(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var a=typeof Object.is=="function"?Object.is:t,l=e.useState,o=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function m(p,v){var w=v(),N=l({inst:{value:w,getSnapshot:v}}),j=N[0].inst,C=N[1];return u(function(){j.value=w,j.getSnapshot=v,y(j)&&C({inst:j})},[p,w,v]),o(function(){return y(j)&&C({inst:j}),p(function(){y(j)&&C({inst:j})})},[p]),f(w),w}function y(p){var v=p.getSnapshot;p=p.value;try{var w=v();return!a(p,w)}catch{return!0}}function g(p,v){return v()}var S=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return lg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S,lg}var t4;function g7(){return t4||(t4=1,rg.exports=p7()),rg.exports}/**
|
|
59
|
+
* @license React
|
|
60
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
61
|
+
*
|
|
62
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the MIT license found in the
|
|
65
|
+
* LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/var n4;function _7(){if(n4)return ig;n4=1;var e=Bf(),t=g7();function a(g,S){return g===S&&(g!==0||1/g===1/S)||g!==g&&S!==S}var l=typeof Object.is=="function"?Object.is:a,o=t.useSyncExternalStore,u=e.useRef,f=e.useEffect,m=e.useMemo,y=e.useDebugValue;return ig.useSyncExternalStoreWithSelector=function(g,S,p,v,w){var N=u(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=m(function(){function R(K){if(!z){if(z=!0,O=K,K=v(K),w!==void 0&&j.hasValue){var J=j.value;if(w(J,K))return k=J}return k=K}if(J=k,l(O,K))return J;var q=v(K);return w!==void 0&&w(J,q)?(O=K,J):(O=K,k=q)}var z=!1,O,k,L=p===void 0?null:p;return[function(){return R(S())},L===null?void 0:function(){return R(L())}]},[S,p,v,w]);var C=o(g,N[0],N[1]);return f(function(){j.hasValue=!0,j.value=C},[C]),y(C),C},ig}var s4;function y7(){return s4||(s4=1,ag.exports=_7()),ag.exports}var v7=y7();function b7(e,t){return e===t}function x7(e,t,a=b7){const l=_.useCallback(f=>{if(!e)return()=>{};const{unsubscribe:m}=e.subscribe(f);return m},[e]),o=_.useCallback(()=>e==null?void 0:e.get(),[e]);return v7.useSyncExternalStoreWithSelector(l,o,o,t,a)}function La(e){const t=ai({warn:(e==null?void 0:e.router)===void 0}),a=(e==null?void 0:e.router)||t,l=_.useRef(void 0);return x7(a.__store,o=>{if(e!=null&&e.select){if(e.structuralSharing??a.options.defaultStructuralSharing){const u=zo(l.current,e.select(o));return l.current=u,u}return e.select(o)}return o})}var gp=_.createContext(void 0),S7=_.createContext(void 0);function io(e){const t=_.useContext(e.from?S7:gp);return La({select:a=>{const l=a.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(no(!((e.shouldThrow??!0)&&!l),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),l!==void 0)return e.select?e.select(l):l},structuralSharing:e.structuralSharing})}function Y0(e){return io({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function V0(e){const{select:t,...a}=e;return io({...a,select:l=>t?t(l.loaderDeps):l.loaderDeps})}function qu(e){return io({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const a=e.strict===!1?t.params:t._strictParams;return e.select?e.select(a):a}})}function Z0(e){return io({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ei(e){const t=ai();return _.useCallback(a=>t.navigate({...a,from:a.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function X0(e){return io({...e,select:t=>e.select?e.select(t.context):t.context})}var ki=S2();function j7(e,t){const a=ai(),l=Q9(t),{activeProps:o,inactiveProps:u,activeOptions:f,to:m,preload:y,preloadDelay:g,hashScrollIntoView:S,replace:p,startTransition:v,resetScroll:w,viewTransition:N,children:j,target:C,disabled:R,style:z,className:O,onClick:k,onBlur:L,onFocus:K,onMouseEnter:J,onMouseLeave:q,onTouchStart:Y,ignoreBlocker:Q,params:G,search:ge,hash:me,state:Z,mask:he,reloadDocument:M,unsafeRelative:$,from:ee,_fromLocation:oe,...ae}=e,I=V2(),ne=La({select:V=>{const _e=V.matches[V.matches.length-1];return{search:_e==null?void 0:_e.search,hash:V.location.hash,path:_e==null?void 0:_e.pathname}},structuralSharing:!0}),U=e.from,ie=_.useMemo(()=>({...e,from:U}),[a,ne,U,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Se=_.useMemo(()=>a.buildLocation({...ie}),[a,ie]),se=Se.maskedLocation?Se.maskedLocation.publicHref:Se.publicHref,we=Se.maskedLocation?Se.maskedLocation.external:Se.external,ye=_.useMemo(()=>T7(se,we,a.history,R),[R,we,se,a.history]),Oe=_.useMemo(()=>{if(ye!=null&&ye.external)return Um(ye.href,a.protocolAllowlist)?void 0:ye.href;if(!M7(m)&&!(typeof m!="string"||m.indexOf(":")===-1))try{return new URL(m),Um(m,a.protocolAllowlist)?void 0:m}catch{}},[m,ye,a.protocolAllowlist]),Le=La({select:V=>{if(Oe)return!1;if(f!=null&&f.exact){if(!fS(V.location.pathname,Se.pathname,a.basepath))return!1}else{const _e=Bm(V.location.pathname,a.basepath),Te=Bm(Se.pathname,a.basepath);if(!(_e.startsWith(Te)&&(_e.length===Te.length||_e[Te.length]==="/")))return!1}return((f==null?void 0:f.includeSearch)??!0)&&!Zo(V.location.search,Se.search,{partial:!(f!=null&&f.exact),ignoreUndefined:!(f!=null&&f.explicitUndefined)})?!1:f!=null&&f.includeHash?I&&V.location.hash===Se.hash:!0}}),_t=Le?Vl(o,{})??w7:og,Ke=Le?og:Vl(u,{})??og,tt=[O,_t.className,Ke.className].filter(Boolean).join(" "),nn=(z||_t.style||Ke.style)&&{...z,..._t.style,...Ke.style},[Xt,jn]=_.useState(!1),zt=_.useRef(!1),Bt=e.reloadDocument||Oe?!1:y??a.options.defaultPreload,yt=g??a.options.defaultPreloadDelay??0,bt=_.useCallback(()=>{a.preloadRoute({...ie,_builtLocation:Se}).catch(V=>{console.warn(V),console.warn(u7)})},[a,ie,Se]);K9(l,_.useCallback(V=>{V!=null&&V.isIntersecting&&bt()},[bt]),C7,{disabled:!!R||Bt!=="viewport"}),_.useEffect(()=>{zt.current||!R&&Bt==="render"&&(bt(),zt.current=!0)},[R,bt,Bt]);const dt=V=>{const _e=V.currentTarget.getAttribute("target"),Te=C!==void 0?C:_e;if(!R&&!R7(V)&&!V.defaultPrevented&&(!Te||Te==="_self")&&V.button===0){V.preventDefault(),ki.flushSync(()=>{jn(!0)});const Ie=a.subscribe("onResolved",()=>{Ie(),jn(!1)});a.navigate({...ie,replace:p,resetScroll:w,hashScrollIntoView:S,startTransition:v,viewTransition:N,ignoreBlocker:Q})}};if(Oe)return{...ae,ref:l,href:Oe,...j&&{children:j},...C&&{target:C},...R&&{disabled:R},...z&&{style:z},...O&&{className:O},...k&&{onClick:k},...L&&{onBlur:L},...K&&{onFocus:K},...J&&{onMouseEnter:J},...q&&{onMouseLeave:q},...Y&&{onTouchStart:Y}};const cn=V=>{if(R||Bt!=="intent")return;if(!yt){bt();return}const _e=V.currentTarget;if(Xd.has(_e))return;const Te=setTimeout(()=>{Xd.delete(_e),bt()},yt);Xd.set(_e,Te)},Pn=V=>{R||Bt!=="intent"||bt()},Ee=V=>{if(R||!Bt||!yt)return;const _e=V.currentTarget,Te=Xd.get(_e);Te&&(clearTimeout(Te),Xd.delete(_e))};return{...ae,..._t,...Ke,href:ye==null?void 0:ye.href,ref:l,onClick:Zc([k,dt]),onBlur:Zc([L,Ee]),onFocus:Zc([K,cn]),onMouseEnter:Zc([J,cn]),onMouseLeave:Zc([q,Ee]),onTouchStart:Zc([Y,Pn]),disabled:!!R,target:C,...nn&&{style:nn},...tt&&{className:tt},...R&&N7,...Le&&k7,...I&&Xt&&E7}}var og={},w7={className:"active"},N7={role:"link","aria-disabled":!0},k7={"data-status":"active","aria-current":"page"},E7={"data-transitioning":"transitioning"},Xd=new WeakMap,C7={rootMargin:"100px"},Zc=e=>t=>{for(const a of e)if(a){if(t.defaultPrevented)return;a(t)}};function T7(e,t,a,l){if(!l)return t?{href:e,external:!0}:{href:a.createHref(e)||"/",external:!1}}function M7(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Wm=_.forwardRef((e,t)=>{const{_asChild:a,...l}=e,{type:o,...u}=j7(l,t),f=typeof l.children=="function"?l.children({isActive:u["data-status"]==="active"}):l.children;if(!a){const{disabled:m,...y}=u;return _.createElement("a",y,f)}return _.createElement(a,u,f)});function R7(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var A7=class extends Y2{constructor(e){super(e),this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>X0({...t,from:this.id}),this.useSearch=t=>Z0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>qu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>V0({...t,from:this.id}),this.useLoaderData=t=>Y0({...t,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=Fr.forwardRef((t,a)=>i.jsx(Wm,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function lc(e){return new A7(e)}var D7=class extends d7{constructor(e){super(e),this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>X0({...t,from:this.id}),this.useSearch=t=>Z0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>qu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>V0({...t,from:this.id}),this.useLoaderData=t=>Y0({...t,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=Fr.forwardRef((t,a)=>i.jsx(Wm,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function O7(e){return new D7(e)}function a4(e){return typeof e=="object"?new i4(e,{silent:!0}).createRoute(e):new i4(e,{silent:!0}).createRoute}var i4=class{constructor(e,t){this.path=e,this.createRoute=a=>{const l=lc(a);return l.isRoot=!1,l},this.silent=t==null?void 0:t.silent}},r4=class{constructor(e){this.useMatch=t=>io({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>X0({...t,from:this.options.id}),this.useSearch=t=>Z0({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>qu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>V0({...t,from:this.options.id}),this.useLoaderData=t=>Y0({...t,from:this.options.id}),this.useNavigate=()=>Ei({from:ai().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}};function l4(e){return typeof e=="object"?new r4(e):t=>new r4({id:e,...t})}function I7(e){const t=La({select:a=>`not-found-${a.location.pathname}-${a.status}`});return i.jsx(Q0,{getResetKey:()=>t,onCatch:(a,l)=>{var o;if(aa(a))(o=e.onCatch)==null||o.call(e,a,l);else throw a},errorComponent:({error:a})=>{var l;if(aa(a))return(l=e.fallback)==null?void 0:l.call(e,a);throw a},children:e.children})}function L7(){return i.jsx("p",{children:"Not Found"})}function iu(e){return i.jsx(i.Fragment,{children:e.children})}function X2(e,t,a){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...a}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...a}):i.jsx(L7,{})}function P7(){return ai().isScrollRestoring,null}var J2=_.memo(function({matchId:t}){var N,j;const a=ai(),l=La({select:C=>{var O;const R=C.matches.findIndex(k=>k.id===t),z=C.matches[R];return no(z),{routeId:z.routeId,ssr:z.ssr,_displayPending:z._displayPending,resetKey:C.loadedAt,parentRouteId:(O=C.matches[R-1])==null?void 0:O.routeId}},structuralSharing:!0}),o=a.routesById[l.routeId],u=o.options.pendingComponent??a.options.defaultPendingComponent,f=u?i.jsx(u,{}):null,m=o.options.errorComponent??a.options.defaultErrorComponent,y=o.options.onCatch??a.options.defaultOnCatch,g=o.isRoot?o.options.notFoundComponent??((N=a.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,S=l.ssr===!1||l.ssr==="data-only",p=(!o.isRoot||o.options.wrapInSuspense||S)&&(o.options.wrapInSuspense??u??(((j=o.options.errorComponent)==null?void 0:j.preload)||S))?_.Suspense:iu,v=m?Q0:iu,w=g?I7:iu;return i.jsxs(o.isRoot?o.options.shellComponent??iu:iu,{children:[i.jsx(gp.Provider,{value:t,children:i.jsx(p,{fallback:f,children:i.jsx(v,{getResetKey:()=>l.resetKey,errorComponent:m||G0,onCatch:(C,R)=>{if(aa(C))throw C;y==null||y(C,R)},children:i.jsx(w,{fallback:C=>{if(!g||C.routeId&&C.routeId!==l.routeId||!C.routeId&&!o.isRoot)throw C;return _.createElement(g,C)},children:S||l._displayPending?i.jsx(h7,{fallback:f,children:i.jsx(o4,{matchId:t})}):i.jsx(o4,{matchId:t})})})})}),l.parentRouteId===Xo&&a.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(U7,{}),i.jsx(P7,{})]}):null]})});function U7(){const e=ai(),t=_.useRef(void 0);return i.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...ec(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var o4=_.memo(function({matchId:t}){var y,g,S,p;const a=ai(),{match:l,key:o,routeId:u}=La({select:v=>{var C;const w=v.matches.find(R=>R.id===t),N=w.routeId,j=(C=a.routesById[N].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:C({routeId:N,loaderDeps:w.loaderDeps,params:w._strictParams,search:w._strictSearch});return{key:j?JSON.stringify(j):void 0,routeId:N,match:{id:w.id,status:w.status,error:w.error,_forcePending:w._forcePending,_displayPending:w._displayPending}}},structuralSharing:!0}),f=a.routesById[u],m=_.useMemo(()=>{const v=f.options.component??a.options.defaultComponent;return v?i.jsx(v,{},o):i.jsx(e6,{})},[o,f.options.component,a.options.defaultComponent]);if(l._displayPending)throw(y=a.getMatch(l.id))==null?void 0:y._nonReactive.displayPendingPromise;if(l._forcePending)throw(g=a.getMatch(l.id))==null?void 0:g._nonReactive.minPendingPromise;if(l.status==="pending"){const v=f.options.pendingMinMs??a.options.defaultPendingMinMs;if(v){const w=a.getMatch(l.id);if(w&&!w._nonReactive.minPendingPromise){const N=Cu();w._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),w._nonReactive.minPendingPromise=void 0},v)}}throw(S=a.getMatch(l.id))==null?void 0:S._nonReactive.loadPromise}if(l.status==="notFound")return no(aa(l.error)),X2(a,f,l.error);if(l.status==="redirected")throw no(ja(l.error)),(p=a.getMatch(l.id))==null?void 0:p._nonReactive.loadPromise;if(l.status==="error")throw l.error;return m}),e6=_.memo(function(){const t=ai(),a=_.useContext(gp),l=La({select:g=>{var S;return(S=g.matches.find(p=>p.id===a))==null?void 0:S.routeId}}),o=t.routesById[l],u=La({select:g=>{const S=g.matches.find(p=>p.id===a);return no(S),S.globalNotFound}}),f=La({select:g=>{var p;const S=g.matches;return(p=S[S.findIndex(v=>v.id===a)+1])==null?void 0:p.id}}),m=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(u)return X2(t,o,void 0);if(!f)return null;const y=i.jsx(J2,{matchId:f});return l===Xo?i.jsx(_.Suspense,{fallback:m,children:y}):y});function z7(){const e=ai(),t=_.useRef({router:e,mounted:!1}),[a,l]=_.useState(!1),{hasPendingMatches:o,isLoading:u}=La({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(v=>v.status==="pending")}),structuralSharing:!0}),f=X1(u),m=u||a||o,y=X1(m),g=u||o,S=X1(g);return e.startTransition=p=>{l(!0),_.startTransition(()=>{p(),l(!1)})},_.useEffect(()=>{const p=e.history.subscribe(e.load),v=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Jl(e.latestLocation.publicHref)!==Jl(v.publicHref)&&e.commitLocation({...v,replace:!0}),()=>{p()}},[e,e.history]),lm(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(v){console.error(v)}})()},[e]),lm(()=>{f&&!u&&e.emit({type:"onLoad",...ec(e.state)})},[f,e,u]),lm(()=>{S&&!g&&e.emit({type:"onBeforeRouteMount",...ec(e.state)})},[g,S,e]),lm(()=>{if(y&&!m){const p=ec(e.state);e.emit({type:"onResolved",...p}),e.__store.setState(v=>({...v,status:"idle",resolvedLocation:v.location})),p.hrefChanged&&SS(e)}},[m,y,e]),null}function B7(){const e=ai(),t=e.routesById[Xo].options.pendingComponent??e.options.defaultPendingComponent,a=t?i.jsx(t,{}):null,l=i.jsxs(typeof document<"u"&&e.ssr?iu:_.Suspense,{fallback:a,children:[i.jsx(z7,{}),i.jsx(H7,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:l}):l}function H7(){const e=ai(),t=La({select:o=>{var u;return(u=o.matches[0])==null?void 0:u.id}}),a=La({select:o=>o.loadedAt}),l=t?i.jsx(J2,{matchId:t}):null;return i.jsx(gp.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?l:i.jsx(Q0,{getResetKey:()=>a,errorComponent:G0,onCatch:void 0,children:l})})}var $7=e=>new F7(e),F7=class extends s7{constructor(e){super(e)}};typeof globalThis<"u"?(globalThis.createFileRoute=a4,globalThis.createLazyFileRoute=l4):typeof window<"u"&&(window.createFileRoute=a4,window.createLazyFileRoute=l4);function q7({router:e,children:t,...a}){Object.keys(a).length>0&&e.update({...e.options,...a,context:{...e.options.context,...a.context}});const l=i.jsx(Z2.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:l}):l}function W7({router:e,...t}){return i.jsx(q7,{router:e,...t,children:i.jsx(B7,{})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Tu;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Tu||(Tu={}));class cg extends Error{constructor(t,a,l){super(t),this.message=t,this.code=a,this.data=l}}const K7=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},Q7=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},l=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:K7(e),u=()=>o()!=="web",f=p=>{const v=g.get(p);return!!(v!=null&&v.platforms.has(o())||m(p))},m=p=>{var v;return(v=a.PluginHeaders)===null||v===void 0?void 0:v.find(w=>w.name===p)},y=p=>e.console.error(p),g=new Map,S=(p,v={})=>{const w=g.get(p);if(w)return console.warn(`Capacitor plugin "${p}" already registered. Cannot register plugins twice.`),w.proxy;const N=o(),j=m(p);let C;const R=async()=>(!C&&N in v?C=typeof v[N]=="function"?C=await v[N]():C=v[N]:t!==null&&!C&&"web"in v&&(C=typeof v.web=="function"?C=await v.web():C=v.web),C),z=(q,Y)=>{var Q,G;if(j){const ge=j==null?void 0:j.methods.find(me=>Y===me.name);if(ge)return ge.rtype==="promise"?me=>a.nativePromise(p,Y.toString(),me):(me,Z)=>a.nativeCallback(p,Y.toString(),me,Z);if(q)return(Q=q[Y])===null||Q===void 0?void 0:Q.bind(q)}else{if(q)return(G=q[Y])===null||G===void 0?void 0:G.bind(q);throw new cg(`"${p}" plugin is not implemented on ${N}`,Tu.Unimplemented)}},O=q=>{let Y;const Q=(...G)=>{const ge=R().then(me=>{const Z=z(me,q);if(Z){const he=Z(...G);return Y=he==null?void 0:he.remove,he}else throw new cg(`"${p}.${q}()" is not implemented on ${N}`,Tu.Unimplemented)});return q==="addListener"&&(ge.remove=async()=>Y()),ge};return Q.toString=()=>`${q.toString()}() { [capacitor code] }`,Object.defineProperty(Q,"name",{value:q,writable:!1,configurable:!1}),Q},k=O("addListener"),L=O("removeListener"),K=(q,Y)=>{const Q=k({eventName:q},Y),G=async()=>{const me=await Q;L({eventName:q,callbackId:me},Y)},ge=new Promise(me=>Q.then(()=>me({remove:G})));return ge.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await G()},ge},J=new Proxy({},{get(q,Y){switch(Y){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?K:k;case"removeListener":return L;default:return O(Y)}}});return l[p]=J,g.set(p,{name:p,proxy:J,platforms:new Set([...Object.keys(v),...j?[N]:[]])}),J};return a.convertFileSrc||(a.convertFileSrc=p=>p),a.getPlatform=o,a.handleError=y,a.isNativePlatform=u,a.isPluginAvailable=f,a.registerPlugin=S,a.Exception=cg,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},G7=e=>e.Capacitor=Q7(e),Kr=G7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),oc=Kr.registerPlugin;class t6{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let l=!1;this.listeners[t]||(this.listeners[t]=[],l=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),l&&this.sendRetainedArgumentsForEvent(t);const f=async()=>this.removeListener(t,a);return Promise.resolve({remove:f})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,l){const o=this.listeners[t];if(!o){if(l){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:l=>{this.notifyListeners(a,l)}}}unimplemented(t="not implemented"){return new Kr.Exception(t,Tu.Unimplemented)}unavailable(t="not available"){return new Kr.Exception(t,Tu.Unavailable)}async removeListener(t,a){const l=this.listeners[t];if(!l)return;const o=l.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(l=>{this.notifyListeners(t,l)}))}}const c4=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),u4=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Y7 extends t6{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(l=>{if(l.length<=0)return;let[o,u]=l.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=u4(o).trim(),u=u4(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=c4(t.key),l=c4(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),f=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${l||""}${o}; path=${u}; ${f};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}oc("CapacitorCookies",{web:()=>new Y7});const V7=async e=>new Promise((t,a)=>{const l=new FileReader;l.onload=()=>{const o=l.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},l.onerror=o=>a(o),l.readAsDataURL(e)}),Z7=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,f)=>(o[u]=e[t[f]],o),{})},X7=(e,t=!0)=>e?Object.entries(e).reduce((l,o)=>{const[u,f]=o;let m,y;return Array.isArray(f)?(y="",f.forEach(g=>{m=t?encodeURIComponent(g):g,y+=`${u}=${m}&`}),y.slice(0,-1)):(m=t?encodeURIComponent(f):f,y=`${u}=${m}`),`${l}&${y}`},"").substr(1):null,J7=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=Z7(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[f,m]of Object.entries(e.data||{}))u.set(f,m);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((m,y)=>{u.append(y,m)});else for(const m of Object.keys(e.data))u.append(m,e.data[m]);a.body=u;const f=new Headers(a.headers);f.delete("content-type"),a.headers=f}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class ej extends t6{async request(t){const a=J7(t,t.webFetchExtra),l=X7(t.params,t.shouldEncodeUrlParams),o=l?`${t.url}?${l}`:t.url,u=await fetch(o,a),f=u.headers.get("content-type")||"";let{responseType:m="text"}=u.ok?t:{};f.includes("application/json")&&(m="json");let y,g;switch(m){case"arraybuffer":case"blob":g=await u.blob(),y=await V7(g);break;case"json":y=await u.json();break;case"document":case"text":default:y=await u.text()}const S={};return u.headers.forEach((p,v)=>{S[v]=p}),{data:y,headers:S,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}oc("CapacitorHttp",{web:()=>new ej});var Xg;(function(e){e.Aztec="AZTEC",e.Codabar="CODABAR",e.Code39="CODE_39",e.Code93="CODE_93",e.Code128="CODE_128",e.DataMatrix="DATA_MATRIX",e.Ean8="EAN_8",e.Ean13="EAN_13",e.Itf="ITF",e.Pdf417="PDF_417",e.QrCode="QR_CODE",e.UpcA="UPC_A",e.UpcE="UPC_E"})(Xg||(Xg={}));var d4;(function(e){e.CalendarEvent="CALENDAR_EVENT",e.ContactInfo="CONTACT_INFO",e.DriversLicense="DRIVERS_LICENSE",e.Email="EMAIL",e.Geo="GEO",e.Isbn="ISBN",e.Phone="PHONE",e.Product="PRODUCT",e.Sms="SMS",e.Text="TEXT",e.Url="URL",e.Wifi="WIFI",e.Unknown="UNKNOWN"})(d4||(d4={}));var Jg;(function(e){e[e["640x480"]=0]="640x480",e[e["1280x720"]=1]="1280x720",e[e["1920x1080"]=2]="1920x1080",e[e["3840x2160"]=3]="3840x2160"})(Jg||(Jg={}));var e0;(function(e){e.Front="FRONT",e.Back="BACK"})(e0||(e0={}));var f4;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.PENDING=1]="PENDING",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.CANCELED=3]="CANCELED",e[e.COMPLETED=4]="COMPLETED",e[e.FAILED=5]="FAILED",e[e.INSTALLING=6]="INSTALLING",e[e.DOWNLOAD_PAUSED=7]="DOWNLOAD_PAUSED"})(f4||(f4={}));var h4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(h4||(h4={}));var m4;(function(e){e[e.HOME=0]="HOME",e[e.UNKNOWN=1]="UNKNOWN",e[e.WORK=2]="WORK"})(m4||(m4={}));var p4;(function(e){e[e.FAX=0]="FAX",e[e.HOME=1]="HOME",e[e.MOBILE=2]="MOBILE",e[e.UNKNOWN=3]="UNKNOWN",e[e.WORK=4]="WORK"})(p4||(p4={}));var g4;(function(e){e[e.OPEN=1]="OPEN",e[e.WEP=2]="WEP",e[e.WPA=3]="WPA"})(g4||(g4={}));const Do=oc("BarcodeScanner",{web:()=>ao(()=>import("./web-C3EZUi0V.js"),[]).then(e=>new e.BarcodeScannerWeb)}),tj=8e3,Km=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";const a=t.replace(/\/+$/,"");try{const l=new URL(a);return l.pathname==="/health"&&(l.pathname="",l.search="",l.hash=""),l.toString().replace(/\/+$/,"")}catch{return a.replace(/\/health$/i,"")}},n6=e=>new Error(`连接探测超时(${e} ms),请确认手机能直接访问该 Hub 地址。`),nj=(e,t)=>{if(!(e instanceof Error))return"连接失败";const a=e.message.trim();return e.name==="AbortError"||e.name==="TimeoutError"||/aborted/i.test(a)?n6(t).message:a||"连接失败"},t0=async(e,t)=>{const a=Km(e),l=new Date().toISOString();if(!a)return{url:"",healthOk:!1,latencyMs:null,checkedAt:l,error:"地址为空"};const o=tj,u=`${a}/health`,f=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),m=new AbortController,y=window.setTimeout(()=>m.abort(n6(o)),o);try{const g=await fetch(u,{cache:"no-store",signal:m.signal}),S=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();return{url:a,healthOk:g.ok,latencyMs:S-f,checkedAt:l,error:g.ok?null:`HTTP ${g.status}`}}catch(g){return{url:a,healthOk:!1,latencyMs:null,checkedAt:l,error:nj(g,o)}}finally{clearTimeout(y)}},sj=()=>{var e;try{const t=(e=Kr.getPlatform)==null?void 0:e.call(Kr);if(t==="android"||t==="ios")return t}catch{}return"web"},Mu=()=>sj(),s6=()=>{var e;try{return((e=Kr.isNativePlatform)==null?void 0:e.call(Kr))===!0}catch{return!1}},_p=()=>Mu()==="android"&&s6(),aj=()=>Mu()==="ios"&&s6(),Ys=()=>_p()||aj(),_4=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,ij=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},ug=e=>{var l;const t=e.trim();if(!t)return"";try{const o=new URL(t);if(o.protocol==="http:"||o.protocol==="https:")return Km(o.toString())}catch{}const a=(l=t.match(/https?:\/\/[^\s]+/i))==null?void 0:l[0];return a?Km(a):""},rj=e=>{var a;const t=[e.rawValue,e.displayValue,(a=e.urlBookmark)==null?void 0:a.url];for(const l of t){const o=(l==null?void 0:l.trim())??"";if(o)try{const u=new URL(o);return u.protocol==="panda:"&&u.searchParams.get("url")?ug(u.searchParams.get("url")??""):ug(u.toString())}catch{return ug(o)}}return""},lj=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4.75H5.9A1.9 1.9 0 0 0 4 6.65v1.1M17 4.75h1.1A1.9 1.9 0 0 1 20 6.65v1.1M20 16.25v1.1a1.9 1.9 0 0 1-1.9 1.9H17M7 19.25H5.9A1.9 1.9 0 0 1 4 17.35v-1.1"}),i.jsx("path",{d:"M8 9.25h8M8 12h8M8 14.75h5"})]}),oj=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M6 6 18 18M18 6 6 18"})}),a6=({title:e,description:t,currentHubUrl:a,initialHubUrl:l,hint:o,saveLabel:u,savingLabel:f,saveDescription:m,saveSuccessMessage:y,onSaveSuccess:g})=>{const[S,p]=_.useState(l),[v,w]=_.useState({loading:!1,result:null}),[N,j]=_.useState({saving:!1}),[C,R]=_.useState(null),[z,O]=_.useState({active:!1,starting:!1}),k=_.useRef([]),L=Km(S),K=Ys();_.useEffect(()=>{p(l)},[l]),_.useEffect(()=>{if(!(typeof document>"u"))return document.documentElement.classList.toggle("hub-scanner-active",z.active),document.body.classList.toggle("hub-scanner-active",z.active),()=>{document.documentElement.classList.remove("hub-scanner-active"),document.body.classList.remove("hub-scanner-active")}},[z.active]),_.useEffect(()=>()=>{(async()=>(await Promise.all(k.current.map(me=>me.remove().catch(()=>{}))),k.current=[],await Do.stopScan().catch(()=>{})))()},[]);const J=async()=>{const me=[...k.current];k.current=[],await Promise.all(me.map(Z=>Z.remove().catch(()=>{})))},q=async()=>{O(me=>({...me,active:!1})),await J(),await Do.stopScan().catch(()=>{})},Y=async()=>{if(!L){R({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}R(null),w({loading:!0,result:null});const me=await t0(L);w({loading:!1,result:me}),R({tone:me.healthOk?"success":"danger",text:me.healthOk?`连接成功,延迟 ${_4(me.latencyMs)}。`:me.error??"连接测试失败。"})},Q=async()=>{var me;if(!L){R({tone:"danger",text:"请先输入可访问的 Hub 地址。"});return}R(null),j({saving:!0});try{const Z=((me=v.result)==null?void 0:me.url)===L?v.result:await t0(L);if(w({loading:!1,result:Z}),!Z.healthOk){R({tone:"danger",text:Z.error??"请先确认 Hub 地址可访问,再继续保存。"});return}await g(Z),R({tone:"success",text:y})}catch(Z){R({tone:"danger",text:Z instanceof Error?Z.message:"保存 Hub 地址失败。"})}finally{j({saving:!1})}},G=async()=>{if(K){R(null),O({active:!1,starting:!0});try{if(!(await Do.isSupported()).supported){R({tone:"danger",text:"当前设备不支持扫码填入,请手动输入地址。"});return}const Z=await Do.requestPermissions();if(Z.camera!=="granted"&&Z.camera!=="limited"){R({tone:"danger",text:"需要相机权限才能扫码,请在系统设置中允许 Panda 使用相机。"});return}const he=await Promise.all([Do.addListener("barcodesScanned",M=>{const $=M.barcodes.map(rj).find(Boolean);if(!$){R({tone:"danger",text:"二维码已识别,但没有拿到可用的 Hub 地址。"}),q();return}p($),w({loading:!1,result:null}),R({tone:"success",text:"已通过扫码填入地址,可以直接测试或保存。"}),q()}),Do.addListener("scanError",M=>{R({tone:"danger",text:M.message||"扫码失败,请稍后重试。"}),q()})]);k.current=he,O({active:!0,starting:!1}),await Do.startScan({formats:[Xg.QrCode],lensFacing:e0.Back,resolution:Jg["1280x720"]})}catch(me){await q(),R({tone:"danger",text:me instanceof Error?me.message:"无法启动扫码,请稍后重试。"})}finally{O(me=>({...me,starting:!1}))}}},ge=z.active&&typeof document<"u"?ki.createPortal(i.jsx("div",{className:"hub-scanner-sheet",role:"dialog","aria-modal":"true","aria-label":"扫描 Hub 地址二维码",children:i.jsxs("div",{className:"hub-scanner-sheet__content",children:[i.jsxs("div",{className:"hub-scanner-sheet__topbar",children:[i.jsx("span",{className:"hub-scanner-sheet__badge",children:"扫码填入"}),i.jsx("button",{type:"button",className:"hub-scanner-sheet__close",onClick:()=>{q()},"aria-label":"关闭扫码",children:i.jsx(oj,{})})]}),i.jsxs("div",{className:"hub-scanner-sheet__frame","aria-hidden":"true",children:[i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--tl"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--tr"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--bl"}),i.jsx("span",{className:"hub-scanner-sheet__corner hub-scanner-sheet__corner--br"})]}),i.jsxs("div",{className:"hub-scanner-sheet__footer",children:[i.jsx("p",{children:"把电脑端显示的 Hub 二维码放进取景框,识别后会自动填入地址。"}),i.jsx("button",{type:"button",className:"settings-ghost-button hub-scanner-sheet__cancel",onClick:()=>{q()},children:"取消扫码"})]})]})}),document.body):null;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"hub-connection-form",children:[i.jsxs("div",{className:"hub-connection-form__header",children:[i.jsxs("div",{className:"hub-connection-form__copy",children:[i.jsx("h3",{className:"hub-connection-form__title",children:e}),i.jsx("p",{className:"hub-connection-form__description",children:t})]}),a?i.jsxs("div",{className:"hub-connection-form__current",children:[i.jsx("span",{children:"当前"}),i.jsx("strong",{children:a})]}):null]}),i.jsxs("label",{className:"hub-connection-form__field",children:[i.jsx("span",{className:"hub-connection-form__label",children:"Hub 地址"}),i.jsxs("span",{className:"hub-connection-form__input-shell",children:[i.jsx("input",{className:"hub-connection-form__input",type:"url",inputMode:"url",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,placeholder:"例如 http://192.168.31.20:4343",value:S,onChange:me=>{p(me.target.value),w({loading:!1,result:null}),R(null)}}),K?i.jsxs("button",{type:"button",className:"hub-connection-form__scan",onClick:()=>{G()},disabled:z.starting||N.saving||v.loading,"aria-label":"扫码填入 Hub 地址",children:[i.jsx(lj,{}),i.jsx("span",{children:z.starting?"启动中":"扫码"})]}):null]})]}),i.jsx("p",{className:"hub-connection-form__hint",children:o}),i.jsxs("div",{className:"hub-connection-form__actions",children:[i.jsxs("button",{type:"button",className:"settings-action hub-connection-form__save",onClick:()=>{Q()},disabled:!L||N.saving||z.starting,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:N.saving?f:u}),i.jsx("span",{children:m})]}),i.jsx("span",{className:"settings-action__state",children:N.saving?"处理中…":"→"})]}),i.jsx("button",{type:"button",className:"settings-ghost-button hub-connection-form__test",onClick:()=>{Y()},disabled:!L||v.loading||N.saving||z.starting,children:v.loading?"测试中…":"测试连接"})]}),v.result?i.jsxs("div",{className:"hub-connection-form__probe",children:[i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"探测地址"}),i.jsx("strong",{children:v.result.url})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"连通结果"}),i.jsx("strong",{className:v.result.healthOk?"is-ok":"is-danger",children:v.result.healthOk?"Hub 在线":v.result.error??"无法连接"})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"延迟"}),i.jsx("strong",{children:_4(v.result.latencyMs)})]}),i.jsxs("div",{className:"hub-connection-form__probe-item",children:[i.jsx("span",{children:"最近探测"}),i.jsx("strong",{children:ij(v.result.checkedAt)})]})]}):null,C?i.jsx("p",{className:`hub-connection-form__notice is-${C.tone}`,children:C.text}):null]}),ge]})};var y4;(function(e){e[e.Sunday=1]="Sunday",e[e.Monday=2]="Monday",e[e.Tuesday=3]="Tuesday",e[e.Wednesday=4]="Wednesday",e[e.Thursday=5]="Thursday",e[e.Friday=6]="Friday",e[e.Saturday=7]="Saturday"})(y4||(y4={}));const Hf=oc("LocalNotifications",{web:()=>ao(()=>import("./web-CIHpZyzh.js"),[]).then(e=>new e.LocalNotificationsWeb)});var mn;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function a(o){throw new Error}e.assertNever=a,e.arrayToEnum=o=>{const u={};for(const f of o)u[f]=f;return u},e.getValidEnumValues=o=>{const u=e.objectKeys(o).filter(m=>typeof o[o[m]]!="number"),f={};for(const m of u)f[m]=o[m];return e.objectValues(f)},e.objectValues=o=>e.objectKeys(o).map(function(u){return o[u]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const u=[];for(const f in o)Object.prototype.hasOwnProperty.call(o,f)&&u.push(f);return u},e.find=(o,u)=>{for(const f of o)if(u(f))return f},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function l(o,u=" | "){return o.map(f=>typeof f=="string"?`'${f}'`:f).join(u)}e.joinValues=l,e.jsonStringifyReplacer=(o,u)=>typeof u=="bigint"?u.toString():u})(mn||(mn={}));var v4;(function(e){e.mergeShapes=(t,a)=>({...t,...a})})(v4||(v4={}));const st=mn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zl=e=>{switch(typeof e){case"undefined":return st.undefined;case"string":return st.string;case"number":return Number.isNaN(e)?st.nan:st.number;case"boolean":return st.boolean;case"function":return st.function;case"bigint":return st.bigint;case"symbol":return st.symbol;case"object":return Array.isArray(e)?st.array:e===null?st.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?st.promise:typeof Map<"u"&&e instanceof Map?st.map:typeof Set<"u"&&e instanceof Set?st.set:typeof Date<"u"&&e instanceof Date?st.date:st.object;default:return st.unknown}},Be=mn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Yr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(u){return u.message},l={_errors:[]},o=u=>{for(const f of u.issues)if(f.code==="invalid_union")f.unionErrors.map(o);else if(f.code==="invalid_return_type")o(f.returnTypeError);else if(f.code==="invalid_arguments")o(f.argumentsError);else if(f.path.length===0)l._errors.push(a(f));else{let m=l,y=0;for(;y<f.path.length;){const g=f.path[y];y===f.path.length-1?(m[g]=m[g]||{_errors:[]},m[g]._errors.push(a(f))):m[g]=m[g]||{_errors:[]},m=m[g],y++}}};return o(this),l}static assert(t){if(!(t instanceof Yr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,mn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},l=[];for(const o of this.issues)if(o.path.length>0){const u=o.path[0];a[u]=a[u]||[],a[u].push(t(o))}else l.push(t(o));return{formErrors:l,fieldErrors:a}}get formErrors(){return this.flatten()}}Yr.create=e=>new Yr(e);const n0=(e,t)=>{let a;switch(e.code){case Be.invalid_type:e.received===st.undefined?a="Required":a=`Expected ${e.expected}, received ${e.received}`;break;case Be.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,mn.jsonStringifyReplacer)}`;break;case Be.unrecognized_keys:a=`Unrecognized key(s) in object: ${mn.joinValues(e.keys,", ")}`;break;case Be.invalid_union:a="Invalid input";break;case Be.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${mn.joinValues(e.options)}`;break;case Be.invalid_enum_value:a=`Invalid enum value. Expected ${mn.joinValues(e.options)}, received '${e.received}'`;break;case Be.invalid_arguments:a="Invalid function arguments";break;case Be.invalid_return_type:a="Invalid function return type";break;case Be.invalid_date:a="Invalid date";break;case Be.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:mn.assertNever(e.validation):e.validation!=="regex"?a=`Invalid ${e.validation}`:a="Invalid";break;case Be.too_small:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:a="Invalid input";break;case Be.too_big:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?a=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:a="Invalid input";break;case Be.custom:a="Invalid input";break;case Be.invalid_intersection_types:a="Intersection results could not be merged";break;case Be.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case Be.not_finite:a="Number must be finite";break;default:a=t.defaultError,mn.assertNever(e)}return{message:a}};let cj=n0;function uj(){return cj}const dj=e=>{const{data:t,path:a,errorMaps:l,issueData:o}=e,u=[...a,...o.path||[]],f={...o,path:u};if(o.message!==void 0)return{...o,path:u,message:o.message};let m="";const y=l.filter(g=>!!g).slice().reverse();for(const g of y)m=g(f,{data:t,defaultError:m}).message;return{...o,path:u,message:m}};function Ze(e,t){const a=uj(),l=dj({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===n0?void 0:n0].filter(o=>!!o)});e.common.issues.push(l)}class ia{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const l=[];for(const o of a){if(o.status==="aborted")return It;o.status==="dirty"&&t.dirty(),l.push(o.value)}return{status:t.value,value:l}}static async mergeObjectAsync(t,a){const l=[];for(const o of a){const u=await o.key,f=await o.value;l.push({key:u,value:f})}return ia.mergeObjectSync(t,l)}static mergeObjectSync(t,a){const l={};for(const o of a){const{key:u,value:f}=o;if(u.status==="aborted"||f.status==="aborted")return It;u.status==="dirty"&&t.dirty(),f.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof f.value<"u"||o.alwaysSet)&&(l[u.value]=f.value)}return{status:t.value,value:l}}}const It=Object.freeze({status:"aborted"}),rf=e=>({status:"dirty",value:e}),ii=e=>({status:"valid",value:e}),b4=e=>e.status==="aborted",x4=e=>e.status==="dirty",Ru=e=>e.status==="valid",Qm=e=>typeof Promise<"u"&&e instanceof Promise;var ut;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ut||(ut={}));class Ji{constructor(t,a,l,o){this._cachedPath=[],this.parent=t,this.data=a,this._path=l,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const S4=(e,t)=>{if(Ru(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Yr(e.common.issues);return this._error=a,this._error}}};function qt(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:l,description:o}=e;if(t&&(a||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(f,m)=>{const{message:y}=e;return f.code==="invalid_enum_value"?{message:y??m.defaultError}:typeof m.data>"u"?{message:y??l??m.defaultError}:f.code!=="invalid_type"?{message:m.defaultError}:{message:y??a??m.defaultError}},description:o}}class ln{get description(){return this._def.description}_getType(t){return zl(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:zl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ia,ctx:{common:t.parent.common,data:t.data,parsedType:zl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Qm(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const l=this.safeParse(t,a);if(l.success)return l.data;throw l.error}safeParse(t,a){const l={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)},o=this._parseSync({data:t,path:l.path,parent:l});return S4(l,o)}"~validate"(t){var l,o;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Ru(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(o=(l=u==null?void 0:u.message)==null?void 0:l.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>Ru(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const l=await this.safeParseAsync(t,a);if(l.success)return l.data;throw l.error}async safeParseAsync(t,a){const l={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zl(t)},o=this._parse({data:t,path:l.path,parent:l}),u=await(Qm(o)?o:Promise.resolve(o));return S4(l,u)}refine(t,a){const l=o=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(o):a;return this._refinement((o,u)=>{const f=t(o),m=()=>u.addIssue({code:Be.custom,...l(o)});return typeof Promise<"u"&&f instanceof Promise?f.then(y=>y?!0:(m(),!1)):f?!0:(m(),!1)})}refinement(t,a){return this._refinement((l,o)=>t(l)?!0:(o.addIssue(typeof a=="function"?a(l,o):a),!1))}_refinement(t){return new Ou({schema:this,typeName:Rt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return to.create(this,this._def)}nullable(){return Iu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xi.create(this)}promise(){return Xm.create(this,this._def)}or(t){return Ym.create([this,t],this._def)}and(t){return Vm.create(this,t,this._def)}transform(t){return new Ou({...qt(this._def),schema:this,typeName:Rt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new l0({...qt(this._def),innerType:this,defaultValue:a,typeName:Rt.ZodDefault})}brand(){return new Oj({typeName:Rt.ZodBranded,type:this,...qt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new o0({...qt(this._def),innerType:this,catchValue:a,typeName:Rt.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return J0.create(this,t)}readonly(){return c0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fj=/^c[^\s-]{8,}$/i,hj=/^[0-9a-z]+$/,mj=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pj=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gj=/^[a-z0-9_-]{21}$/i,_j=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let dg;const xj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Sj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,wj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,i6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ej=new RegExp(`^${i6}$`);function r6(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const a=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function Cj(e){return new RegExp(`^${r6(e)}$`)}function Tj(e){let t=`${i6}T${r6(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function Mj(e,t){return!!((t==="v4"||!t)&&xj.test(e)||(t==="v6"||!t)&&jj.test(e))}function Rj(e,t){if(!_j.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const l=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),o=JSON.parse(atob(l));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Aj(e,t){return!!((t==="v4"||!t)&&Sj.test(e)||(t==="v6"||!t)&&wj.test(e))}class qr extends ln{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==st.string){const u=this._getOrReturnCtx(t);return Ze(u,{code:Be.invalid_type,expected:st.string,received:u.parsedType}),It}const l=new ia;let o;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="max")t.data.length>u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if(u.kind==="length"){const f=t.data.length>u.value,m=t.data.length<u.value;(f||m)&&(o=this._getOrReturnCtx(t,o),f?Ze(o,{code:Be.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):m&&Ze(o,{code:Be.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),l.dirty())}else if(u.kind==="email")vj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"email",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="emoji")dg||(dg=new RegExp(bj,"u")),dg.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"emoji",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="uuid")pj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"uuid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="nanoid")gj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"nanoid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid")fj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cuid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="cuid2")hj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cuid2",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="ulid")mj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"ulid",code:Be.invalid_string,message:u.message}),l.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Ze(o,{validation:"url",code:Be.invalid_string,message:u.message}),l.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"regex",code:Be.invalid_string,message:u.message}),l.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),l.dirty()):u.kind==="toLowerCase"?t.data=t.data.toLowerCase():u.kind==="toUpperCase"?t.data=t.data.toUpperCase():u.kind==="startsWith"?t.data.startsWith(u.value)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:{startsWith:u.value},message:u.message}),l.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:{endsWith:u.value},message:u.message}),l.dirty()):u.kind==="datetime"?Tj(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:"datetime",message:u.message}),l.dirty()):u.kind==="date"?Ej.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:"date",message:u.message}),l.dirty()):u.kind==="time"?Cj(u).test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.invalid_string,validation:"time",message:u.message}),l.dirty()):u.kind==="duration"?yj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"duration",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="ip"?Mj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"ip",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="jwt"?Rj(t.data,u.alg)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"jwt",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="cidr"?Aj(t.data,u.version)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"cidr",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="base64"?Nj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"base64",code:Be.invalid_string,message:u.message}),l.dirty()):u.kind==="base64url"?kj.test(t.data)||(o=this._getOrReturnCtx(t,o),Ze(o,{validation:"base64url",code:Be.invalid_string,message:u.message}),l.dirty()):mn.assertNever(u);return{status:l.value,value:t.data}}_regex(t,a,l){return this.refinement(o=>t.test(o),{validation:a,code:Be.invalid_string,...ut.errToObj(l)})}_addCheck(t){return new qr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ut.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ut.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ut.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ut.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ut.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ut.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ut.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ut.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ut.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ut.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ut.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ut.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ut.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ut.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ut.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ut.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...ut.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...ut.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...ut.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...ut.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...ut.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...ut.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...ut.errToObj(a)})}nonempty(t){return this.min(1,ut.errToObj(t))}trim(){return new qr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxLength(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}qr.create=e=>new qr({checks:[],typeName:Rt.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...qt(e)});function Dj(e,t){const a=(e.toString().split(".")[1]||"").length,l=(t.toString().split(".")[1]||"").length,o=a>l?a:l,u=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return u%f/10**o}class Au extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==st.number){const u=this._getOrReturnCtx(t);return Ze(u,{code:Be.invalid_type,expected:st.number,received:u.parsedType}),It}let l;const o=new ia;for(const u of this._def.checks)u.kind==="int"?mn.isInteger(t.data)||(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.invalid_type,expected:"integer",received:"float",message:u.message}),o.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),o.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),o.dirty()):u.kind==="multipleOf"?Dj(t.data,u.value)!==0&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.not_multiple_of,multipleOf:u.value,message:u.message}),o.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.not_finite,message:u.message}),o.dirty()):mn.assertNever(u);return{status:o.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,ut.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ut.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ut.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ut.toString(a))}setLimit(t,a,l,o){return new Au({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ut.toString(o)}]})}_addCheck(t){return new Au({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ut.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ut.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ut.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ut.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ut.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ut.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:ut.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ut.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ut.toString(t)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&mn.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(a===null||l.value>a)&&(a=l.value):l.kind==="max"&&(t===null||l.value<t)&&(t=l.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Au.create=e=>new Au({checks:[],typeName:Rt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...qt(e)});class wf extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==st.bigint)return this._getInvalidInput(t);let l;const o=new ia;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),o.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),o.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(l=this._getOrReturnCtx(t,l),Ze(l,{code:Be.not_multiple_of,multipleOf:u.value,message:u.message}),o.dirty()):mn.assertNever(u);return{status:o.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Ze(a,{code:Be.invalid_type,expected:st.bigint,received:a.parsedType}),It}gte(t,a){return this.setLimit("min",t,!0,ut.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ut.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ut.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ut.toString(a))}setLimit(t,a,l,o){return new wf({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:l,message:ut.toString(o)}]})}_addCheck(t){return new wf({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ut.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ut.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ut.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ut.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ut.toString(a)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}wf.create=e=>new wf({checks:[],typeName:Rt.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...qt(e)});class s0 extends ln{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==st.boolean){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.boolean,received:l.parsedType}),It}return ii(t.data)}}s0.create=e=>new s0({typeName:Rt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...qt(e)});class Gm extends ln{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==st.date){const u=this._getOrReturnCtx(t);return Ze(u,{code:Be.invalid_type,expected:st.date,received:u.parsedType}),It}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Ze(u,{code:Be.invalid_date}),It}const l=new ia;let o;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),l.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(o=this._getOrReturnCtx(t,o),Ze(o,{code:Be.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),l.dirty()):mn.assertNever(u);return{status:l.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Gm({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:ut.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:ut.toString(a)})}get minDate(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t!=null?new Date(t):null}}Gm.create=e=>new Gm({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Rt.ZodDate,...qt(e)});class j4 extends ln{_parse(t){if(this._getType(t)!==st.symbol){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.symbol,received:l.parsedType}),It}return ii(t.data)}}j4.create=e=>new j4({typeName:Rt.ZodSymbol,...qt(e)});class w4 extends ln{_parse(t){if(this._getType(t)!==st.undefined){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.undefined,received:l.parsedType}),It}return ii(t.data)}}w4.create=e=>new w4({typeName:Rt.ZodUndefined,...qt(e)});class N4 extends ln{_parse(t){if(this._getType(t)!==st.null){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.null,received:l.parsedType}),It}return ii(t.data)}}N4.create=e=>new N4({typeName:Rt.ZodNull,...qt(e)});class a0 extends ln{constructor(){super(...arguments),this._any=!0}_parse(t){return ii(t.data)}}a0.create=e=>new a0({typeName:Rt.ZodAny,...qt(e)});class k4 extends ln{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ii(t.data)}}k4.create=e=>new k4({typeName:Rt.ZodUnknown,...qt(e)});class so extends ln{_parse(t){const a=this._getOrReturnCtx(t);return Ze(a,{code:Be.invalid_type,expected:st.never,received:a.parsedType}),It}}so.create=e=>new so({typeName:Rt.ZodNever,...qt(e)});class E4 extends ln{_parse(t){if(this._getType(t)!==st.undefined){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.void,received:l.parsedType}),It}return ii(t.data)}}E4.create=e=>new E4({typeName:Rt.ZodVoid,...qt(e)});class Xi extends ln{_parse(t){const{ctx:a,status:l}=this._processInputParams(t),o=this._def;if(a.parsedType!==st.array)return Ze(a,{code:Be.invalid_type,expected:st.array,received:a.parsedType}),It;if(o.exactLength!==null){const f=a.data.length>o.exactLength.value,m=a.data.length<o.exactLength.value;(f||m)&&(Ze(a,{code:f?Be.too_big:Be.too_small,minimum:m?o.exactLength.value:void 0,maximum:f?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),l.dirty())}if(o.minLength!==null&&a.data.length<o.minLength.value&&(Ze(a,{code:Be.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),l.dirty()),o.maxLength!==null&&a.data.length>o.maxLength.value&&(Ze(a,{code:Be.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),l.dirty()),a.common.async)return Promise.all([...a.data].map((f,m)=>o.type._parseAsync(new Ji(a,f,a.path,m)))).then(f=>ia.mergeArray(l,f));const u=[...a.data].map((f,m)=>o.type._parseSync(new Ji(a,f,a.path,m)));return ia.mergeArray(l,u)}get element(){return this._def.type}min(t,a){return new Xi({...this._def,minLength:{value:t,message:ut.toString(a)}})}max(t,a){return new Xi({...this._def,maxLength:{value:t,message:ut.toString(a)}})}length(t,a){return new Xi({...this._def,exactLength:{value:t,message:ut.toString(a)}})}nonempty(t){return this.min(1,t)}}Xi.create=(e,t)=>new Xi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Rt.ZodArray,...qt(t)});function ru(e){if(e instanceof ms){const t={};for(const a in e.shape){const l=e.shape[a];t[a]=to.create(ru(l))}return new ms({...e._def,shape:()=>t})}else return e instanceof Xi?new Xi({...e._def,type:ru(e.element)}):e instanceof to?to.create(ru(e.unwrap())):e instanceof Iu?Iu.create(ru(e.unwrap())):e instanceof ac?ac.create(e.items.map(t=>ru(t))):e}class ms extends ln{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),a=mn.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==st.object){const g=this._getOrReturnCtx(t);return Ze(g,{code:Be.invalid_type,expected:st.object,received:g.parsedType}),It}const{status:l,ctx:o}=this._processInputParams(t),{shape:u,keys:f}=this._getCached(),m=[];if(!(this._def.catchall instanceof so&&this._def.unknownKeys==="strip"))for(const g in o.data)f.includes(g)||m.push(g);const y=[];for(const g of f){const S=u[g],p=o.data[g];y.push({key:{status:"valid",value:g},value:S._parse(new Ji(o,p,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof so){const g=this._def.unknownKeys;if(g==="passthrough")for(const S of m)y.push({key:{status:"valid",value:S},value:{status:"valid",value:o.data[S]}});else if(g==="strict")m.length>0&&(Ze(o,{code:Be.unrecognized_keys,keys:m}),l.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const S of m){const p=o.data[S];y.push({key:{status:"valid",value:S},value:g._parse(new Ji(o,p,o.path,S)),alwaysSet:S in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const S of y){const p=await S.key,v=await S.value;g.push({key:p,value:v,alwaysSet:S.alwaysSet})}return g}).then(g=>ia.mergeObjectSync(l,g)):ia.mergeObjectSync(l,y)}get shape(){return this._def.shape()}strict(t){return ut.errToObj,new ms({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,l)=>{var u,f;const o=((f=(u=this._def).errorMap)==null?void 0:f.call(u,a,l).message)??l.defaultError;return a.code==="unrecognized_keys"?{message:ut.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new ms({...this._def,unknownKeys:"strip"})}passthrough(){return new ms({...this._def,unknownKeys:"passthrough"})}extend(t){return new ms({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ms({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Rt.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new ms({...this._def,catchall:t})}pick(t){const a={};for(const l of mn.objectKeys(t))t[l]&&this.shape[l]&&(a[l]=this.shape[l]);return new ms({...this._def,shape:()=>a})}omit(t){const a={};for(const l of mn.objectKeys(this.shape))t[l]||(a[l]=this.shape[l]);return new ms({...this._def,shape:()=>a})}deepPartial(){return ru(this)}partial(t){const a={};for(const l of mn.objectKeys(this.shape)){const o=this.shape[l];t&&!t[l]?a[l]=o:a[l]=o.optional()}return new ms({...this._def,shape:()=>a})}required(t){const a={};for(const l of mn.objectKeys(this.shape))if(t&&!t[l])a[l]=this.shape[l];else{let u=this.shape[l];for(;u instanceof to;)u=u._def.innerType;a[l]=u}return new ms({...this._def,shape:()=>a})}keyof(){return l6(mn.objectKeys(this.shape))}}ms.create=(e,t)=>new ms({shape:()=>e,unknownKeys:"strip",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});ms.strictCreate=(e,t)=>new ms({shape:()=>e,unknownKeys:"strict",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});ms.lazycreate=(e,t)=>new ms({shape:e,unknownKeys:"strip",catchall:so.create(),typeName:Rt.ZodObject,...qt(t)});class Ym extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l=this._def.options;function o(u){for(const m of u)if(m.result.status==="valid")return m.result;for(const m of u)if(m.result.status==="dirty")return a.common.issues.push(...m.ctx.common.issues),m.result;const f=u.map(m=>new Yr(m.ctx.common.issues));return Ze(a,{code:Be.invalid_union,unionErrors:f}),It}if(a.common.async)return Promise.all(l.map(async u=>{const f={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:f}),ctx:f}})).then(o);{let u;const f=[];for(const y of l){const g={...a,common:{...a.common,issues:[]},parent:null},S=y._parseSync({data:a.data,path:a.path,parent:g});if(S.status==="valid")return S;S.status==="dirty"&&!u&&(u={result:S,ctx:g}),g.common.issues.length&&f.push(g.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const m=f.map(y=>new Yr(y));return Ze(a,{code:Be.invalid_union,unionErrors:m}),It}}get options(){return this._def.options}}Ym.create=(e,t)=>new Ym({options:e,typeName:Rt.ZodUnion,...qt(t)});function i0(e,t){const a=zl(e),l=zl(t);if(e===t)return{valid:!0,data:e};if(a===st.object&&l===st.object){const o=mn.objectKeys(t),u=mn.objectKeys(e).filter(m=>o.indexOf(m)!==-1),f={...e,...t};for(const m of u){const y=i0(e[m],t[m]);if(!y.valid)return{valid:!1};f[m]=y.data}return{valid:!0,data:f}}else if(a===st.array&&l===st.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let u=0;u<e.length;u++){const f=e[u],m=t[u],y=i0(f,m);if(!y.valid)return{valid:!1};o.push(y.data)}return{valid:!0,data:o}}else return a===st.date&&l===st.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vm extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t),o=(u,f)=>{if(b4(u)||b4(f))return It;const m=i0(u.value,f.value);return m.valid?((x4(u)||x4(f))&&a.dirty(),{status:a.value,value:m.data}):(Ze(l,{code:Be.invalid_intersection_types}),It)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([u,f])=>o(u,f)):o(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}}Vm.create=(e,t,a)=>new Vm({left:e,right:t,typeName:Rt.ZodIntersection,...qt(a)});class ac extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.array)return Ze(l,{code:Be.invalid_type,expected:st.array,received:l.parsedType}),It;if(l.data.length<this._def.items.length)return Ze(l,{code:Be.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),It;!this._def.rest&&l.data.length>this._def.items.length&&(Ze(l,{code:Be.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...l.data].map((f,m)=>{const y=this._def.items[m]||this._def.rest;return y?y._parse(new Ji(l,f,l.path,m)):null}).filter(f=>!!f);return l.common.async?Promise.all(u).then(f=>ia.mergeArray(a,f)):ia.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new ac({...this._def,rest:t})}}ac.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ac({items:e,typeName:Rt.ZodTuple,rest:null,...qt(t)})};class Zm extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.object)return Ze(l,{code:Be.invalid_type,expected:st.object,received:l.parsedType}),It;const o=[],u=this._def.keyType,f=this._def.valueType;for(const m in l.data)o.push({key:u._parse(new Ji(l,m,l.path,m)),value:f._parse(new Ji(l,l.data[m],l.path,m)),alwaysSet:m in l.data});return l.common.async?ia.mergeObjectAsync(a,o):ia.mergeObjectSync(a,o)}get element(){return this._def.valueType}static create(t,a,l){return a instanceof ln?new Zm({keyType:t,valueType:a,typeName:Rt.ZodRecord,...qt(l)}):new Zm({keyType:qr.create(),valueType:t,typeName:Rt.ZodRecord,...qt(a)})}}class C4 extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.map)return Ze(l,{code:Be.invalid_type,expected:st.map,received:l.parsedType}),It;const o=this._def.keyType,u=this._def.valueType,f=[...l.data.entries()].map(([m,y],g)=>({key:o._parse(new Ji(l,m,l.path,[g,"key"])),value:u._parse(new Ji(l,y,l.path,[g,"value"]))}));if(l.common.async){const m=new Map;return Promise.resolve().then(async()=>{for(const y of f){const g=await y.key,S=await y.value;if(g.status==="aborted"||S.status==="aborted")return It;(g.status==="dirty"||S.status==="dirty")&&a.dirty(),m.set(g.value,S.value)}return{status:a.value,value:m}})}else{const m=new Map;for(const y of f){const g=y.key,S=y.value;if(g.status==="aborted"||S.status==="aborted")return It;(g.status==="dirty"||S.status==="dirty")&&a.dirty(),m.set(g.value,S.value)}return{status:a.value,value:m}}}}C4.create=(e,t,a)=>new C4({valueType:t,keyType:e,typeName:Rt.ZodMap,...qt(a)});class Nf extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.parsedType!==st.set)return Ze(l,{code:Be.invalid_type,expected:st.set,received:l.parsedType}),It;const o=this._def;o.minSize!==null&&l.data.size<o.minSize.value&&(Ze(l,{code:Be.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),a.dirty()),o.maxSize!==null&&l.data.size>o.maxSize.value&&(Ze(l,{code:Be.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),a.dirty());const u=this._def.valueType;function f(y){const g=new Set;for(const S of y){if(S.status==="aborted")return It;S.status==="dirty"&&a.dirty(),g.add(S.value)}return{status:a.value,value:g}}const m=[...l.data.values()].map((y,g)=>u._parse(new Ji(l,y,l.path,g)));return l.common.async?Promise.all(m).then(y=>f(y)):f(m)}min(t,a){return new Nf({...this._def,minSize:{value:t,message:ut.toString(a)}})}max(t,a){return new Nf({...this._def,maxSize:{value:t,message:ut.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}Nf.create=(e,t)=>new Nf({valueType:e,minSize:null,maxSize:null,typeName:Rt.ZodSet,...qt(t)});class T4 extends ln{get schema(){return this._def.getter()}_parse(t){const{ctx:a}=this._processInputParams(t);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}T4.create=(e,t)=>new T4({getter:e,typeName:Rt.ZodLazy,...qt(t)});class r0 extends ln{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Ze(a,{received:a.data,code:Be.invalid_literal,expected:this._def.value}),It}return{status:"valid",value:t.data}}get value(){return this._def.value}}r0.create=(e,t)=>new r0({value:e,typeName:Rt.ZodLiteral,...qt(t)});function l6(e,t){return new Du({values:e,typeName:Rt.ZodEnum,...qt(t)})}class Du extends ln{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),l=this._def.values;return Ze(a,{expected:mn.joinValues(l),received:a.parsedType,code:Be.invalid_type}),It}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),l=this._def.values;return Ze(a,{received:a.data,code:Be.invalid_enum_value,options:l}),It}return ii(t.data)}get options(){return this._def.values}get enum(){const t={};for(const a of this._def.values)t[a]=a;return t}get Values(){const t={};for(const a of this._def.values)t[a]=a;return t}get Enum(){const t={};for(const a of this._def.values)t[a]=a;return t}extract(t,a=this._def){return Du.create(t,{...this._def,...a})}exclude(t,a=this._def){return Du.create(this.options.filter(l=>!t.includes(l)),{...this._def,...a})}}Du.create=l6;class M4 extends ln{_parse(t){const a=mn.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(t);if(l.parsedType!==st.string&&l.parsedType!==st.number){const o=mn.objectValues(a);return Ze(l,{expected:mn.joinValues(o),received:l.parsedType,code:Be.invalid_type}),It}if(this._cache||(this._cache=new Set(mn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=mn.objectValues(a);return Ze(l,{received:l.data,code:Be.invalid_enum_value,options:o}),It}return ii(t.data)}get enum(){return this._def.values}}M4.create=(e,t)=>new M4({values:e,typeName:Rt.ZodNativeEnum,...qt(t)});class Xm extends ln{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==st.promise&&a.common.async===!1)return Ze(a,{code:Be.invalid_type,expected:st.promise,received:a.parsedType}),It;const l=a.parsedType===st.promise?a.data:Promise.resolve(a.data);return ii(l.then(o=>this._def.type.parseAsync(o,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Xm.create=(e,t)=>new Xm({type:e,typeName:Rt.ZodPromise,...qt(t)});class Ou extends ln{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Rt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:l}=this._processInputParams(t),o=this._def.effect||null,u={addIssue:f=>{Ze(l,f),f.fatal?a.abort():a.dirty()},get path(){return l.path}};if(u.addIssue=u.addIssue.bind(u),o.type==="preprocess"){const f=o.transform(l.data,u);if(l.common.async)return Promise.resolve(f).then(async m=>{if(a.value==="aborted")return It;const y=await this._def.schema._parseAsync({data:m,path:l.path,parent:l});return y.status==="aborted"?It:y.status==="dirty"||a.value==="dirty"?rf(y.value):y});{if(a.value==="aborted")return It;const m=this._def.schema._parseSync({data:f,path:l.path,parent:l});return m.status==="aborted"?It:m.status==="dirty"||a.value==="dirty"?rf(m.value):m}}if(o.type==="refinement"){const f=m=>{const y=o.refinement(m,u);if(l.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(l.common.async===!1){const m=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return m.status==="aborted"?It:(m.status==="dirty"&&a.dirty(),f(m.value),{status:a.value,value:m.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(m=>m.status==="aborted"?It:(m.status==="dirty"&&a.dirty(),f(m.value).then(()=>({status:a.value,value:m.value}))))}if(o.type==="transform")if(l.common.async===!1){const f=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!Ru(f))return It;const m=o.transform(f.value,u);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:m}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(f=>Ru(f)?Promise.resolve(o.transform(f.value,u)).then(m=>({status:a.value,value:m})):It);mn.assertNever(o)}}Ou.create=(e,t,a)=>new Ou({schema:e,typeName:Rt.ZodEffects,effect:t,...qt(a)});Ou.createWithPreprocess=(e,t,a)=>new Ou({schema:t,effect:{type:"preprocess",transform:e},typeName:Rt.ZodEffects,...qt(a)});class to extends ln{_parse(t){return this._getType(t)===st.undefined?ii(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}to.create=(e,t)=>new to({innerType:e,typeName:Rt.ZodOptional,...qt(t)});class Iu extends ln{_parse(t){return this._getType(t)===st.null?ii(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Iu.create=(e,t)=>new Iu({innerType:e,typeName:Rt.ZodNullable,...qt(t)});class l0 extends ln{_parse(t){const{ctx:a}=this._processInputParams(t);let l=a.data;return a.parsedType===st.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}l0.create=(e,t)=>new l0({innerType:e,typeName:Rt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...qt(t)});class o0 extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l={...a,common:{...a.common,issues:[]}},o=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return Qm(o)?o.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Yr(l.common.issues)},input:l.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yr(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}}o0.create=(e,t)=>new o0({innerType:e,typeName:Rt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...qt(t)});class R4 extends ln{_parse(t){if(this._getType(t)!==st.nan){const l=this._getOrReturnCtx(t);return Ze(l,{code:Be.invalid_type,expected:st.nan,received:l.parsedType}),It}return{status:"valid",value:t.data}}}R4.create=e=>new R4({typeName:Rt.ZodNaN,...qt(e)});class Oj extends ln{_parse(t){const{ctx:a}=this._processInputParams(t),l=a.data;return this._def.type._parse({data:l,path:a.path,parent:a})}unwrap(){return this._def.type}}class J0 extends ln{_parse(t){const{status:a,ctx:l}=this._processInputParams(t);if(l.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return u.status==="aborted"?It:u.status==="dirty"?(a.dirty(),rf(u.value)):this._def.out._parseAsync({data:u.value,path:l.path,parent:l})})();{const o=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return o.status==="aborted"?It:o.status==="dirty"?(a.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:l.path,parent:l})}}static create(t,a){return new J0({in:t,out:a,typeName:Rt.ZodPipeline})}}class c0 extends ln{_parse(t){const a=this._def.innerType._parse(t),l=o=>(Ru(o)&&(o.value=Object.freeze(o.value)),o);return Qm(a)?a.then(o=>l(o)):l(a)}unwrap(){return this._def.innerType}}c0.create=(e,t)=>new c0({innerType:e,typeName:Rt.ZodReadonly,...qt(t)});var Rt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Rt||(Rt={}));const T=qr.create,Qe=Au.create,$t=s0.create,Ij=a0.create;so.create;const rt=Xi.create,Ce=ms.create;Ym.create;Vm.create;ac.create;const Jm=Zm.create,cc=r0.create,At=Du.create;Xm.create;to.create;Iu.create;const o6=At(["codex","claude"]),Lj=At(["managed","attached-live","history-only"]),Pj=At(["active","idle","attention","offline"]),c6=At(["idle","running","completed"]),u6=At(["image","file"]),Uj=At(["user","repo","system","admin"]),zj=Ce({can_stream_live:$t(),can_send_input:$t(),can_interrupt:$t(),can_approve:$t(),can_reject:$t(),can_show_git:$t(),can_show_terminal:$t()}),d6=Ce({used_tokens:Qe(),total_tokens:Qe(),remaining_tokens:Qe(),percent_used:Qe(),cached_input_tokens:Qe(),output_tokens:Qe(),reasoning_output_tokens:Qe(),updated_at:T()}),Bj=At(["pending","in_progress","completed"]),Hj=Ce({id:T(),step:T(),status:Bj}),e_=Ce({session_id:T(),turn_id:T().nullable(),source:At(["rollout","app-server"]),updated_at:T(),explanation:T().nullable().default(null),steps:rt(Hj),completed_count:Qe().int().nonnegative(),total_count:Qe().int().nonnegative(),is_active:$t()}),$j=Ce({parent_session_id:T(),root_session_id:T().nullable().default(null),nickname:T().nullable().default(null),role:T().nullable().default(null),depth:Qe().int().nonnegative()}),Fj=At(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),qj=At(["pending","submitting","resolved"]),f6=Ce({id:T(),label:T(),description:T().nullable().default(null),emphasis:At(["default","primary","danger"]).default("default")}),Wj=Ce({id:T(),header:T().nullable().default(null),question:T(),options:rt(f6).default([]),allow_other:$t().default(!1),is_secret:$t().default(!1)}),t_=Ce({id:T(),session_id:T(),turn_id:T().nullable().default(null),item_id:T().nullable().default(null),kind:Fj,status:qj,title:T(),description:T().nullable().default(null),created_at:T(),updated_at:T(),options:rt(f6).default([]),questions:rt(Wj).default([]),allow_freeform:$t().default(!1),freeform_placeholder:T().nullable().default(null),submit_label:T().nullable().default(null)}),Kj=Ce({id:T(),kind:u6,name:T().nullable().default(null),mime_type:T().nullable().default(null),size_bytes:Qe().int().nonnegative().nullable().default(null),content_url:T().nullable().default(null)}),A4=Ce({id:T(),kind:u6,name:T(),mime_type:T().nullable().default(null),size_bytes:Qe().int().nonnegative().nullable().default(null),data_url:T()}),Qj=Ce({name:T(),description:T(),path:T(),scope:Uj,enabled:$t()}),Gj=At(["supported","unsupported"]),Yj=Ce({name:T(),description:T(),availability:Gj.default("supported")}),D4=Ce({cli_version:T().nullable().default(null),loaded_at:T(),cache_ttl_ms:Qe().int().nonnegative(),commands:rt(Yj)});Ce({id:T(),label:T(),description:T(),isDefault:$t(),defaultReasoningEffort:T().nullable().default(null),supportedReasoningEfforts:rt(T()).default([])});const Vj=At(["running","awaiting_input","completed","failed"]),Zj=At(["none","choice","text"]),Xj=Ce({id:T(),label:T(),description:T().nullable().default(null)}),Jj=Ce({type:cc("set_session_model"),model:T(),reasoning_effort:T().nullable().default(null)}).nullable().default(null),ew=Ce({panel_id:T(),session_id:T(),command_name:T(),command_text:T(),title:T(),description:T().nullable().default(null),status:Vj,body:T(),submitted_at:T(),updated_at:T(),input_type:Zj,options:rt(Xj).default([]),input_placeholder:T().nullable().default(null),submit_label:T().nullable().default(null),effect:Jj}),O4=Ce({panel:ew}),tw=At(["online","offline"]),yp=Ce({id:T(),name:T(),display_name:T().nullable().default(null),host:T(),tailscale_ip:T().nullable().default(null),tailscale_dns_name:T().nullable().default(null),direct_base_url:T(),ws_base_url:T(),status:tw,provider_availability:rt(o6),project_count:Qe(),session_count:Qe(),transport:At(["direct-agent","hub-routed"]),version:T().nullable().default(null),registered_at:T().nullable().default(null),last_seen_at:T().nullable().default(null)}),n_=Ce({id:T(),agent_id:T(),name:T(),display_name:T().nullable(),pinned:$t(),path:T(),branch:T(),worktree:T(),runtime_profiles:rt(T()),preview_url:T().nullable()}),$f=Ce({id:T(),agent_id:T(),project_id:T(),provider:o6,archived:$t(),title:T(),mode:Lj,health:Pj,branch:T(),worktree:T(),summary:T(),latest_assistant_message:T().nullable().default(null),last_event_at:T(),pinned:$t(),run_state:c6,run_state_changed_at:T().nullable(),context_usage:d6.nullable().default(null),subagent:$j.nullable().default(null),capability:zj}),nw=Ce({path:T(),additions:Qe(),deletions:Qe()}),sw=Ce({files:rt(nw),additions:Qe(),deletions:Qe()}),kf=Ce({id:T(),kind:At(["user","assistant","thinking","tool","system"]),title:T(),body:T(),body_truncated:$t().default(!1),detail_available:$t().default(!1),patch_summary:sw.nullable().default(null),session_ids:rt(T()).default([]),timestamp:T(),accent:At(["primary","secondary","muted"]),attachments:rt(Kj).default([])}),aw=At(["tail","full_compact"]),h6=Ce({session_id:T(),generated_at:T(),view:aw,anchor_entry_id:T().nullable().default(null),has_earlier_entries:$t().default(!1),entries:rt(kf)}),iw=At(["app-server","rollout-fallback"]),rw=At(["running","completed"]),lw=At(["add","delete","update"]),s_=Ce({path:T(),kind:lw,move_path:T().nullable(),additions:Qe(),deletions:Qe(),diff:T(),item_id:T().nullable()}),ow=s_.omit({diff:!0}).extend({diff_available:$t().default(!1)}),m6=Ce({id:T(),session_id:T(),turn_id:T(),source:iw,status:rw,started_at:T(),completed_at:T().nullable(),updated_at:T(),aggregated_diff:T(),files:rt(s_)}),p6=m6.omit({aggregated_diff:!0,files:!0}).extend({aggregated_diff_available:$t().default(!1),files:rt(ow)}),cw=Ce({session_id:T(),change_set_id:T(),file:s_,empty_message:T().default("此变更没有可展示的补丁内容")}),uw=Ce({path:T(),status:At(["modified","added","deleted","renamed"]),additions:Qe(),deletions:Qe()}),g6=At(["modified","added","deleted","renamed","untracked"]),dw=Ce({path:T(),previous_path:T().nullable().default(null),status:g6,additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative()}),fw=Ce({session_id:T(),project_id:T(),path:T(),previous_path:T().nullable().default(null),additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative(),diff:T()}),_6=Ce({session_id:T(),project_id:T(),branch:T(),branches:rt(T()),upstream_branch:T().nullable().default(null),ahead_count:Qe().int().nonnegative(),behind_count:Qe().int().nonnegative(),files:rt(dw),updated_at:T()}),hw=Ce({path:T(),previous_path:T().nullable().default(null),status:g6}),mw=Ce({oid:T(),short_oid:T(),subject:T(),author_name:T(),authored_at:T(),committed_at:T(),parent_oids:rt(T()).default([]),refs:rt(T()).default([]),files:rt(hw)}),pw=Ce({session_id:T(),project_id:T(),commit_oid:T(),path:T(),previous_path:T().nullable().default(null),additions:Qe().int().nonnegative(),deletions:Qe().int().nonnegative(),diff:T()}),gw=Ce({session_id:T(),project_id:T(),branch:T(),upstream_branch:T().nullable().default(null),head_oid:T().nullable().default(null),upstream_head_oid:T().nullable().default(null),commits:rt(mw),updated_at:T()});At(["discard-file","discard-all","commit-all","switch-branch","push"]);const _w=Ce({ok:cc(!0),workspace:_6}),y6=At(["auto","powershell","cmd","bash"]),yw=At(["user","codex"]),vw=Ce({id:T(),name:T(),description:T().nullable().default(null),command:T(),kill_command:T().nullable().default(null),cwd:T().nullable().default(null),shell:y6.default("auto"),node_version:T().nullable().default(null),port:Qe().int().positive().nullable().default(null),source:yw.default("user"),created_at:T(),updated_at:T()}),bw=Ce({name:T(),description:T().nullable().default(null),command:T(),kill_command:T().nullable().default(null),cwd:T().nullable().default(null),shell:y6.default("auto"),node_version:T().nullable().default(null),port:Qe().int().positive().nullable().default(null)}),a_=Ce({session_id:T(),project_id:T(),config_path:T(),commands:rt(vw),updated_at:T()}),xw=At(["user","codex"]),Sw=Ce({id:T(),name:T(),description:T().nullable().default(null),url:T(),source:xw.default("user"),created_at:T(),updated_at:T()}),jw=Ce({name:T(),description:T().nullable().default(null),url:T()}),i_=Ce({session_id:T(),project_id:T(),config_path:T(),websites:rt(Sw),updated_at:T()}),ww=At(["queued","running","completed","failed","stopped"]),Nw=At(["stdout","stderr","system"]),kw=Ce({cursor:Qe().int().nonnegative(),stream:Nw,text:T(),timestamp:T()}),r_=Ce({id:T(),session_id:T(),project_id:T(),command_id:T().nullable().default(null),title:T(),command:T(),cwd:T(),status:ww,exit_code:Qe().int().nullable().default(null),created_at:T(),started_at:T().nullable().default(null),completed_at:T().nullable().default(null),updated_at:T(),last_output_at:T().nullable().default(null),output_cursor:Qe().int().nonnegative(),preview:T().nullable().default(null)}),l_=Ce({session_id:T(),project_id:T(),active_terminal_id:T().nullable().default(null),terminals:rt(r_),updated_at:T()}),Ew=Ce({session_id:T(),project_id:T(),terminal:r_,chunks:rt(kw),next_cursor:Qe().int().nonnegative(),truncated:$t().default(!1)}),v6=Ce({run_state:c6.optional(),run_state_changed_at:T().nullable().optional(),summary:T().optional(),latest_assistant_message:T().nullable().optional(),last_event_at:T().optional(),context_usage:d6.nullable().optional()}),Cw=Ce({session_id:T(),recovered_at:T(),session_patch:v6,timeline:rt(kf),interactions:rt(t_),plan_snapshot:e_.nullable().default(null),change_sets:rt(m6),terminal_snapshot:l_.nullable().default(null)}),b6=Ce({manager:At(["none","nvm-windows"]).default("none"),versions:rt(T()).default([]),error:T().nullable().default(null)}),x6=Ce({command_catalog:a_,website_catalog:i_,node_runtime:b6,terminal_snapshot:l_}),Tw=Ce({session_id:T(),generated_at:T(),session_patch:v6,timeline:h6,interactions:rt(t_),plan_snapshot:e_.nullable().default(null),run_workbench:x6.nullable().default(null),change_sets:rt(p6).default([])}),Mw=Ce({catalog:a_}),Rw=Ce({catalog:i_}),Aw=Ce({commands:rt(bw),reason:T().nullable().default(null)}),Dw=Ce({generation:Aw,catalog:a_}),Ow=Ce({websites:rt(jw),reason:T().nullable().default(null)}),Iw=Ce({generation:Ow,catalog:i_}),Lw=Ce({snapshot:l_,terminal:r_.nullable().default(null)}),Pw=At(["dev-hub","dev-agent","dev-web","release-hub","release-agent"]),Uw=At(["unknown","running","stopped","degraded"]),zw=At(["process","windows-service"]),Bw=At(["missing","running","stopped","unknown"]),Hw=At(["dev-start","dev-restart","dev-stop","dev-probe","npm-publish","release-service-install","release-service-uninstall","release-install-run","apk-build"]),$w=At(["running","succeeded","failed"]),Fw=At(["info","success","warn","error"]),S6=Ce({repo_path:T().nullable().default(null),nvm_version:T().nullable().default(null),dev_hub_port:Qe().int().positive().nullable().default(null),dev_hub_args:T().default(""),dev_agent_port:Qe().int().positive().nullable().default(null),dev_agent_hub_url:T().default(""),dev_agent_direct_base_url:T().default(""),dev_agent_ws_base_url:T().default(""),dev_agent_name:T().default(""),dev_agent_args:T().default(""),dev_web_port:Qe().int().positive().nullable().default(null),dev_web_hub_url:T().default(""),dev_web_args:T().default(""),release_hub_port:Qe().int().positive().nullable().default(null),release_hub_service_name:T().default("PandaHub"),release_hub_args:T().default(""),release_agent_port:Qe().int().positive().nullable().default(null),release_agent_service_name:T().default("PandaAgent"),release_agent_hub_url:T().default(""),release_agent_direct_base_url:T().default(""),release_agent_ws_base_url:T().default(""),release_agent_name:T().default(""),release_agent_args:T().default(""),updated_at:T().nullable().default(null)}),qw=S6.extend({npm_token:T().nullable().default(null),clear_npm_token:$t().default(!1)}),Ww=Ce({has_npm_token:$t(),npm_token_hint:T().nullable().default(null)}),Kw=Ce({checked_at:T(),url:T().nullable().default(null),ok:$t(),status_code:Qe().int().nullable().default(null),duration_ms:Qe().int().nonnegative().nullable().default(null),message:T().nullable().default(null)}),Qw=Ce({key:Pw,label:T(),status:Uw,manager:zw.default("process"),service_name:T().nullable().default(null),service_registered:$t().default(!1),service_status:Bw.nullable().default(null),configured_port:Qe().int().positive().nullable().default(null),detected_pids:rt(Qe().int().positive()).default([]),probe:Kw.nullable().default(null)}),Gw=Ce({id:T(),timestamp:T(),level:Fw,message:T()}),j6=Ce({id:T(),kind:Hw,title:T(),status:$w,created_at:T(),started_at:T().nullable().default(null),finished_at:T().nullable().default(null),summary:T().nullable().default(null),error:T().nullable().default(null),disconnect_expected:$t().default(!1),logs:rt(Gw).default([])}),Yw=Ce({artifact_id:T(),file_name:T(),size_bytes:Qe().int().nonnegative(),built_at:T(),published_at:T().nullable().default(null),version_name:T().nullable().default(null),version_code:Qe().int().nullable().default(null),download_path:T()}),u0=Ce({generated_at:T(),config:S6,credentials:Ww,node_runtime:b6,services:rt(Qw),current_version:T().nullable().default(null),apk_artifact:Yw.nullable().default(null),jobs:rt(j6).default([])});Ce({action:At(["start-development","restart-development","stop-development","probe-development","publish-npm","install-release-services","uninstall-release-services","install-latest-release","build-apk"])});const Vw=Ce({ok:cc(!0),snapshot:u0,job:j6.nullable().default(null)}),Zw=Ce({id:T(),name:T(),command:T(),port:Qe().nullable(),status:At(["running","stopped","degraded"]),log_excerpt:T()}),Xw=Ce({id:T(),label:T(),url:T(),status:At(["ready","starting","stopped"])}),w6=Ce({path:T(),name:T(),has_children:$t()}),Jw=Ce({directory:w6}),eN=Ce({id:T(),title:T(),description:T(),status:At(["pending","approved","rejected"])}),tN=Ce({project_id:T(),visible_session_count:Qe().int().nonnegative(),archived_session_count:Qe().int().nonnegative(),hidden_history_count:Qe().int().nonnegative()}),nN=n_.pick({id:!0,agent_id:!0,name:!0,display_name:!0,pinned:!0,path:!0}),sN=yp.pick({id:!0,name:!0,display_name:!0,status:!0}),N6=$f.pick({id:!0,agent_id:!0,project_id:!0,archived:!0,title:!0,last_event_at:!0,pinned:!0,run_state:!0,run_state_changed_at:!0,subagent:!0}),aN=$f.pick({id:!0,agent_id:!0,project_id:!0,archived:!0,title:!0,provider:!0,mode:!0,health:!0,branch:!0,worktree:!0,summary:!0,latest_assistant_message:!0,last_event_at:!0,pinned:!0,run_state:!0,run_state_changed_at:!0,context_usage:!0,subagent:!0,capability:!0}),iN=Ce({generated_at:T(),session:aN}),rN=Ce({generated_at:T(),agents:rt(yp)}),lN=$f.pick({id:!0,title:!0,run_state:!0,run_state_changed_at:!0,latest_assistant_message:!0}),oN=Ce({generated_at:T(),recent_sessions:rt(lN)}),cN=Ce({session_id:T(),agent_id:T(),project_id:T(),direct_base_url:T(),ws_base_url:T()}),uN=Ce({generated_at:T(),agent:sN.nullable().default(null),projects:rt(nN),project_stats:rt(tN).default([]),sessions:rt(N6),active_session_id:T()}),k6=At(["archived","history"]),dN=Ce({bucket:k6,project_id:T().nullable().default(null),sessions:rt(N6),next_cursor:T().nullable().default(null),total_count:Qe().int().nonnegative()}),fN=Ce({session_id:T(),entry_id:T(),command_entry:kf,output_entries:rt(kf).default([])}),hN=Ce({generated_at:T(),agents:rt(yp),projects:rt(n_),sessions:rt($f),active_session_id:T(),timeline:rt(kf),changed_files:rt(uw),runtime_processes:rt(Zw),previews:rt(Xw),approvals:rt(eN)});Ce({agent:yp,projects:rt(n_),sessions:rt($f),active_session_id:T().default(""),generated_at:T()});const I4=Ce({ok:cc(!0),agent_id:T(),heartbeat_interval_ms:Qe().int().positive(),heartbeat_timeout_ms:Qe().int().positive(),registered_at:T(),received_at:T()}),mN=At(["rename","delete"]);Ce({action:mN,display_name:T().nullable().default(null)});const pN=Ce({ok:cc(!0)}),o_=Ce({completion_notifications_enabled:$t().default(!1)}),gN=Ce({p256dh:T(),auth:T()}),_N=Ce({endpoint:T().url(),expirationTime:Qe().nullable().default(null),keys:gN}),yN=Ce({label:T().nullable().default(null),user_agent:T().nullable().default(null)});Ce({subscription:_N,settings:o_.default({}),device:yN.default({})});const vN=Ce({endpoint:T().url()}),bN=Ce({endpoint:T().url()}),xN=Ce({supported:$t(),vapid_public_key:T().nullable().default(null),subject:T().nullable().default(null),reason:T().nullable().default(null)}),SN=Ce({ok:cc(!0),subscription_id:T(),endpoint:T().url(),settings:o_,created_at:T(),updated_at:T()}),jN=Ce({ok:cc(!0),endpoint:T().url(),delivered_at:T()}),wN=Ce({type:At(["agent.online","agent.offline","snapshot.changed","session.updated","thread.updated","timeline.delta","timeline.reset","interaction.delta","interaction.reset","plan.delta","plan.reset","changeset.delta","changeset.reset","terminal.snapshot","terminal.delta","turn.delta","turn.completed","approval.requested"]),timestamp:T(),payload:Jm(Ij())}),NN=Ce({width:Qe().nonnegative(),height:Qe().nonnegative(),device_pixel_ratio:Qe().nonnegative(),visual_width:Qe().nonnegative().nullable().default(null),visual_height:Qe().nonnegative().nullable().default(null),screen_width:Qe().nonnegative().nullable().default(null),screen_height:Qe().nonnegative().nullable().default(null)}),kN=Ce({user_agent:T(),language:T().nullable().default(null),languages:rt(T()).default([]),platform:T().nullable().default(null),vendor:T().nullable().default(null),online:$t().nullable().default(null),cookie_enabled:$t().nullable().default(null),secure_context:$t(),standalone_display_mode:$t(),hardware_concurrency:Qe().int().nonnegative().nullable().default(null),device_memory_gb:Qe().nonnegative().nullable().default(null),max_touch_points:Qe().int().nonnegative().nullable().default(null)}),EN=Ce({href:T(),pathname:T(),referrer:T().nullable().default(null),visibility_state:T().nullable().default(null)}),CN=Ce({scope:T(),active_script_url:T().nullable().default(null),waiting_script_url:T().nullable().default(null),installing_script_url:T().nullable().default(null)}),TN=Ce({supported:$t(),controller:$t(),registrations:rt(CN).default([])}),MN=Ce({supported:$t(),keys:rt(T()).default([])}),RN=Ce({href:T().nullable().default(null),rel:T().nullable().default(null)}),AN=Ce({href:T().nullable().default(null),owner_node:T().nullable().default(null),media:T().nullable().default(null),disabled:$t(),css_rule_count:Qe().int().nonnegative().nullable().default(null)}),DN=Ce({url:T(),kind:At(["stylesheet","script","manifest","icon","other"]),ok:$t(),status:Qe().int().nonnegative().nullable().default(null),content_type:T().nullable().default(null),cache_control:T().nullable().default(null),error:T().nullable().default(null)}),ON=Ce({name:T(),initiator_type:T().nullable().default(null),duration_ms:Qe().nonnegative().nullable().default(null),transfer_size:Qe().nonnegative().nullable().default(null),decoded_body_size:Qe().nonnegative().nullable().default(null)}),IN=Ce({x:Qe(),y:Qe(),width:Qe().nonnegative(),height:Qe().nonnegative()}),LN=Ce({selector:T(),found:$t(),text_preview:T().nullable().default(null),rect:IN.nullable().default(null),computed:Jm(T()).default({})});Ce({captured_at:T(),page:EN,environment:kN,viewport:NN,feature_support:Jm($t()).default({}),service_worker:TN,cache:MN,manifest:RN,stylesheets:rt(AN).default([]),resource_probes:rt(DN).default([]),performance_entries:rt(ON).default([]),theme_variables:Jm(T()).default({}),element_snapshots:rt(LN).default([]),notes:rt(T()).default([])});const PN=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Ps=e=>(e==null?void 0:e.trim())??"",L4="\0",P4=e=>{const t=Ps(e);return t?PN.test(t)?1:2+Math.min(t.length,64)/100:0},UN=(e,t)=>{const a=P4(e),l=P4(t);if(l>a)return Ps(t)||null;if(a>l)return Ps(e)||null;const o=Ps(e),u=Ps(t);return u.length>o.length?u||null:o||null},zN=e=>{const t=Ps(e.content_url);return t?[e.kind,"content",t].join(L4):[e.kind,"meta",Ps(e.mime_type).toLowerCase(),typeof e.size_bytes=="number"&&Number.isFinite(e.size_bytes)?String(Math.max(0,Math.round(e.size_bytes))):"",Ps(e.name).toLowerCase()].join(L4)},BN=(e,t)=>{const a=Ps(e.name),l=Ps(t.name),o=Ps(e.mime_type),u=Ps(t.mime_type);return{id:e.id||t.id,kind:e.kind==="image"||t.kind==="image"?"image":e.kind,name:UN(a,l),mime_type:o||u||null,size_bytes:e.size_bytes??t.size_bytes??null,content_url:Ps(e.content_url)||Ps(t.content_url)||null}},E6=e=>{if(!e||e.length===0)return[];const t=[],a=new Map;for(const l of e){const o=zN(l),u=a.get(o);if(u===void 0){a.set(o,t.length),t.push({...l,name:Ps(l.name)||null,mime_type:Ps(l.mime_type)||null,size_bytes:typeof l.size_bytes=="number"&&Number.isFinite(l.size_bytes)?Math.max(0,Math.round(l.size_bytes)):null,content_url:Ps(l.content_url)||null});continue}t[u]=BN(t[u],l)}return t},C6=(e,t)=>E6([...e??[],...t??[]]),va=e=>new Date(e).toISOString(),HN=()=>({generated_at:new Date().toISOString(),active_session_id:"session-managed-1",agents:[{id:"agent-shanghai-main",name:"studio-main",display_name:null,host:"100.88.10.14",tailscale_ip:"100.88.10.14",tailscale_dns_name:"studio-main.tail-scale.ts.net",direct_base_url:"http://100.88.10.14:4242",ws_base_url:"ws://100.88.10.14:4242/ws",status:"online",provider_availability:["codex"],project_count:2,session_count:2,transport:"direct-agent",version:"0.1.0",registered_at:va("2026-03-18T10:30:00+08:00"),last_seen_at:va("2026-03-18T10:58:00+08:00")},{id:"agent-macbook",name:"macbook-air",display_name:null,host:"100.89.20.77",tailscale_ip:"100.89.20.77",tailscale_dns_name:"macbook-air.tail-scale.ts.net",direct_base_url:"http://100.89.20.77:4242",ws_base_url:"ws://100.89.20.77:4242/ws",status:"online",provider_availability:["codex"],project_count:1,session_count:1,transport:"hub-routed",version:"0.1.0",registered_at:va("2026-03-18T10:20:00+08:00"),last_seen_at:va("2026-03-18T10:55:00+08:00")}],projects:[{id:"project-panda",agent_id:"agent-shanghai-main",name:"panda",display_name:null,pinned:!1,path:"D:/ai/panda",branch:"main",worktree:"default",runtime_profiles:["dev","storybook","test"],preview_url:"https://panda.tailnet.ts.net"},{id:"project-remodex-lab",agent_id:"agent-shanghai-main",name:"remodex",display_name:null,pinned:!1,path:"D:/ai/remodex",branch:"phase1-ui",worktree:"mobile-lab",runtime_profiles:["dev"],preview_url:null},{id:"project-notes",agent_id:"agent-macbook",name:"notes",display_name:null,pinned:!1,path:"D:/Users/dev/notes",branch:"research",worktree:"default",runtime_profiles:["dev"],preview_url:null}],sessions:[{id:"session-managed-1",agent_id:"agent-shanghai-main",project_id:"project-panda",provider:"codex",archived:!1,title:"Stage 1 buildout",mode:"managed",health:"active",branch:"main",worktree:"default",summary:"Monorepo scaffold, PWA shell, agent bootstrap API",latest_assistant_message:"Wiring the shell.",last_event_at:va("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:va("2026-03-18T10:57:20+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!0,can_interrupt:!0,can_approve:!0,can_reject:!0,can_show_git:!0,can_show_terminal:!0}},{id:"session-live-2",agent_id:"agent-shanghai-main",project_id:"project-remodex-lab",provider:"codex",archived:!1,title:"Remote attach",mode:"attached-live",health:"idle",branch:"phase1-ui",worktree:"mobile-lab",summary:"",latest_assistant_message:null,last_event_at:va("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:va("2026-03-18T10:48:00+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!0}},{id:"session-history-3",agent_id:"agent-macbook",project_id:"project-notes",provider:"codex",archived:!1,title:"Research notes",mode:"history-only",health:"offline",branch:"research",worktree:"default",summary:"",latest_assistant_message:null,last_event_at:va("2026-03-17T19:12:00+08:00"),pinned:!1,run_state:"idle",run_state_changed_at:null,context_usage:null,subagent:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!1}}],timeline:[{id:"entry-1",kind:"system",title:"Session ready",body:"Managed session attached.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:va("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:va("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:va("2026-03-18T10:45:30+08:00"),accent:"secondary",attachments:[]},{id:"entry-4",kind:"tool",title:"Tool activity",body:"Scanned docs/, checked runtime versions, and created the initial workspace directories.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:va("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:va("2026-03-18T10:58:00+08:00"),accent:"primary",attachments:[]}],changed_files:[{path:"apps/web/src/components/dashboard.tsx",status:"added",additions:248,deletions:0},{path:"packages/protocol/src/index.ts",status:"modified",additions:94,deletions:12},{path:"apps/agent/src/index.ts",status:"modified",additions:77,deletions:3}],runtime_processes:[{id:"runtime-dev",name:"dev",command:"pnpm --filter @panda/web dev --host 0.0.0.0 --port 4173",port:4173,status:"running",log_excerpt:"Vite server ready on 0.0.0.0:4173 and previewed over the tailnet."},{id:"runtime-agent",name:"agent",command:"pnpm --filter @panda/agent dev",port:4242,status:"running",log_excerpt:"Fastify listening on http://0.0.0.0:4242 with WebSocket events enabled."}],previews:[{id:"preview-main",label:"PWA preview",url:"https://panda.tailnet.ts.net",status:"ready"},{id:"preview-storybook",label:"Design lab",url:"https://storybook.tailnet.ts.net",status:"starting"}],approvals:[{id:"approval-1",title:"Write workspace files",description:"Create monorepo config, React app shell, and Fastify agent entrypoints.",status:"approved"},{id:"approval-2",title:"Attach external Codex session",description:"External session controls remain experimental until app-server transport is available.",status:"pending"}]}),$N=()=>HN(),FN=()=>$N(),T6=e=>{const t=new URL(e);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class qN{constructor(t,a=T6(t)){this.baseUrl=t,this.wsBaseUrl=a}getConnectionKey(){return`${this.baseUrl}::${this.wsBaseUrl}`}async readJson(t,a){const l=await fetch(t);if(!l.ok)throw new Error(`Request failed with ${l.status}`);return a.parse(await l.json())}async postJson(t,a,l){const o=await fetch(new URL(t,this.baseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),u=await o.json().catch(()=>null);if(!o.ok)throw new Error((u==null?void 0:u.error)??`Request failed with ${o.status}`);return l?l.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:l=FN}=t??{};try{const o=await fetch(new URL("/api/bootstrap",this.baseUrl));if(!o.ok)throw new Error(`Bootstrap request failed with ${o.status}`);const u=await o.json();return hN.parse(u)}catch(o){if(!a)throw o;return l()}}async getHubDirectory(){return this.readJson(new URL("/api/hub/directory",this.baseUrl),rN)}async getHubRecentSessions(){return this.readJson(new URL("/api/hub/recent-sessions",this.baseUrl),oN)}async getSessionLocation(t){return this.readJson(new URL(`/api/sessions/${t}/location`,this.baseUrl),cN)}async getWorkspaceDirectory(t){const a=new URL("/api/workspace",this.baseUrl);return t!=null&&t.selectedSessionId&&a.searchParams.set("selectedSessionId",t.selectedSessionId),this.readJson(a,uN)}async getWorkspaceSessionPage(t){const a=new URL("/api/workspace/sessions",this.baseUrl);return a.searchParams.set("bucket",k6.parse(t.bucket)),t.projectId&&a.searchParams.set("projectId",t.projectId),t.cursor&&a.searchParams.set("cursor",t.cursor),typeof t.limit=="number"&&Number.isFinite(t.limit)&&a.searchParams.set("limit",String(Math.max(1,Math.floor(t.limit)))),t.selectedSessionId&&a.searchParams.set("selectedSessionId",t.selectedSessionId),this.readJson(a,dN)}async getWorkspaceSessionDetail(t){const a=new URL("/api/workspace/session-detail",this.baseUrl);return a.searchParams.set("sessionId",t),this.readJson(a,iN)}async getSessionTimeline(t,a){const l=new URL(`/api/sessions/${t}/timeline`,this.baseUrl);return a!=null&&a.view&&l.searchParams.set("view",a.view),this.readJson(l,h6)}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>p6.parse(l)):[]})}async getSessionBootstrap(t){return this.readJson(new URL(`/api/sessions/${t}/bootstrap`,this.baseUrl),Tw)}async getSessionToolCallDetail(t,a){const l=new URL(`/api/sessions/${t}/tool-detail`,this.baseUrl);return l.searchParams.set("entryId",a),this.readJson(l,fN)}async getSessionChangeSetFileDiff(t,a){const l=new URL(`/api/sessions/${t}/change-set-file-diff`,this.baseUrl);return l.searchParams.set("changeSetId",a.changeSetId),l.searchParams.set("path",a.path),a.itemId&&l.searchParams.set("itemId",a.itemId),this.readJson(l,cw)}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),_6)}async getSessionGitWorkspaceFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,fw)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),gw)}async getSessionGitHistoryFileDiff(t,a){const l=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return l.searchParams.set("commitOid",a.commitOid),l.searchParams.set("path",a.path),a.previousPath&&l.searchParams.set("previousPath",a.previousPath),this.readJson(l,pw)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),x6)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},Mw)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},Dw)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},Rw)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},Iw)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},Lw)}async getSessionTerminalOutput(t){const a=new URL(`/api/sessions/${t.sessionId}/terminals/${t.terminalId}/output`,this.baseUrl);return typeof t.cursor=="number"&&Number.isFinite(t.cursor)&&a.searchParams.set("cursor",String(Math.max(0,Math.floor(t.cursor)))),this.readJson(a,Ew)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:e_.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>t_.parse(l)):[]})}async getSessionRecoverySnapshot(t){return this.readJson(new URL(`/api/sessions/${t}/recovery`,this.baseUrl),Cw)}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(l=>Qj.parse(l)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),D4)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},D4)}async listDirectories(t){const a=new URL("/api/directories",this.baseUrl);return t.agentId&&a.searchParams.set("agentId",t.agentId),t.path&&a.searchParams.set("path",t.path),this.readJson(a,{parse:l=>Array.isArray(l)?l.map(o=>w6.parse(o)):[]})}async createDirectory(t){return this.postJson("/api/directories",t,Jw)}async createProject(t){return this.postJson("/api/projects",t)}async createSession(t){var a;return this.postJson("/api/sessions",{...t,attachments:(a=t.attachments)==null?void 0:a.map(l=>A4.parse(l)),serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async updateSession(t){return this.postJson(`/api/sessions/${t.sessionId}/actions`,{action:t.action,name:t.name})}async updateThread(t){return this.postJson(`/api/threads/${t.projectId}/actions`,{action:t.action,name:t.name,orderedProjectIds:t.orderedProjectIds})}async sendSessionInput(t){var a;return this.postJson(`/api/sessions/${t.sessionId}/input`,{input:t.input,attachments:(a=t.attachments)==null?void 0:a.map(l=>A4.parse(l)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode,yoloMode:t.yoloMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},O4)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},O4)}async respondToSessionInteraction(t){return this.postJson(`/api/sessions/${t.sessionId}/interactions/${t.requestId}/respond`,{optionId:t.optionId??null,text:t.text??null,answers:t.answers??null})}async interruptSession(t){return this.postJson(`/api/sessions/${t}/interrupt`,{})}async registerAgent(t){return this.postJson("/api/agents/register",t,I4)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,I4)}async updateAgent(t){return this.postJson(`/api/agents/${t.agentId}/actions`,{action:t.action,display_name:t.displayName??null},pN)}async getWebPushPublicConfig(){return this.readJson(new URL("/api/push/public-key",this.baseUrl),xN)}async upsertWebPushSubscription(t){return this.postJson("/api/push/subscriptions",{subscription:t.subscription,settings:o_.parse(t.settings),device:t.device??null},SN)}async removeWebPushSubscription(t){return this.postJson("/api/push/subscriptions/remove",vN.parse(t))}async sendWebPushTest(t){return this.postJson("/api/push/test",bN.parse(t),jN)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},_w)}async getDevManagerSnapshot(t){const a=new URL("/api/dev-manager",this.baseUrl);return t!=null&&t.includeServiceProbe&&a.searchParams.set("includeServiceProbe","1"),this.readJson(a,u0)}async saveDevManagerConfig(t){return this.postJson("/api/dev-manager/config",qw.parse(t),u0)}async executeDevManagerAction(t){return this.postJson("/api/dev-manager/actions",t,Vw)}createEventStream(t,a){var he;let m=null,y=((he=a==null?void 0:a.sessionId)==null?void 0:he.trim())??"",g="",S=!1,p=0,v=null,w=!1,N=!1,j=!1,C=0;const R=typeof document<"u"&&typeof document.visibilityState=="string",z=()=>R&&document.visibilityState==="hidden",O=(a==null?void 0:a.reconnectWhenHidden)===!0,k=M=>(M==null?void 0:M.readyState)===WebSocket.OPEN||(M==null?void 0:M.readyState)===WebSocket.CONNECTING,L=()=>{v!==null&&(globalThis.clearTimeout(v),v=null)},K=(M,$)=>{var ee;(ee=a==null?void 0:a.onStatus)==null||ee.call(a,{state:M,attempt:p,maxAttempts:5,error:$})},J=M=>{const $=m;!$||$.readyState!==WebSocket.OPEN||(g&&g!==M&&($.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g=""),!(!M||g===M)&&(g=M,$.send(JSON.stringify({type:"session.subscribe",sessionId:M}))))},q=M=>{if(S||w)return;if(!O&&z()){w=!1,j=!0,L(),K("failed",M);return}if(p+=1,!O&&p>5){p=5,j=!0,K("failed",M);return}w=!0,j=!1,K("reconnecting",M),L();const $=O?Math.min(p,5):p,ee=Math.min(1e4,1200*2**Math.max(0,$-1));v=globalThis.setTimeout(()=>{w=!1,Y()},ee)},Y=()=>{if(S||k(m))return;L(),w=!1,j=!1;const M=new WebSocket(this.wsBaseUrl);m=M,M.addEventListener("open",()=>{S||m!==M||(w=!1,N=!1,p=0,K("connected"),J(y))}),M.addEventListener("message",$=>{if(m!==M)return;const ee=wN.safeParse(JSON.parse($.data));ee.success&&t(ee.data)}),M.addEventListener("error",()=>{if(S||m!==M)return;const $=`无法连接到 ${this.wsBaseUrl}`;M.readyState!==WebSocket.OPEN&&q($)}),M.addEventListener("close",$=>{var oe;if(m===M&&(m=null),S||m!==null)return;const ee=((oe=$.reason)==null?void 0:oe.trim())||`WebSocket 已断开(code ${$.code||"unknown"})`;q(ee)})},Q=M=>{if(S||k(m)||N)return;const $=Date.now();$-C<1500||(C=$,N=!0,p=0,w=!1,j=!1,L(),K("reconnecting",M),Y())},G=()=>{document.visibilityState==="visible"&&(j||!k(m))&&Q("应用回到前台,正在恢复连接")},ge=()=>{(j||!k(m))&&Q("页面恢复显示,正在恢复连接")},me=()=>{(j||!k(m))&&Q("窗口重新聚焦,正在恢复连接")},Z=()=>{(j||!k(m))&&Q("网络已恢复,正在重新连接")};return typeof window<"u"&&(window.addEventListener("pageshow",ge),window.addEventListener("focus",me),window.addEventListener("online",Z)),typeof document<"u"&&document.addEventListener("visibilitychange",G),Y(),{setSessionId:M=>{y=(M==null?void 0:M.trim())??"",!S&&J(y)},close:()=>{S=!0,w=!1,N=!1,j=!1,L(),typeof window<"u"&&(window.removeEventListener("pageshow",ge),window.removeEventListener("focus",me),window.removeEventListener("online",Z)),typeof document<"u"&&document.removeEventListener("visibilitychange",G);const M=m;if((M==null?void 0:M.readyState)===WebSocket.OPEN&&g&&M.send(JSON.stringify({type:"session.unsubscribe",sessionId:g})),g="",m=null,(M==null?void 0:M.readyState)===WebSocket.CONNECTING){const $=()=>{try{M.close()}catch{}};M.addEventListener("open",$,{once:!0});return}M==null||M.close()}}}connectEvents(t,a){const l=this.createEventStream(t,a);return()=>{l.close()}}}const M6=(e,t)=>new qN(e,(t==null?void 0:t.wsBaseUrl)??T6(e)),R6=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return null;try{const a=new URL(t);return a.port?`${a.hostname}:${a.port}`:a.hostname}catch{return t.replace(/\/+$/,"")||null}},ic=e=>{var t;return((t=e.display_name)==null?void 0:t.trim())||e.name.trim()||R6(e.direct_base_url)||"未命名节点"},WN=e=>{var a;const t=((a=e.display_name)==null?void 0:a.trim())??"";return!t||t===e.name?null:e.name},fg=e=>R6(e.direct_base_url)||e.host||e.tailscale_ip||e.tailscale_dns_name||e.direct_base_url,ep="panda:last-agent-id",tp="panda:last-session-id",Ef="panda:pending-session-id",Cf="panda:pending-project-id",Tf="panda:pending-directory-picker",Lu="panda:pending-session-handoff",Mf="panda:selected-agent-connection-hint",KN=3e4,QN=1800*1e3,lf=e=>typeof e=="object"&&e!==null,GN=e=>{if(!lf(e))return null;const{sessionId:t,agentId:a,projectId:l,createdAt:o,session:u,project:f,optimisticEntry:m}=e;return typeof t!="string"||typeof a!="string"||typeof l!="string"||typeof o!="string"||!lf(u)||u.id!==t||u.agent_id!==a||u.project_id!==l||f!==null&&(!lf(f)||f.id!==l||f.agent_id!==a||typeof f.name!="string"||typeof f.path!="string")||m!==null&&(!lf(m)||typeof m.id!="string"||typeof m.kind!="string"||typeof m.body!="string"||typeof m.timestamp!="string")?null:{sessionId:t,agentId:a,projectId:l,createdAt:o,session:u,project:f??null,optimisticEntry:m??null}},YN=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>KN:!0},VN=e=>{if(!lf(e))return null;const{agentId:t,name:a,displayName:l,directBaseUrl:o,wsBaseUrl:u,createdAt:f}=e;return typeof t!="string"||typeof a!="string"||l!==null&&typeof l!="string"||typeof o!="string"||typeof u!="string"||typeof f!="string"?null:{agentId:t,name:a,displayName:l,directBaseUrl:o,wsBaseUrl:u,createdAt:f}},ZN=e=>{const t=new Date(e.createdAt).getTime();return Number.isFinite(t)?Date.now()-t>QN:!0},XN=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Lu);return}window.sessionStorage.setItem(Lu,JSON.stringify(e))}catch{}},c_=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Lu);if(!t)return null;const a=GN(JSON.parse(t));return!a||YN(a)?(window.sessionStorage.removeItem(Lu),null):e&&a.sessionId!==e?null:a}catch{return null}},JN=e=>{if(!(typeof window>"u"))try{const t=c_();if(e&&(t!=null&&t.sessionId)&&t.sessionId!==e)return;window.sessionStorage.removeItem(Lu)}catch{}},ek=e=>{if(!(typeof window>"u"))try{if(!e){window.sessionStorage.removeItem(Mf);return}window.sessionStorage.setItem(Mf,JSON.stringify(e))}catch{}},Ff=e=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(Mf);if(!t)return null;const a=VN(JSON.parse(t));return!a||ZN(a)?(window.sessionStorage.removeItem(Mf),null):e&&a.agentId!==e?null:a}catch{return null}},uc=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(ep)}catch{return null}},Zi=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(ep,e);return}window.localStorage.removeItem(ep)}catch{}},np=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(tp)}catch{return null}},sa=e=>{if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(tp,e);return}window.localStorage.removeItem(tp)}catch{}},Wr=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Ef,e);return}window.sessionStorage.removeItem(Ef)}catch{}},tk=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(Ef);return e&&window.sessionStorage.removeItem(Ef),e}catch{return null}},fu=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Cf,e);return}window.sessionStorage.removeItem(Cf)}catch{}},nk=()=>{if(typeof window>"u")return null;try{const e=window.sessionStorage.getItem(Cf);return e&&window.sessionStorage.removeItem(Cf),e}catch{return null}},of=e=>{if(!(typeof window>"u"))try{if(e){window.sessionStorage.setItem(Tf,"1");return}window.sessionStorage.removeItem(Tf)}catch{}},sk=()=>{if(typeof window>"u")return!1;try{const e=window.sessionStorage.getItem(Tf);return e&&window.sessionStorage.removeItem(Tf),e==="1"}catch{return!1}},A6=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(ep),window.localStorage.removeItem(tp),window.sessionStorage.removeItem(Ef),window.sessionStorage.removeItem(Cf),window.sessionStorage.removeItem(Tf),window.sessionStorage.removeItem(Lu),window.sessionStorage.removeItem(Mf)}catch{}},sp=oc("Preferences",{web:()=>ao(()=>import("./web-BqX5x67V.js"),[]).then(e=>new e.PreferencesWeb)}),ak=new Set(["4173","4174"]),ik="PandaMobile",D6="hub_url",O6="onboarding_completed",d0=new Set;let Vi={platform:Mu(),hubUrl:"",onboardingCompleted:!1};const I6=()=>{for(const e of d0)e()},rk=e=>(d0.add(e),()=>{d0.delete(e)}),rc=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{return new URL(t).toString().replace(/\/+$/,"")}catch{return t.replace(/\/+$/,"")}},lk=()=>typeof window>"u"?null:window.location.origin||null,L6=e=>{if(typeof window>"u")return`http://localhost:${e}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${e}`},ok=()=>rc(L6(4242)),ck=()=>{const e=rc(void 0);if(e)return e;const t=lk();if(!t)return"http://localhost:4343";const a=window.location.port.trim();return ak.has(a)?L6(4343):rc(t)},uk=()=>rc(void 0),dk=()=>!1,fk=()=>{const e=Mu();if(e==="web")return{platform:e,hubUrl:ck(),onboardingCompleted:!0};const t=uk();return{platform:e,hubUrl:t,onboardingCompleted:!!t}},U4=async e=>{if(Ys()){const{value:t}=await sp.get({key:e});return t}if(typeof window>"u")return null;try{return window.localStorage.getItem(`panda:runtime:${e}`)}catch{return null}},z4=async(e,t)=>{if(Ys()){if(t===null){await sp.remove({key:e});return}await sp.set({key:e,value:t});return}if(!(typeof window>"u"))try{if(t===null){window.localStorage.removeItem(`panda:runtime:${e}`);return}window.localStorage.setItem(`panda:runtime:${e}`,t)}catch{}},hk=async()=>{const e=fk();Ys()&&await sp.configure({group:ik});const[t,a]=await Promise.all([U4(D6),U4(O6)]),l=e.platform==="web"?e.hubUrl:rc(t)||e.hubUrl,o=e.platform==="web"?!0:a==="true"||!!(l&&e.onboardingCompleted);return Vi={platform:e.platform,hubUrl:l,onboardingCompleted:o},I6(),Vi},f0=()=>Vi,mk=()=>rc(Vi.hubUrl),pk=()=>{const e=f0();return e.platform==="web"?dk():!e.hubUrl||!e.onboardingCompleted},P6=async e=>{const t=e.hubUrl===void 0?Vi.hubUrl:rc(e.hubUrl),a=e.onboardingCompleted??Vi.onboardingCompleted;return Vi={...Vi,hubUrl:t,onboardingCompleted:a},Vi.platform!=="web"&&await Promise.all([z4(D6,t||null),z4(O6,a?"true":"false")]),I6(),Vi},vp=()=>_.useSyncExternalStore(rk,f0,f0),gk=new Set(["localhost","127.0.0.1","::1"]),U6=()=>ok(),Wu=()=>mk(),B4=new Map,_k={direct:"Agent 直连",hub:"Hub 聚合"},yk=1e4,vk=1e4,z6=1e4,bk=1e4,H4=1200,$4=5e3;let Em=null,h0=0,lu=null,hu=null,ap=0,ou=null,Cm=null,m0=0,cu=null;const p0=new Map,Tm=new Map,Mm=new Map,si=e=>(e==null?void 0:e.trim())??"",B6=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/^\[|\]$/g,"").replace(/\.+$/,"").toLowerCase():""},H6=e=>gk.has(B6(e)),Pu=e=>{const t=(e==null?void 0:e.trim())??"";if(!t)return"";try{const a=new URL(t),l=B6(a.hostname);return l&&(a.hostname=l),a.toString().replace(/\/+$/,"")}catch{return t}},Uu=()=>typeof window>"u"||Ys()?!1:H6(window.location.hostname),xk=e=>{const t=e.trim();if(!t)return H4;try{const a=new URL(t);return H6(a.hostname)?H4:$4}catch{return $4}},zu=async e=>{const t=e.trim();if(!t)return!1;const a=Mm.get(t),l=Date.now();if(a&&l-a.checkedAt<bk)return a.reachable;const o=new AbortController,u=globalThis.setTimeout(()=>o.abort(),xk(t));try{const m=(await fetch(`${t}/health`,{signal:o.signal})).ok;return Mm.set(t,{reachable:m,checkedAt:Date.now()}),m}catch{return Mm.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},Ku=(e,t)=>{const a=`${e}::${(t==null?void 0:t.trim())??""}`,l=B4.get(a);if(l)return l;const o=M6(e,{wsBaseUrl:t});return B4.set(a,o),o},F4=()=>Ku($6()),q4=e=>{const t=e(hu);hu=t,ap=t?Date.now():0},u_=(e,t,a)=>({mode:"direct",label:e,baseUrl:t,client:Ku(t,a)}),$6=()=>{const e=Wu();if(!e)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");return e},_f=e=>{const t=e==="hub"?$6():U6();return{mode:e,label:_k[e],baseUrl:t,client:Ku(t)}},F6=e=>Pu(e.direct_base_url),Sk=e=>Pu(e.ws_base_url),W4=e=>{const t=F6(e)||e.tailscale_dns_name||e.tailscale_ip||e.host;return`无法直连节点 ${ic(e)}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},jk=async()=>{if(!Uu())return null;const e=Date.now();if(Cm&&e-m0<z6)return Cm;if(cu)return cu;cu=(async()=>{const t=U6();if(!await zu(t))return null;const a=await Ku(t).getPhaseOneSnapshot({fallbackToMock:!1});return Cm=a,m0=Date.now(),a})().catch(()=>null);try{return await cu}finally{cu=null}},q6=async e=>{var l,o;const t=await jk(),a=((o=(l=t==null?void 0:t.agents[0])==null?void 0:l.id)==null?void 0:o.trim())??"";return!!(a&&a===e.trim())},W6=async e=>{if(await q6(e.id))return{..._f("direct"),label:`Agent 直连 · ${ic(e)}(本机)`};const t=F6(e),a=Sk(e);return u_(`Agent 直连 · ${ic(e)}`,t,a||void 0)},wk=async e=>{if(await q6(e.agent_id))return{..._f("direct"),label:`Agent 直连 · ${e.agent_id}(本机)`};const t=Pu(e.direct_base_url),a=Pu(e.ws_base_url);return u_(`Agent 直连 · ${e.agent_id}`,t,a||void 0)},K6=e=>{var l;const t=si(e.agentId);if(!t)return null;const a=Ff(t);return a!=null&&a.directBaseUrl.trim()?u_(`Agent 直连 · ${((l=a.displayName)==null?void 0:l.trim())||a.name.trim()||t}`,Pu(a.directBaseUrl),Pu(a.wsBaseUrl)||void 0):null},K4=async e=>{const t=K6(e);if(t!=null&&t.baseUrl&&(await zu(t.baseUrl)||!Uu()))return t;const a=await G6(),l=a?Q6(a,e):null;if(!l)return null;const o=await W6(l);return o.baseUrl&&(await zu(o.baseUrl)||!Uu())?o:null},Q6=(e,t)=>{const a=si(t.agentId);return a?e.agents.find(l=>l.id===a)??null:null},Nk=e=>{const t=si(e.sessionId),a=si(e.projectId),l=si(e.agentId);return l?`agent:${l}`:a?`project:${a}`:t?`session:${t}`:""},G6=async()=>{const e=Date.now();if(hu&&e-ap<z6)return hu;if(ou)return ou;ou=(async()=>{const t=Wu();if(!t)return null;const a=await Ku(t).getHubDirectory();return hu=a,ap=Date.now(),a})().catch(()=>null);try{return await ou}finally{ou=null}},kk=async()=>{if(!Uu())return _f("hub");const e=Date.now();if(Em&&e-h0<yk)return Em;if(lu)return lu;lu=(async()=>{const t=Wu(),a=t&&await zu(t)?_f("hub"):_f("direct");return Em=a,h0=Date.now(),a})();try{return await lu}finally{lu=null}},Ek=async e=>{const t=Nk(e),a=Date.now(),l=t?p0.get(t):null;if(l&&a-l.cachedAt<vk)return l.target;const o=t?Tm.get(t):null;if(o)return o;const u=(async()=>{const f=si(e.sessionId),m=si(e.agentId),y=K6(e),g=Wu();if(!g&&!y&&!m)throw new Error("尚未配置 Panda Hub 地址,请先完成应用连接设置。");const S=g?Ku(g):null;if(m){const N=await K4(e);if(N)return N}if(f){const N=S?await S.getSessionLocation(f).catch(()=>null):null;if(!N){const C=m?await K4(e):null;if(C)return C;throw new Error("Hub 未返回目标会话位置,无法建立直连。")}const j=await wk(N);if(!j.baseUrl)throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`);if(await zu(j.baseUrl)||!Uu())return j;throw new Error(`无法直连节点 ${N.agent_id}(${N.direct_base_url||N.ws_base_url||"unknown"})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`)}if(si(e.projectId)&&!si(e.agentId))throw new Error("Project-scoped connection resolution now requires agentId.");const p=await G6(),v=p?Q6(p,e):null;if(!v)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const w=await W6(v);if(!w.baseUrl)throw new Error(W4(v));if(await zu(w.baseUrl)||!Uu())return w;throw new Error(W4(v))})();t&&Tm.set(t,u);try{const f=await u;return t&&p0.set(t,{target:f,cachedAt:Date.now()}),f}finally{t&&Tm.delete(t)}},xn=async e=>!(si(e==null?void 0:e.sessionId)||si(e==null?void 0:e.projectId)||si(e==null?void 0:e.agentId))?kk():Ek(e??{}),Ck=()=>{Em=null,h0=0,lu=null,hu=null,ap=0,ou=null,Cm=null,m0=0,cu=null,p0.clear(),Tm.clear(),Mm.clear()},Y6="panda:notification-settings",V6="panda:notified-completions",d_="panda:web-push-subscription-state",Tk=280,Z6="session-completions",hg={completionNotificationsEnabled:!1};let Rf=Ys()?"default":"unsupported";const qf=()=>{const e=Wu();if(!e)throw new Error("尚未配置 Panda Hub 地址。");return M6(e)},X6=e=>({completionNotificationsEnabled:(e==null?void 0:e.completionNotificationsEnabled)===!0}),Mk=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,J6=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(V6);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},Rk=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(V6,JSON.stringify(e))}catch{}},Ak=e=>{if(!e||typeof e!="object")return null;const t=typeof e.endpoint=="string"?e.endpoint.trim():"",a=typeof e.updatedAt=="string"?e.updatedAt.trim():"";return!t||!a?null:{completionNotificationsEnabled:e.completionNotificationsEnabled===!0,endpoint:t,updatedAt:a}},e3=()=>{if(typeof window>"u")return null;try{return Ak(JSON.parse(window.localStorage.getItem(d_)??"null"))}catch{return null}},t3=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(d_,JSON.stringify(e))}catch{}},ip=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(d_)}catch{}},n3=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))throw new Error("当前环境没有可用的 Service Worker。");return navigator.serviceWorker.ready},Dk=e=>{const t="=".repeat((4-e.length%4)%4),a=(e+t).replace(/-/g,"+").replace(/_/g,"/"),l=window.atob(a),o=new Uint8Array(l.length);for(let u=0;u<l.length;u+=1)o[u]=l.charCodeAt(u);return o},f_=async()=>{const e=await n3();return"pushManager"in e?e.pushManager.getSubscription():null},s3=e=>{var u,f;const t=e.toJSON(),a=e.endpoint.trim(),l=typeof((u=t.keys)==null?void 0:u.p256dh)=="string"?t.keys.p256dh.trim():"",o=typeof((f=t.keys)==null?void 0:f.auth)=="string"?t.keys.auth.trim():"";if(!a||!l||!o)throw new Error("浏览器返回的推送订阅信息不完整。");return{endpoint:a,expirationTime:typeof e.expirationTime=="number"?e.expirationTime:null,keys:{p256dh:l,auth:o}}},a3=async()=>{try{return await qf().getWebPushPublicConfig()}catch(e){throw new Error(e instanceof Error?e.message:"无法读取 Hub Web Push 配置。")}},g0=()=>{if(typeof window>"u")return hg;try{const e=window.localStorage.getItem(Y6);return e?X6(JSON.parse(e)):hg}catch{return hg}},Io=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Y6,JSON.stringify(X6(e)))}catch{}},Wf=()=>Ys()?!0:typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,Bu=()=>Ys()||!Wf()?!1:"PushManager"in window,mu=()=>Ys()?Rf:Wf()?Notification.permission:"unsupported",i3=e=>e==="granted"?"granted":e==="denied"?"denied":e==="prompt"?"default":"unsupported",r3=async()=>{_p()&&await Hf.createChannel({id:Z6,name:"任务完成提醒",description:"Panda 对话和任务完成提醒",importance:4,visibility:1,vibration:!0,lights:!0}).catch(()=>{})},h_=async()=>{if(Ys()){const e=await Hf.checkPermissions();return Rf=i3(e.display),Rf}return Wf()?Notification.permission:"unsupported"},_0=async()=>{if(Ys()){await r3();const e=await Hf.requestPermissions();return Rf=i3(e.display),Rf}return Wf()?Notification.requestPermission():"unsupported"},y0=()=>{var e;return((e=e3())==null?void 0:e.completionNotificationsEnabled)===!0},Ok=async e=>{if(!e.completionNotificationsEnabled||mu()!=="granted")return{synced:!1,reason:"notifications-disabled"};if(!Bu())return{synced:!1,reason:"unsupported"};const t=await a3();if(!t.supported||!t.vapid_public_key)return ip(),{synced:!1,reason:"hub-unsupported"};const a=await f_();if(!a)return ip(),{synced:!1,reason:"missing-browser-subscription"};const l=await qf().upsertWebPushSubscription({subscription:s3(a),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:du()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return t3({completionNotificationsEnabled:l.settings.completion_notifications_enabled,endpoint:l.endpoint,updatedAt:l.updated_at}),{synced:!0,endpoint:l.endpoint}},Q4=async e=>{if(!Bu())throw new Error("当前环境不支持 Web Push。");const t=await a3();if(!t.supported||!t.vapid_public_key)throw new Error(t.reason??"Hub 当前没有可用的 Web Push 配置。");const a=await n3(),o=await a.pushManager.getSubscription()??null??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Dk(t.vapid_public_key)}),u=await qf().upsertWebPushSubscription({subscription:s3(o),settings:{completion_notifications_enabled:e.completionNotificationsEnabled},device:{label:du()?"installed-pwa":"browser-tab",user_agent:typeof navigator<"u"?navigator.userAgent:null}});return t3({completionNotificationsEnabled:u.settings.completion_notifications_enabled,endpoint:u.endpoint,updatedAt:u.updated_at}),u},Ik=async()=>{if(!Bu())return ip(),{removed:!1};const e=await f_();if(e){try{await qf().removeWebPushSubscription({endpoint:e.endpoint})}catch{}try{await e.unsubscribe()}catch{}}return ip(),{removed:!!e}},Lk=async()=>{var l,o;if(!Bu())throw new Error("当前环境不支持 Web Push。");if(mu()!=="granted")throw new Error("请先授予系统通知权限。");const e=await f_(),t=e3(),a=((l=e==null?void 0:e.endpoint)==null?void 0:l.trim())||((o=t==null?void 0:t.endpoint)==null?void 0:o.trim())||"";if(!a)throw new Error("当前设备还没有可用的 Web Push 订阅。");return await qf().sendWebPushTest({endpoint:a}),{ok:!0,endpoint:a}},du=()=>{if(typeof window>"u")return!1;const e=navigator;return window.matchMedia("(display-mode: standalone)").matches||e.standalone===!0},G4=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),Pk=e=>{if(typeof e!="string")return"";const t=e.replace(/\r\n/g,`
|
|
67
|
+
`).replace(/\s+/g," ").trim();return t?Mk(t,Tk):""},Uk=(e,t)=>J6()[e]===t,mg=(e,t)=>{const a=J6();a[e]!==t&&Rk({...a,[e]:t})},l3=async e=>{if(!Wf())return!1;if(Ys()){if(await h_()!=="granted")return!1;await r3();try{return await Hf.schedule({notifications:[{id:Math.abs(Array.from(`${e.sessionId}:${e.completedAt}`).reduce((a,l)=>a*31+l.charCodeAt(0)|0,17)),title:e.title,body:e.body,channelId:Z6,schedule:{at:new Date(Date.now()+250),allowWhileIdle:!0},extra:{url:e.url,sessionId:e.sessionId,completedAt:e.completedAt}}]}),!0}catch{return!1}}if(typeof window>"u")return!1;const t={body:e.body,tag:`session-completed:${e.sessionId}:${e.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:e.sessionId,url:e.url,completedAt:e.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(e.title,t),!0}catch{try{const a=new Notification(e.title,t);return a.onclick=()=>{window.focus(),window.location.assign(e.url)},!0}catch{return!1}}},zk=async e=>{if(!Ys())return()=>{};const t=await Hf.addListener("localNotificationActionPerformed",a=>{var o;const l=typeof((o=a.notification.extra)==null?void 0:o.url)=="string"?a.notification.extra.url.trim():"";l&&e(l)});return()=>{t.remove()}},o3=1,Bk=10080*60*1e3,c3="panda-web-cache",Hu="app-state",u3="react-query",Y4="panda:storage-persist-result",Hk=new Set(["directory","bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),m_=()=>typeof window<"u"&&typeof window.indexedDB<"u",$k=e=>typeof e[0]=="string"&&Hk.has(e[0]),d3=async()=>m_()?await new Promise((e,t)=>{const a=window.indexedDB.open(c3,1);a.onupgradeneeded=()=>{const l=a.result;l.objectStoreNames.contains(Hu)||l.createObjectStore(Hu)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,Fk=async()=>{const e=await d3();if(!e)return null;try{return await new Promise((t,a)=>{const u=e.transaction(Hu,"readonly").objectStore(Hu).get(u3);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{e.close()}},qk=async e=>{const t=await d3();if(t)try{await new Promise((a,l)=>{const o=t.transaction(Hu,"readwrite");o.objectStore(Hu).put(e,u3),o.oncomplete=()=>a(),o.onerror=()=>l(o.error??new Error("Unable to write Panda cache record.")),o.onabort=()=>l(o.error??new Error("Writing Panda cache record was aborted."))})}finally{t.close()}},rp=async()=>{m_()&&await new Promise(e=>{const t=window.indexedDB.deleteDatabase(c3);t.onsuccess=()=>e(),t.onerror=()=>e(),t.onblocked=()=>e()})},Wk=async e=>{if(m_())try{const t=await Fk();if(!t)return;const a=Date.now()-t.persistedAt>Bk;if(t.version!==o3||a){await rp();return}v9(e,t.clientState)}catch{await rp().catch(()=>{})}},Kk=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(Y4))return;const t=await navigator.storage.persist();window.localStorage.setItem(Y4,t?"granted":"denied")}catch{}},Qk=e=>{if(typeof window>"u")return()=>{};Kk();let t=null,a=null,l=!1,o=!1;const u=async()=>{if(!o){if(a){l=!0;return}a=(async()=>{const S=y9(e,{shouldDehydrateQuery:p=>$k(p.queryKey)});await qk({version:o3,persistedAt:Date.now(),clientState:S})})();try{await a}catch{}finally{a=null,l&&(l=!1,u())}}},f=(S=!1)=>{if(!o){if(t!==null&&(window.clearTimeout(t),t=null),S){u();return}t=window.setTimeout(()=>{t=null,u()},1200)}},m=e.getQueryCache().subscribe(()=>{f(!1)}),y=()=>{document.visibilityState==="hidden"&&f(!0)},g=()=>{f(!0)};return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",g),()=>{o=!0,m(),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",g),t!==null&&(window.clearTimeout(t),t=null)}},f3=async e=>{Ck(),A6(),await rp().catch(()=>{}),e.removeQueries({predicate:t=>typeof t.queryKey[0]=="string"&&t.queryKey[0]!=="pwa-install-diagnostics"})},Gk=()=>{const e=Ei(),t=Pa(),a=vp();return i.jsx("main",{className:"runtime-onboarding",children:i.jsxs("div",{className:"runtime-onboarding__shell",children:[i.jsxs("section",{className:"runtime-onboarding__hero",children:[i.jsx("span",{className:"runtime-onboarding__eyebrow",children:"首次连接"}),i.jsx("h1",{className:"runtime-onboarding__title",children:"输入 Panda 访问地址"}),i.jsx("p",{className:"runtime-onboarding__summary",children:"填一次,之后打开就能直接进入。也支持扫码。"})]}),i.jsx("section",{className:"settings-panel runtime-onboarding__panel",children:i.jsx(a6,{title:"Hub 地址",description:"填写电脑上显示的访问地址。",initialHubUrl:a.hubUrl,hint:"手机能直接打开这个地址就可以。",saveLabel:"保存并进入",savingLabel:"连接中",saveDescription:"保存后立即进入,之后也能在设置里修改。",saveSuccessMessage:"地址已保存,正在进入 Panda。",onSaveSuccess:async l=>{await P6({hubUrl:l.url,onboardingCompleted:!0}),Ys()&&await _0().catch(()=>"unsupported")==="granted"&&Io({completionNotificationsEnabled:!0}),await f3(t),await e({to:"/nodes",replace:!0})}})})]})})},Ki=["directory","hub"],Yk=["directory","hub","recent-sessions"],rs=["directory","workspace"],Vk=["bootstrap","hub"],Zk=rs,V4=e=>{if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Xk=(e,t)=>{if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1)if(!p_(e[a],t[a]))return!1;return!0},p_=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Xk(e,t);if(V4(e)&&V4(t)){const a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(const o of a)if(!(o in t)||!p_(e[o],t[o]))return!1;return!0}return!1},yf=(e,t)=>e!==void 0&&p_(e,t)?e:t,Rm=(e,t,a)=>{if(!e||e.length===0)return t;const l=new Map(e.map(u=>[a(u),u])),o=t.map(u=>yf(l.get(a(u)),u));return e.length===o.length&&e.every((u,f)=>u===o[f])?e:o},Z4=(e,t,a,l=new Date().toISOString())=>{if(!e)return e;let o=!1;const u=e.agents.map(f=>{if(f.id!==t||!Object.entries(a).some(([g,S])=>f[g]!==S))return f;const y={...f,...a};return o=!0,y});return o?{...e,generated_at:l,agents:u}:e},h3=(e,t)=>{if(!e)return t;const a=Rm(e.agents,t.agents,o=>o.id),l=yf(e.generated_at,t.generated_at);return e.agents===a&&e.generated_at===l?e:{...t,generated_at:l,agents:a}},Jk=180,eE=()=>{const e=Pa(),{hubUrl:t}=vp(),a=_.useRef(null),l=uc(),o=Ff(l),u=!!(l&&o);return _.useEffect(()=>{if(!t||u)return;let f=!1,m,y=!1,g=!1,S=!1;const p=()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},v=(C,R)=>{const z=new Date().toISOString();e.setQueryData(Ki,O=>Z4(O,C,{status:R},z)??O),q4(O=>Z4(O,C,{status:R},z)??O)},w=async()=>{try{const C=await F4().getHubDirectory();if(f)return;q4(()=>C),e.setQueryData(Ki,R=>h3(R,C))}catch{}},N=()=>{p(),a.current=window.setTimeout(()=>{a.current=null,w()},Jk)},j=C=>{var R,z;if(C.type==="agent.online"){if(S){S=!1;return}const O=typeof((R=C.payload)==null?void 0:R.agentId)=="string"?C.payload.agentId.trim():"";if(!O)return;v(O,"online"),N();return}if(C.type==="agent.offline"){const O=typeof((z=C.payload)==null?void 0:z.agentId)=="string"?C.payload.agentId.trim():"";if(!O)return;v(O,"offline"),N();return}C.type==="snapshot.changed"&&N()};w();try{m=F4().connectEvents(j,{reconnectWhenHidden:!0,onStatus:C=>{if(C.state==="connected"){S=!0,y&&g&&(g=!1,N()),y=!0;return}y&&(g=!0)}})}catch{}return()=>{f=!0,p(),m==null||m()}},[t,e,u]),null},Kf=e=>[...e].sort((t,a)=>{const l=Number(a.pinned)-Number(t.pinned);return l!==0?l:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),ro=e=>{if(!e)return e;const t=new Map(e.project_stats.map(a=>[a.project_id,a]));return{...e,project_stats:e.projects.map(a=>{const l=e.sessions.filter(u=>u.project_id===a.id),o=t.get(a.id);return{project_id:a.id,visible_session_count:l.filter(u=>!u.archived).length,archived_session_count:(o==null?void 0:o.archived_session_count)??0,hidden_history_count:(o==null?void 0:o.hidden_history_count)??0}})}},tE=e=>({id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent}),nE=e=>({id:e.id,agent_id:e.agent_id,name:e.name,display_name:e.display_name,pinned:e.pinned,path:e.path}),v0=e=>{if(!e)return null;const t={};return typeof e.title=="string"&&(t.title=e.title),typeof e.archived=="boolean"&&(t.archived=e.archived),typeof e.pinned=="boolean"&&(t.pinned=e.pinned),typeof e.last_event_at=="string"&&(t.last_event_at=e.last_event_at),(e.run_state==="idle"||e.run_state==="running"||e.run_state==="completed")&&(t.run_state=e.run_state),(e.run_state_changed_at===null||typeof e.run_state_changed_at=="string")&&(t.run_state_changed_at=e.run_state_changed_at),(e.subagent===null||typeof e.subagent=="object"&&e.subagent!==null)&&(t.subagent=e.subagent),Object.keys(t).length>0?t:null},lp=(e,t)=>!!(e!=null&&e.sessions.some(a=>a.id===t)),op=(e,t,a)=>!e||!lp(e,t)?e:ro({...e,sessions:Kf(e.sessions.map(l=>l.id===t?{...l,...a}:l))}),b0=(e,t,a)=>{if(!e)return e;const l=e.sessions.find(f=>f.id===t);if(!l)return e;const o=new Date(a).getTime(),u=new Date(l.last_event_at).getTime();return!Number.isFinite(o)||Number.isFinite(u)&&o<=u?e:op(e,t,{last_event_at:a})},cf=(e,t,a)=>{if(!e)return e;const{last_event_at:l,...o}=a;let u=op(e,t,o);return typeof l=="string"&&l.trim()&&(u=b0(u,t,l)),u},m3=(e,t,a)=>{if(!e||t.length===0)return e;const l=new Set(t);return ro({...e,sessions:Kf(e.sessions.map(o=>l.has(o.id)?{...o,...a}:o))})},p3=(e,t)=>{var u;if(!e||t.length===0)return e;const a=new Set(t),l=e.sessions.filter(f=>!a.has(f.id)),o=a.has(e.active_session_id)?((u=l[0])==null?void 0:u.id)??"":e.active_session_id;return ro({...e,active_session_id:o,sessions:Kf(l)})},pu=(e,t,a)=>!e||!e.projects.some(l=>l.id===t)?e:ro({...e,projects:e.projects.map(l=>l.id===t?{...l,...a}:l)}),cp=(e,t)=>{if(!e||t.length===0||e.projects.length<=1)return e;const a=new Map(e.projects.map(u=>[u.id,u])),l=new Set,o=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),o.push(f))}for(const u of e.projects)l.has(u.id)||o.push(u);return o.every((u,f)=>{var m;return u.id===((m=e.projects[f])==null?void 0:m.id)})?e:ro({...e,projects:o})},up=(e,t)=>{var o;if(!e)return e;const a=e.sessions.filter(u=>u.project_id!==t),l=a.some(u=>u.id===e.active_session_id)?e.active_session_id:((o=a[0])==null?void 0:o.id)??"";return ro({...e,active_session_id:l,projects:e.projects.filter(u=>u.id!==t),sessions:Kf(a)})},g3=(e,t)=>{if(!e)return e;const a=tE(t),l=[a,...e.sessions.filter(o=>o.id!==a.id)];return ro({...e,generated_at:new Date().toISOString(),active_session_id:a.id,sessions:Kf(l)})},sE=(e,t)=>{if(!e)return e;const a=nE(t),l=[a,...e.projects.filter(o=>o.id!==a.id)];return ro({...e,generated_at:new Date().toISOString(),projects:l})},aE=(e,t)=>{if(!e)return t;const a=t.agent?yf(e.agent??void 0,t.agent):e.agent===null?e.agent:null,l=Rm(e.projects,t.projects,y=>y.id),o=Rm(e.project_stats,t.project_stats,y=>y.project_id),u=Rm(e.sessions,t.sessions,y=>y.id),f=yf(e.generated_at,t.generated_at),m=yf(e.active_session_id,t.active_session_id);return e.agent===a&&e.projects===l&&e.project_stats===o&&e.sessions===u&&e.generated_at===f&&e.active_session_id===m?e:{...t,generated_at:f,agent:a,projects:l,project_stats:o,sessions:u,active_session_id:m}},iE=async()=>{const e=await xn();if(e.mode==="direct"){const t=await e.client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:t.generated_at,agents:t.agents}}return e.client.getHubDirectory()},rE=async()=>{const e=await xn();if(e.mode==="direct"){const t=await e.client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:t.generated_at,recent_sessions:[...t.sessions].sort((a,l)=>+new Date(l.last_event_at)-+new Date(a.last_event_at)).slice(0,24).map(a=>({id:a.id,title:a.title,run_state:a.run_state,run_state_changed_at:a.run_state_changed_at,latest_assistant_message:a.latest_assistant_message}))}}return e.client.getHubRecentSessions()},lE=async e=>(await xn(e==null?void 0:e.scope)).client.getWorkspaceDirectory({selectedSessionId:(e==null?void 0:e.selectedSessionId)??null}),oE=(e,t)=>h3(e,t),cE=(e,t)=>aE(e,t),x0=e=>{var t,a,l;return[...rs,((t=e==null?void 0:e.scope)==null?void 0:t.agentId)??"",(a=e==null?void 0:e.scope)!=null&&a.agentId?"":((l=e==null?void 0:e.scope)==null?void 0:l.sessionId)??""]},_3=e=>({queryKey:Ki,enabled:(e==null?void 0:e.enabled)??!0,queryFn:iE,structuralSharing:oE,staleTime:3e4,refetchInterval:3e5,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),uE=()=>({queryKey:Yk,queryFn:rE,staleTime:3e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),y3=e=>({queryKey:x0(e),enabled:(e==null?void 0:e.enabled)??!0,queryFn:()=>lE(e),placeholderData:l9,structuralSharing:cE,staleTime:1e4,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1}),v3=async e=>e.fetchQuery(_3()),dE=async e=>e.fetchQuery(uE()),uf=async(e,t)=>e.fetchQuery(y3(t)),fE=1200,hE=e=>typeof document>"u"?!1:document.visibilityState==="visible"&&np()===e,b3=e=>{var t;return((t=e==null?void 0:e.title)==null?void 0:t.trim())||"当前会话"},mE=e=>e.run_state!=="completed"?null:(typeof e.run_state_changed_at=="string"?e.run_state_changed_at.trim():"")||null,pE=(e,t)=>{if(!e||(typeof e.completionReason=="string"?e.completionReason:"completed")!=="completed")return null;const l=typeof e.sessionId=="string"?e.sessionId.trim():"",o=typeof e.completedAt=="string"?e.completedAt.trim():"";if(!l||!o)return null;const u=(t==null?void 0:t.recent_sessions.find(y=>y.id===l))??null,f=typeof e.sessionTitle=="string"&&e.sessionTitle.trim()||b3(u),m=(typeof e.finalReply=="string"?e.finalReply:"")||(u==null?void 0:u.latest_assistant_message)||"";return{sessionId:l,completedAt:o,sessionTitle:f,finalReply:m}},gE=(e,t)=>{const a=new Map(((e==null?void 0:e.recent_sessions)??[]).map(l=>[l.id,l]));return t.recent_sessions.flatMap(l=>{var m;const o=mE(l);if(!o)return[];const u=((m=l.latest_assistant_message)==null?void 0:m.trim())??"";if(!u)return[];const f=a.get(l.id);return(f==null?void 0:f.run_state)==="completed"&&f.run_state_changed_at===o?[]:[{sessionId:l.id,completedAt:o,sessionTitle:b3(l),finalReply:u}]})},_E=(e,t,a)=>{if(!e||!a)return e;let l=!1;const o=e.recent_sessions.map(u=>{if(u.id!==t)return u;const f=a.run_state==="idle"||a.run_state==="running"||a.run_state==="completed"?a.run_state:null,m={...u,...typeof a.title=="string"?{title:a.title}:null,...f?{run_state:f}:null,...a.run_state_changed_at===null||typeof a.run_state_changed_at=="string"?{run_state_changed_at:a.run_state_changed_at}:null,...a.latest_assistant_message===null||typeof a.latest_assistant_message=="string"?{latest_assistant_message:a.latest_assistant_message}:null};return l=l||m.title!==u.title||m.run_state!==u.run_state||m.run_state_changed_at!==u.run_state_changed_at||m.latest_assistant_message!==u.latest_assistant_message,m});return l?{...e,recent_sessions:o}:e},yE=({})=>{const e=Pa(),t=_.useRef(void 0),a=_.useRef(new Set),l=_.useRef(null),o=_.useRef(!1),u=uc(),f=Ff(u),m=u&&f?u:null;return _.useEffect(()=>{const y=async O=>{const k=g0();if(!Ys()&&!k.completionNotificationsEnabled||mu()!=="granted")return;if(y0()){mg(O.sessionId,O.completedAt);return}const L=`${O.sessionId}:${O.completedAt}`;if(!a.current.has(L)&&!Uk(O.sessionId,O.completedAt)){if(hE(O.sessionId)){mg(O.sessionId,O.completedAt);return}a.current.add(L);try{await l3({sessionId:O.sessionId,completedAt:O.completedAt,title:O.sessionTitle,body:Pk(O.finalReply),url:`/session/${O.sessionId}`})&&mg(O.sessionId,O.completedAt)}finally{a.current.delete(L)}}},g=async O=>{for(const k of O)await y(k)};let S=!1,p,v=!1,w=!1,N=!1;const j=async()=>{if(!m)return dE(e);const k=await(await xn({agentId:m})).client.getPhaseOneSnapshot({fallbackToMock:!1});return{generated_at:k.generated_at,recent_sessions:[...k.sessions].sort((L,K)=>+new Date(K.last_event_at)-+new Date(L.last_event_at)).slice(0,24).map(L=>({id:L.id,title:L.title,run_state:L.run_state,run_state_changed_at:L.run_state_changed_at,latest_assistant_message:L.latest_assistant_message}))}};j().then(O=>{S||(t.current=O)}).catch(()=>{});const C=async()=>{if(!o.current){o.current=!0;try{const O=await j();if(S)return;const k=t.current;if(t.current=O,!k)return;await g(gE(k,O))}catch{}finally{o.current=!1}}},R=()=>{l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,C()},fE)},z=O=>{var k,L;if(O.type==="turn.completed"){const K=pE(O.payload,t.current);K&&y(K);return}if(O.type==="session.updated"){const K=typeof((k=O.payload)==null?void 0:k.sessionId)=="string"?O.payload.sessionId.trim():"",J=(L=O.payload)!=null&&L.sessionPatch&&typeof O.payload.sessionPatch=="object"?O.payload.sessionPatch:null;K&&J&&(t.current=_E(t.current,K,J));return}O.type==="agent.online"&&N&&(N=!1)};return xn(m?{agentId:m}:void 0).then(O=>{S||(p=O.client.connectEvents(z,{reconnectWhenHidden:!0,onStatus:k=>{if(k.state==="connected"){N=!0,v&&w&&(w=!1,R()),v=!0;return}v&&(w=!0)}}))}),()=>{S=!0,l.current!==null&&(clearTimeout(l.current),l.current=null),p==null||p()}},[e,m]),null},g_=e=>e.replace(/[\\/]+$/,""),dp=e=>g_(e).replace(/\\/g,"/").toLowerCase(),vE=e=>{const t=g_(e.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),l=a[a.length-1];return l?l.endsWith(":")?t:l:t},x3=e=>{if(!e)return null;const t=e.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=g_(t),l=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(l<0)return null;const o=a.slice(0,l);return o?/^[A-Za-z]:$/.test(o)?`${o}\\`:o:a.startsWith("/")?"/":null},S3=async e=>(await xn({agentId:e.agentId})).client.listDirectories(e),bE=async e=>(await xn({agentId:e.agentId})).client.createDirectory(e),xE=async e=>{const t=e.bootstrapQueryKey??["bootstrap"],a=e.projects.find(u=>u.agent_id===e.agentId&&dp(u.path)===dp(e.path));if(a)return a;const o=await(await xn({agentId:e.agentId})).client.createProject({agentId:e.agentId,name:vE(e.path),path:e.path});return e.queryClient.invalidateQueries({queryKey:t}),o.project},X4=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),SE=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),jE=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),J4=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),wE=({agentId:e,initialPath:t=null,title:a="选择开发版代码目录",subtitle:l="按需展开目录,只在你进入某一层时加载它的子目录。",confirmLabel:o="使用这个目录",onClose:u,onSelect:f})=>{const[m,y]=_.useState(t),[g,S]=_.useState(t),[p,v]=_.useState([]),[w,N]=_.useState(!0),[j,C]=_.useState(null);_.useEffect(()=>{y(t),S(t)},[t]),_.useEffect(()=>{let L=!1;return N(!0),C(null),S3({agentId:e,path:m}).then(K=>{L||v(K)}).catch(K=>{L||(C(K instanceof Error?K.message:"目录列表加载失败。"),v([]))}).finally(()=>{L||N(!1)}),()=>{L=!0}},[e,m]);const R=x3(m),z=R!==null||J4(m),O=()=>{if(R!==null){y(R),S(R);return}J4(m)&&(y(null),S(null))},k=L=>{y(L),S(L)};return i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true","aria-label":a,children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim","aria-label":"关闭目录选择",onClick:u}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsx("section",{className:"directory-picker settings-directory-picker",children:i.jsxs("div",{className:"directory-picker__panel",children:[i.jsx("header",{className:"directory-picker__header",children:i.jsxs("div",{className:"directory-picker__heading",children:[i.jsx("h2",{children:a}),l?i.jsx("p",{children:l}):null]})}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),i.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&S(m)},disabled:!m,"aria-pressed":g===m,children:[i.jsx("span",{className:"directory-picker__path-icon",children:i.jsx(X4,{})}),i.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"目录"}),i.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:w?i.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):j?i.jsx("div",{className:"directory-picker__state is-error",children:j}):p.length===0?i.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):p.map(L=>{const K=g===L.path;return i.jsxs("div",{className:`directory-picker__row ${K?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:()=>{S(L.path)},onDoubleClick:()=>{L.has_children&&k(L.path)},"aria-selected":K,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(X4,{})}),i.jsx("span",{className:"directory-picker__row-name",children:L.name}),K?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(jE,{})}):null]}),L.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${L.name}`,onClick:()=>k(L.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(SE,{})})}):null]},L.path)})})]}),i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[z?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:O,children:i.jsx("span",{children:"返回上级"})}):null,i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:u,children:i.jsx("span",{children:"取消"})}),i.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g,onClick:()=>{g&&f(g)},children:o})]})})]})})})]})},j3="panda-dev-manager-last-apk-download",NE=9e4,um=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},kE=e=>typeof e!="number"||!Number.isFinite(e)||e<=0?"未知":e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/1024/1024*10)/10} MB`,EE=()=>{if(typeof window>"u")return null;try{const e=window.localStorage.getItem(j3);if(!e)return null;const t=JSON.parse(e);return typeof t.artifactId!="string"||typeof t.triggeredAt!="number"||!Number.isFinite(t.triggeredAt)?null:{artifactId:t.artifactId,triggeredAt:t.triggeredAt}}catch{return null}},CE=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(j3,JSON.stringify({artifactId:e,triggeredAt:Date.now()}))}catch{}},Xc=e=>e==="succeeded"?"通过":e==="failed"?"异常":"进行中",Jd=e=>e==="succeeded"?"is-success":e==="failed"?"is-danger":"is-muted",eb=e=>e==null?"未测试":e?"通过":"异常",tb=e=>e==null?"is-muted":e?"is-success":"is-danger",TE=e=>e?e==="running"?"运行中":e==="stopped"?"已停止":e==="missing"?"未注册":"未知":"未注册",Dl=e=>e?`http://127.0.0.1:${e}`:"",dm=e=>e?`ws://127.0.0.1:${e}/ws`:"",nb=e=>({...e}),pg=(e,t)=>{if(!e||e.config.updated_at!==t.config.updated_at)return t;const a=new Map(e.services.map(l=>[l.key,l]));return{...t,services:t.services.map(l=>{if(l.probe)return l;const o=a.get(l.key);return o!=null&&o.probe?{...l,probe:o.probe}:l})}},ME=({isActive:e,agentId:t})=>{var ne;const a=Pa(),[l,o]=_.useState(null),[u,f]=_.useState(null),[m,y]=_.useState(""),[g,S]=_.useState(!1),[p,v]=_.useState(null),[w,N]=_.useState(!1),j=t?{agentId:t}:void 0,C=["settings-dev-manager",t??"no-agent"],R=is({queryKey:C,queryFn:async()=>{const U=await xn(j),ie=a.getQueryData(C),Se=await U.client.getDevManagerSnapshot({includeServiceProbe:!1});return{baseUrl:U.baseUrl,snapshot:pg(ie==null?void 0:ie.snapshot,Se)}},enabled:e&&!!t,refetchOnWindowFocus:!1,staleTime:0,refetchInterval:U=>{const ie=U.state.data;return ie!=null&&ie.snapshot.jobs.some(Se=>Se.status==="running")?2e3:!1}});_.useEffect(()=>{var ie;const U=(ie=R.data)==null?void 0:ie.snapshot.config;U&&(l&&u===U.updated_at||(o(nb(U)),f(U.updated_at),y(""),S(!1)))},[R.data,l,u]);const z=ss({mutationFn:async()=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法保存开发版配置。");if(!l)throw new Error("开发版配置还没有加载完成。");return(await xn(j)).client.saveDevManagerConfig({...l,npm_token:m||null,clear_npm_token:g})},onSuccess:U=>{a.setQueryData(C,ie=>({baseUrl:(ie==null?void 0:ie.baseUrl)??"",snapshot:pg(ie==null?void 0:ie.snapshot,U)})),o(nb(U.config)),f(U.config.updated_at),y(""),S(!1),v("开发版配置已保存。")},onError:U=>{v(U instanceof Error?U.message:"保存配置失败。")}}),O=ss({mutationFn:async U=>{if(!j)throw new Error("当前没有可用的开发节点,暂时无法执行开发版管理操作。");return(await xn(j)).client.executeDevManagerAction({action:U})},onSuccess:(U,ie)=>{var Se,se,we;a.setQueryData(C,ye=>({baseUrl:(ye==null?void 0:ye.baseUrl)??"",snapshot:pg(ye==null?void 0:ye.snapshot,U.snapshot)})),v(ie==="install-latest-release"?"后台升级助手已启动,当前连接会短时断开,请等待正式版自动恢复。":ie==="install-release-services"?((Se=U.job)==null?void 0:Se.summary)??"正式版服务注册任务已启动。":ie==="uninstall-release-services"?((se=U.job)==null?void 0:se.summary)??"正式版服务移除任务已启动。":((we=U.job)==null?void 0:we.summary)??"任务已启动。")},onError:U=>{v(U instanceof Error?U.message:"执行操作失败。")}}),k=((ne=R.data)==null?void 0:ne.snapshot)??null,L=(k==null?void 0:k.jobs[0])??null,K=(k==null?void 0:k.jobs.find(U=>U.status==="running"))??null,J=(k==null?void 0:k.jobs.find(U=>U.kind==="npm-publish"))??null,q=(k==null?void 0:k.jobs.find(U=>U.kind==="release-service-install"))??null,Y=(k==null?void 0:k.jobs.find(U=>U.kind==="release-service-uninstall"))??null,Q=(k==null?void 0:k.jobs.find(U=>U.kind==="release-install-run"))??null,G=L,ge=_.useMemo(()=>(k==null?void 0:k.services.filter(U=>U.key.startsWith("dev-")))??[],[k]),me=_.useMemo(()=>(k==null?void 0:k.services.filter(U=>U.key.startsWith("release-")))??[],[k]),Z=_.useMemo(()=>ge.some(U=>U.status==="running")?"部分或全部运行中":ge.some(U=>U.status==="degraded")?"存在异常":"未运行",[ge]),he=(U,ie)=>{o(Se=>Se&&{...Se,[U]:ie})},M=(U,ie)=>{const Se=Number(ie)||null;o(se=>{if(!se)return se;const we={...se,[U]:Se};if(U==="dev_hub_port"){const ye=Dl(se.dev_hub_port),Oe=Dl(Se);se.dev_agent_hub_url===ye&&(we.dev_agent_hub_url=Oe),se.dev_web_hub_url===ye&&(we.dev_web_hub_url=Oe)}if(U==="dev_agent_port"){const ye=Dl(se.dev_agent_port),Oe=Dl(Se),Le=dm(se.dev_agent_port),_t=dm(Se);se.dev_agent_direct_base_url===ye&&(we.dev_agent_direct_base_url=Oe),se.dev_agent_ws_base_url===Le&&(we.dev_agent_ws_base_url=_t)}if(U==="release_hub_port"){const ye=Dl(se.release_hub_port),Oe=Dl(Se);se.release_agent_hub_url===ye&&(we.release_agent_hub_url=Oe)}if(U==="release_agent_port"){const ye=Dl(se.release_agent_port),Oe=Dl(Se),Le=dm(se.release_agent_port),_t=dm(Se);se.release_agent_direct_base_url===ye&&(we.release_agent_direct_base_url=Oe),se.release_agent_ws_base_url===Le&&(we.release_agent_ws_base_url=_t)}return we})},$=async()=>{if(!(k!=null&&k.apk_artifact)){v("当前还没有可下载的 APK。");return}if(!j){v("当前没有可用的开发节点,暂时无法下载 APK。");return}const U=EE();if((U==null?void 0:U.artifactId)===k.apk_artifact.artifact_id&&Date.now()-U.triggeredAt<NE){v("同一个 APK 刚刚已经触发过下载。如果安装确认没有弹出,请先查看系统下载列表或等待浏览器处理完成。");return}const ie=await xn(j),Se=new URL(k.apk_artifact.download_path,ie.baseUrl).toString();CE(k.apk_artifact.artifact_id),window.open(Se,"_blank","noopener,noreferrer"),v("APK 下载已触发。")},ee=U=>{he("repo_path",U),N(!1),v(`已选中开发版目录:${U}`)},oe=O.isPending;if(R.isLoading&&!k)return i.jsx("p",{className:"settings-block__status",children:"正在加载开发版管理信息…"});if(R.error instanceof Error)return i.jsx("p",{className:"settings-block__status",children:R.error.message});if(!t)return i.jsx("p",{className:"settings-block__status",children:"当前没有可用的代码线程节点,请先在会话里连接到目标 agent,再使用开发版管理。"});if(!k||!l)return i.jsx("p",{className:"settings-block__status",children:"当前还没有可用的开发版管理数据。"});const ae=O.variables,I=k.node_runtime.versions.length>0;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"开发版与正式版双环境"}),i.jsx("p",{className:"settings-panel__subtitle",children:"正式版保持默认可用,开发版走独立端口和独立命令。首屏只读取轻量快照,状态测试按端口连通性快测。"})]})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"开发版代码"}),i.jsx("strong",{children:k.config.repo_path??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"正式版版本"}),i.jsx("strong",{children:k.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"开发版状态"}),i.jsx("strong",{children:Z})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"最新 APK"}),i.jsx("strong",{children:k.apk_artifact?um(k.apk_artifact.built_at):"尚未生成"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"基础配置"}),i.jsx("p",{className:"settings-panel__subtitle",children:"保存开发版路径、nvm 版本、启动参数,以及正式版升级后自动恢复所需配置。"})]}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void z.mutateAsync(),disabled:z.isPending,children:z.isPending?"保存中…":"保存配置"})})]}),i.jsxs("div",{className:"dev-manager-form-grid",children:[i.jsxs("div",{className:"dev-manager-form-section dev-manager-field--wide",children:[i.jsx("strong",{children:"开发版运行配置"}),i.jsx("p",{children:"这些配置直接用于启动、重启、停止开发版 Hub + Agent + Web。启动参数会追加到对应启动命令末尾。"})]}),i.jsxs("div",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版代码路径"}),i.jsx("input",{type:"text",className:`dev-manager-path-display ${l.repo_path?"is-selected":""}`,value:l.repo_path??"",placeholder:t?"点击下方按钮选择目录":"当前没有可用节点,暂时无法浏览目录",readOnly:!0,onClick:()=>{t&&N(!0)}}),i.jsxs("div",{className:"settings-actions-row dev-manager-path-actions",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>N(!0),disabled:!t,children:"选择目录"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>he("repo_path",null),disabled:!l.repo_path,children:"清空"})]}),i.jsx("small",{className:"dev-manager-field-hint",children:"使用内置目录弹层懒加载浏览;这里只保存最终选中的开发版仓库路径。"})]}),i.jsxs("div",{className:"settings-field",children:[i.jsx("span",{children:"Node 版本"}),i.jsxs("select",{value:l.nvm_version??"",onChange:U=>he("nvm_version",U.target.value||null),children:[i.jsx("option",{value:"",children:"保持系统默认"}),k.node_runtime.versions.map(U=>i.jsx("option",{value:U,children:U},U))]}),i.jsx("small",{className:`dev-manager-field-hint ${I?"":"is-danger"}`,children:I?k.node_runtime.manager==="nvm-windows"?"下拉内容包含当前正在运行的 Node 版本,以及这台电脑上 nvm-windows 已安装的版本。":"下拉内容至少包含当前正在运行的 Node 版本;如果这台电脑安装了 nvm-windows,也会一并列出。":k.node_runtime.error||"当前没有检测到可用的 Node 版本。"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"npm 令牌"}),i.jsx("input",{type:"password",value:m,onChange:U=>{S(!1),y(U.target.value)},placeholder:k.credentials.has_npm_token?`已保存:${k.credentials.npm_token_hint??"******"}`:"输入新的 npm token"})]}),i.jsx("div",{className:"settings-actions-row dev-manager-token-actions",children:i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{y(""),S(!0)},children:"清空令牌"})}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Hub 端口"}),i.jsx("input",{type:"number",value:l.dev_hub_port??"",onChange:U=>M("dev_hub_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 端口"}),i.jsx("input",{type:"number",value:l.dev_agent_port??"",onChange:U=>M("dev_agent_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Web 端口"}),i.jsx("input",{type:"number",value:l.dev_web_port??"",onChange:U=>M("dev_web_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent -> Hub URL"}),i.jsx("input",{type:"text",value:l.dev_agent_hub_url,onChange:U=>he("dev_agent_hub_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 直连 URL"}),i.jsx("input",{type:"text",value:l.dev_agent_direct_base_url,onChange:U=>he("dev_agent_direct_base_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent WS URL"}),i.jsx("input",{type:"text",value:l.dev_agent_ws_base_url,onChange:U=>he("dev_agent_ws_base_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Agent 名称"}),i.jsx("input",{type:"text",value:l.dev_agent_name,onChange:U=>he("dev_agent_name",U.target.value),placeholder:"留空后默认显示为直连地址 host:port"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"开发版 Web -> Hub URL"}),i.jsx("input",{type:"text",value:l.dev_web_hub_url,onChange:U=>he("dev_web_hub_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Hub 追加参数"}),i.jsx("textarea",{value:l.dev_hub_args,onChange:U=>he("dev_hub_args",U.target.value),placeholder:"会直接追加到 corepack pnpm dev:hub 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Agent 追加参数"}),i.jsx("textarea",{value:l.dev_agent_args,onChange:U=>he("dev_agent_args",U.target.value),placeholder:"会直接追加到 corepack pnpm dev:agent 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"开发版 Web 追加参数"}),i.jsx("textarea",{value:l.dev_web_args,onChange:U=>he("dev_web_args",U.target.value),placeholder:"会直接追加到开发版 Web 的 vite 命令后面"})]}),i.jsxs("div",{className:"dev-manager-form-section dev-manager-field--wide",children:[i.jsx("strong",{children:"正式版自动恢复配置"}),i.jsx("p",{children:"这些配置不是给当前已运行的正式版实时改端口,而是点击“安装并运行”后,后台升级助手用它重新拉起正式版 Hub + Agent。"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Hub 端口(自动恢复)"}),i.jsx("input",{type:"number",value:l.release_hub_port??"",onChange:U=>M("release_hub_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 端口(自动恢复)"}),i.jsx("input",{type:"number",value:l.release_agent_port??"",onChange:U=>M("release_agent_port",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Hub 服务名"}),i.jsx("input",{type:"text",value:l.release_hub_service_name,onChange:U=>he("release_hub_service_name",U.target.value),placeholder:"PandaHub"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 服务名"}),i.jsx("input",{type:"text",value:l.release_agent_service_name,onChange:U=>he("release_agent_service_name",U.target.value),placeholder:"PandaAgent"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent -> Hub URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_hub_url,onChange:U=>he("release_agent_hub_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 直连 URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_direct_base_url,onChange:U=>he("release_agent_direct_base_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent WS URL(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_ws_base_url,onChange:U=>he("release_agent_ws_base_url",U.target.value)})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"正式版 Agent 名称(自动恢复)"}),i.jsx("input",{type:"text",value:l.release_agent_name,onChange:U=>he("release_agent_name",U.target.value),placeholder:"留空后默认显示为直连地址 host:port"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"正式版 Hub 追加参数(自动恢复)"}),i.jsx("textarea",{value:l.release_hub_args,onChange:U=>he("release_hub_args",U.target.value),placeholder:"会直接追加到 panda hub 后面"})]}),i.jsxs("label",{className:"settings-field dev-manager-field--wide",children:[i.jsx("span",{children:"正式版 Agent 追加参数(自动恢复)"}),i.jsx("textarea",{value:l.release_agent_args,onChange:U=>he("release_agent_args",U.target.value),placeholder:"会直接注入 panda agent 命令后面"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"开发版运行控制"}),i.jsx("p",{className:"settings-panel__subtitle",children:"启动、重启、停止开发版 Hub / Agent / Web。进入页面默认不做探测,点击状态测试后仅按端口连通性快速判断。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void O.mutateAsync("start-development"),disabled:oe,children:ae==="start-development"&&O.isPending?"启动中…":"启动"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void O.mutateAsync("restart-development"),disabled:oe,children:ae==="restart-development"&&O.isPending?"重启中…":"重启"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void O.mutateAsync("stop-development"),disabled:oe,children:ae==="stop-development"&&O.isPending?"停止中…":"停止"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void O.mutateAsync("probe-development"),disabled:oe,children:ae==="probe-development"&&O.isPending?"测试中…":"状态测试"})]})]}),i.jsx("div",{className:"dev-manager-service-grid",children:ge.map(U=>{var ie,Se;return i.jsxs("article",{className:`settings-diagnostic-list__item dev-manager-service-card is-${U.status}`,children:[i.jsx("strong",{children:U.label}),i.jsxs("span",{children:["上次测试:"," ",i.jsx("strong",{className:tb((ie=U.probe)==null?void 0:ie.ok),children:eb((Se=U.probe)==null?void 0:Se.ok)})]}),i.jsxs("span",{children:["端口:",U.configured_port??"未配置"]}),U.detected_pids.length>0?i.jsxs("span",{children:["PID:",U.detected_pids.join(", ")]}):null]},U.key)})})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"npm 发布与正式版恢复"}),i.jsx("p",{className:"settings-panel__subtitle",children:"发布最新 npm 包,注册 Windows 服务,并在升级后优先按服务方式恢复正式版 Hub + Agent。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void O.mutateAsync("publish-npm"),disabled:O.isPending,children:ae==="publish-npm"&&O.isPending?"发布中…":"发布"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void O.mutateAsync("install-release-services"),disabled:O.isPending,children:ae==="install-release-services"&&O.isPending?"注册中…":"注册/更新服务"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void O.mutateAsync("uninstall-release-services"),disabled:O.isPending,children:ae==="uninstall-release-services"&&O.isPending?"移除中…":"移除服务"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void O.mutateAsync("install-latest-release"),disabled:O.isPending,children:ae==="install-latest-release"&&O.isPending?"切换中…":"安装并运行"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前正式版版本"}),i.jsx("span",{children:k.current_version??"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 npm 发布"}),i.jsx("span",{className:J?Jd(J.status):"is-muted",children:J?Xc(J.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近服务注册"}),i.jsx("span",{className:q?Jd(q.status):"is-muted",children:q?Xc(q.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近服务移除"}),i.jsx("span",{className:Y?Jd(Y.status):"is-muted",children:Y?Xc(Y.status):"未执行"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近正式版恢复"}),i.jsx("span",{className:Q?Jd(Q.status):"is-muted",children:Q?Xc(Q.status):"未执行"})]}),me.map(U=>{var ie,Se;return i.jsxs("article",{className:`settings-diagnostic-list__item dev-manager-service-card is-${U.status}`,children:[i.jsx("strong",{children:U.label}),i.jsxs("span",{children:["当前模式:"," ",i.jsx("strong",{children:U.manager==="windows-service"?"Windows 服务":"普通进程"})]}),i.jsxs("span",{children:["服务名:",U.service_name??"未配置"]}),i.jsxs("span",{children:["服务控制器:"," ",i.jsx("strong",{className:U.service_registered?"":"is-muted",children:TE(U.service_registered?U.service_status:"missing")})]}),i.jsxs("span",{children:["探测结果:"," ",i.jsx("strong",{className:tb((ie=U.probe)==null?void 0:ie.ok),children:eb((Se=U.probe)==null?void 0:Se.ok)})]}),i.jsxs("span",{children:["端口:",U.configured_port??"未配置"]})]},U.key)})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"APK 编译与下载"}),i.jsx("p",{className:"settings-panel__subtitle",children:"直接用开发版源码产出 release APK,并提供下载入口。"})]}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>void O.mutateAsync("build-apk"),disabled:O.isPending,children:ae==="build-apk"&&O.isPending?"编译中…":"编译 APK"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>void $(),disabled:!k.apk_artifact,children:"下载 APK"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近构建时间"}),i.jsx("span",{children:k.apk_artifact?um(k.apk_artifact.built_at):"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"版本"}),i.jsx("span",{children:k.apk_artifact?`${k.apk_artifact.version_name??"未知"}${k.apk_artifact.version_code?` (${k.apk_artifact.version_code})`:""}`:"尚未构建"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"文件大小"}),i.jsx("span",{children:k.apk_artifact?kE(k.apk_artifact.size_bytes):"尚未构建"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"任务日志"}),i.jsx("p",{className:"settings-panel__subtitle",children:"这里只显示最近一次任务的日志;更早的历史记录仍会保留在后台状态文件中。"})]})}),p?i.jsx("p",{className:"settings-block__status",children:p}):null,K?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前运行中"}),i.jsxs("span",{children:[K.title," · ",Xc(K.status)]})]}):null,G?i.jsx("div",{className:"settings-log-list",children:i.jsxs("article",{className:"settings-log-item dev-manager-job",children:[i.jsxs("div",{className:"settings-log-item__meta",children:[i.jsx("strong",{children:G.title}),i.jsx("span",{children:um(G.started_at??G.created_at)})]}),i.jsxs("div",{className:`settings-log-item__kind ${Jd(G.status)}`,children:[Xc(G.status),G.disconnect_expected?" · 会中断连接":""]}),G.summary?i.jsx("div",{className:"dev-manager-job__summary",children:G.summary}):null,G.logs.length>0?i.jsx("pre",{className:"settings-log-item__detail",children:G.logs.slice(-16).map(U=>`[${um(U.timestamp)}] ${U.message}`).join(`
|
|
68
|
+
`)}):null]},G.id)}):i.jsx("p",{className:"settings-block__status",children:"还没有开发版管理任务记录。"})]}),w&&t?i.jsx(wE,{agentId:t,initialPath:l.repo_path,onClose:()=>N(!1),onSelect:ee}):null]})},w3=oc("App",{web:()=>ao(()=>import("./web-HzS7kaoe.js"),[]).then(e=>new e.AppWeb)}),RE=oc("Browser",{web:()=>ao(()=>import("./web-Ck4th-0Z.js"),[]).then(e=>new e.BrowserWeb)}),AE=e=>{const t=(e==null?void 0:e.trim())??"";return t?t.replace(/\/+$/,""):""},DE=async()=>{if(!_p())return{platform:Mu(),version:null,build:null,appId:null};const e=await w3.getInfo();return{platform:Mu(),version:e.version??null,build:e.build??null,appId:e.id??null}},N3=e=>{const t=AE(e);return t?new URL("/downloads/android/latest.json",t).toString():""},OE=async e=>{const t=N3(e);if(!t)throw new Error("当前还没有配置可用的 Hub 地址。");const a=await fetch(t,{cache:"no-store"});if(!a.ok)throw new Error(`更新清单请求失败(HTTP ${a.status})。`);const l=await a.json(),o=Array.isArray(l.release_notes)?l.release_notes.filter(f=>typeof f=="string"&&f.trim().length>0):[];if(l.platform!=="android"||typeof l.version_name!="string"||typeof l.version_code!="number"||typeof l.published_at!="string"||typeof l.apk_url!="string")throw new Error("Hub 返回的 Android 更新清单格式无效。");const u=new URL(l.apk_url,t).toString();return{platform:"android",version_name:l.version_name,version_code:l.version_code,published_at:l.published_at,apk_url:u,release_notes:o}},IE=e=>{const t=Number(e);return Number.isFinite(t)?t:null},LE=(e,t)=>{if(!e||!t)return!1;const a=IE(e.build);return typeof a=="number"?t.version_code>a:t.version_name!==e.version},PE=async e=>{if(!e.trim())throw new Error("当前没有可用的 APK 下载地址。");await RE.open({url:e})},k3="panda:session-model",E3="panda:command-execution-model",__="panda:session-model-options",S0="panda:session-model-options-updated",C3="panda:session-reasoning",T3="panda:session-fast-mode",M3="panda:session-plan-mode",R3="panda:session-yolo-mode",$u=[{id:"gpt-5.4",label:"gpt-5.4",value:"gpt-5.4"},{id:"gpt-5.3-codex",label:"gpt-5.3-codex",value:"gpt-5.3-codex"},{id:"gpt-5.3",label:"gpt-5.3",value:"gpt-5.3"},{id:"gpt-5.4-mini",label:"gpt-5.4-mini",value:"gpt-5.4-mini"},{id:"gpt-5.2",label:"gpt-5.2",value:"gpt-5.2"}],Af=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var x2;const A3=((x2=$u[0])==null?void 0:x2.value)??"gpt-5.4",sb="gpt-5.4-mini",UE=Af[2].value,$r=e=>typeof e=="string"?e.trim():"",zE=(e,t)=>{if(!e||typeof e!="object")return null;const a=e,l=$r(a.value),o=$r(a.label)||l,u=$r(a.id)||l||`custom-model-${t+1}`;if(!o||!l)return null;const f=$r(a.description);return{id:u,label:o,value:l,description:f||null}},BE=e=>{const t=new Set,a=new Set;return e.flatMap(l=>{const o=l.value.toLowerCase();if(a.has(o))return[];a.add(o);let u=l.id,f=2;for(;t.has(u);)u=`${l.id}-${f}`,f+=1;return t.add(u),[{...l,id:u}]})},D3=e=>{if(!Array.isArray(e))return $u;const t=BE(e.flatMap((a,l)=>{const o=zE(a,l);return o?[o]:[]}));return t.length>0?t:$u},Qf=e=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},HE=()=>{typeof window>"u"||window.dispatchEvent(new Event(S0))},Gf=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},y_=(e,t=!1)=>{const a=Qf(e);return a==="true"?!0:a==="false"?!1:t},v_=(e,t)=>{Gf(e,t?"true":"false")},Qu=(e,t)=>{const a=t==null?void 0:t.trim();return a?`${e}:${a}`:null},ef=e=>{const t=$r(e==null?void 0:e.value)||"",a=$r(e==null?void 0:e.label)||t;return{id:$r(e==null?void 0:e.id)||$r(e==null?void 0:e.value)||`custom-model-${Date.now()}`,label:a,value:t,description:$r(e==null?void 0:e.description)||null}},$E=()=>bp().map(({id:e,...t})=>t),bp=()=>{const e=Qf(__);if(!e)return $u;try{return D3(JSON.parse(e))}catch{return $u}},FE=e=>{const t=D3(e);Gf(__,JSON.stringify(t)),HE()},qE=e=>Af.some(t=>t.value===e),b_=()=>{var a;const e=Qf(k3),t=bp();return t.some(l=>l.value===e)?e:((a=t[0])==null?void 0:a.value)??A3},Am=()=>{const e=Qf(E3),t=bp();if(t.some(l=>l.value===e))return e;const a=t.find(l=>l.value===sb)??t[0];return(a==null?void 0:a.value)??sb},O3=()=>{const e=Qf(C3);return qE(e)?e:UE},vf=e=>{Gf(k3,e)},gg=e=>{Gf(E3,e)},I3=e=>{Gf(C3,e)},ab=e=>{const t=Qu(T3,e);return t?y_(t):!1},ib=e=>{const t=Qu(M3,e);return t?y_(t):!1},rb=e=>{const t=Qu(R3,e);return t?y_(t):!1},L3=(e,t)=>{const a=Qu(T3,e);a&&v_(a,t)},P3=(e,t)=>{const a=Qu(M3,e);a&&v_(a,t)},U3=(e,t)=>{const a=Qu(R3,e);a&&v_(a,t)},WE=(e,t)=>{L3(e,t.isFastModeEnabled),P3(e,t.isPlanModeEnabled),U3(e,t.isYoloModeEnabled)},fp=(e,t=$E())=>{var a,l;return((a=t.find(o=>o.value===e))==null?void 0:a.label)??(typeof e=="string"&&e.trim()?e.trim():((l=t[0])==null?void 0:l.label)??A3)},KE=e=>{var t;return((t=Af.find(a=>a.value===e))==null?void 0:t.label)??Af[2].label},QE=JSON.parse('[{"id":"absolutely","light":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2d2d2b","opaqueWindows":true,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#f9f9f7"},"variant":"light"},"dark":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f9f9f7","opaqueWindows":false,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#2d2d2b"},"variant":"dark"}},{"id":"ayu","dark":{"codeThemeId":"ayu","theme":{"accent":"#e6b450","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#bfbdb6","opaqueWindows":false,"semanticColors":{"diffAdded":"#7fd962","diffRemoved":"#ea6c73","skill":"#cda1fa"},"surface":"#0b0e14"},"variant":"dark"}},{"id":"catppuccin","light":{"codeThemeId":"catppuccin","theme":{"accent":"#8839ef","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#4c4f69","opaqueWindows":true,"semanticColors":{"diffAdded":"#40a02b","diffRemoved":"#d20f39","skill":"#8839ef"},"surface":"#eff1f5"},"variant":"light"},"dark":{"codeThemeId":"catppuccin","theme":{"accent":"#cba6f7","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#cdd6f4","opaqueWindows":false,"semanticColors":{"diffAdded":"#a6e3a1","diffRemoved":"#f38ba8","skill":"#cba6f7"},"surface":"#1e1e2e"},"variant":"dark"}},{"id":"codex","light":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#0d0d0d","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#751ed9"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#fcfcfc","opaqueWindows":false,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#b06dff"},"surface":"#111111"},"variant":"dark"}},{"id":"dracula","dark":{"codeThemeId":"dracula","theme":{"accent":"#ff79c6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f8f8f2","opaqueWindows":false,"semanticColors":{"diffAdded":"#50fa7b","diffRemoved":"#ff5555","skill":"#ff79c6"},"surface":"#282a36"},"variant":"dark"}},{"id":"everforest","light":{"codeThemeId":"everforest","theme":{"accent":"#93b259","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#5c6a72","opaqueWindows":true,"semanticColors":{"diffAdded":"#8da101","diffRemoved":"#f85552","skill":"#df69ba"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"everforest","theme":{"accent":"#a7c080","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d3c6aa","opaqueWindows":false,"semanticColors":{"diffAdded":"#a7c080","diffRemoved":"#e67e80","skill":"#d699b6"},"surface":"#2d353b"},"variant":"dark"}},{"id":"github","light":{"codeThemeId":"github","theme":{"accent":"#0969da","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#1f2328","opaqueWindows":true,"semanticColors":{"diffAdded":"#1a7f37","diffRemoved":"#cf222e","skill":"#8250df"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"github","theme":{"accent":"#1f6feb","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6edf3","opaqueWindows":false,"semanticColors":{"diffAdded":"#3fb950","diffRemoved":"#f85149","skill":"#bc8cff"},"surface":"#0d1117"},"variant":"dark"}},{"id":"gruvbox","light":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#3c3836","opaqueWindows":true,"semanticColors":{"diffAdded":"#3c3836","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#fbf1c7"},"variant":"light"},"dark":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#ebdbb2","opaqueWindows":false,"semanticColors":{"diffAdded":"#ebdbb2","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#282828"},"variant":"dark"}},{"id":"linear","light":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":45,"fonts":{"code":null,"ui":"Inter"},"ink":"#2a3140","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#ba2623","skill":"#8160d8"},"surface":"#f7f8fa"},"variant":"light"},"dark":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":60,"fonts":{"code":null,"ui":"Inter"},"ink":"#e6e9ef","opaqueWindows":true,"semanticColors":{"diffAdded":"#7ad9c0","diffRemoved":"#fa423e","skill":"#c2a1ff"},"surface":"#17181d"},"variant":"dark"}},{"id":"lobster","dark":{"codeThemeId":"lobster","theme":{"accent":"#ff5c5c","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#e4e4e7","opaqueWindows":true,"semanticColors":{"diffAdded":"#22c55e","diffRemoved":"#ff5c5c","skill":"#3b82f6"},"surface":"#111827"},"variant":"dark"}},{"id":"material","dark":{"codeThemeId":"material","theme":{"accent":"#80cbc4","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#eeffff","opaqueWindows":true,"semanticColors":{"diffAdded":"#c3e88d","diffRemoved":"#f07178","skill":"#c792ea"},"surface":"#212121"},"variant":"dark"}},{"id":"matrix","dark":{"codeThemeId":"matrix","theme":{"accent":"#1eff5a","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#b8ffca","opaqueWindows":true,"semanticColors":{"diffAdded":"#1eff5a","diffRemoved":"#fa423e","skill":"#1eff5a"},"surface":"#040805"},"variant":"dark"}},{"id":"monokai","dark":{"codeThemeId":"monokai","theme":{"accent":"#99947c","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#f8f8f2","opaqueWindows":true,"semanticColors":{"diffAdded":"#86b42b","diffRemoved":"#c4265e","skill":"#8c6bc8"},"surface":"#272822"},"variant":"dark"}},{"id":"night-owl","dark":{"codeThemeId":"night-owl","theme":{"accent":"#44596b","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d6deeb","opaqueWindows":true,"semanticColors":{"diffAdded":"#c5e478","diffRemoved":"#ef5350","skill":"#c792ea"},"surface":"#011627"},"variant":"dark"}},{"id":"nord","dark":{"codeThemeId":"nord","theme":{"accent":"#88c0d0","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d8dee9","opaqueWindows":true,"semanticColors":{"diffAdded":"#a3be8c","diffRemoved":"#bf616a","skill":"#b48ead"},"surface":"#2e3440"},"variant":"dark"}},{"id":"notion","light":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#37352f","opaqueWindows":true,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#a31515","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d9d9d8","opaqueWindows":true,"semanticColors":{"diffAdded":"#4ec9b0","diffRemoved":"#fa423e","skill":"#3183d8"},"surface":"#191919"},"variant":"dark"}},{"id":"one","light":{"codeThemeId":"one","theme":{"accent":"#526fff","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#383a42","opaqueWindows":true,"semanticColors":{"diffAdded":"#3bba54","diffRemoved":"#e45649","skill":"#526fff"},"surface":"#fafafa"},"variant":"light"},"dark":{"codeThemeId":"one","theme":{"accent":"#4d78cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#abb2bf","opaqueWindows":true,"semanticColors":{"diffAdded":"#8cc265","diffRemoved":"#e05561","skill":"#c162de"},"surface":"#282c34"},"variant":"dark"}},{"id":"oscurange","dark":{"codeThemeId":"oscurange","theme":{"accent":"#f9b98c","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6e6e6","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#479ffa"},"surface":"#0b0b0f"},"variant":"dark"}},{"id":"proof","light":{"codeThemeId":"proof","theme":{"accent":"#3d755d","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2f312d","opaqueWindows":false,"semanticColors":{"diffAdded":"#3d755d","diffRemoved":"#ba2623","skill":"#5f6ac2"},"surface":"#f5f3ed"},"variant":"light"}},{"id":"rose-pine","light":{"codeThemeId":"rose-pine","theme":{"accent":"#d7827e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#575279","opaqueWindows":false,"semanticColors":{"diffAdded":"#56949f","diffRemoved":"#797593","skill":"#907aa9"},"surface":"#faf4ed"},"variant":"light"},"dark":{"codeThemeId":"rose-pine","theme":{"accent":"#ea9a97","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e0def4","opaqueWindows":true,"semanticColors":{"diffAdded":"#9ccfd8","diffRemoved":"#908caa","skill":"#c4a7e7"},"surface":"#232136"},"variant":"dark"}},{"id":"sentry","dark":{"codeThemeId":"sentry","theme":{"accent":"#7055f6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6dff9","opaqueWindows":true,"semanticColors":{"diffAdded":"#8ee6d7","diffRemoved":"#fa423e","skill":"#7055f6"},"surface":"#2d2935"},"variant":"dark"}},{"id":"solarized","light":{"codeThemeId":"solarized","theme":{"accent":"#b58900","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#657b83","opaqueWindows":false,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"solarized","theme":{"accent":"#d30102","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#839496","opaqueWindows":true,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#002b36"},"variant":"dark"}},{"id":"temple","dark":{"codeThemeId":"temple","theme":{"accent":"#e4f222","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#c7e6da","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#e4f222"},"surface":"#02120c"},"variant":"dark"}},{"id":"tokyo-night","dark":{"codeThemeId":"tokyo-night","theme":{"accent":"#3d59a1","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#a9b1d6","opaqueWindows":true,"semanticColors":{"diffAdded":"#449dab","diffRemoved":"#914c54","skill":"#9d7cd8"},"surface":"#1a1b26"},"variant":"dark"}},{"id":"vscode-plus","light":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#000000","opaqueWindows":false,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#ee0000","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d4d4d4","opaqueWindows":true,"semanticColors":{"diffAdded":"#369432","diffRemoved":"#f44747","skill":"#000080"},"surface":"#1e1e1e"},"variant":"dark"}}]'),GE={themes:QE},z3="panda:theme-settings",YE=13,VE=12,B3="codex",x_="codex",ZE='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',XE='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',JE=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,lb=(e,t)=>{const a=e==null?void 0:e.trim();return a?JE.test(a)?a:`${a}, ${t}`:t},eC={absolutely:"Absolutely",ayu:"Ayu",catppuccin:"Catppuccin",codex:"Codex",dracula:"Dracula",everforest:"Everforest",github:"GitHub",gruvbox:"Gruvbox",linear:"Linear",lobster:"Lobster",material:"Material",matrix:"Matrix",monokai:"Monokai","night-owl":"Night Owl",nord:"Nord",notion:"Notion",one:"One",oscurange:"Oscurange",proof:"Proof","rose-pine":"Rose Pine",sentry:"Sentry",solarized:"Solarized",temple:"Temple","tokyo-night":"Tokyo Night","vscode-plus":"VSCode Plus"},Gu=(e,t,a)=>Math.min(a,Math.max(t,e)),Lo=(e,t)=>{const l=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!l)return t;const[,o]=l;return`#${(o.length===3?o.split("").map(f=>`${f}${f}`).join(""):o).toUpperCase()}`},Lr=e=>{const t=Lo(e,"#000000").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}},tC=(e,t,a)=>`#${[e,t,a].map(l=>Gu(Math.round(l),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,St=(e,t,a)=>{const l=Lr(e),o=Lr(t),u=Gu(a,0,1);return tC(l.r+(o.r-l.r)*u,l.g+(o.g-l.g)*u,l.b+(o.b-l.b)*u)},nC=e=>{const{r:t,g:a,b:l}=Lr(e),o=u=>{const f=u/255;return f<=.03928?f/12.92:((f+.055)/1.055)**2.4};return o(t)*.2126+o(a)*.7152+o(l)*.0722},sC=e=>nC(e)>.5?"#0D1117":"#FFFFFF",Dr=(e,t)=>{const a=Math.round(Gu(t,0,1)*100);return a>=100?e:`color-mix(in srgb, ${e} ${a}%, transparent)`},H3=GE.themes,$3=(e,t)=>{var l,o;const a=t==="light"?e.light:e.dark;return a?{id:e.id,label:eC[e.id]??e.id,codeThemeId:a.codeThemeId,variant:t,accent:Lo(a.theme.accent,"#0169CC"),background:Lo(a.theme.surface,"#FFFFFF"),foreground:Lo(a.theme.ink,"#0D0D0D"),contrast:Gu(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:Lo(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:Lo(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:Lo(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((l=a.theme.fonts.ui)==null?void 0:l.trim())||null,code:((o=a.theme.fonts.code)==null?void 0:o.trim())||null}}:null},j0=H3.map(e=>$3(e,"light")).filter(e=>!!e),Df=H3.map(e=>$3(e,"dark")).filter(e=>!!e);Df.find(e=>e.id===x_)??Df[0];const tc={mode:"system",lightThemeId:B3,darkThemeId:x_,uiFontSize:YE,codeFontSize:VE},F3=e=>Gu(Number(e),11,18),q3=e=>Gu(Number(e),10,18),S_=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",xp=e=>j0.find(t=>t.id===e)??j0[0],Sp=e=>Df.find(t=>t.id===e)??Df[0],ob=(e,t=tc,a="light")=>a==="dark"?{...t,darkThemeId:Sp(e).id}:{...t,lightThemeId:xp(e).id},Bl=e=>({mode:(e==null?void 0:e.mode)==="light"||(e==null?void 0:e.mode)==="dark"||(e==null?void 0:e.mode)==="system"?e.mode:tc.mode,lightThemeId:xp((e==null?void 0:e.lightThemeId)??B3).id,darkThemeId:Sp((e==null?void 0:e.darkThemeId)??x_).id,uiFontSize:F3((e==null?void 0:e.uiFontSize)??tc.uiFontSize),codeFontSize:q3((e==null?void 0:e.codeFontSize)??tc.codeFontSize)}),W3=()=>{if(typeof window>"u")return tc;try{const e=window.localStorage.getItem(z3);return e?Bl(JSON.parse(e)):tc}catch{return tc}},tf=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(z3,JSON.stringify(Bl(e)))}catch{}},aC=(e,t)=>e==="system"?t:e,Ir=(e,t=S_())=>{const a=Bl(e),l=aC(a.mode,t),o=xp(a.lightThemeId),u=Sp(a.darkThemeId),f=l==="dark"?u:o;return{...a,appearance:l,lightTheme:o,darkTheme:u,activeTheme:f,uiFontFamily:lb(f.fonts.ui,ZE),codeFontFamily:lb(f.fonts.code,XE)}},iC=e=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{e(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},rC=(e,t)=>{const a=Ir(e,t),l=a.activeTheme,o=t==="dark",u=(l.contrast-(o?60:45))/100,f=l.semanticColors.diffAdded,m=l.semanticColors.diffRemoved,y=l.semanticColors.skill,g=Lr(f),S=Lr(m),p=Lr(y),v=Lr(l.accent),w=Lr(l.background),N=Lr(l.foreground),j=l.background,C=o?St(l.background,"#FFFFFF",.05+u*.08):St(l.background,"#FFFFFF",.42+u*.16),R=o?St(l.background,"#FFFFFF",.07+u*.08):St(l.background,"#FFFFFF",.78+u*.1),z=o?St(l.background,"#FFFFFF",.1+u*.08):St(l.background,"#FFFFFF",.56+u*.14),O=o?St(l.background,"#FFFFFF",.14+u*.08):St(l.background,l.foreground,.1+u*.12),k=o?St(l.background,"#000000",.08-u*.06):St(l.background,l.foreground,.03+u*.08),L=o?St(l.background,"#FFFFFF",.08+u*.06):St(l.background,l.foreground,.06+u*.08),K=o?St(l.background,"#FFFFFF",.14+u*.08):St(l.background,l.foreground,.14+u*.1),J=o?St(l.background,"#FFFFFF",.22+u*.08):St(l.background,l.foreground,.22+u*.1),q=o?St(l.background,"#FFFFFF",.08+u*.04):St(l.background,l.foreground,.1+u*.08),Y=l.foreground,Q=o?St(l.foreground,l.background,.28-u*.1):St(l.foreground,l.background,.5-u*.14),G=o?St(l.foreground,l.background,.46-u*.1):St(l.foreground,l.background,.64-u*.14),ge=St(l.foreground,l.background,o?.58:.74),me=l.accent,Z=o?St(l.accent,"#FFFFFF",.18):St(l.accent,"#FFFFFF",.24),he=o?St(l.accent,l.background,.78):St(l.accent,l.background,.88),M=o?St(l.accent,l.background,.84):St(l.accent,l.background,.92),$=sC(me),ee=o?St(l.background,"#FFFFFF",.1):St(l.background,l.foreground,.08),oe=o?St(l.background,"#000000",.06):St(l.background,l.foreground,.035),ae=o?St(l.background,"#FFFFFF",.05):St(l.background,l.foreground,.06),I=o?St(l.background,"#FFFFFF",.03):St(l.background,l.foreground,.085),ne=o?St(l.background,"#FFFFFF",.065):St(l.background,l.foreground,.05),U=St(l.foreground,l.background,o?.42:.68),ie=o?St(l.background,"#FFFFFF",.08):St(l.foreground,l.background,.18),Se=o?St(l.background,"#FFFFFF",.08):St(l.background,l.foreground,.06),se=o?St(l.background,"#FFFFFF",.12):St(l.background,l.foreground,.1),we=o?St(l.background,"#FFFFFF",.14+u*.05):St(l.background,l.foreground,.12+u*.08),ye=l.opaqueWindows?1:o?.92:.95,Oe=l.opaqueWindows?1:o?.94:.965,Le=l.opaqueWindows?1:.94;return{"--theme-id":l.id,"--theme-code-theme-id":l.codeThemeId,"--theme-window-opaque":l.opaqueWindows?"1":"0","--theme-accent":me,"--theme-accent-rgb":`${v.r} ${v.g} ${v.b}`,"--theme-background":l.background,"--theme-background-rgb":`${w.r} ${w.g} ${w.b}`,"--theme-foreground":l.foreground,"--theme-foreground-rgb":`${N.r} ${N.g} ${N.b}`,"--theme-shadow-rgb":o?"0 0 0":"39 28 17","--theme-ui-font":a.uiFontFamily,"--theme-code-font":a.codeFontFamily,"--theme-ui-font-size":`${a.uiFontSize}px`,"--theme-code-font-size":`${a.codeFontSize}px`,"--color-surface-base":j,"--color-surface-elevated":C,"--color-surface-panel":R,"--color-surface-raised":z,"--color-surface-panel-strong":O,"--color-surface-sidebar":Dr(k,Oe),"--color-surface-sidebar-elevated":Dr(L,Oe),"--color-surface-border":K,"--color-surface-border-strong":J,"--color-surface-border-soft":q,"--color-surface-overlay":Dr(O,ye),"--color-surface-floating":Dr(R,ye),"--color-surface-tooltip":Dr(ie,Le),"--color-surface-code":oe,"--color-surface-code-muted":ae,"--color-surface-code-gutter":I,"--color-surface-code-meta":ne,"--color-surface-inline-code":ee,"--color-surface-hover":Se,"--color-surface-pressed":se,"--color-surface-danger-soft":Dr(m,o?.14:.08),"--color-surface-success-soft":Dr(f,o?.14:.08),"--color-text-primary":Y,"--color-text-secondary":Q,"--color-text-muted":G,"--color-text-tertiary":ge,"--color-text-on-accent":$,"--color-text-link":me,"--color-text-link-hover":Z,"--color-text-danger":m,"--color-text-success":f,"--color-accent-primary":me,"--color-accent-primary-soft":he,"--color-accent-secondary":Z,"--color-accent-secondary-soft":M,"--color-accent-contrast":$,"--color-accent-primary-rgb":`${v.r} ${v.g} ${v.b}`,"--color-success":f,"--color-warning":St(l.accent,f,.35),"--color-danger":m,"--color-status-online":me,"--color-status-offline":o?"#76808A":"#A5ACA4","--color-skill":y,"--color-skill-rgb":`${p.r} ${p.g} ${p.b}`,"--color-code-keyword":y,"--color-code-title":me,"--color-code-string":St(f,l.foreground,o?.26:.18),"--color-code-number":St(y,me,.36),"--color-code-comment":St(l.foreground,l.background,o?.52:.72),"--color-code-meta-text":U,"--color-code-add":f,"--color-code-add-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-add-bg":Dr(f,o?.16:.11),"--color-code-remove":m,"--color-code-remove-rgb":`${S.r} ${S.g} ${S.b}`,"--color-code-remove-bg":Dr(m,o?.18:.11),"--color-divider":we,"--color-overlay-scrim":l.opaqueWindows?o?"rgba(8, 10, 12, 0.66)":"rgba(23, 20, 17, 0.14)":o?"rgba(8, 10, 12, 0.54)":"rgba(23, 20, 17, 0.09)","--shadow-soft":o?"0 24px 54px rgba(0, 0, 0, 0.34)":"0 24px 54px rgba(24, 18, 12, 0.08)","--shadow-panel":o?"0 10px 26px rgba(0, 0, 0, 0.24)":"0 10px 26px rgba(37, 23, 10, 0.06)","--shadow-sm":o?"0 2px 12px rgba(0, 0, 0, 0.18)":"0 2px 12px rgba(37, 23, 10, 0.05)","--shadow-overlay":o?"0 20px 44px rgba(0, 0, 0, 0.36)":"0 18px 40px rgba(42, 26, 12, 0.1)","--font-display":a.uiFontFamily,"--font-sans":a.uiFontFamily,"--font-mono":a.codeFontFamily,"--font-size-ui-base":`${a.uiFontSize}px`,"--font-size-code-base":`${a.codeFontSize}px`}},K3=(e,t=S_())=>{if(typeof document>"u")return;const a=Ir(e,t),l=rC(a,a.appearance),o=document.documentElement;o.dataset.theme=a.appearance,o.dataset.uiTheme=a.appearance,o.dataset.themeId=a.activeTheme.id,o.dataset.codeThemeId=a.activeTheme.codeThemeId,o.dataset.windowStyle=a.activeTheme.opaqueWindows?"opaque":"soft",o.style.colorScheme=a.appearance;for(const[u,f]of Object.entries(l))o.style.setProperty(u,f)},lC=async()=>{if(await rp().catch(()=>{}),"serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(a=>a.unregister()))}if("caches"in window){const t=await window.caches.keys();await Promise.all(t.map(a=>window.caches.delete(a)))}const e=window.indexedDB;if(typeof e.databases=="function"){const t=await e.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(l=>{const o=e.deleteDatabase(a);o.onsuccess=()=>l(),o.onerror=()=>l(),o.onblocked=()=>l()})))}window.localStorage.clear(),window.sessionStorage.clear()},j_="panda:pwa-install-log",oC=48,Es=e=>((e==null?void 0:e.trim())??"")||null,Q3=()=>{if(typeof window>"u")return[];try{const e=window.localStorage.getItem(j_);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(a=>{if(!a||typeof a!="object")return null;const l=a;return typeof l.id!="string"||typeof l.timestamp!="string"||typeof l.kind!="string"||typeof l.message!="string"?null:{id:l.id,timestamp:l.timestamp,kind:l.kind,message:l.message,detail:Es(l.detail)}}).filter(a=>!!a).sort((a,l)=>+new Date(l.timestamp)-+new Date(a.timestamp)):[]}catch{return[]}},cC=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(j_,JSON.stringify(e.slice(0,oC)))}catch{}},uC=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(j_)}catch{}},Ol=e=>{const t=Q3(),a={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:new Date().toISOString(),kind:e.kind,message:e.message.trim(),detail:Es(e.detail)};return cC([a,...t]),a},cb=(e,t)=>{var a;return((a=e.find(l=>l.kind===t))==null?void 0:a.timestamp)??null},dC=async e=>{const t=await fetch(e,{cache:"no-store"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},fC=async e=>{try{let t=await fetch(e,{method:"HEAD",cache:"no-store"});return(t.status===405||t.status===501)&&(t=await fetch(e,{method:"GET",cache:"no-store"})),{ok:t.ok,status:t.status,error:null}}catch(t){return{ok:!1,status:null,error:t instanceof Error?t.message:"Unknown fetch failure"}}},hC=async()=>{if(typeof document>"u"||typeof window>"u")return{href:null,present:!1,ok:!1,error:"Document is unavailable.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};const e=document.querySelector('link[rel~="manifest"]'),t=Es(e==null?void 0:e.href);if(!t)return{href:null,present:!1,ok:!1,error:"页面没有 manifest 链接。",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]};try{const a=await dC(t),l=Array.isArray(a.icons)?a.icons:[],o=await Promise.all(l.slice(0,8).map(async u=>{const f=u,m=Es(typeof f.src=="string"?f.src:null);if(!m)return{src:"(missing)",purpose:Es(typeof f.purpose=="string"?f.purpose:null),sizes:Es(typeof f.sizes=="string"?f.sizes:null),type:Es(typeof f.type=="string"?f.type:null),ok:!1,status:null,error:"Icon src is missing."};const y=new URL(m,t).toString(),g=await fC(y);return{src:y,purpose:Es(typeof f.purpose=="string"?f.purpose:null),sizes:Es(typeof f.sizes=="string"?f.sizes:null),type:Es(typeof f.type=="string"?f.type:null),ok:g.ok,status:g.status,error:g.error}}));return{href:t,present:!0,ok:!0,error:null,id:Es(typeof a.id=="string"?a.id:null),name:Es(typeof a.name=="string"?a.name:null),shortName:Es(typeof a.short_name=="string"?a.short_name:null),startUrl:Es(typeof a.start_url=="string"?a.start_url:null),scope:Es(typeof a.scope=="string"?a.scope:null),display:Es(typeof a.display=="string"?a.display:null),displayOverride:Array.isArray(a.display_override)?a.display_override.filter(u=>typeof u=="string"):[],themeColor:Es(typeof a.theme_color=="string"?a.theme_color:null),backgroundColor:Es(typeof a.background_color=="string"?a.background_color:null),icons:o}}catch(a){return{href:t,present:!0,ok:!1,error:a instanceof Error?a.message:"Manifest fetch failed.",id:null,name:null,shortName:null,startUrl:null,scope:null,display:null,displayOverride:[],themeColor:null,backgroundColor:null,icons:[]}}},mC=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return{supported:!1,controller:!1,registrations:[]};try{const e=await navigator.serviceWorker.getRegistrations();return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:e.map(t=>{var a,l,o;return{scope:t.scope,activeScriptUrl:((a=t.active)==null?void 0:a.scriptURL)??null,waitingScriptUrl:((l=t.waiting)==null?void 0:l.scriptURL)??null,installingScriptUrl:((o=t.installing)==null?void 0:o.scriptURL)??null}})}}catch{return{supported:!0,controller:!!navigator.serviceWorker.controller,registrations:[]}}},pC=e=>{const t=e.standaloneDisplayMode||e.navigatorStandalone;return t&&e.appInstalledSeen?{label:"较像已安装应用",confidence:"medium",detail:"当前页面正以独立窗口打开,并且这个站点记录到过 appinstalled 事件,更像是真正安装后的应用入口。"}:t?{label:"更像主屏幕快捷方式",confidence:"medium",detail:"当前页面虽然已脱离浏览器标签页,但站点本地没有观测到 appinstalled 事件,无法证明系统级安装已经完成,更像是主屏幕快捷方式。"}:e.installPromptAvailable?{label:"可触发安装流程",confidence:"high",detail:"浏览器已经提供 beforeinstallprompt 事件,设置页里的安装按钮可以主动弹出安装流程。"}:e.beforeInstallPromptSeen?{label:"浏览器曾允许安装",confidence:"low",detail:"站点历史上收到过 beforeinstallprompt,但当前页面没有可用的安装事件,可能需要刷新页面、重新访问或等待浏览器重新评估。"}:{label:"当前不像可安装应用",confidence:"medium",detail:"浏览器当前没有给出可用的安装事件,页面更像普通标签页或只能走“添加到主屏幕”的快捷方式链路。"}},gC=e=>{const t=[];if(e.secureContext||t.push("当前页面不是安全上下文,Chrome 不会提供完整的 PWA 安装链路。"),!e.manifest.present)t.push("页面没有 manifest 链接,浏览器无法把当前站点识别为可安装 Web App。");else if(!e.manifest.ok)t.push(`manifest 读取失败:${e.manifest.error??"未知错误"}。`);else{(!e.manifest.display||e.manifest.display==="browser")&&t.push("manifest 没有声明 standalone/minimal-ui 显示模式,浏览器更可能只给快捷方式。"),!e.manifest.name&&!e.manifest.shortName&&t.push("manifest 缺少 name/short_name,安装身份信息不完整。");const l=e.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("192x192")),o=e.manifest.icons.some(f=>f.ok&&(f.sizes??"").includes("512x512"));(!l||!o)&&t.push("manifest 图标里缺少可访问的 192x192 或 512x512 图标,Android 安装链路可能会退化。");const u=e.manifest.icons.filter(f=>!f.ok);u.length>0&&t.push(`有 ${u.length} 个 manifest 图标资源探测失败,安装时可能因为图标拉取失败而退化或失败。`)}return e.serviceWorker.supported?e.serviceWorker.registrations.length===0&&t.push("当前页面没有检测到 Service Worker 注册,Chrome 往往不会提供完整安装流程。"):t.push("当前浏览器不支持 Service Worker,无法满足完整的 PWA 安装条件。"),!e.installPromptAvailable&&!e.launchedStandalone&&e.secureContext&&e.manifest.ok&&e.serviceWorker.registrations.length>0&&t.push("浏览器当前没有下发 beforeinstallprompt,设置页按钮无法主动触发安装,只能走浏览器菜单的安装/添加到主屏幕入口。"),e.logs.find(l=>{var o;return l.kind==="install-choice"&&((o=l.detail)==null?void 0:o.toLowerCase().includes("accepted"))})&&!e.appInstalledSeen&&t.push("站点记录到用户接受过安装请求,但没有后续 appinstalled 事件,更像是浏览器回退成快捷方式,或系统级安装没有完成。"),e.launchedStandalone&&!e.appInstalledSeen&&t.push("当前虽然是独立窗口形态,但没有观测到 appinstalled,不能把它视为已经完成系统级安装。"),t},_C=async e=>{const t=Q3(),[a,l]=await Promise.all([hC(),mC()]),o=navigator,u=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches,f=o.standalone===!0,m=t.some(w=>w.kind==="beforeinstallprompt"),y=t.some(w=>w.kind==="appinstalled"),g=(e==null?void 0:e.installPromptAvailable)===!0,S=u||f,p=[];window.isSecureContext&&p.push("当前是安全上下文。"),a.ok&&p.push("manifest 可读取。"),l.registrations.length>0&&p.push(`检测到 ${l.registrations.length} 个 Service Worker 注册。`),g&&p.push("浏览器已提供可调用的安装事件。"),y&&p.push("站点本地记录到过 appinstalled 事件。");const v=["从桌面图标打开后,确认没有浏览器地址栏或标签栏。","到 Android“设置 -> 应用”里搜索 Panda,若能搜到,更像系统级安装。","到应用抽屉里搜索 Panda;若只在桌面可见而应用抽屉里没有,更像快捷方式。","如果日志里只有“添加到主屏幕”链路,没有 appinstalled,通常不能认定为真正安装完成。"];return{capturedAt:new Date().toISOString(),environment:{href:typeof window>"u"?null:window.location.href,origin:typeof window>"u"?null:window.location.origin,secureContext:typeof window<"u"?window.isSecureContext:!1,online:typeof navigator<"u"&&typeof navigator.onLine=="boolean"?navigator.onLine:null,userAgent:typeof navigator>"u"?null:navigator.userAgent,isAndroid:typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,standaloneDisplayMode:u,navigatorStandalone:f},promptState:{installPromptAvailable:g,beforeInstallPromptSeen:m,appInstalledSeen:y,lastBeforeInstallPromptAt:cb(t,"beforeinstallprompt"),lastAppInstalledAt:cb(t,"appinstalled")},manifest:a,serviceWorker:l,assessment:pC({standaloneDisplayMode:u,navigatorStandalone:f,installPromptAvailable:g,beforeInstallPromptSeen:m,appInstalledSeen:y}),failureReasons:gC({secureContext:typeof window<"u"?window.isSecureContext:!1,manifest:a,serviceWorker:l,installPromptAvailable:g,appInstalledSeen:y,launchedStandalone:S,logs:t}),successSignals:p,confirmationChecklist:v,logs:t}},yC=e=>{if(typeof window>"u")return()=>{};const t=l=>{(l.key===null||l.key===__)&&e()},a=()=>{e()};return window.addEventListener("storage",t),window.addEventListener(S0,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(S0,a)}},vC=()=>bp(),bC=()=>$u,w_=()=>_.useSyncExternalStore(yC,vC,bC);function N_(e){return is(_3(e))}const G3=e=>{var t,a,l;return["codex-commands",((t=e==null?void 0:e.agentId)==null?void 0:t.trim())??"",((a=e==null?void 0:e.projectId)==null?void 0:a.trim())??"",((l=e==null?void 0:e.sessionId)==null?void 0:l.trim())??""]},Y3=e=>{const t=(e==null?void 0:e.enabled)??!0;return is({queryKey:G3(e==null?void 0:e.scope),enabled:t,queryFn:async()=>(await xn(e==null?void 0:e.scope)).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},ub=e=>{let t;const a=new Set,l=(g,S)=>{const p=typeof g=="function"?g(t):g;if(!Object.is(p,t)){const v=t;t=S??(typeof p!="object"||p===null)?p:Object.assign({},t,p),a.forEach(w=>w(t,v))}},o=()=>t,m={setState:l,getState:o,getInitialState:()=>y,subscribe:g=>(a.add(g),()=>a.delete(g))},y=t=e(l,o,m);return m},xC=(e=>e?ub(e):ub),SC=e=>e;function jC(e,t=SC){const a=Fr.useSyncExternalStore(e.subscribe,Fr.useCallback(()=>t(e.getState()),[e,t]),Fr.useCallback(()=>t(e.getInitialState()),[e,t]));return Fr.useDebugValue(a),a}const db=e=>{const t=xC(e),a=l=>jC(t,l);return Object.assign(a,t),a},wC=(e=>e?db(e):db),fb=W3(),hb=S_(),Sa=wC(e=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,isSettingsOverlayOpen:!1,themeSettings:fb,systemAppearance:hb,resolvedTheme:Ir(fb,hb),setPanelTab:t=>e({panelTab:t}),setComposerText:t=>e({composerText:t}),setActiveSessionId:t=>e({activeSessionId:t}),setBottomNavVisible:t=>e({bottomNavVisible:t}),openSettingsOverlay:()=>e({isSettingsOverlayOpen:!0}),closeSettingsOverlay:()=>e({isSettingsOverlayOpen:!1}),setThemeMode:t=>e(a=>{const l=Bl({...a.themeSettings,mode:t});return tf(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setLightThemeId:t=>e(a=>{const l=Bl(ob(xp(t).id,a.themeSettings,"light"));return tf(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setDarkThemeId:t=>e(a=>{const l=Bl({...ob(Sp(t).id,a.themeSettings,"dark")});return tf(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setUiFontSize:t=>e(a=>{const l=Bl({...a.themeSettings,uiFontSize:t});return tf(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setCodeFontSize:t=>e(a=>{const l=Bl({...a.themeSettings,codeFontSize:t});return tf(l),{themeSettings:l,resolvedTheme:Ir(l,a.systemAppearance)}}),setSystemAppearance:t=>e(a=>({systemAppearance:t,resolvedTheme:Ir(a.themeSettings,t)}))})),mb=980,fm=[{id:"theme",title:"主题",description:"调整界面的颜色风格。",icon:"theme"},{id:"models",title:"模型维护",description:"维护可选模型、默认模型和展示顺序。",icon:"models"},{id:"cache",title:"缓存",description:"解决页面没更新的问题。",icon:"cache"},{id:"notifications",title:"移动提醒",description:"安装到桌面,并在对话完成后接收系统通知。",icon:"notifications"},{id:"installation",title:"安装诊断",description:"判断当前是不是安装版,并分析为什么安装失败。",icon:"installation"},{id:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"},{id:"dev-manager",title:"开发版管理",description:"维护开发版、npm 发布、自升级和 APK 编译下载。",icon:"dev-manager"}],NC=[{id:"appearance",label:"外观与模型",sections:["theme","models","cache"]},{id:"notifications",label:"提醒与安装",sections:["notifications","installation"]},{id:"connection",label:"连接与设备",sections:["connection","dev-manager"]}],kC=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],EC=(e,t,a,l)=>["const pandaTheme = {",` codeThemeId: "${e}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${l},`,"}"],CC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m15 6-6 6 6 6"})}),TC=({open:e})=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:e?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),MC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),RC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M12 5v14M5 12h14"})}),AC=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),DC=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),OC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),IC=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),pb=({icon:e})=>e==="cache"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M5 8.5C5 6.57 8.13 5 12 5s7 1.57 7 3.5S15.87 12 12 12 5 10.43 5 8.5Z"}),i.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),i.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):e==="models"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),i.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):e==="connection"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9.5 14.5a3.5 3.5 0 0 1 0-5l1.5-1.5a3.5 3.5 0 0 1 5 5L15 14"}),i.jsx("path",{d:"M14.5 9.5a3.5 3.5 0 0 1 0 5L13 16a3.5 3.5 0 0 1-5-5L9 10"})]}):e==="dev-manager"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 3.75v4.5"}),i.jsx("path",{d:"M12 15.75v4.5"}),i.jsx("path",{d:"M3.75 12h4.5"}),i.jsx("path",{d:"M15.75 12h4.5"}),i.jsx("path",{d:"m6.7 6.7 3.1 3.1"}),i.jsx("path",{d:"m14.2 14.2 3.1 3.1"}),i.jsx("path",{d:"m17.3 6.7-3.1 3.1"}),i.jsx("path",{d:"m9.8 14.2-3.1 3.1"}),i.jsx("circle",{cx:"12",cy:"12",r:"2.9"})]}):e==="notifications"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6.5 9.5a5.5 5.5 0 0 1 11 0c0 5.25 1.9 6.83 1.9 6.83H4.6S6.5 14.75 6.5 9.5Z"}),i.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):e==="installation"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 3.75v10.5"}),i.jsx("path",{d:"m8.5 10.75 3.5 3.5 3.5-3.5"}),i.jsx("path",{d:"M5.25 16.75h13.5"}),i.jsx("path",{d:"M6 19.25h12"})]}):i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 4.75v2.1M12 17.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"}),i.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),LC=({icon:e,active:t})=>{const a=t?2:1.8;return e==="sun"?i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),i.jsx("path",{d:"M12 2.75v2.1M12 19.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"})]}):e==="moon"?i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M20.2 14.1A8.5 8.5 0 1 1 9.9 3.8a6.9 6.9 0 0 0 10.3 10.3Z"})}):i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),i.jsx("path",{d:"M8 19h8"})]})},PC=({title:e,caption:t,accent:a,background:l,foreground:o,lines:u})=>i.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":l,"--preview-foreground":o},children:[i.jsxs("div",{className:"theme-preview-panel__meta",children:[i.jsx("span",{children:e}),i.jsx("span",{children:t})]}),i.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${e} 主题预览`,children:u.map(f=>i.jsx("code",{children:f},f))})]}),Jc=({label:e,value:t})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsxs("div",{className:"theme-token",children:[i.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),i.jsx("span",{children:t})]})]}),hm=({label:e,value:t})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsx("div",{className:"theme-token",children:t})]}),gb=({label:e,value:t,mono:a})=>i.jsxs("div",{className:"settings-row settings-row--token",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),_b=({label:e,value:t,onChange:a,min:l,max:o})=>i.jsxs("div",{className:"settings-row settings-row--size",children:[i.jsx("div",{className:"settings-row__copy",children:i.jsx("span",{className:"settings-row__label",children:e})}),i.jsxs("div",{className:"theme-stepper",children:[i.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${e} 减小 1px`,children:"-"}),i.jsxs("label",{className:"theme-stepper__input-wrap",children:[i.jsx("input",{className:"theme-stepper__input",type:"number",min:l,max:o,step:1,value:t,onChange:u=>a(Number(u.target.value))}),i.jsx("span",{children:"px"})]}),i.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${e} 增大 1px`,children:"+"})]})]}),yb=(e,t,a,l)=>{if(t===a)return e;const o=e.findIndex(S=>S.id===t),u=e.findIndex(S=>S.id===a);if(o<0||u<0)return e;const f=[...e],[m]=f.splice(o,1);if(!m)return e;const y=f.findIndex(S=>S.id===a),g=l==="before"?y:y+1;return f.splice(g,0,m),f},eu=e=>{if(!e)return"未记录";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{hour12:!1})},mm=e=>typeof e!="number"||!Number.isFinite(e)?"未测得":`${Math.max(0,Math.round(e))} ms`,_g=async(e,t)=>{const a=await t0(t);return{label:e,...a}},V3=({mode:e="page",onRequestClose:t}={})=>{var wn,xs;const a=Ei(),l=Pa(),o=vp(),{data:u}=N_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(null),[v,w]=_.useState("theme"),[N,j]=_.useState(null),[C,R]=_.useState(()=>typeof window<"u"&&window.innerWidth>=mb),[z,O]=_.useState(()=>g0()),[k,L]=_.useState(()=>mu()),[K,J]=_.useState(()=>Bu()),[q,Y]=_.useState(()=>y0()),[Q,G]=_.useState(!1),[ge,me]=_.useState(!1),[Z,he]=_.useState(null),[M,$]=_.useState(!1),[ee,oe]=_.useState(()=>du()),[ae,I]=_.useState(()=>G4()),[ne,U]=_.useState(0),ie=Sa(A=>A.themeSettings),Se=Sa(A=>A.resolvedTheme),se=Sa(A=>A.systemAppearance),we=Sa(A=>A.setThemeMode),ye=Sa(A=>A.setLightThemeId),Oe=Sa(A=>A.setDarkThemeId),Le=Sa(A=>A.setUiFontSize),_t=Sa(A=>A.setCodeFontSize),Ke=w_(),[tt,nn]=_.useState(()=>b_()),[Xt,jn]=_.useState(()=>Am()),[zt,Bt]=_.useState(null),[yt,bt]=_.useState(()=>ef()),[dt,cn]=_.useState(null),[Pn,Ee]=_.useState(null),[V,_e]=_.useState(null),Te=typeof window>"u"?null:uc(),Ie=typeof window>"u"?null:np(),ce=(u==null?void 0:u.agents.find(A=>A.id===Te))??(u==null?void 0:u.agents[0]),Ae=((wn=ce==null?void 0:ce.direct_base_url)==null?void 0:wn.trim().replace(/\/+$/,""))??"",qe=o.platform!=="web",xt=v==="cache"||N==="cache",Dt=ce!=null&&ce.id?{agentId:ce.id}:void 0,ue=G3(Dt),Me=is({queryKey:["settings-connection",o.hubUrl,(ce==null?void 0:ce.id)??"",Ae],queryFn:async()=>{const A=await xn(),[pe,et,Lt]=await Promise.all([_g(A.label,A.baseUrl),_g("Panda Hub",Wu()),Ae?_g((ce==null?void 0:ce.name)??"当前节点",Ae):Promise.resolve(null)]);return{modeLabel:A.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:A.label,backendUrl:A.baseUrl,healthOk:pe.healthOk,latencyMs:pe.latencyMs,checkedAt:pe.checkedAt,activeProbe:pe,hubProbe:et,agentProbe:Lt}},enabled:v==="connection"||N==="connection",staleTime:0,refetchOnWindowFocus:!1}),Re=is({queryKey:["installed-app-info",o.platform],queryFn:()=>DE(),enabled:qe,staleTime:3e4,refetchOnWindowFocus:!1}),We=is({queryKey:["android-release-manifest",o.hubUrl],queryFn:()=>OE(o.hubUrl),enabled:o.platform==="android"&&!!o.hubUrl&&(v==="connection"||N==="connection"),staleTime:0,refetchOnWindowFocus:!1}),Xe=Y3({enabled:xt&&!!Dt,scope:Dt}),Je=()=>{U(A=>A+1)},Tt=is({queryKey:["pwa-install-diagnostics",ne,!!Z,ee],queryFn:async()=>_C({installPromptAvailable:!!Z}),enabled:v==="installation"||N==="installation",staleTime:0,refetchOnWindowFocus:!1}),Wt=ss({mutationFn:async()=>{if(!Dt)throw new Error("当前没有可用节点,无法刷新命令目录。");return(await xn(Dt)).client.refreshCodexCommands()},onMutate:()=>{g(null)},onSuccess:A=>{l.setQueryData(ue,A),g(`命令目录已刷新,共 ${A.commands.length} 条,CLI 版本 ${A.cli_version??"未知"}。`)},onError:A=>{g(A instanceof Error?A.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const A=()=>{const pe=window.innerWidth>=mb;R(pe)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[]),_.useEffect(()=>{g(null)},[(xs=Me.data)==null?void 0:xs.backendUrl]),_.useEffect(()=>{C&&j(v)},[v,C]),_.useEffect(()=>{cn(null)},[v]),_.useEffect(()=>{if(typeof window>"u")return;const A=Lt=>{Lt.preventDefault(),he(Lt),Ol({kind:"beforeinstallprompt",message:"浏览器提供了可调用的安装事件。",detail:window.location.href}),Je()},pe=()=>{he(null),oe(!0),p("应用已安装到桌面。"),Ol({kind:"appinstalled",message:"站点收到 appinstalled 事件。",detail:"浏览器报告安装流程已经完成或被接受。"}),Je()},et=()=>{L(mu()),O(g0()),oe(du()),I(G4()),Ol({kind:"visibilitychange",message:`页面切换为 ${document.visibilityState}。`,detail:`standalone=${du()?"yes":"no"}`}),Je()};return window.addEventListener("beforeinstallprompt",A),window.addEventListener("appinstalled",pe),document.addEventListener("visibilitychange",et),()=>{window.removeEventListener("beforeinstallprompt",A),window.removeEventListener("appinstalled",pe),document.removeEventListener("visibilitychange",et)}},[]),_.useEffect(()=>{if(Ke.length===0||Ke.some(pe=>pe.value===tt))return;const A=Ke[0].value;vf(A),nn(A)},[Ke,tt]),_.useEffect(()=>{var pe;if(Ke.length===0||Ke.some(et=>et.value===Xt))return;const A=((pe=Ke.find(et=>et.value==="gpt-5.4-mini"))==null?void 0:pe.value)??Ke[0].value;gg(A),jn(A)},[Xt,Ke]),_.useEffect(()=>{const A=()=>{h_().then(pe=>{L(pe)}).catch(()=>{L(mu())}),J(Bu()),Y(y0())};return A(),window.addEventListener("focus",A),document.addEventListener("visibilitychange",A),()=>{window.removeEventListener("focus",A),document.removeEventListener("visibilitychange",A)}},[]),_.useEffect(()=>{if(k!=="granted"||!z.completionNotificationsEnabled||!K)return;let A=!1;return G(!0),Ok(z).then(pe=>{A||Y(pe.synced)}).catch(()=>{A||Y(!1)}).finally(()=>{A||G(!1)}),()=>{A=!0}},[K,k,z]);const ls=()=>{if(e==="overlay"){t==null||t();return}if(Ie){Zi((ce==null?void 0:ce.id)??null),sa(Ie),a({to:"/"});return}a({to:"/nodes"})},Nt=A=>{e==="overlay"&&(t==null||t()),a({to:A})},Un=async()=>{g(null),m(!0);try{await lC(),g("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{m(!1),g("清理失败,请在浏览器设置中手动清理站点数据。")}},Cn=async()=>{if(p(null),qe){if(k==="granted"){p("当前已经拿到系统通知权限;完成提醒会自动跟随系统权限生效。");return}const A=await _0();if(L(A),A==="granted"){const pe={completionNotificationsEnabled:!0};Io(pe),O(pe),p("系统通知已开启,后续任务完成会直接走原生通知。");return}if(A==="denied"){p("系统通知已被拒绝,请到系统设置里重新开启。");return}p("还没有拿到通知权限,可以稍后再试一次。");return}if(k!=="granted"){const A=await _0();if(L(A),A==="granted"){if(!K){const pe={completionNotificationsEnabled:!0};Io(pe),O(pe),p(qe?"系统通知已开启,任务完成时会直接走原生通知。":"系统通知已开启,但当前环境不支持后台 Web Push。");return}G(!0);try{const pe={completionNotificationsEnabled:!0};await Q4(pe),Io(pe),O(pe),Y(!0),p("系统通知和后台 Web Push 都已开启。");return}catch(pe){Y(!1),p(pe instanceof Error?pe.message:"通知权限已开启,但 Web Push 订阅失败。");return}finally{G(!1)}}if(A==="denied"){p("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}p("还没有拿到通知权限,可以稍后再试一次。");return}if(z.completionNotificationsEnabled){G(!0);try{await Ik();const A={completionNotificationsEnabled:!1};Io(A),O(A),Y(!1),p("完成提醒已关闭,后台推送订阅也已移除。")}catch(A){p(A instanceof Error?A.message:"关闭 Web Push 订阅失败。")}finally{G(!1)}return}if(!K){const A={completionNotificationsEnabled:!0};Io(A),O(A),p(qe?"原生通知已开启,后续会沿用当前 App 的在线事件提醒。":"当前环境不支持后台 Web Push,只能在页面在线时提醒。");return}G(!0);try{const A={completionNotificationsEnabled:!0};await Q4(A),Io(A),O(A),Y(!0),p("完成提醒已开启,Hub 会在会话完成后推送到这台手机。")}catch(A){Y(!1),p(A instanceof Error?A.message:"开启 Web Push 失败。")}finally{G(!1)}},Dn=async()=>{p(null),me(!0);try{if(qe){await l3({sessionId:"settings-test",completedAt:new Date().toISOString(),title:"Panda 测试提醒",body:"这是一条来自 Android 壳的本地通知测试。",url:"/settings"}),p("测试通知已发出,请看当前设备的系统通知栏。");return}await Lk(),p("测试推送已发出,请看手机或当前设备的通知栏。")}catch(A){p(A instanceof Error?A.message:"发送测试推送失败。")}finally{me(!1)}},De=async()=>{if(!Z){Ol({kind:"install-unavailable",message:"当前页面没有可用的安装事件。",detail:ae?"浏览器没有下发 beforeinstallprompt,只能走菜单里的安装应用或添加到主屏幕。":"当前浏览器没有提供可调用的安装对话框。"}),Je(),p(ae?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}$(!0),p(null),Ol({kind:"install-button-click",message:"用户点击了设置页里的安装按钮。",detail:"准备调用浏览器安装对话框。"}),Je();try{Ol({kind:"install-prompt-shown",message:"已调用浏览器安装对话框。",detail:"等待用户在系统安装弹窗里做出选择。"}),await Z.prompt();const A=await Z.userChoice;Ol({kind:"install-choice",message:A.outcome==="accepted"?"用户接受了安装请求。":"用户取消了安装请求。",detail:`outcome=${A.outcome}; platform=${A.platform}`}),Je(),A.outcome==="accepted"?p("安装请求已提交,请回到桌面查看。"):p("你取消了这次安装。")}catch(A){Ol({kind:"install-error",message:"调用浏览器安装流程时报错。",detail:A instanceof Error?A.message:"Unknown install error"}),Je(),p("浏览器没有完成安装流程,请查看下方安装诊断。")}finally{he(null),$(!1),oe(du()),Je()}},Qt=A=>{var pe,et,Lt;if(FE(A),!A.some(pt=>pt.value===tt)){const pt=((pe=A[0])==null?void 0:pe.value)??"";pt&&(vf(pt),nn(pt))}if(!A.some(pt=>pt.value===Xt)){const pt=((et=A.find(ct=>ct.value==="gpt-5.4-mini"))==null?void 0:et.value)??((Lt=A[0])==null?void 0:Lt.value)??"";pt&&(gg(pt),jn(pt))}},On=()=>{Bt("new"),bt(ef()),cn(null)},Ts=A=>{Bt(A.id),bt({...A}),cn(null)},Ua=()=>{Bt(null),bt(ef()),cn(null)},Us=()=>{var ct;const A=yt.label.trim(),pe=yt.value.trim();if(!A||!pe){cn("请填写显示名和模型 ID。");return}if(Ke.find(gn=>gn.value.toLowerCase()===pe.toLowerCase()&&gn.id!==zt)){cn(`模型 ID ${pe} 已存在。`);return}const Lt={...yt,label:A,value:pe,description:((ct=yt.description)==null?void 0:ct.trim())||null},pt=zt==="new"?[...Ke,Lt]:Ke.map(gn=>gn.id===zt?Lt:gn);Qt(pt),Bt(null),bt(ef()),cn(zt==="new"?"模型已添加。":"模型已更新。")},Ci=A=>{const pe=Ke.filter(et=>et.id!==A);if(pe.length===0){cn("至少保留一个模型。");return}Qt(pe),zt===A&&(Bt(null),bt(ef())),cn("模型已删除。")},Fn=A=>{vf(A),nn(A),cn(`默认模型已切换为 ${A}。`)},Vs=A=>{gg(A),jn(A),cn(`命令执行模型已切换为 ${A}。`)},te=(A,pe)=>{const et=Ke.findIndex(ct=>ct.id===A);if(et<0)return;const Lt=pe==="up"?et-1:et+1;if(Lt<0||Lt>=Ke.length)return;const pt=Ke[Lt];pt&&Qt(yb(Ke,A,pt.id,pe==="up"?"before":"after"))},Pe=(A,pe)=>{Ee(pe),_e(null),A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",pe)},$e=(A,pe)=>{if(!Pn||Pn===pe)return;A.preventDefault();const et=A.currentTarget.getBoundingClientRect(),Lt=A.clientY<et.top+et.height/2?"before":"after";_e(pt=>(pt==null?void 0:pt.modelId)===pe&&pt.position===Lt?pt:{modelId:pe,position:Lt})},at=A=>{!Pn||!V||V.modelId!==A||(Qt(yb(Ke,Pn,A,V.position)),Ee(null),_e(null))},Ut=()=>{Ee(null),_e(null)},ft=Se.appearance,Mt=ft==="light"?j0:Df,qn=ft==="light"?ie.lightThemeId:ie.darkThemeId,jt=Mt.find(A=>A.id===qn)??Mt[0],zs=Se.activeTheme,Kt=EC(jt.codeThemeId,jt.accent,jt.contrast,jt.opaqueWindows),bs=ie.mode==="system"?`当前跟随系统:${se==="dark"?"深色":"浅色"}`:`当前固定为${Se.appearance==="dark"?"深色":"浅色"}模式`,Wn="当前正在显示",P=jt.opaqueWindows?"不透明窗口":"半透明窗口",be=fm.find(A=>A.id===v)??fm[0],Ue={"--settings-mobile-sticky-safe-area":qe?"0px":"var(--app-safe-area-top)"},He=`${jt.label} · ${P} · 对比度 ${jt.contrast}`,Ge=Ke.find(A=>A.value===tt)??Ke[0]??null,ht=Ke.find(A=>A.value===Xt)??Ke.find(A=>A.value==="gpt-5.4-mini")??Ke[0]??null,mt=A=>{var pe;return A==="theme"?Se.activeTheme.label:A==="models"?(Ge==null?void 0:Ge.label)??`${Ke.length} 个模型`:A==="cache"?y||(Xe.data?`${Xe.data.commands.length} 条命令`:"站点与命令目录"):A==="notifications"?z.completionNotificationsEnabled?"已开启":"未开启":A==="installation"?ee?"已安装":"检查状态":(pe=Me.data)!=null&&pe.healthOk?Me.data.modeLabel:(ce==null?void 0:ce.name)??"查看链路"},ot=()=>i.jsx("div",{className:"settings-mobile-layout",children:i.jsx("div",{className:"settings-mobile-sections",role:"list","aria-label":"设置分组",children:NC.map(A=>i.jsx("section",{className:"settings-mobile-group","aria-label":A.label,children:A.sections.map(pe=>{const et=fm.find(ct=>ct.id===pe);if(!et)return null;const Lt=N===et.id,pt=mt(et.id);return i.jsxs(_.Fragment,{children:[i.jsxs("button",{type:"button",className:`settings-mobile-row ${Lt?"is-active":""}`,"data-section":et.id,onClick:()=>{w(et.id),j(ct=>ct===et.id?null:et.id)},"aria-expanded":Lt,"aria-controls":`settings-mobile-detail-${et.id}`,children:[i.jsx("span",{className:"settings-mobile-row__icon","data-section":et.id,"aria-hidden":"true",children:i.jsx(pb,{icon:et.icon})}),i.jsx("span",{className:"settings-mobile-row__copy",children:i.jsx("span",{className:"settings-mobile-row__title",children:et.title})}),i.jsx("span",{className:"settings-mobile-row__summary",children:pt}),i.jsx("span",{className:"settings-mobile-row__chevron","aria-hidden":"true",children:i.jsx(TC,{open:!1})})]}),Lt?i.jsx("section",{className:"settings-mobile-detail settings-mobile-detail--inline",id:`settings-mobile-detail-${et.id}`,children:sn(et.id)}):null]},et.id)})},A.id))})}),Xn=()=>i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsxs("div",{children:[i.jsx("h3",{className:"settings-panel__title",children:"外观"}),i.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),i.jsx("div",{className:"settings-control-grid",children:i.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[i.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),i.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:kC.map(A=>{const pe=A.value===ie.mode;return i.jsxs("button",{type:"button",className:`theme-mode-switch__button ${pe?"is-active":""}`,onClick:()=>we(A.value),role:"tab","aria-selected":pe,children:[i.jsx(LC,{icon:A.icon,active:pe}),i.jsx("span",{children:A.label})]},A.value)})}),i.jsx("p",{className:"settings-control-block__hint",children:bs})]})})]}),i.jsxs("div",{className:"settings-theme-layout",children:[i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:ft==="light"?"浅色风格":"深色风格"})})}),i.jsxs("div",{className:"settings-theme-selector",children:[i.jsx("label",{className:"settings-select settings-select--wide",children:i.jsx("select",{value:jt.id,onChange:A=>{if(ft==="light"){ye(A.target.value);return}Oe(A.target.value)},"aria-label":ft==="light"?"选择浅色主题":"选择深色主题",children:Mt.map(A=>i.jsx("option",{value:A.id,children:A.label},`${A.variant}-${A.id}`))})}),i.jsxs("div",{className:"settings-theme-selector__summary",children:[i.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[i.jsx("span",{style:{"--theme-card-color":jt.background}}),i.jsx("span",{style:{"--theme-card-color":jt.foreground}}),i.jsx("span",{style:{"--theme-card-color":jt.accent}}),i.jsx("span",{style:{"--theme-card-color":jt.semanticColors.diffAdded}}),i.jsx("span",{style:{"--theme-card-color":jt.semanticColors.diffRemoved}})]}),i.jsxs("div",{className:"settings-theme-selector__copy",children:[i.jsx("strong",{children:jt.label}),i.jsx("span",{children:He})]}),jt.id===zs.id&&jt.variant===Se.appearance?i.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):i.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),i.jsx("div",{className:"theme-status-badge",children:Wn})]}),i.jsx(PC,{title:ft==="light"?"浅色预览":"深色预览",caption:jt.label,accent:jt.accent,background:jt.background,foreground:jt.foreground,lines:Kt}),i.jsxs("div",{className:"settings-list",children:[i.jsx(hm,{label:"代码风格",value:jt.codeThemeId}),i.jsx(hm,{label:"当前模式",value:jt.variant}),i.jsx(hm,{label:"对比度",value:String(jt.contrast)}),i.jsx(hm,{label:"面板质感",value:P}),i.jsx(Jc,{label:"强调色",value:jt.accent}),i.jsx(Jc,{label:"背景色",value:jt.background}),i.jsx(Jc,{label:"文字色",value:jt.foreground}),i.jsx(Jc,{label:"新增颜色",value:jt.semanticColors.diffAdded}),i.jsx(Jc,{label:"删除颜色",value:jt.semanticColors.diffRemoved}),i.jsx(Jc,{label:"特殊强调",value:jt.semanticColors.skill}),i.jsx(gb,{label:"界面字体",value:jt.fonts.ui??"null"}),i.jsx(gb,{label:"代码字体",value:jt.fonts.code??"null",mono:!0})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),i.jsxs("div",{className:"settings-list",children:[i.jsx(_b,{label:"界面字号",value:ie.uiFontSize,onChange:A=>Le(F3(A)),min:11,max:18}),i.jsx(_b,{label:"代码字号",value:ie.codeFontSize,onChange:A=>_t(q3(A)),min:10,max:18})]})]})]}),Jt=()=>{var A;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),i.jsxs("button",{type:"button",className:"settings-inline-action",onClick:On,children:[i.jsx(RC,{}),"新增模型"]})]}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"首位模型"}),i.jsx("strong",{children:((A=Ke[0])==null?void 0:A.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前默认"}),i.jsx("strong",{children:(Ge==null?void 0:Ge.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("strong",{children:(ht==null?void 0:ht.label)??"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"可选数量"}),i.jsxs("strong",{children:[Ke.length," 个"]})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),i.jsxs("div",{className:"settings-model-editor__grid",children:[i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"默认模型"}),i.jsx("select",{value:tt,onChange:pe=>Fn(pe.target.value),children:Ke.map(pe=>i.jsx("option",{value:pe.value,children:pe.label},pe.id))})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"命令执行模型"}),i.jsx("select",{value:Xt,onChange:pe=>Vs(pe.target.value),children:Ke.map(pe=>i.jsx("option",{value:pe.value,children:pe.label},pe.id))})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),dt?i.jsx("div",{className:"settings-inline-status",role:"alert",children:dt}):null,i.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:Ke.map((pe,et)=>{const Lt=Pn===pe.id,pt=(V==null?void 0:V.modelId)===pe.id&&V.position==="before",ct=(V==null?void 0:V.modelId)===pe.id&&V.position==="after",gn=pe.value===tt;return i.jsxs("article",{className:`settings-model-card ${Lt?"is-dragging":""} ${pt?"is-drop-before":""} ${ct?"is-drop-after":""}`,draggable:!0,onDragStart:zn=>Pe(zn,pe.id),onDragOver:zn=>$e(zn,pe.id),onDrop:zn=>{zn.preventDefault(),at(pe.id)},onDragEnd:Ut,role:"listitem",children:[i.jsxs("div",{className:"settings-model-card__main",children:[i.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:i.jsx(MC,{})}),i.jsxs("div",{className:"settings-model-card__copy",children:[i.jsxs("div",{className:"settings-model-card__title-row",children:[i.jsx("strong",{children:pe.label}),gn?i.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),i.jsx("code",{className:"settings-model-card__value",children:pe.value})]})]}),i.jsxs("div",{className:"settings-model-card__actions",children:[i.jsx("button",{type:"button",className:`settings-mini-button settings-model-card__primary-action ${gn?"is-active":""}`,onClick:()=>Fn(pe.value),children:"设为默认"}),i.jsxs("div",{className:"settings-model-card__icon-actions",children:[i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>te(pe.id,"up"),disabled:et===0,"aria-label":`上移 ${pe.label}`,children:i.jsx(OC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>te(pe.id,"down"),disabled:et===Ke.length-1,"aria-label":`下移 ${pe.label}`,children:i.jsx(IC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ts(pe),"aria-label":`编辑 ${pe.label}`,children:i.jsx(AC,{})}),i.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>Ci(pe.id),disabled:Ke.length<=1,"aria-label":`删除 ${pe.label}`,children:i.jsx(DC,{})})]})]})]},pe.id)})}),zt?i.jsxs("div",{className:"settings-model-editor",children:[i.jsx("div",{className:"settings-model-editor__header",children:i.jsx("strong",{children:zt==="new"?"新增模型":"编辑模型"})}),i.jsxs("div",{className:"settings-model-editor__grid",children:[i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"显示名"}),i.jsx("input",{type:"text",value:yt.label,onChange:pe=>bt(et=>({...et,label:pe.target.value})),placeholder:"例如:gpt-5.4"})]}),i.jsxs("label",{className:"settings-field",children:[i.jsx("span",{children:"模型 ID"}),i.jsx("input",{type:"text",value:yt.value,onChange:pe=>bt(et=>({...et,value:pe.target.value})),placeholder:"例如:gpt-5.4"})]})]}),i.jsxs("div",{className:"settings-model-editor__actions",children:[i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:Ua,children:"取消"}),i.jsx("button",{type:"button",className:"settings-inline-action",onClick:Us,children:"保存"})]})]}):null]})]})},Jn=()=>{var A,pe;return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"适合什么时候用"}),i.jsx("strong",{children:"页面资源或本地缓存异常"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"常见表现"}),i.jsx("strong",{children:"样式没更新、列表卡旧、页面反复异常"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Un(),disabled:f,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"清理并刷新"}),i.jsx("span",{children:"删除页面资源缓存和本地会话缓存,强制重新加载最新页面。"})]}),i.jsx("span",{className:"settings-action__state",children:f?"处理中…":"→"})]}),y?i.jsx("p",{className:"settings-block__status",children:y}):null]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>Nt("/diagnostics"),children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"打开安卓诊断页"}),i.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),i.jsx("span",{className:"settings-action__state",children:"→"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 CLI"}),i.jsx("span",{children:((A=Xe.data)==null?void 0:A.cli_version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近刷新"}),i.jsx("span",{children:((pe=Xe.data)==null?void 0:pe.loaded_at)??"尚未生成"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"命令数量"}),i.jsx("span",{children:Xe.data?`${Xe.data.commands.length} 条`:"检测中…"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Wt.mutateAsync(),disabled:Wt.isPending,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:"刷新命令目录"}),i.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),i.jsx("span",{className:"settings-action__state",children:Wt.isPending?"刷新中…":"→"})]})]})]})},as=()=>{var ct,gn,zn,za,Bs,Hs,Zs,$s,ri,Ti,er,tr,nr,sr,Ba,Ms,Ha,ar,Xs,Ss,ir,rr;const A=Re.data,pe=We.data,et=!!(pe!=null&&pe.apk_url),Lt=LE(A,pe),pt=N3(o.hubUrl);return i.jsxs("div",{className:"settings-content-stack",children:[qe?i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"Hub 连接配置"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前 Hub"}),i.jsx("strong",{children:o.hubUrl||"未配置"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"首启状态"}),i.jsx("strong",{children:o.onboardingCompleted?"已完成":"未完成"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"App 形态"}),i.jsx("strong",{children:"Capacitor Android"})]})]})]}):i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"网页端连接基线"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前网页入口"}),i.jsx("strong",{children:o.hubUrl||"未检测到"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"地址来源"}),i.jsx("strong",{children:"浏览器访问地址"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"缓存策略"}),i.jsx("strong",{children:"同源页面 + 本地查询缓存"})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:qe?"重新设置 Hub":"当前访问方式"})})}),qe?i.jsx(a6,{title:"输入新的 Hub 地址",description:"扫码或手动输入后,保存即可让 APK 用新地址重新建立连接。",currentHubUrl:o.hubUrl,initialHubUrl:o.hubUrl,hint:"保存后会清理旧的查询缓存、会话定位和连接判定缓存,避免继续误连到旧 Hub。",saveLabel:"保存并重连",savingLabel:"正在保存地址",saveDescription:"新的 Hub 地址会持久化到本机,后续重新打开 APK 会继续沿用。",saveSuccessMessage:"Hub 地址已保存,连接缓存和旧会话定位已重置。",onSaveSuccess:async li=>{await P6({hubUrl:li.url,onboardingCompleted:!0}),await f3(l),Me.refetch(),We.refetch(),Re.refetch()}}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Hub 地址"}),i.jsx("span",{children:o.hubUrl||"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"可修改性"}),i.jsx("span",{children:"网页端跟随浏览器打开的地址,不额外保存本地覆盖配置。"})]})]})]}),o.platform==="android"?i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"App 升级"})}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Re.refetch(),We.refetch()},children:"刷新版本"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前版本"}),i.jsx("span",{children:(A==null?void 0:A.version)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 build"}),i.jsx("span",{children:(A==null?void 0:A.build)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"应用包名"}),i.jsx("span",{children:(A==null?void 0:A.appId)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"更新清单"}),i.jsx("span",{children:pt||"等待 Hub 地址"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最新发布"}),i.jsx("span",{children:We.isLoading?"检测中…":pe?`${pe.version_name} (${pe.version_code})`:We.error instanceof Error?We.error.message:"未检测到"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"升级状态"}),i.jsx("span",{className:Lt?"is-ok":"is-muted",children:Lt?"发现新版本":et?"当前已是最新":"等待发布 APK"})]}),pe!=null&&pe.published_at?i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"发布时间"}),i.jsx("span",{children:eu(pe.published_at)})]}):null,i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>{pe!=null&&pe.apk_url&&PE(pe.apk_url)},disabled:!(pe!=null&&pe.apk_url),children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:Lt?"下载并覆盖安装新版 APK":"打开最新 APK 下载地址"}),i.jsx("span",{children:"通过同一个 `applicationId` 和固定签名覆盖安装,旧配置和本地数据会保留,不需要卸载重装。"})]}),i.jsx("span",{className:"settings-action__state",children:pe!=null&&pe.apk_url?"→":"未就绪"})]}),pe!=null&&pe.release_notes.length?i.jsx("div",{className:"settings-diagnostic-list",children:pe.release_notes.map(li=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsx("strong",{children:"发布说明"}),i.jsx("span",{children:li})]},li))}):null]}):null,i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"设备名称"}),i.jsx("strong",{children:(ce==null?void 0:ce.name)??"未选择节点"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"连接方式"}),i.jsx("strong",{children:((ct=Me.data)==null?void 0:ct.modeLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前链路延迟"}),i.jsx("strong",{className:(gn=Me.data)!=null&&gn.healthOk?"is-ok":"is-muted",children:Me.isLoading?"检测中…":mm((zn=Me.data)==null?void 0:zn.latencyMs)})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前链路"})}),i.jsx("div",{className:"settings-actions-row",children:i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Me.refetch()},children:"刷新延迟"})})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务名称"}),i.jsx("span",{children:((za=Me.data)==null?void 0:za.backendLabel)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"服务地址"}),i.jsx("span",{children:((Bs=Me.data)==null?void 0:Bs.backendUrl)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前状态"}),i.jsx("span",{className:(Hs=Me.data)!=null&&Hs.healthOk?"is-ok":"is-muted",children:Me.isLoading?"检测中…":(Zs=Me.data)!=null&&Zs.healthOk?"在线":(($s=Me.data)==null?void 0:$s.activeProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前延迟"}),i.jsx("span",{children:mm((ri=Me.data)==null?void 0:ri.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近探测"}),i.jsx("span",{children:eu((Ti=Me.data)==null?void 0:Ti.checkedAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"设备标识"}),i.jsx("span",{children:(ce==null?void 0:ce.id)??"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近会话"}),i.jsx("span",{children:Ie??"未选择会话"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"延迟对比"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 延迟"}),i.jsx("span",{children:mm((er=Me.data)==null?void 0:er.hubProbe.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 状态"}),i.jsx("span",{className:(tr=Me.data)!=null&&tr.hubProbe.healthOk?"is-ok":"is-muted",children:(nr=Me.data)!=null&&nr.hubProbe.healthOk?"在线":((sr=Me.data)==null?void 0:sr.hubProbe.error)??"无法连接"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Hub 地址"}),i.jsx("span",{children:((Ba=Me.data)==null?void 0:Ba.hubProbe.url)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 延迟"}),i.jsx("span",{children:mm((Ha=(Ms=Me.data)==null?void 0:Ms.agentProbe)==null?void 0:Ha.latencyMs)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 状态"}),i.jsx("span",{className:(Xs=(ar=Me.data)==null?void 0:ar.agentProbe)!=null&&Xs.healthOk?"is-ok":"is-muted",children:(Ss=Me.data)!=null&&Ss.agentProbe?Me.data.agentProbe.healthOk?"在线":Me.data.agentProbe.error??"无法连接":"未选择节点"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前 Agent 地址"}),i.jsx("span",{children:((rr=(ir=Me.data)==null?void 0:ir.agentProbe)==null?void 0:rr.url)||Ae||"未配置"})]})]})]})},In=()=>{const A=qe?"原生 APK":ee?"已安装":"未安装",pe=k==="granted"?"已允许":k==="denied"?"已拒绝":k==="default"?"待授权":"不支持",et=qe?k==="granted"?"原生通知":"等待授权":K?Q?"同步中":q?"已连接":z.completionNotificationsEnabled&&k==="granted"?"待连接":"未连接":"不支持",Lt=qe?k==="granted"?"已开启":"待授权":k==="granted"&&z.completionNotificationsEnabled?q?"后台可达":K?"前台兜底":"仅前台":"未开启",pt=qe?"原生系统通知":K?q?"Hub Web Push + 系统通知":"系统通知,后台通道待建立":"系统通知(仅页面在线)",ct=qe?k==="granted"?"通常可见,细节取决于系统设置":"先授予通知权限":q?ee?"已具备条件":"大多可见,安装后更稳":K?"先建立后台通道":"当前环境很难稳定锁屏提醒",gn=k==="unsupported"||!qe&&Q,zn=qe?k==="granted"?"系统通知已开启":"申请通知权限":k==="granted"&&z.completionNotificationsEnabled?"关闭完成提醒":Q?"正在建立后台提醒":"开启完成提醒",za=k==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":qe?k==="granted"?"首次连接时也会自动申请;这里主要用于补检查权限状态。":"如果首次连接时错过了授权,这里可以补申请一次。":K?"开启后会向 Hub 注册这台设备,后台或锁屏时也能收到完成提醒。":"当前环境只能在页面在线时提醒,建议安装到桌面并使用支持 Web Push 的浏览器。",Bs=qe?k==="unsupported"?"不可用":k==="granted"?"已开启":"→":k==="unsupported"?"不可用":Q?"同步中…":k==="granted"&&z.completionNotificationsEnabled?q?"已连接":K?"待连接":"已开启":"→",Hs=qe?k==="granted":k==="granted"&&z.completionNotificationsEnabled&&q&&!Q,Zs=qe?"直接在当前 APK 里发一条本地测试通知,确认系统权限和展示链路正常。":q?"立刻让 Hub 给当前这台设备发一条测试通知,用来确认后台链路是否真的可达。":"只有当前设备已经完成 Web Push 注册后,才能发送测试通知。";return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"桌面安装"}),i.jsx("strong",{children:A})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"系统通知权限"}),i.jsx("strong",{children:pe})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"完成提醒"}),i.jsx("strong",{children:Lt})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"后台 Web Push"}),i.jsx("strong",{children:et})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:qe?"当前交付形态":"安装到桌面"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"推荐平台"}),i.jsx("span",{children:qe?"当前已经是 Android APK":ae?"Android 当前设备":"Android 效果最佳"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前形态"}),i.jsx("span",{children:qe?"本地前端壳 + 局域网后端":ee?"已是桌面应用":"浏览器标签页"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void De(),disabled:qe||ee||M,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:qe?"已经是可安装 APK":ee?"已经安装":"安装到桌面"}),i.jsx("span",{children:qe?"当前无需再走 PWA 安装链路,后续升级直接下载新版 APK 覆盖安装即可。":ee?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),i.jsx("span",{className:"settings-action__state",children:qe||ee?"✓":M?"处理中…":"→"})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"提醒方式"}),i.jsx("span",{children:pt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"锁屏可见"}),i.jsx("span",{children:ct})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"后台通道"}),i.jsx("span",{children:et})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"触发时机"}),i.jsx("span",{children:qe?"App 在线时收到完成事件后,直接发原生系统通知":K?"Hub 收到对话完成后主动推送":"页面在线时收到完成事件后提醒"})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Cn(),disabled:gn,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:zn}),i.jsx("span",{children:za})]}),i.jsx("span",{className:"settings-action__state",children:Bs})]}),i.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Dn(),disabled:!Hs||ge,children:[i.jsxs("div",{className:"settings-action__copy",children:[i.jsx("strong",{children:qe?ge?"正在发送测试通知":"发送测试通知":ge?"正在发送测试推送":"发送测试推送"}),i.jsx("span",{children:Zs})]}),i.jsx("span",{className:"settings-action__state",children:ge?"发送中…":Hs?"→":"未就绪"})]}),S?i.jsx("p",{className:"settings-block__status",children:S}):null]})]})},pn=()=>{const A=Tt.data,pe=A!=null&&A.promptState.installPromptAvailable?"可主动触发":A!=null&&A.promptState.beforeInstallPromptSeen?"本地曾出现":"未出现",et=A!=null&&A.promptState.appInstalledSeen?"记录到过":"未记录到",Lt=A!=null&&A.manifest.ok?"正常":A!=null&&A.manifest.present?"读取失败":"缺失",pt=A!=null&&A.serviceWorker.registrations.length?`${A.serviceWorker.registrations.length} 个注册`:A!=null&&A.serviceWorker.supported?"未注册":"不支持";return i.jsxs("div",{className:"settings-content-stack",children:[i.jsxs("section",{className:"settings-panel settings-panel--hero",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"安装结果判断"})})}),i.jsxs("div",{className:"settings-summary-strip",children:[i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"当前研判"}),i.jsx("strong",{children:(A==null?void 0:A.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"安装事件"}),i.jsx("strong",{children:pe})]}),i.jsxs("div",{className:"settings-summary-strip__item",children:[i.jsx("span",{children:"appinstalled"}),i.jsx("strong",{children:et})]})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsxs("div",{className:"settings-panel__header",children:[i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"当前状态"})}),i.jsxs("div",{className:"settings-actions-row",children:[i.jsx("button",{type:"button",className:"settings-inline-action",onClick:()=>{Tt.refetch()},children:"刷新诊断"}),i.jsx("button",{type:"button",className:"settings-ghost-button",onClick:()=>{uC(),Je()},children:"清空日志"})]})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前窗口形态"}),i.jsx("span",{children:A?A.environment.standaloneDisplayMode||A.environment.navigatorStandalone?"独立窗口 / 主屏幕入口":"浏览器标签页":"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"系统级安装研判"}),i.jsx("span",{children:(A==null?void 0:A.assessment.label)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"研判置信度"}),i.jsx("span",{children:(A==null?void 0:A.assessment.confidence)??"检测中…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前说明"}),i.jsx("span",{children:(A==null?void 0:A.assessment.detail)??"正在分析…"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近抓取时间"}),i.jsx("span",{children:eu(A==null?void 0:A.capturedAt)})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"PWA 条件与安装信号"})})}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"安全上下文"}),i.jsx("span",{children:A!=null&&A.environment.secureContext?"是":"否"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest"}),i.jsx("span",{children:Lt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"manifest display"}),i.jsx("span",{children:(A==null?void 0:A.manifest.display)??"未声明"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"Service Worker"}),i.jsx("span",{children:pt})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"当前可主动触发安装"}),i.jsx("span",{children:A!=null&&A.promptState.installPromptAvailable?"可以":"不可以"})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 beforeinstallprompt"}),i.jsx("span",{children:eu(A==null?void 0:A.promptState.lastBeforeInstallPromptAt)})]}),i.jsxs("div",{className:"settings-meta",children:[i.jsx("span",{children:"最近 appinstalled"}),i.jsx("span",{children:eu(A==null?void 0:A.promptState.lastAppInstalledAt)})]})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"为什么当前可能安装失败"})})}),Tt.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在收集安装诊断…"}):A!=null&&A.failureReasons.length?i.jsx("div",{className:"settings-diagnostic-list",children:A.failureReasons.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["原因 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`))}):i.jsx("p",{className:"settings-block__status",children:"当前没有发现明显的前端侧阻断条件;如果仍无法完成系统级安装,更像是浏览器策略、安装链路回退或平台侧判断导致。"})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"成功信号与人工确认"})})}),A!=null&&A.successSignals.length?i.jsx("div",{className:"settings-diagnostic-list",children:A.successSignals.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["信号 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`))}):null,i.jsx("div",{className:"settings-diagnostic-list",children:(A==null?void 0:A.confirmationChecklist.map((ct,gn)=>i.jsxs("div",{className:"settings-diagnostic-list__item",children:[i.jsxs("strong",{children:["确认 ",gn+1]}),i.jsx("span",{children:ct})]},`${gn}-${ct}`)))??null})]}),i.jsxs("section",{className:"settings-panel",children:[i.jsx("div",{className:"settings-panel__header",children:i.jsx("div",{children:i.jsx("h3",{className:"settings-panel__title",children:"浏览器安装事件日志"})})}),Tt.isLoading?i.jsx("p",{className:"settings-block__status",children:"正在读取日志…"}):A!=null&&A.logs.length?i.jsx("div",{className:"settings-log-list",children:A.logs.map(ct=>i.jsxs("article",{className:"settings-log-item",children:[i.jsxs("div",{className:"settings-log-item__meta",children:[i.jsx("strong",{children:ct.message}),i.jsx("span",{children:eu(ct.timestamp)})]}),i.jsx("div",{className:"settings-log-item__kind",children:ct.kind}),ct.detail?i.jsx("pre",{className:"settings-log-item__detail",children:ct.detail}):null]},ct.id))}):i.jsx("p",{className:"settings-block__status",children:"还没有本地安装日志。后续在这个页面触发安装、刷新页面、出现 beforeinstallprompt 或 appinstalled 后,这里会自动积累证据。"})]})]})},sn=A=>A==="models"?Jt():A==="cache"?Jn():A==="notifications"?In():A==="installation"?pn():A==="connection"?as():A==="dev-manager"?i.jsx(ME,{isActive:v==="dev-manager"||N==="dev-manager",agentId:(ce==null?void 0:ce.id)??null}):Xn();return i.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",style:Ue,children:i.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:i.jsx("div",{className:"settings-screen__body",children:i.jsxs("div",{className:"settings-shell",children:[i.jsxs("header",{className:"settings-page-header",children:[i.jsx("button",{type:"button",className:"settings-card__back",onClick:ls,"aria-label":"返回会话",children:i.jsx(CC,{})}),i.jsx("div",{className:"settings-page-header__copy",children:i.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),C?i.jsxs("div",{className:"settings-workspace",children:[i.jsxs("aside",{className:"settings-sidebar",children:[i.jsx("div",{className:"settings-sidebar__title",children:"设置"}),i.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:fm.map(A=>{const pe=A.id===v;return i.jsxs("button",{type:"button",className:`settings-sidebar__item ${pe?"is-active":""}`,onClick:()=>w(A.id),children:[i.jsx(pb,{icon:A.icon}),i.jsx("span",{children:A.title})]},A.id)})})]}),i.jsxs("main",{className:"settings-stage",children:[i.jsx("header",{className:"settings-stage__header",children:i.jsxs("div",{children:[i.jsx("h2",{className:"settings-stage__title",children:be.title}),i.jsx("p",{className:"settings-stage__description",children:be.description})]})}),sn(v)]})]}):ot()]})})})})},UC=({onClose:e})=>{const t=_.useRef(null);return _.useEffect(()=>{var u;if(typeof document>"u")return;const a=document.documentElement.style.overflow,l=document.body.style.overflow;document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",(u=t.current)==null||u.focus();const o=f=>{f.key==="Escape"&&(f.preventDefault(),e())};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),document.documentElement.style.overflow=a,document.body.style.overflow=l}},[e]),i.jsx("div",{ref:t,className:"settings-overlay",role:"dialog","aria-modal":"true","aria-label":"设置",tabIndex:-1,children:i.jsx(V3,{mode:"overlay",onRequestClose:e})})},zC=()=>{const e=Ei();vp();const t=Sa(p=>p.themeSettings),a=Sa(p=>p.systemAppearance),l=Sa(p=>p.setSystemAppearance),o=Sa(p=>p.isSettingsOverlayOpen),u=Sa(p=>p.closeSettingsOverlay),f=La({select:p=>p.location.pathname}),m=_.useRef(null),y=uc(),g=Ff(y),S=!!(y&&g);return _.useEffect(()=>{K3(t,a)},[a,t]),_.useEffect(()=>iC(l),[l]),_.useEffect(()=>{h_().catch(()=>{})},[]),_.useEffect(()=>{let p;return zk(v=>{e({to:v}).catch(()=>{typeof window<"u"&&window.location.assign(v)})}).then(v=>{p=v}),()=>{p==null||p()}},[e]),_.useEffect(()=>{if(!o){m.current=null;return}if(m.current===null){m.current=f;return}f!==m.current&&u()},[u,o,f]),pk()?i.jsx(Gk,{}):i.jsxs("div",{className:"app-shell",children:[S?null:i.jsx(eE,{}),i.jsx(yE,{}),i.jsx("div",{className:"app-shell__content","aria-hidden":o,children:i.jsx(e6,{})}),o?i.jsx(UC,{onClose:u}):null]})};/**
|
|
69
|
+
* @license lucide-react v0.577.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/const Z3=(...e)=>e.filter((t,a,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===a).join(" ").trim();/**
|
|
74
|
+
* @license lucide-react v0.577.0 - ISC
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the ISC license.
|
|
77
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/const BC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
79
|
+
* @license lucide-react v0.577.0 - ISC
|
|
80
|
+
*
|
|
81
|
+
* This source code is licensed under the ISC license.
|
|
82
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
+
*/const HC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,l)=>l?l.toUpperCase():a.toLowerCase());/**
|
|
84
|
+
* @license lucide-react v0.577.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/const vb=e=>{const t=HC(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
89
|
+
* @license lucide-react v0.577.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/var $C={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
94
|
+
* @license lucide-react v0.577.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/const FC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
99
|
+
* @license lucide-react v0.577.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/const qC=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:f,...m},y)=>_.createElement("svg",{ref:y,...$C,width:t,height:t,stroke:e,strokeWidth:l?Number(a)*24/Number(t):a,className:Z3("lucide",o),...!u&&!FC(m)&&{"aria-hidden":"true"},...m},[...f.map(([g,S])=>_.createElement(g,S)),...Array.isArray(u)?u:[u]]));/**
|
|
104
|
+
* @license lucide-react v0.577.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const jp=(e,t)=>{const a=_.forwardRef(({className:l,...o},u)=>_.createElement(qC,{ref:u,iconNode:t,className:Z3(`lucide-${BC(vb(e))}`,`lucide-${e}`,l),...o}));return a.displayName=vb(e),a};/**
|
|
109
|
+
* @license lucide-react v0.577.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const WC=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],KC=jp("pencil-line",WC);/**
|
|
114
|
+
* @license lucide-react v0.577.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const QC=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],GC=jp("pin",QC);/**
|
|
119
|
+
* @license lucide-react v0.577.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const YC=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],VC=jp("rotate-cw",YC);/**
|
|
124
|
+
* @license lucide-react v0.577.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const ZC=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],X3=jp("trash-2",ZC),yg=({message:e})=>i.jsx("p",{className:"empty-copy",children:e}),XC=async e=>(await xn()).client.updateAgent({agentId:e.agentId,action:e.action,displayName:e.displayName??null}),JC=(e,t,a)=>e&&{...e,agents:e.agents.map(l=>l.id===t?{...l,...a}:l)},eT=(e,t)=>e&&{...e,agents:e.agents.filter(a=>a.id!==t)},tT=()=>{var M,$;const e=Ei(),t=Pa(),{data:a,isPending:l,isFetching:o,error:u}=N_(),[f,m]=_.useState(!1),[y,g]=_.useState(null),[S,p]=_.useState(""),[v,w]=_.useState(null),[N,j]=_.useState(null),[C,R]=_.useState(null),[z,O]=_.useState(null),[k,L]=_.useState(!1),K=a??C,J=(K==null?void 0:K.agents)??[];_.useEffect(()=>{let ee=!1;return xn().then(oe=>{ee||m(oe.mode==="hub")}).catch(()=>{ee||m(!1)}),()=>{ee=!0}},[]),_.useEffect(()=>{a&&(R(a),O(null))},[a]),_.useEffect(()=>{if(a||k)return;let ee=!1;const oe=window.setTimeout(()=>{ee||(L(!0),O(null),t.removeQueries({queryKey:Ki}),v3(t).then(ae=>{ee||R(ae)}).catch(ae=>{ee||O(ae instanceof Error?ae.message:"节点列表刷新失败")}).finally(()=>{ee||L(!1)}))},1200);return()=>{ee=!0,window.clearTimeout(oe)}},[t,a,k]);const q=_.useMemo(()=>J.find(ee=>ee.id===y)??null,[J,y]),Y=_.useMemo(()=>J.find(ee=>ee.id===v)??null,[J,v]),Q=ss({mutationFn:XC,onMutate:async ee=>{j(null),await t.cancelQueries({queryKey:Ki});const oe=t.getQueryData(Ki);return ee.action==="rename"&&t.setQueryData(Ki,ae=>{var I;return JC(ae,ee.agentId,{display_name:((I=ee.displayName)==null?void 0:I.trim())||null})}),ee.action==="delete"&&t.setQueryData(Ki,ae=>eT(ae,ee.agentId)),{previousSnapshot:oe}},onSuccess:(ee,oe)=>{oe.action==="rename"&&(g(null),p("")),oe.action==="delete"&&w(null)},onError:(ee,oe,ae)=>{ae!=null&&ae.previousSnapshot&&t.setQueryData(Ki,ae.previousSnapshot),j(ee instanceof Error?ee.message:"节点操作失败")},onSettled:async()=>{await t.invalidateQueries({queryKey:Ki})}}),G=Q.isPending?((M=Q.variables)==null?void 0:M.action)??null:null,ge=Q.isPending?(($=Q.variables)==null?void 0:$.agentId)??null:null,me=ee=>{Zi(ee.id),sa(null),Wr(null),fu(null),of(!1),ek({agentId:ee.id,name:ee.name,displayName:ee.display_name??null,directBaseUrl:ee.direct_base_url,wsBaseUrl:ee.ws_base_url,createdAt:new Date().toISOString()}),e({to:"/"})},Z=q&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{g(null),p(""),j(null)},"aria-label":"关闭节点备注面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered node-sheet",children:[i.jsx("div",{className:"node-sheet__eyebrow",children:"节点备注"}),i.jsx("div",{className:"sheet-panel__title",children:"修改显示名称"}),i.jsx("p",{className:"node-sheet__description",children:"留空后会恢复显示为原始节点名。"}),i.jsxs("div",{className:"node-sheet__meta",children:[i.jsx("span",{children:q.name}),i.jsx("span",{children:fg(q)})]}),i.jsx("input",{className:"sheet-panel__input",value:S,onChange:ee=>p(ee.target.value),placeholder:q.name,autoFocus:!0}),N?i.jsx("p",{className:"error-text",children:N}):null,i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{g(null),p(""),j(null)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:G==="rename"&&ge===q.id,onClick:()=>{Q.mutate({agentId:q.id,action:"rename",displayName:S.trim()||null})},children:G==="rename"&&ge===q.id?"保存中...":"保存"})]})]})})]}),document.body):null,he=Y&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{w(null),j(null)},"aria-label":"关闭删除节点面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered node-sheet node-sheet--danger",children:[i.jsx("div",{className:"node-sheet__eyebrow is-danger",children:"删除注册"}),i.jsx("div",{className:"sheet-panel__title",children:"确认移除这个节点?"}),i.jsx("p",{className:"node-sheet__description",children:"这只会删除当前 Hub 里的注册记录,不会删除远端机器。agent 重新注册后可以再次加入。"}),i.jsxs("div",{className:"node-sheet__meta",children:[i.jsx("span",{children:ic(Y)}),i.jsx("span",{children:fg(Y)})]}),N?i.jsx("p",{className:"error-text",children:N}):null,i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{w(null),j(null)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button node-sheet__button-danger",disabled:G==="delete"&&ge===Y.id,onClick:()=>{Q.mutate({agentId:Y.id,action:"delete"})},children:G==="delete"&&ge===Y.id?"删除中...":"确认删除"})]})]})})]}),document.body):null;return i.jsxs("div",{className:"nodes-screen",children:[i.jsxs("div",{className:"nodes-screen__header",children:[i.jsx("h1",{children:"节点列表"}),i.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),i.jsx("div",{className:"nodes-screen__content node-list",children:!K&&(l||o||k)?i.jsx(yg,{message:"正在读取节点列表..."}):!K&&(u||z)?i.jsx(yg,{message:u instanceof Error?u.message:z??"节点列表加载失败"}):J.length===0?i.jsx(yg,{message:"暂无节点"}):J.map(ee=>{const oe=WN(ee),ae=ic(ee),I=G==="rename"&&ge===ee.id,ne=G==="delete"&&ge===ee.id;return i.jsxs("article",{className:`node-card ${f?"node-card--manageable":""}`,children:[i.jsxs("button",{type:"button",className:"node-card__surface",onClick:()=>me(ee),children:[i.jsxs("div",{className:"node-card__title-stack",children:[i.jsx("strong",{children:ae}),oe?i.jsxs("span",{className:"node-card__secondary-name",children:["原名称 · ",oe]}):null]}),i.jsx("div",{className:"node-card__ip",children:fg(ee)})]}),i.jsxs("div",{className:"node-card__rail",children:[i.jsx("span",{className:`node-status-dot ${ee.status}`,"aria-label":ee.status==="online"?"节点在线":"节点离线",title:ee.status==="online"?"节点在线":"节点离线"}),f?i.jsxs("div",{className:"node-card__actions",children:[i.jsx("button",{type:"button",className:"node-card__icon-button","aria-label":`修改 ${ae} 的备注名称`,title:"修改备注名称",disabled:ne,onClick:()=>{w(null),j(null),g(ee.id),p(ee.display_name??"")},children:i.jsx(KC,{size:16,strokeWidth:2})}),i.jsx("button",{type:"button",className:"node-card__icon-button is-danger","aria-label":`删除 ${ae} 节点注册`,title:"删除注册节点",disabled:I,onClick:()=>{g(null),p(""),j(null),w(ee.id)},children:i.jsx(X3,{size:16,strokeWidth:2})})]}):null]})]},ee.id)})}),Z,he]})};function nT(e){return is({queryKey:(e==null?void 0:e.queryKey)??Vk,queryFn:async()=>(await xn(e==null?void 0:e.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const sT=(e,t)=>{for(const[,a]of e){const l=a==null?void 0:a.sessions.find(o=>o.id===t);if(l!=null&&l.agent_id)return l.agent_id}return null},aT=()=>{var y,g;const{sessionId:e}=qu({strict:!1}),t=Ei(),a=Pa(),l=c_(e),o=nT({queryKey:["session-route-bridge",e??""]}),u=e?sT(a.getQueriesData({queryKey:rs}),e):null,f=e?((g=(y=o.data)==null?void 0:y.sessions.find(S=>S.id===e))==null?void 0:g.agent_id)??null:null,m=(l==null?void 0:l.agentId)??u??f??uc();return _.useEffect(()=>{if(!e){t({to:"/",replace:!0});return}!m&&(o.isPending||o.isFetching)||(sa(e),Wr(e),m&&Zi(m),t({to:"/",replace:!0}))},[t,m,e,o.isFetching,o.isPending]),null},iT=(e,t)=>e==="offline"?"offline":e==="online"&&t==="connected"?"online":e==="online"?"reconnecting":"offline",rT=e=>{switch(e){case"online":return"节点在线";case"reconnecting":return"节点重连中";case"offline":return"节点离线";default:return"节点状态未知"}};function J3(e){return is(y3(e))}const lT=24,w0={sessions:[],nextCursor:null,totalCount:0,isLoading:!1,error:null,initialized:!1},ex=e=>e.trim(),oT=e=>[...e].sort((t,a)=>Number(a.pinned)-Number(t.pinned)||+new Date(a.last_event_at)-+new Date(t.last_event_at)),cT=(e,t)=>{const a=new Map;for(const l of e)a.set(l.id,l);for(const l of t)a.set(l.id,l);return oT([...a.values()])},pm=(e,t)=>e[ex(t)]??w0;function tx(e){var g,S,p;const[t,a]=_.useState({}),[l,o]=_.useState({}),u=_.useCallback(()=>{a({}),o({})},[]);_.useEffect(()=>{u()},[(g=e==null?void 0:e.scope)==null?void 0:g.agentId,(S=e==null?void 0:e.scope)==null?void 0:S.projectId,(p=e==null?void 0:e.scope)==null?void 0:p.sessionId,e==null?void 0:e.selectedSessionId,u]);const f=_.useCallback(async(v,w)=>{const N=ex(w);if(!N)return;const j=v==="history"?a:o,C=pm(v==="history"?t:l,N);if(!C.isLoading&&!(C.initialized&&C.nextCursor===null)){j(R=>({...R,[N]:{...pm(R,N),isLoading:!0,error:null}}));try{const z=await(await xn(e==null?void 0:e.scope)).client.getWorkspaceSessionPage({bucket:v,projectId:N,cursor:C.initialized?C.nextCursor:null,limit:lT,selectedSessionId:(e==null?void 0:e.selectedSessionId)??null});j(O=>{const k=pm(O,N);return{...O,[N]:{sessions:cT(k.sessions,z.sessions),nextCursor:z.next_cursor,totalCount:z.total_count,isLoading:!1,error:null,initialized:!0}}})}catch(R){j(z=>({...z,[N]:{...pm(z,N),isLoading:!1,error:R instanceof Error?R.message:"加载会话分页失败",initialized:!0}}))}}},[l,t,e==null?void 0:e.scope,e==null?void 0:e.selectedSessionId]),m=_.useCallback(async v=>{await f("history",v)},[f]),y=_.useCallback(async v=>{await f("archived",v)},[f]);return{historyState:t,archivedState:l,loadMoreHistory:m,loadMoreArchived:y,reset:u}}const uT=180*1e3,uu=6,nx="panda:completed-session-seen-at",vg=6,dT=220,gm=e=>{e.cancelable&&e.preventDefault()},bb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),fT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:i.jsx("path",{d:"M12 5v14M5 12h14"})}),hT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),mT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H11l-4.5 4v-4H7.5A2.5 2.5 0 0 1 5 12.5z"})}),pT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"}),i.jsx("path",{d:"M16.5 10.5v5"}),i.jsx("path",{d:"M14 13h5"})]}),xb=({open:e})=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e?"is-open":"",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),gT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),_T=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m15 6-6 6 6 6"})}),yT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M10.33 4.32c.6-1.76 2.74-1.76 3.34 0a1.78 1.78 0 0 0 2.66 1l.18-.1c1.6-.92 3.4.88 2.48 2.48l-.1.18a1.78 1.78 0 0 0 1 2.66c1.76.6 1.76 2.74 0 3.34a1.78 1.78 0 0 0-1 2.66l.1.18c.92 1.6-.88 3.4-2.48 2.48l-.18-.1a1.78 1.78 0 0 0-2.66 1c-.6 1.76-2.74 1.76-3.34 0a1.78 1.78 0 0 0-2.66-1l-.18.1c-1.6.92-3.4-.88-2.48-2.48l.1-.18a1.78 1.78 0 0 0-1-2.66c-1.76-.6-1.76-2.74 0-3.34a1.78 1.78 0 0 0 1-2.66l-.1-.18c-.92-1.6.88-3.4 2.48-2.48l.18.1a1.78 1.78 0 0 0 2.66-1Z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),vT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"6",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:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),bT=e=>{const t=Date.now(),a=new Date(e).getTime(),l=Math.max(0,t-a),o=60*1e3,u=60*o,f=24*u;return l<u?`${Math.max(1,Math.floor(l/o))}分钟`:l<f?`${Math.max(1,Math.floor(l/u))}小时`:`${Math.max(1,Math.floor(l/f))}天`},bg=e=>e.run_state==="completed"&&e.run_state_changed_at&&Date.now()-new Date(e.run_state_changed_at).getTime()>uT?"idle":e.run_state??"idle",xT=(e,t)=>Number(t.pinned)-Number(e.pinned)||+new Date(t.last_event_at)-+new Date(e.last_event_at),ST=(e,t)=>{if(e.length<=uu)return e;if(!t)return e.slice(0,uu);const a=e.findIndex(l=>l.id===t);return a===-1||a<uu?e.slice(0,uu):[...e.slice(0,uu-1),e[a]]},jT=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(nx);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}},xg=(e,t)=>e.length===t.length&&e.every((a,l)=>a===t[l]),wT=(e,t)=>{if(!t||t.length===0||e.length<=1)return e;const a=new Map(e.map(u=>[u.id,u])),l=new Set,o=[];for(const u of t){const f=a.get(u);!f||l.has(u)||(l.add(u),o.push(f))}for(const u of e)l.has(u.id)||o.push(u);return o},NT=(e,t,a)=>{if(t<0||t>=e.length||a<0||a>=e.length||t===a)return e;const l=[...e],[o]=l.splice(t,1);return o?(l.splice(a,0,o),l):e},kT=(e,t,a)=>{if(t.length===0)return e;const l=new Set(t);let o=0;return e.map(u=>{if(!l.has(u))return u;const f=a[o]??u;return o+=1,f})},tu=(e,t)=>`${e}:${t}`,sx=_.memo(function({open:t,progress:a=t?1:0,isDragging:l=!1,desktopPinned:o=!1,isDesktopResizing:u=!1,onClose:f,onDesktopResizeStart:m,currentAgent:y,agentIndicatorState:g,projects:S,sessions:p,projectStats:v=[],historySessionsByProject:w={},archivedSessionsByProject:N={},historyPageStateByProject:j={},archivedPageStateByProject:C={},activeSessionId:R,onCreateSession:z,onCreateDirectoryThread:O,onSelectSession:k,onSessionAction:L,onThreadAction:K,onOpenSettings:J,onLoadMoreHistory:q,onLoadMoreArchived:Y,pendingSessionActionId:Q,pendingThreadActionId:G}){const ge=Ei(),me=a>.001,Z=!!y,he=Z?g??((y==null?void 0:y.status)==="online"?"online":"offline"):null,M=he?rT(he):"未选择节点",$=_.useRef({threads:null,archived:null}),ee=_.useRef({}),oe=_.useRef(null),ae=_.useRef(null),I=_.useRef(null),ne=_.useRef(null),U=_.useRef(null),ie=_.useRef({}),Se=_.useRef(null),[se,we]=_.useState({}),[ye,Oe]=_.useState(null),[Le,_t]=_.useState(null),Ke=_.useMemo(()=>p.map(P=>{const be=se[P.id];return be?{...P,...be.pinned===void 0?null:{pinned:be.pinned}}:P}).filter(P=>{var be;return!((be=se[P.id])!=null&&be.hidden)}),[se,p]),tt=_.useMemo(()=>new Map(v.map(P=>[P.project_id,P])),[v]),nn=(Le==null?void 0:Le.nextGlobalProjectIds)??ye,Xt=_.useMemo(()=>wT(S,nn),[S,nn]),jn=_.useMemo(()=>Ke.filter(P=>!P.subagent),[Ke]),zt=jn.find(P=>P.id===R),Bt=zt==null?void 0:zt.project_id,[yt,bt]=_.useState(Bt?[Bt]:[]),[dt,cn]=_.useState("threads"),[Pn,Ee]=_.useState(null),[V,_e]=_.useState(null),[Te,Ie]=_.useState(null),[ce,Ae]=_.useState(null),[qe,xt]=_.useState([]),[Dt,ue]=_.useState(null),[Me,Re]=_.useState(""),[We,Xe]=_.useState(()=>jT()),Je=_.useMemo(()=>jn.filter(P=>!P.archived),[jn]),Tt=_.useMemo(()=>Je.filter(P=>P.pinned).sort((P,be)=>+new Date(be.last_event_at)-+new Date(P.last_event_at)),[Je]),Wt=_.useMemo(()=>Je.filter(P=>!P.pinned),[Je]),ls=P=>Xt.map(be=>{var as;const Ue=tt.get(be.id),He=P==="threads"?Wt.filter(In=>In.project_id===be.id):N[be.id]??[],Ge=P==="threads"?w[be.id]??[]:[],ht=[...He];for(const In of Ge)ht.some(pn=>pn.id===In.id)||ht.push(In);const mt=ht.sort((In,pn)=>xT(In,pn)),ot=P==="threads"?j[be.id]??w0:C[be.id]??w0,Xn=P==="threads"?mt.length+Math.max(0,(Ue==null?void 0:Ue.hidden_history_count)??0):Math.max(mt.length,(Ue==null?void 0:Ue.archived_session_count)??0),Jt=P==="threads"?Math.max(0,((Ue==null?void 0:Ue.hidden_history_count)??0)-ot.sessions.length):Math.max(0,((Ue==null?void 0:Ue.archived_session_count)??0)-ot.sessions.length),Jn=((as=mt[0])==null?void 0:as.last_event_at)??new Date(0).toISOString();return{project:be,threadSessions:mt,collapsedThreadSessions:ST(mt,R),hiddenSessionCount:Math.max(0,mt.length-uu),totalSessionCount:Xn,pageState:ot,remainingPageCount:Jt,latestEventAt:Jn}}).filter(({totalSessionCount:be})=>be>0),Nt=_.useMemo(()=>ls("threads"),[R,C,N,j,w,Xt,tt,Wt]),Un=_.useMemo(()=>ls("archived"),[R,C,N,j,w,Xt,tt,Wt]);_.useEffect(()=>{we(P=>{let be=!1;const Ue={...P};for(const[He,Ge]of Object.entries(P)){const ht=p.find(ot=>ot.id===He);if(!ht){Ge.hidden&&(delete Ue[He],be=!0);continue}(Ge.pinned===void 0||ht.pinned===Ge.pinned)&&!Ge.hidden&&(delete Ue[He],be=!0)}return be?Ue:P})},[p]),_.useEffect(()=>{Oe(P=>{if(!P)return P;const be=S.map(He=>He.id),Ue=[...P.filter(He=>be.includes(He)),...be.filter(He=>!P.includes(He))];return xg(Ue,be)?null:Ue})},[S]),_.useEffect(()=>{Bt&&bt(P=>P.includes(Bt)?P:[...P,Bt])},[Bt]),_.useEffect(()=>{cn(zt!=null&&zt.archived?"archived":"threads")},[zt==null?void 0:zt.archived,R]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(nx,JSON.stringify(We))}catch{}},[We]),_.useEffect(()=>{t||o||(Ie(null),Ae(null),ue(null),_e(null))},[o,t]),_.useEffect(()=>{if(!o||!Te)return;const P=be=>{const Ue=be.target;if(!(Ue instanceof Element)){Ie(null);return}Ue.closest(".thread-group__menu-anchor")||Ue.closest(".thread-group__menu")||Ie(null)};return window.addEventListener("pointerdown",P),()=>{window.removeEventListener("pointerdown",P)}},[o,Te]),_.useEffect(()=>{if(!R)return;const P=jn.find(Ue=>Ue.id===R);if(!P||bg(P)!=="completed"||!P.run_state_changed_at)return;const be=P.run_state_changed_at;Xe(Ue=>Ue[P.id]===be?Ue:{...Ue,[P.id]:be})},[R,jn]),_.useEffect(()=>()=>{oe.current!==null&&globalThis.clearTimeout(oe.current),Dn(),Se.current!==null&&window.cancelAnimationFrame(Se.current)},[]),_.useEffect(()=>{ne.current=Le},[Le]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const P={},be=[],Ue=Le?tu(Le.pane,Le.projectId):null;for(const[He,Ge]of Object.entries(ee.current)){if(!Ge)continue;const ht=Ge.offsetTop;if(P[He]=ht,Ue===He)continue;const mt=ie.current[He];if(mt===void 0)continue;const ot=mt-ht;Math.abs(ot)<.5||(Ge.style.transition="none",Ge.style.transform=`translateY(${ot}px)`,be.push(Ge))}Se.current!==null&&window.cancelAnimationFrame(Se.current),be.length>0&&(Se.current=window.requestAnimationFrame(()=>{for(const He of be)He.style.transition="",He.style.transform=""})),ie.current=P},[Nt,Un,yt,qe,Le==null?void 0:Le.projectId,nn]);const Cn=()=>{oe.current!==null&&(globalThis.clearTimeout(oe.current),oe.current=null)},Dn=()=>{const P=I.current;P&&(P.removeEventListener("selectstart",gm),P.removeEventListener("contextmenu",gm),I.current=null)},De=P=>P==="threads"?Nt:Un,Qt=(P,be,Ue,He,Ge)=>{const ht=$.current[be],mt=ee.current[tu(be,P)];if(!ht||!mt)return!1;const ot=De(be).map(et=>et.project.id),Xn=ot.indexOf(P);if(Xn===-1)return!1;const Jt=Xt.map(et=>et.id),Jn=ht.getBoundingClientRect(),as=mt.getBoundingClientRect(),In=mt.offsetHeight,pn=mt.offsetWidth,sn=Ge-as.top,wn=ht.scrollTop,xs=Math.max(wn,ht.scrollTop+ht.clientHeight-In),A=Math.max(wn,Math.min(xs,ht.scrollTop+Ge-Jn.top-sn)),pe={pane:be,projectId:P,pointerId:Ue,pointerType:He,originIndex:Xn,visibleProjectIds:ot,nextVisibleProjectIds:ot,nextGlobalProjectIds:Jt,previewTop:A,itemHeight:In,itemWidth:pn,pointerOffsetY:sn};return ne.current=pe,_t(pe),U.current=P,!0},On=P=>{_t(be=>{if(!be)return be;ne.current=be;const Ue=$.current[be.pane];if(!Ue||!ee.current[tu(be.pane,be.projectId)])return be;const He=Ue.getBoundingClientRect(),Ge=Ue.scrollTop,ht=Math.max(Ge,Ue.scrollTop+Ue.clientHeight-be.itemHeight),mt=Math.max(Ge,Math.min(ht,Ue.scrollTop+P-He.top-be.pointerOffsetY)),ot=mt+be.itemHeight/2,Xn=be.nextVisibleProjectIds,Jt=Xn.indexOf(be.projectId);if(Jt===-1)return be;const Jn=Xn.filter(A=>A!==be.projectId);let as=0;const In=Jn[0],pn=In?ee.current[tu(be.pane,In)]:null;if(pn&&mt<=pn.offsetTop+pn.offsetHeight*.42)as=0;else for(let A=0;A<Jn.length;A+=1){const pe=Jn[A],et=pe?ee.current[tu(be.pane,pe)]:null;if(!et){as=A+1;continue}const Lt=et.offsetTop+et.offsetHeight/2;if(ot<=Lt){as=A;break}as=A+1}const sn=NT(Xn,Jt,as),wn=kT(be.nextGlobalProjectIds,be.visibleProjectIds,sn);if(mt===be.previewTop&&xg(sn,be.nextVisibleProjectIds))return be;const xs={...be,previewTop:mt,nextVisibleProjectIds:sn,nextGlobalProjectIds:wn};return ne.current=xs,xs})},Ts=P=>{Cn(),Dn(),ae.current=null;const be=P??ne.current;if(ne.current=null,_t(null),!be||!!xg(be.visibleProjectIds,be.nextVisibleProjectIds)||!K)return;const He=ye??Xt.map(ht=>ht.id),Ge=be.nextGlobalProjectIds;Oe(Ge),Promise.resolve(K(be.projectId,"reorder",{orderedProjectIds:Ge})).catch(()=>{Oe(He)})},Ua=()=>{Cn(),Dn(),ae.current=null,ne.current=null,_t(null)};_.useEffect(()=>{if(typeof window>"u"||!ne.current)return;const P=He=>{const Ge=ne.current;!Ge||Ge.pointerId!==He.pointerId||On(He.clientY)},be=He=>{const Ge=ne.current;!Ge||Ge.pointerId!==He.pointerId||Ts(Ge)},Ue=He=>{const Ge=ne.current;!Ge||Ge.pointerId!==He.pointerId||Ua()};return window.addEventListener("pointermove",P),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",Ue),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",Ue)}},[Le==null?void 0:Le.pointerId]);const Us=P=>{bt(be=>be.includes(P)?be.filter(Ue=>Ue!==P):[...be,P])},Ci=P=>{if(U.current===P){U.current=null;return}Us(P)},Fn=(P,be,Ue)=>{if(P.pointerType==="mouse"&&P.button!==0)return;Cn();const He=P.currentTarget;Dn(),P.pointerType==="touch"&&(I.current=He,He.addEventListener("selectstart",gm),He.addEventListener("contextmenu",gm)),ae.current={pane:Ue,projectId:be,pointerId:P.pointerId,pointerType:P.pointerType,startX:P.clientX,startY:P.clientY,currentX:P.clientX,currentY:P.clientY},P.pointerType!=="touch"&&He.setPointerCapture(P.pointerId),P.pointerType==="touch"&&(oe.current=globalThis.setTimeout(()=>{const Ge=ae.current;if(!Ge||Ge.projectId!==be||Ge.pointerId!==P.pointerId)return;He.hasPointerCapture(P.pointerId)||He.setPointerCapture(P.pointerId),Qt(be,Ue,P.pointerId,P.pointerType,Ge.currentY)&&On(Ge.currentY)},dT))},Vs=(P,be,Ue)=>{const He=ae.current;if(!He||He.projectId!==be||He.pointerId!==P.pointerId||He.pane!==Ue)return;if(He.currentX=P.clientX,He.currentY=P.clientY,(Le==null?void 0:Le.projectId)===be&&Le.pointerId===P.pointerId){P.preventDefault(),On(P.clientY);return}const Ge=P.clientX-He.startX,ht=P.clientY-He.startY;if(He.pointerType==="touch"){(Math.abs(Ge)>vg||Math.abs(ht)>vg)&&Cn();return}Math.abs(ht)<vg||Math.abs(ht)<Math.abs(Ge)||!Qt(be,Ue,P.pointerId,P.pointerType,P.clientY)||(P.preventDefault(),On(P.clientY))},te=(P,be)=>{if(P.currentTarget.hasPointerCapture(P.pointerId)&&P.currentTarget.releasePointerCapture(P.pointerId),(Le==null?void 0:Le.projectId)===be&&Le.pointerId===P.pointerId){P.preventDefault(),Ts();return}Cn(),Dn(),ae.current=null},Pe=(P,be)=>{if(P.currentTarget.hasPointerCapture(P.pointerId)&&P.currentTarget.releasePointerCapture(P.pointerId),(Le==null?void 0:Le.projectId)===be&&Le.pointerId===P.pointerId){Ua();return}Cn(),Dn(),ae.current=null},$e=P=>{xt(be=>be.includes(P)?be.filter(Ue=>Ue!==P):[...be,P])},at=P=>{if(bg(P)!=="completed"||!P.run_state_changed_at)return;const be=P.run_state_changed_at;Xe(Ue=>Ue[P.id]===be?Ue:{...Ue,[P.id]:be})},ft=`translateX(-${(dt==="threads"?0:1)*50}%)`,Mt=Dt&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{ue(null),Re("")},"aria-label":"关闭重命名面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[i.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),i.jsx("input",{className:"sheet-panel__input",value:Me,onChange:P=>Re(P.target.value),placeholder:"输入线程名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{ue(null),Re("")},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Me.trim()||G===Dt,onClick:()=>{jt()},children:"保存"})]})]})})]}),document.body):null,qn=P=>{Ie(null),Ae(null),ue(P.id),Re(P.display_name??P.name)},jt=async()=>{!Dt||!Me.trim()||!K||(await K(Dt,"rename",{name:Me.trim()}),ue(null),Re(""))},zs=(P,be,Ue)=>{if(!L)return;const He=se[P.id];be==="pin"||be==="unpin"?we(ht=>({...ht,[P.id]:{...ht[P.id],pinned:be==="pin"}})):be==="delete"&&we(ht=>({...ht,[P.id]:{...ht[P.id],hidden:!0}}));const Ge=L(P.id,be,Ue);Ge&&typeof Ge.then=="function"&&Ge.catch(()=>{we(ht=>{const mt={...ht};return He?mt[P.id]=He:delete mt[P.id],mt})})},Kt=P=>{const be=bg(P),Ue=be==="completed"&&P.id!==R&&!!P.run_state_changed_at&&We[P.id]!==P.run_state_changed_at,He=o&&Pn===P.id,Ge=!!L&&He,ht=V===P.id,mt=o&&(Ge||ht);return i.jsxs("div",{className:`thread-session ${P.id===R?"is-active":""}`,onMouseEnter:()=>Ee(P.id),onMouseLeave:()=>{Ee(ot=>ot===P.id?null:ot),_e(ot=>ot===P.id?null:ot)},children:[i.jsx("button",{type:"button",className:`thread-session__icon-button ${Ge?"is-visible":""} ${P.pinned?"is-active":""}`,disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),zs(P,P.pinned?"unpin":"pin")},"aria-label":P.pinned?"取消置顶会话":"置顶会话",title:P.pinned?"取消置顶":"置顶",children:i.jsx(GC,{strokeWidth:P.pinned?2.1:1.95})}),i.jsxs("div",{className:"thread-session__row",children:[k?i.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:P.title,onClick:()=>{at(P),k(P.id),f()},children:[i.jsx("span",{className:`thread-session__status is-${Ue?"completed":be} ${Ue?"is-unread":""} ${mt?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:P.title})]}):i.jsxs(Wm,{to:"/session/$sessionId",params:{sessionId:P.id},title:P.title,onClick:()=>{at(P),f()},className:"thread-session__link",children:[i.jsx("span",{className:`thread-session__status is-${Ue?"completed":be} ${Ue?"is-unread":""} ${mt?"is-hidden":""}`,"aria-hidden":"true"}),i.jsx("div",{className:"thread-session__title",children:P.title})]}),i.jsx("div",{className:"thread-session__meta",children:o&&He&&L?ht?i.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),zs(P,"delete")},children:"确认"}):i.jsx("button",{type:"button",className:"thread-session__delete",disabled:Q===P.id,onClick:ot=>{ot.stopPropagation(),_e(P.id)},"aria-label":`删除 ${P.title}`,children:i.jsx(X3,{strokeWidth:1.95})}):i.jsx("span",{className:"thread-session__time",children:bT(P.last_event_at)})})]})]},P.id)},bs=({project:P,threadSessions:be,collapsedThreadSessions:Ue,hiddenSessionCount:He,totalSessionCount:Ge,pageState:ht,remainingPageCount:mt},ot)=>{const Xn=tu(ot,P.id),Jt=yt.includes(P.id),Jn=qe.includes(P.id),as=P.display_name??P.name,In=!!K&&o&&Te===P.id,pn=!!K&&ce===P.id,sn=ot==="archived",wn=Jn?be:Ue,xs=He>0,A=mt>0,pe=ot==="threads"?q:Y,et=(Le==null?void 0:Le.projectId)===P.id&&Le.pane===ot,Lt=pn&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>Ae(null),"aria-label":"关闭线程菜单"}),i.jsxs("div",{className:"sheet-panel",children:[i.jsx("div",{className:"sheet-panel__title",children:as}),i.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>qn(P),children:"编辑名称"}),i.jsx("button",{type:"button",className:"sheet-panel__item",disabled:G===P.id,onClick:()=>{K==null||K(P.id,sn?"unarchive":"archive"),Ae(null)},children:sn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:G===P.id,onClick:()=>{K==null||K(P.id,"remove"),Ae(null)},children:"移除"})]})]}),document.body):null;return i.jsxs(_.Fragment,{children:[i.jsx("div",{ref:pt=>{ee.current[Xn]=pt},className:`thread-group-shell ${et?"is-drag-placeholder":""}`,children:i.jsxs("section",{className:"thread-group",children:[i.jsxs("div",{className:"thread-group__header",children:[i.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>Ci(P.id),onPointerDown:pt=>Fn(pt,P.id,ot),onPointerMove:pt=>Vs(pt,P.id,ot),onPointerUp:pt=>te(pt,P.id),onPointerCancel:pt=>Pe(pt,P.id),"aria-expanded":Jt,title:as,children:[i.jsx("span",{className:"thread-group__chevron",children:i.jsx(xb,{open:Jt})}),i.jsx("span",{className:"thread-group__icon",children:i.jsx(bb,{})}),i.jsx("span",{className:"thread-group__title-text",children:as})]}),i.jsxs("div",{className:"thread-group__actions",children:[K?i.jsxs("div",{className:"thread-group__menu-anchor",children:[i.jsx("button",{type:"button",className:`thread-group__more ${In||pn?"is-open":""}`,onClick:pt=>{if(pt.stopPropagation(),o){Ie(ct=>ct===P.id?null:P.id);return}Ae(P.id)},"aria-label":`${as} 更多选项`,children:i.jsx(vT,{})}),In?i.jsxs("div",{className:"thread-group__menu",children:[i.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>qn(P),children:"编辑名称"}),i.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:G===P.id,onClick:()=>{K==null||K(P.id,sn?"unarchive":"archive"),Ie(null)},children:sn?"取消归档":"归档线程"}),i.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:G===P.id,onClick:()=>{K==null||K(P.id,"remove"),Ie(null)},children:"移除"})]}):null]}):null,i.jsx("button",{type:"button",className:"thread-group__add",onClick:pt=>{pt.stopPropagation(),z(P.id,P.name)},"aria-label":`在 ${P.name} 下新增会话`,children:i.jsx(fT,{})})]})]}),Jt?Ge===0?i.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):i.jsxs(i.Fragment,{children:[wn.length>0?i.jsx("div",{className:"thread-group__sessions",children:wn.map(pt=>Kt(pt))}):i.jsx("div",{className:"thread-group__empty",children:ot==="archived"?"这个归档线程还没有已加载的会话":"这个线程还没有已加载的历史会话"}),xs?i.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>$e(P.id),"aria-expanded":Jn,children:Jn?"折叠显示":"展开显示"}):null,A&&pe?i.jsx("button",{type:"button",className:"thread-group__session-toggle",disabled:ht.isLoading,onClick:()=>{pe(P.id)},children:ht.isLoading?"加载中...":ot==="archived"?`加载已归档会话 (${mt})`:`加载更早会话 (${mt})`}):null,ht.error?i.jsx("div",{className:"thread-group__empty",children:ht.error}):null]}):null]},P.id)}),Lt]},P.id)},Wn=P=>{if(!Le||Le.pane!==P)return null;const be=De(P).find(Ge=>Ge.project.id===Le.projectId);if(!be)return null;const Ue={top:Le.previewTop,width:`${Le.itemWidth}px`},He=be.project.display_name??be.project.name;return i.jsx("div",{className:"thread-group-drag-preview",style:Ue,"aria-hidden":"true",children:i.jsxs("div",{className:"thread-group-drag-preview__header",children:[i.jsx("span",{className:"thread-group-drag-preview__chevron",children:i.jsx(xb,{open:!0})}),i.jsx("span",{className:"thread-group-drag-preview__icon",children:i.jsx(bb,{})}),i.jsx("span",{className:"thread-group-drag-preview__title",children:He})]})})};return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:`sidebar-scrim ${me?"is-visible":""}`,style:{opacity:o?0:a,pointerEvents:o?"none":me?"auto":"none",transition:l?"none":void 0},onClick:f,"aria-label":"关闭侧边栏"}),i.jsxs("aside",{className:`conversation-sidebar ${t?"is-open":""} ${o?"is-desktop-pinned":""} ${u?"is-resizing":""}`,style:{transform:o?"translateX(0)":`translateX(calc(-100% + ${Math.max(0,Math.min(a,1))*100}%))`,transition:l?"none":void 0},children:[o&&m?i.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:P=>{P.pointerType!=="touch"&&(P.preventDefault(),P.stopPropagation(),m(P.clientX))}}):null,i.jsxs("div",{className:"conversation-sidebar__header",children:[i.jsxs("div",{className:`conversation-sidebar__brand ${Z&&he?`is-${he}`:"is-empty"}`,"aria-label":M,title:M,children:[Z?i.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,i.jsx("span",{className:"conversation-sidebar__brand-name",children:y?ic(y):"未选择节点"})]}),o?null:i.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:f,"aria-label":"关闭",children:"×"})]}),i.jsxs("div",{className:"conversation-sidebar__actions",children:[i.jsxs(Wm,{to:"/nodes",className:"sidebar-action",onClick:f,children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(hT,{})}),i.jsx("span",{children:"节点列表"})]}),i.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{f();const P=S.find(be=>be.id===Bt)??S[0];P?z(P.id,P.name):ge({to:"/nodes"})},children:[i.jsx("span",{className:"sidebar-action__icon",children:i.jsx(mT,{})}),i.jsx("span",{children:"新会话"})]})]}),i.jsx("div",{className:"conversation-sidebar__threads",children:i.jsxs("div",{className:"sidebar-pane-track",style:{transform:ft},children:[i.jsxs("div",{ref:P=>{$.current.threads=P},className:`sidebar-pane ${dt==="threads"?"is-active":"is-inactive"}`,children:[Tt.length>0?i.jsxs("div",{className:"sidebar-pinned",children:[i.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),i.jsx("div",{className:"sidebar-pinned__list",children:Tt.map(P=>Kt(P))})]}):null,i.jsxs("div",{className:"conversation-sidebar__node-row",children:[i.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),O?i.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:O,"aria-label":"新增目录线程",title:"新增目录线程",children:i.jsx(pT,{})}):null]}),Nt.map(P=>bs(P,"threads")),Wn("threads"),i.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>cn("archived"),children:[i.jsx("span",{children:"已归档"}),i.jsx("span",{className:"thread-archive__icon",children:i.jsx(gT,{})})]})]}),i.jsxs("div",{ref:P=>{$.current.archived=P},className:`sidebar-pane sidebar-pane--archived ${dt==="archived"?"is-active":"is-inactive"}`,children:[i.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),Un.length>0?i.jsx("div",{className:"thread-archive__list",children:Un.map(P=>bs(P,"archived"))}):i.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),Wn("archived"),i.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>cn("threads"),"aria-label":"返回线程列表",children:[i.jsx("span",{className:"thread-archive__back-icon",children:i.jsx(_T,{})}),i.jsx("span",{children:"返回"})]})]})]})}),i.jsx("div",{className:"conversation-sidebar__footer",children:i.jsxs("button",{type:"button",className:"sidebar-settings",onClick:()=>{f(),J==null||J()},"aria-label":"打开设置页",children:[i.jsx("span",{className:"sidebar-settings__icon",children:i.jsx(yT,{})}),i.jsx("span",{children:"设置"})]})})]}),Mt]})}),k_="optimistic-user:",ET="overlay-user:",CT=[k_,ET],TT=5e3,Po=e=>["timeline-optimistic",e],wp=e=>e.kind==="user"&&CT.some(t=>e.id.startsWith(t)),E_=e=>e.kind==="user"&&!wp(e),C_=e=>e.kind==="user"&&e.id.startsWith(k_),MT=e=>e.kind==="user"&&!C_(e),Sb=e=>e.body.replace(/\r\n/g,`
|
|
129
|
+
`).trim(),jb=e=>new Date(e).getTime(),Np=(e,t)=>{if(Sb(e)!==Sb(t))return!1;const a=jb(e.timestamp),l=jb(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(l)?!0:l>=a-TT},RT=(e,t)=>{const a=t.filter(E_);if(a.length===0)return new Set;const l=new Set,o=new Set;for(const u of e??[]){if(!wp(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&Np(u,m));f<0||(l.add(f),o.add(u.id))}return o},AT=(e,t)=>{const a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>E_(u));if(a.length===0)return new Map;const l=new Set,o=new Map;for(const u of e??[]){if(!wp(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&Np(u,m));f&&(l.add(f.index),(u.attachments??[]).length!==0&&o.set(f.index,C6(f.entry.attachments,u.attachments)))}return o},DT=(e,t)=>{const a=t.filter(MT);if(a.length===0)return new Set;const l=new Set,o=new Set;for(const u of e??[]){if(!C_(u))continue;const f=a.findIndex((m,y)=>!l.has(y)&&Np(u,m));f<0||(l.add(f),o.add(u.id))}return o},OT=e=>{const t=[...e??[]],a=t.map((u,f)=>({entry:u,index:f})).filter(({entry:u})=>E_(u));if(a.length===0)return t;const l=new Set,o=new Set;for(const u of t){if(!wp(u))continue;const f=a.find(({entry:m,index:y})=>!l.has(y)&&Np(u,m));f&&(l.add(f.index),o.add(u.id))}return o.size===0?t:t.filter(u=>!o.has(u.id))},N0=(e,t)=>[...e??[],t],ax=(e,t)=>{const a=AT(e,t),l=RT(e,t),o=[...e??[]].filter(f=>!l.has(f.id)),u=new Set(o.map(f=>f.id));for(const[f,m]of t.entries())u.has(m.id)||(u.add(m.id),o.push(a.has(f)?{...m,attachments:a.get(f)??m.attachments}:m));return o},k0=(e,t)=>[...ax(e,t)].sort((a,l)=>{const o=new Date(a.timestamp).getTime(),u=new Date(l.timestamp).getTime();return!Number.isFinite(o)||!Number.isFinite(u)?0:o-u}),ix=(e,t)=>(e??[]).filter(a=>C_(a)&&!DT([a],t).has(a.id)),IT=(e,t)=>{const a=OT(e),l=ix(t,a);return k0(l,a)},LT=(e,t)=>{if(!e||e.session_id!==t.session_id)return{...t,entries:k0(void 0,t.entries)};const a=e.view==="full_compact"&&t.view==="tail",l=k0(e.entries,t.entries);return{session_id:t.session_id,generated_at:t.generated_at,view:a?e.view:t.view,anchor_entry_id:a?e.anchor_entry_id??t.anchor_entry_id:t.anchor_entry_id,has_earlier_entries:a?!1:t.has_earlier_entries,entries:l}},PT=(e,t)=>(e??[]).filter(a=>a.id!==t),rx="image/",UT=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,zT=e=>new Promise((t,a)=>{const l=new FileReader;l.onerror=()=>a(l.error??new Error("无法读取文件")),l.onload=()=>{if(typeof l.result=="string"&&l.result){t(l.result);return}a(new Error("无法读取文件"))},l.readAsDataURL(e)}),lx=async e=>({id:UT(),kind:e.type.startsWith(rx)?"image":"file",name:e.name,mime_type:e.type||null,size_bytes:Number.isFinite(e.size)?Math.max(0,Math.round(e.size)):null,data_url:await zT(e)}),wb=e=>{var t;return e.kind==="image"||!!((t=e.mime_type)!=null&&t.startsWith(rx))},ox=e=>E6((e??[]).map((t,a)=>({id:t.id||`attachment-${a}`,kind:t.kind,name:t.name,mime_type:t.mime_type??null,size_bytes:t.size_bytes??null,content_url:t.data_url}))),E0=e=>typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,BT=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,HT=/^[A-Za-z0-9._-]$/,$T=/^[A-Za-z0-9._-]$/,C0=e=>/\s/.test(e),Nb=e=>HT.test(e),FT=e=>$T.test(e),Ia=e=>e.trim().toLowerCase(),qT=e=>Ia(e).split(/[^a-z0-9]+/i).filter(Boolean),kb=e=>e==="repo"?0:e==="user"?1:2,WT=e=>e==="repo"?"项目":e==="user"?"个人":"系统",cx=e=>{const t=[];let a=0;for(const l of e.matchAll(BT)){const o=l[0],u=l.index??0;if(o.startsWith("$")){const f=u>0?e[u-1]??"":"";if(u>0&&!C0(f))continue}if(o.startsWith("/")){const f=u>0?e[u-1]??"":"";if(u>0&&!C0(f))continue}if(u>a&&t.push({kind:"text",value:e.slice(a,u)}),o.startsWith("`")&&o.endsWith("`"))t.push({kind:"code",value:o.slice(1,-1)});else if(o.startsWith("**")&&o.endsWith("**"))t.push({kind:"strong",value:o.slice(2,-2)});else if(o.startsWith("*")&&o.endsWith("*"))t.push({kind:"emphasis",value:o.slice(1,-1)});else if(o.startsWith("[")){const f=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(o);f?t.push({kind:"path-link",label:f[1]??"",path:f[2]??""}):t.push({kind:"text",value:o})}else o.startsWith("/")?t.push({kind:"command",raw:o,name:o.slice(1)}):t.push({kind:"skill",raw:o,name:o.slice(1)});a=u+o.length}return a<e.length&&t.push({kind:"text",value:e.slice(a)}),t},ux=(e,t,a=t)=>{if(t!==a)return null;let l=t;for(;l>0&&Nb(e[l-1]??"");)l-=1;const o=l-1;if(o<0||e[o]!=="$")return null;const u=o>0?e[o-1]??"":"";if(o>0&&!C0(u))return null;let f=t;for(;f<e.length&&Nb(e[f]??"");)f+=1;return{start:o,end:f,query:e.slice(o+1,t)}},KT=(e,t,a,l)=>{const o=ux(e,t,a);if(!o)return null;const m=(e[o.end]??"").length===0?`$${l} `:`$${l}`,y=`${e.slice(0,o.start)}${m}${e.slice(o.end)}`,g=o.start+m.length;return{value:y,selectionStart:g,selectionEnd:g}},T_=e=>e.startsWith("/"),dx=(e,t,a=t)=>{if(!T_(e)||t!==a)return null;const l=e.search(/\s/),o=l<0?e.length:l;if(t>o)return null;let u=1;for(;u<e.length&&FT(e[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:e.slice(1,t)}},QT=(e,t,a,l)=>{const o=dx(e,t,a);if(!o)return null;const m=(e[o.end]??"").length===0?`/${l} `:`/${l}`,y=`${e.slice(0,o.start)}${m}${e.slice(o.end)}`,g=o.start+m.length;return{value:y,selectionStart:g,selectionEnd:g}},GT=(e,t)=>{const a=Ia(t),l=e.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const f=Ia(u.name),m=Ia(u.description);return f.includes(a)||m.includes(a)}),o=u=>{if(!a)return 0;const f=Ia(u.name),m=Ia(u.description),y=qT(u.name);return f===a?0:y.some(g=>g===a)?1:f.startsWith(a)?2:y.some(g=>g.startsWith(a))?3:f.includes(a)?4:m.startsWith(a)?5:6};return[...l].sort((u,f)=>{const m=o(u),y=o(f);if(m!==y)return m-y;const g=kb(u.scope)-kb(f.scope);if(g!==0)return g;const S=Ia(u.name),p=Ia(f.name);return S.localeCompare(p)})},YT=(e,t)=>{const a=Ia(t);return[...e.filter(o=>{if(!a)return!0;const u=Ia(o.name),f=Ia(o.description);return u.includes(a)||f.includes(a)})].sort((o,u)=>{const f=Ia(o.name),m=Ia(u.name),y=f===a?0:f.startsWith(a)?1:2,g=m===a?0:m.startsWith(a)?1:2;return y!==g?y-g:o.availability!==u.availability?o.availability==="supported"?-1:1:f.localeCompare(m)})},Sg=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),VT=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),Eb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),ZT=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),Cb=e=>!!(e&&/^[A-Za-z]:[\\/]?$/.test(e.trim())),XT=({agentId:e,projects:t,initialPath:a=null,title:l="选择目录",subtitle:o="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:f="返回上级",onProjectCreated:m})=>{const y=Pa(),[g,S]=_.useState(a),[p,v]=_.useState(a),[w,N]=_.useState([]),[j,C]=_.useState(!0),[R,z]=_.useState(null),[O,k]=_.useState(0),[L,K]=_.useState(!1),[J,q]=_.useState(""),[Y,Q]=_.useState(null),G=_.useRef(null);_.useEffect(()=>{S(a),v(a)},[a]),_.useEffect(()=>{K(!1),q(""),Q(null),me.reset()},[g]),_.useEffect(()=>{let ye=!1;return C(!0),z(null),S3({agentId:e,path:g}).then(Oe=>{ye||N(Oe)}).catch(Oe=>{ye||(z(Oe instanceof Error?Oe.message:"目录列表加载失败"),N([]))}).finally(()=>{ye||C(!1)}),()=>{ye=!0}},[e,g,O]),_.useEffect(()=>{var ye,Oe;L&&((ye=G.current)==null||ye.focus(),(Oe=G.current)==null||Oe.select())},[L]);const ge=ss({mutationFn:async ye=>xE({agentId:e,path:ye,projects:t,queryClient:y,bootstrapQueryKey:Zk}),onSuccess:ye=>{m(ye)}}),me=ss({mutationFn:async ye=>bE({agentId:e,parentPath:ye.parentPath,name:ye.name}),onSuccess:({directory:ye})=>{K(!1),q(""),Q(null),v(ye.path),k(Oe=>Oe+1)}}),Z=_.useMemo(()=>{const ye=new Map;for(const Oe of t)ye.set(dp(Oe.path),Oe);return ye},[t]),he=_.useMemo(()=>p?Z.get(dp(p))??null:null,[Z,p]),M=u!=="选择此目录"?u:he?"在线程中继续":"创建新线程",$=x3(g),ee=$!==null||Cb(g),oe=!!g,ae=J.trim(),I=Y??(me.error instanceof Error?me.error.message:null),ne=ge.error instanceof Error?ge.error.message:ge.error?"创建线程失败":null,U=()=>{if($!==null){S($),v($);return}Cb(g)&&(S(null),v(null))},ie=ye=>{S(ye),v(ye)},Se=()=>{K(!1),q(""),Q(null),me.reset()},se=()=>{g&&(me.reset(),Q(null),q(""),K(!0))},we=()=>{if(g){if(!ae){Q("目录名称不能为空");return}Q(null),me.mutate({parentPath:g,name:ae})}};return i.jsx("section",{className:"directory-picker",children:i.jsxs("div",{className:"directory-picker__panel",children:[i.jsx("header",{className:"directory-picker__header",children:i.jsxs("div",{className:"directory-picker__heading",children:[i.jsx("h2",{children:l}),o?i.jsx("p",{children:o}):null]})}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),i.jsxs("button",{type:"button",className:`directory-picker__path ${p===g?"is-selected":""}`,onClick:()=>{g&&v(g)},disabled:!g,"aria-pressed":p===g,children:[i.jsx("span",{className:"directory-picker__path-icon",children:i.jsx(Sg,{})}),i.jsx("span",{className:"directory-picker__path-value",children:g??"根目录"})]})]}),i.jsxs("div",{className:"directory-picker__field",children:[i.jsx("span",{className:"directory-picker__field-label",children:"目录"}),i.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:j?i.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):R?i.jsx("div",{className:"directory-picker__state is-error",children:R}):i.jsxs(i.Fragment,{children:[w.length===0&&!L?i.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):null,w.map(ye=>{const Oe=p===ye.path;return i.jsxs("div",{className:`directory-picker__row ${Oe?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:Le=>{if(ye.has_children&&Le.detail>=2){ie(ye.path);return}v(ye.path)},"aria-selected":Oe,children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(Sg,{})}),i.jsx("span",{className:"directory-picker__row-name",children:ye.name}),!ye.has_children&&Oe?i.jsx("span",{className:"directory-picker__row-check",children:i.jsx(Eb,{})}):null]}),ye.has_children?i.jsx("button",{type:"button",className:"directory-picker__row-enter-button","aria-label":`进入 ${ye.name}`,onClick:()=>ie(ye.path),children:i.jsx("span",{className:"directory-picker__row-enter","aria-hidden":"true",children:i.jsx(VT,{})})}):null]},ye.path)}),L?i.jsx("div",{className:"directory-picker__row is-creating",children:i.jsxs("div",{className:"directory-picker__row-editor",children:[i.jsx("span",{className:"directory-picker__row-icon",children:i.jsx(Sg,{})}),i.jsx("input",{ref:G,type:"text",className:"directory-picker__row-input",value:J,onChange:ye=>{q(ye.target.value),Y&&Q(null),me.error&&me.reset()},onKeyDown:ye=>{ye.key==="Enter"&&(ye.preventDefault(),we()),ye.key==="Escape"&&(ye.preventDefault(),Se())},placeholder:"输入目录名称","aria-label":"新目录名称",disabled:me.isPending}),i.jsxs("div",{className:"directory-picker__row-actions",children:[i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:we,"aria-label":"确认创建目录",disabled:!ae||me.isPending,children:i.jsx(Eb,{})}),i.jsx("button",{type:"button",className:"directory-picker__row-action",onClick:Se,"aria-label":"取消创建目录",disabled:me.isPending,children:i.jsx(ZT,{})})]})]})}):null]})})]}),I?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:I}):null,ne?i.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:ne}):null,i.jsx("footer",{className:"directory-picker__footer",children:i.jsxs("div",{className:"directory-picker__footer-actions",children:[ee?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:U,children:i.jsx("span",{children:f})}):null,oe?i.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:se,disabled:L||me.isPending,children:i.jsx("span",{children:"新建目录"})}):null,i.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!p||ge.isPending,onClick:()=>{p&&ge.mutate(p)},children:ge.isPending?"创建中…":M})]})})]})})},JT=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281.999849615234 85.965369875" width="281.999849615234" height="85.965369875" role="img" aria-label="Panda wordmark">\r
|
|
130
|
+
<path fill="#d97757" fill-rule="nonzero" d="M539.0830078125,114.554069519043C537.650695800781,114.554061889648 536.2041015625,114.826202392578 534.7431640625,115.370460510254 533.2822265625,115.914741516113 531.892883300781,116.616561889648 530.5751953125,117.475936889648 529.257507324219,118.335311889648 528.054382324219,119.280624389648 526.9658203125,120.311874389648 525.877258300781,121.343124389648 524.9892578125,122.345733642578 524.3017578125,123.319686889648 522.9267578125,125.153022766113 521.480163574219,127.244171142578 519.9619140625,129.593124389648 518.443664550781,131.942077636719 516.925476074219,134.405624389648 515.4072265625,136.983749389648 513.888977050781,139.561874389648 512.4423828125,142.197296142578 511.0673828125,144.889999389648 509.6923828125,147.582702636719 508.474945068359,150.203796386719 507.4150390625,152.753280639648 506.355133056641,155.302764892578 505.510101318359,157.737655639648 504.8798828125,160.057968139648 504.249664306641,162.378280639648 503.9345703125,164.455108642578 503.9345703125,166.288436889648 503.9345703125,168.981140136719 504.4501953125,171.143905639648 505.4814453125,172.776718139648 506.5126953125,174.409530639648 508.460601806641,175.225936889648 511.3251953125,175.225936889648 512.299133300781,175.225936889648 513.7314453125,174.610046386719 515.6220703125,173.378280639648 517.5126953125,172.146514892578 519.5322265625,170.585311889648 521.6806640625,168.694686889648 523.8291015625,166.804061889648 525.9345703125,164.755889892578 527.9970703125,162.550155639648 530.0595703125,160.344421386719 531.749694824219,158.238952636719 533.0673828125,156.233749389648 534.499694824219,154.113952636719 535.9462890625,151.793640136719 537.4072265625,149.272811889648 538.8681640625,146.751983642578 540.2001953125,144.173858642578 541.4033203125,141.538436889648 542.6064453125,138.903015136719 543.580383300781,136.310577392578 544.3251953125,133.761093139648 545.070007324219,131.211608886719 545.4423828125,128.848327636719 545.4423828125,126.671249389648 545.4423828125,122.374374389648 544.7978515625,119.280624389648 543.5087890625,117.389999389648 542.2197265625,115.499374389648 540.744445800781,114.554061889648 539.0830078125,114.554069519043z M416.966674804688,110.343124389648C413.930206298828,110.343124389648 409.805206298828,113.522811889648 404.591674804688,119.882186889648 401.956268310547,123.147811889648 399.535675048828,126.270210266113 397.329956054688,129.249374389648 395.124237060547,132.228546142578 393.104705810547,135.179061889648 391.271362304688,138.100936889648 389.266143798828,141.251983642578 387.561737060547,144.145202636719 386.158081054688,146.780624389648 384.754425048828,149.416046142578 383.565643310547,151.764999389648 382.591674804688,153.827499389648 379.211456298828,161.103546142578 377.521362304688,166.832702636719 377.521362304688,171.014999389648 377.521362304688,176.343124389648 379.326049804688,179.007186889648 382.935424804688,179.007186889648 386.143768310547,179.007186889648 390.555206298828,177.145202636719 396.169799804688,173.421249389648 401.956268310547,169.468124389648 406.425018310547,165.916046142578 409.576049804688,162.764999389648 412.841674804688,159.327499389648 415.563018798828,156.434265136719 417.740112304688,154.085311889648 419.917205810547,151.736358642578 421.635955810547,149.845733642578 422.896362304688,148.413436889648 424.156768798828,146.981140136719 425.316925048828,145.376983642578 426.376831054688,143.600936889648 427.436706542969,141.824890136719 428.453643798828,139.876983642578 429.427612304688,137.757186889648 427.938018798828,137.413436889648 426.806518554688,136.668640136719 426.033081054688,135.522811889648 425.259643554688,134.376983642578 424.872924804688,133.087921142578 424.872924804688,131.655624389648 424.872924804688,130.509796142578 425.044799804688,128.819686889648 425.388549804688,126.585311889648 425.732299804688,124.350936889648 425.904174804688,122.632186889648 425.904174804688,121.429061889648 425.904174804688,120.397811889648 425.632019042969,119.237655639648 425.087768554688,117.948593139648 424.543487548828,116.659530639648 423.841674804688,115.456405639648 422.982299804688,114.339218139648 422.122924804688,113.222030639648 421.163299560547,112.276718139648 420.103393554688,111.503280639648 419.043487548828,110.729843139648 417.997924804688,110.343124389648 416.966674804688,110.343124389648z M181.0703125,108.538436889648C178.95051574707,108.767608642578 176.6875,109.469429016113 174.28125,110.643905639648 171.875,111.818389892578 169.32551574707,113.623077392578 166.6328125,116.057968139648 163.940093994141,118.492866516113 161.104156494141,121.629585266113 158.125,125.468124389648 155.14582824707,129.306671142578 152.05207824707,133.975936889648 148.84375,139.475936889648 147.869781494141,141.137390136719 146.795562744141,142.956405639648 145.62109375,144.932968139648 144.44660949707,146.909530639648 143.32942199707,149.086608886719 142.26953125,151.464218139648 141.20964050293,153.841827392578 140.32160949707,156.376983642578 139.60546875,159.069686889648 138.88932800293,161.762390136719 138.53125,164.598327636719 138.53125,167.577499389648 138.53125,169.353546142578 139.17578125,170.699890136719 140.46484375,171.616561889648 141.75390625,172.533233642578 143.0859375,172.991561889648 144.4609375,172.991561889648 145.893218994141,172.991561889648 147.75520324707,172.203796386719 150.046875,170.628280639648 152.338531494141,169.052764892578 154.81640625,166.961608886719 157.48046875,164.354843139648 160.14453125,161.748077392578 162.865875244141,158.768905639648 165.64453125,155.417343139648 168.42317199707,152.065780639648 171.00129699707,148.613952636719 173.37890625,145.061874389648 175.756500244141,141.509796142578 177.819000244141,138.014999389648 179.56640625,134.577499389648 181.31379699707,131.139999389648 182.502593994141,128.017608642578 183.1328125,125.210311889648 183.3046875,124.350936889648 183.50520324707,123.334014892578 183.734375,122.159530639648 183.963531494141,120.985054016113 184.178375244141,119.810577392578 184.37890625,118.636093139648 184.57942199707,117.461616516113 184.75129699707,116.373077392578 184.89453125,115.370460510254 185.037750244141,114.367866516113 185.109375,113.637397766113 185.109375,113.179061889648 185.109375,113.064483642578 185.0234375,112.749374389648 184.8515625,112.233749389648 184.6796875,111.718124389648 184.421875,111.188179016113 184.078125,110.643905639648 183.734375,110.099639892578 183.319000244141,109.612655639648 182.83203125,109.182968139648 182.34504699707,108.753280639648 181.815093994141,108.538436889648 181.2421875,108.538436889648L181.0703125,108.538436889648z M453.576049804688,56.2884368896484C455.294799804688,56.2884368896484 456.984893798828,56.6608428955078 458.646362304688,57.4056243896484 460.422393798828,58.0931243896484 461.310424804688,59.0670928955078 461.310424804688,60.3274993896484 461.310424804688,61.0149993896484 461.181518554688,62.1321868896484 460.923706054688,63.6790618896484 460.665893554688,65.2259368896484 460.307800292969,67.2311477661133 459.849487304688,69.6946868896484 459.391143798828,72.1582336425781 458.775268554688,75.2090148925781 458.001831054688,78.8470306396484 457.228393554688,82.4850540161133 456.383331298828,86.8248977661133 455.466674804688,91.8665618896484 455.409362792969,92.4394836425781 455.237487792969,93.5853118896484 454.951049804688,95.3040618896484 454.664581298828,97.0228118896484 454.349487304688,98.8418273925781 454.005737304688,100.761093139648 453.661987304688,102.680366516113 453.346862792969,104.456405639648 453.060424804688,106.089218139648 452.773956298828,107.722030639648 452.602081298828,108.738960266113 452.544799804688,109.139999389648 451.799987792969,113.780624389648 451.198425292969,118.134796142578 450.740112304688,122.202499389648 450.281768798828,126.270210266113 450.052612304688,130.395202636719 450.052612304688,134.577499389648 450.052612304688,137.900421142578 450.138549804688,141.824890136719 450.310424804688,146.350936889648 450.482299804688,150.934265136719 450.911987304688,155.374374389648 451.599487304688,159.671249389648 452.286987304688,163.968124389648 453.289581298828,166.116561889648 454.607299804688,166.116561889648 459.305206298828,166.116561889648 464.977081298828,163.968124389648 471.622924804688,159.671249389648 478.211456298828,155.317077636719 484.570831298828,150.332702636719 490.701049804688,144.718124389648 493.766143798828,141.910827636719 496.659362792969,139.167999267578 499.380737304688,136.489608764648L504.336578369141,131.408462524414 505.0302734375,130.205429077148C506.390960693359,128.092803955078 507.859069824219,126.041038513184 509.4345703125,124.050155639648 512.585632324219,120.068389892578 515.7939453125,116.573593139648 519.0595703125,113.565780639648 522.3251953125,110.557968139648 525.433288574219,108.180366516113 528.3837890625,106.432968139648 531.334289550781,104.685577392578 533.726257324219,103.811874389648 535.5595703125,103.811874389648 536.0751953125,103.811874389648 536.662414550781,103.926460266113 537.3212890625,104.155616760254 537.980163574219,104.384796142578 538.667663574219,104.628280639648 539.3837890625,104.886093139648 540.099914550781,105.143905639648 540.787414550781,105.373077392578 541.4462890625,105.573593139648 542.105163574219,105.774116516113 542.663757324219,105.874374389648 543.1220703125,105.874374389648 543.580383300781,105.874374389648 544.038757324219,105.774116516113 544.4970703125,105.573593139648 544.955383300781,105.373077392578 545.413757324219,105.143905639648 545.8720703125,104.886093139648 546.330383300781,104.628280639648 546.788757324219,104.384796142578 547.2470703125,104.155616760254 547.705383300781,103.926460266113 548.163757324219,103.811874389648 548.6220703125,103.811874389648 549.3095703125,103.811874389648 550.054382324219,104.041046142578 550.8564453125,104.499374389648 551.658508300781,104.957710266113 552.431945800781,105.544952392578 553.1767578125,106.261093139648 553.921569824219,106.977241516113 554.580383300781,107.793647766113 555.1533203125,108.710311889648 555.726257324219,109.626983642578 556.127258300781,110.514999389648 556.3564453125,111.374374389648 556.585632324219,112.405624389648 556.886413574219,113.164741516113 557.2587890625,113.651718139648 557.631164550781,114.138702392578 558.003601074219,114.582710266113 558.3759765625,114.983749389648 558.748352050781,115.384796142578 559.0634765625,115.857452392578 559.3212890625,116.401718139648 559.5791015625,116.945991516113 559.7080078125,117.791046142578 559.7080078125,118.936874389648 559.7080078125,119.509796142578 559.507507324219,120.712921142578 559.1064453125,122.546249389648 558.705383300781,124.379585266113 558.261413574219,126.513702392578 557.7744140625,128.948593139648 557.287414550781,131.383483886719 556.843444824219,133.918640136719 556.4423828125,136.554061889648 556.041320800781,139.189483642578 555.8408203125,141.595733642578 555.8408203125,143.772811889648 555.8408203125,149.903015136719 556.1845703125,154.916046142578 556.8720703125,158.811874389648 557.5595703125,162.707702636719 558.5048828125,165.787139892578 559.7080078125,168.050155639648 560.9111328125,170.313171386719 562.3291015625,171.874374389648 563.9619140625,172.733749389648 565.5947265625,173.593124389648 567.327819824219,174.022811889648 569.1611328125,174.022811889648 573.515319824219,174.022811889648 577.081726074219,173.278015136719 579.8603515625,171.788436889648 582.638977050781,170.298858642578 585.116882324219,168.093124389648 587.2939453125,165.171249389648 587.924133300781,164.369171142578 588.468444824219,163.653015136719 588.9267578125,163.022811889648 589.385070800781,162.392608642578 589.843383789063,162.077499389648 590.3017578125,162.077499389648 591.103820800781,162.077499389648 591.834289550781,162.392608642578 592.4931640625,163.022811889648 593.151977539063,163.653015136719 593.4814453125,164.311874389648 593.4814453125,164.999374389648 593.4814453125,165.916046142578 593.295227050781,166.961608886719 592.9228515625,168.136093139648 592.550476074219,169.310577392578 591.963195800781,170.499374389648 591.1611328125,171.702499389648 590.1298828125,173.478546142578 588.769165039063,175.297546386719 587.0791015625,177.159530639648 585.388977050781,179.021514892578 583.498352050781,180.711608886719 581.4072265625,182.229843139648 579.316101074219,183.748077392578 577.038757324219,184.994171142578 574.5751953125,185.968124389648 572.111633300781,186.942077636719 569.562194824219,187.429061889648 566.9267578125,187.429061889648 563.4892578125,187.429061889648 560.5244140625,186.655624389648 558.0322265625,185.108749389648 555.5400390625,183.561874389648 553.3916015625,181.456405639648 551.5869140625,178.792343139648 549.7822265625,176.128280639648 548.292663574219,173.020202636719 547.1181640625,169.468124389648 545.943664550781,165.916046142578 544.984069824219,162.163436889648 544.2392578125,158.210311889648 541.718444824219,161.876983642578 538.724914550781,165.514999389648 535.2587890625,169.124374389648 531.792663574219,172.733749389648 528.2119140625,175.985046386719 524.5166015625,178.878280639648 520.8212890625,181.771514892578 517.183288574219,184.120468139648 513.6025390625,185.925155639648 510.021820068359,187.729843139648 506.8564453125,188.632186889648 504.1064453125,188.632186889648 502.273101806641,188.632186889648 500.511383056641,188.173858642578 498.8212890625,187.257186889648 497.131195068359,186.340515136719 495.6416015625,185.108749389648 494.3525390625,183.561874389648 493.0634765625,182.014999389648 492.046539306641,180.238952636719 491.3017578125,178.233749389648 490.556976318359,176.228546142578 490.1845703125,174.108749389648 490.1845703125,171.874374389648 490.1845703125,169.639999389648 490.370758056641,167.291046142578 490.7431640625,164.827499389648 491.115570068359,162.363952636719 491.745758056641,159.714218139648 492.6337890625,156.878280639648L493.119232177734,155.466354370117 492.849487304688,155.761093139648C490.385925292969,158.253280639648 487.779174804688,160.788436889648 485.029174804688,163.366561889648 482.279174804688,165.944686889648 479.615112304688,168.264999389648 477.036987304688,170.327499389648 474.458862304688,172.389999389648 471.938018798828,174.251983642578 469.474487304688,175.913436889648 464.604675292969,179.236358642578 460.708862304688,180.897811889648 457.786987304688,180.897811889648 456.641143798828,180.897811889648 455.180206298828,180.496765136719 453.404174804688,179.694686889648 449.794799804688,178.033233642578 446.930206298828,174.996765136719 444.810424804688,170.585311889648 442.747924804688,166.173858642578 441.286987304688,161.561874389648 440.427612304688,156.749374389648 439.568237304688,151.936874389648 438.852081298828,146.551452636719 438.279174804688,140.593124389648 431.117706298828,153.942077636719 421.836456298828,165.801452636719 410.435424804688,176.171249389648 398.977081298828,186.598327636719 387.117706298828,191.811874389648 374.857299804688,191.811874389648 371.477081298828,191.811874389648 368.898956298828,190.007186889648 367.122924804688,186.397811889648 365.346893310547,182.845733642578 364.458862304688,179.150421142578 364.458862304688,175.311874389648 364.458862304688,170.155624389648 364.888549804688,166.317077636719 365.747924804688,163.796249389648L366.740081787109,161.069854736328 361.366027832031,165.944686889648C358.67333984375,168.179061889648 356.037902832031,170.155624389648 353.459777832031,171.874374389648 351.397277832031,173.249374389648 349.43505859375,174.538436889648 347.573059082031,175.741561889648 345.711090087891,176.944686889648 343.834777832031,177.975936889648 341.944152832031,178.835311889648 340.053527832031,179.694686889648 338.076965332031,180.382186889648 336.014465332031,180.897811889648 333.951965332031,181.413436889648 331.68896484375,181.671249389648 329.225402832031,181.671249389648 324.47021484375,181.671249389648 320.60302734375,180.468124389648 317.623840332031,178.061874389648 316.13427734375,176.858749389648 314.830871582031,175.297546386719 313.713684082031,173.378280639648 312.596496582031,171.459014892578 311.62255859375,169.324890136719 310.791809082031,166.975936889648 309.961090087891,164.626983642578 309.244934082031,162.134796142578 308.643371582031,159.499374389648 308.041809082031,156.863952636719 307.54052734375,154.257186889648 307.139465332031,151.679061889648 306.623840332031,148.470733642578 306.136871337891,145.591827392578 305.678527832031,143.042343139648 305.22021484375,140.492858886719 304.690246582031,138.344421386719 304.088684082031,136.597030639648 303.487121582031,134.849639892578 302.756652832031,133.503280639648 301.897277832031,132.557968139648 301.037902832031,131.612655639648 299.920715332031,131.139999389648 298.545715332031,131.139999389648 297.457183837891,131.139999389648 296.425933837891,131.254577636719 295.451965332031,131.483749389648 294.47802734375,131.712921142578 293.461090087891,132.171249389648 292.401184082031,132.858749389648 291.34130859375,133.546249389648 290.18115234375,134.520202636719 288.920715332031,135.780624389648 287.660308837891,137.041046142578 286.18505859375,138.702499389648 284.494934082031,140.764999389648 282.804840087891,142.827499389648 280.871246337891,145.348327636719 278.694152832031,148.327499389648 276.51708984375,151.306671142578 273.967590332031,154.858749389648 271.045715332031,158.983749389648 269.613433837891,160.988952636719 267.92333984375,163.194686889648 265.975402832031,165.600936889648 264.027496337891,168.007186889648 262.03662109375,170.298858642578 260.002746582031,172.475936889648 257.968902587891,174.653015136719 255.97802734375,176.572296142578 254.03010559082,178.233749389648 252.082183837891,179.895202636719 250.363433837891,180.955108642578 248.87385559082,181.413436889648 243.832183837891,180.324890136719 241.31135559082,174.051452636719 241.31135559082,162.593124389648 241.31135559082,159.556671142578 241.65510559082,154.944686889648 242.34260559082,148.757186889648 242.68635559082,145.949890136719 243.08740234375,143.013702392578 243.54573059082,139.948593139648L243.633743286133,139.477767944336 241.3662109375,142.344100952148C239.48274230957,144.571319580078 237.55989074707,146.694686889648 235.59765625,148.714218139648 231.67317199707,152.753280639648 227.705718994141,156.577499389648 223.6953125,160.186874389648 219.51301574707,163.968124389648 215.34504699707,166.918640136719 211.19140625,169.038436889648 207.037750244141,171.158233642578 203.299468994141,172.218124389648 199.9765625,172.218124389648 198.54426574707,172.218124389648 197.12629699707,171.874374389648 195.72265625,171.186874389648 194.319000244141,170.499374389648 193.00129699707,169.597030639648 191.76953125,168.479843139648 190.537750244141,167.362655639648 189.44921875,166.059265136719 188.50390625,164.569686889648 187.55859375,163.080108642578 186.828125,161.533233642578 186.3125,159.929061889648 186.026031494141,159.069686889648 185.768218994141,158.081405639648 185.5390625,156.964218139648 185.30989074707,155.847030639648 185.080718994141,154.815780639648 184.8515625,153.870468139648 184.62239074707,152.925155639648 184.36457824707,152.123077392578 184.078125,151.464218139648 183.791656494141,150.805358886719 183.4765625,150.475936889648 183.1328125,150.475936889648 182.90364074707,150.475936889648 182.416656494141,150.848327636719 181.671875,151.593124389648 180.92707824707,152.337921142578 180.053375244141,153.297546386719 179.05078125,154.472030639648 178.04817199707,155.646514892578 176.97395324707,156.964218139648 175.828125,158.425155639648 174.682281494141,159.886093139648 173.55078125,161.304061889648 172.43359375,162.679061889648 171.31640625,164.054061889648 170.31379699707,165.314483642578 169.42578125,166.460311889648 168.537750244141,167.606140136719 167.8359375,168.465515136719 167.3203125,169.038436889648 165.54426574707,171.043640136719 163.43879699707,173.091827392578 161.00390625,175.182968139648 158.569000244141,177.274108886719 156.13410949707,179.179061889648 153.69921875,180.897811889648 151.264312744141,182.616561889648 149.02995300293,184.020202636719 146.99609375,185.108749389648 144.96223449707,186.197296142578 143.45832824707,186.741561889648 142.484375,186.741561889648 140.30729675293,186.741561889648 138.20182800293,186.383483886719 136.16796875,185.667343139648 134.13410949707,184.951202392578 132.34375,183.905624389648 130.796875,182.530624389648 129.25,181.155624389648 128.00390625,179.465515136719 127.05859375,177.460311889648 126.11328125,175.455108642578 125.640625,173.163436889648 125.640625,170.585311889648 125.640625,166.345733642578 126.485679626465,161.504577636719 128.17578125,156.061874389648 129.020843505859,153.340515136719 130.001953125,150.597686767578 131.119140625,147.833358764648L132.791915893555,144.115005493164 132.34375,144.417343139648C129.36457824707,146.336608886719 126.05598449707,148.370468139648 122.41796875,150.518905639648 118.779945373535,152.667343139648 114.92707824707,154.844421386719 110.859375,157.050155639648 106.791664123535,159.255889892578 102.72395324707,161.418640136719 98.65625,163.538436889648 94.5885391235352,165.658233642578 90.6354141235352,167.663436889648 86.796875,169.554061889648 82.9583282470703,171.444686889648 79.4635391235352,173.106140136719 76.3125,174.538436889648 74.0208282470703,175.569686889648 71.84375,176.729843139648 69.78125,178.018905639648 67.71875,179.307968139648 65.69921875,180.511093139648 63.7226600646973,181.628280639648 61.74609375,182.745468139648 59.7552070617676,183.676452636719 57.7499961853027,184.421249389648 55.7447891235352,185.166046142578 53.625,185.538436889648 51.390625,185.538436889648 50.0729141235352,185.538436889648 48.7981758117676,185.380889892578 47.5664100646973,185.065780639648 46.3346328735352,184.750671386719 45.2317695617676,184.249374389648 44.2578163146973,183.561874389648 43.2838516235352,182.874374389648 42.49609375,182.000671386719 41.8945274353027,180.940780639648 41.29296875,179.880889892578 40.9921875,178.606140136719 40.9921875,177.116561889648 40.9921875,176.314483642578 41.2643203735352,175.569686889648 41.80859375,174.882186889648 42.3528633117676,174.194686889648 43.0546875,173.578796386719 43.9140625,173.034530639648 44.7734375,172.490264892578 45.71875,171.988952636719 46.75,171.530624389648 47.78125,171.072296142578 48.7838516235352,170.671249389648 49.7578086853027,170.327499389648 50.7890586853027,169.926452636719 52.0065078735352,169.511093139648 53.41015625,169.081405639648 54.8138008117676,168.651718139648 56.2317695617676,168.222030639648 57.6640625,167.792343139648 59.0963516235352,167.362655639648 60.4856719970703,166.918640136719 61.83203125,166.460311889648 63.1783828735352,166.001983642578 64.3385391235352,165.543640136719 65.3125,165.085311889648 67.1458282470703,164.111358642578 68.8645782470703,162.879577636719 70.46875,161.389999389648 72.0729141235352,159.900421142578 73.5625,158.267608642578 74.9375,156.491561889648 76.3125,154.715515136719 77.6015625,152.867858886719 78.8046875,150.948593139648 80.0078125,149.029327392578 81.125,147.181671142578 82.1562576293945,145.405624389648 82.84375,144.202499389648 83.5026016235352,142.856140136719 84.1328125,141.366561889648 84.7630157470703,139.876983642578 85.3216094970703,138.387390136719 85.80859375,136.897811889648 86.2955703735352,135.408233642578 86.66796875,133.990264892578 86.92578125,132.643905639648 87.18359375,131.297546386719 87.3125,130.166046142578 87.3125,129.249374389648 87.3125,125.296249389648 86.453125,122.145210266113 84.734375,119.796249389648 83.015625,117.447296142578 80.8671875,116.272811889648 78.2890548706055,116.272811889648 76.6848907470703,116.272811889648 74.8372344970703,116.802764892578 72.74609375,117.862655639648 70.6549453735352,118.922554016113 68.5637969970703,120.197296142578 66.47265625,121.686874389648 64.3815078735352,123.176460266113 62.43359375,124.737655639648 60.62890625,126.370468139648 58.82421875,128.003280639648 57.3776016235352,129.392608642578 56.2890586853027,130.538436889648 53.6536407470703,133.345733642578 51.1757774353027,136.396514892578 48.85546875,139.690780639648 46.53515625,142.985046386719 44.34375,146.365264892578 42.2812461853027,149.831405639648 40.21875,153.297546386719 38.2708320617676,156.778015136719 36.4375,160.272811889648 34.6041641235352,163.767608642578 32.9140625,167.119171142578 31.3671855926514,170.327499389648 30.6796875,173.020202636719 30.0065097808838,175.999374389648 29.3476543426514,179.264999389648 28.6888008117676,182.530624389648 28.1874980926514,186.111358642578 27.8437538146973,190.007186889648 27.2135410308838,197.741561889648 26.7408847808838,204.645202636719 26.4257793426514,210.718124389648 26.1106758117676,216.791046142578 25.4661445617676,222.348327636719 24.4921913146973,227.389999389648 24.1484375,229.223327636719 23.3177070617676,230.841827392578 22.0000057220459,232.245468139648 20.6822910308838,233.649108886719 18.9635410308838,234.350936889648 16.84375,234.350936889648 16.2135410308838,234.350936889648 15.46875,234.193389892578 14.6093778610229,233.878280639648 13.75,233.563171386719 12.93359375,233.119171142578 12.1601552963257,232.546249389648 11.38671875,231.973327636719 10.7278642654419,231.328796386719 10.1835947036743,230.612655639648 9.63932228088379,229.896514892578 9.3671875,229.108749389648 9.3671875,228.249374389648 9.3671875,226.358749389648 9.49609375,224.024108886719 9.75390529632568,221.245468139648 10.01171875,218.466827392578 10.3125,215.673858642578 10.6562471389771,212.866561889648 11,210.059265136719 11.3294267654419,207.509796142578 11.6445322036743,205.218124389648 11.9596347808838,202.926452636719 12.1744785308838,201.322296142578 12.2890615463257,200.405624389648 13.0911455154419,194.504577636719 13.8072910308838,188.130889892578 14.4375,181.284530639648 15.0677080154419,174.438171386719 15.5833330154419,166.975936889648 15.9843711853027,158.897811889648 16.0416660308838,157.179061889648 16.11328125,154.901718139648 16.1992206573486,152.065780639648 16.28515625,149.229843139648 16.37109375,146.365264892578 16.4570331573486,143.472030639648 16.54296875,140.578796386719 16.62890625,137.886093139648 16.71484375,135.393905639648 16.80078125,132.901718139648 16.9010410308838,131.139999389648 17.0156269073486,130.108749389648 17.8177070617676,119.166046142578 20.6822929382324,113.694686889648 25.6093730926514,113.694686889648 26.5833320617676,113.694686889648 27.5143203735352,113.938179016113 28.4023399353027,114.425163269043 29.2903633117676,114.912139892578 30.078125,115.542343139648 30.7656288146973,116.315780639648 31.453125,117.089218139648 31.9973945617676,117.962921142578 32.3984336853027,118.936874389648 32.7994766235352,119.910835266113 33,120.856147766113 33,121.772804260254 33,123.778022766113 32.78515625,125.940780639648 32.3554725646973,128.261093139648 31.9257793426514,130.581405639648 31.4531230926514,132.959014892578 30.9374961853027,135.393905639648 30.4218730926514,137.828796386719 29.9492168426514,140.220733642578 29.51953125,142.569686889648 29.0898418426514,144.918640136719 28.8749980926514,147.067077636719 28.8750019073486,149.014999389648 28.8749980926514,150.676452636719 29.0468730926514,151.507186889648 29.390625,151.507186889648 33.4010391235352,144.288436889648 37.3255195617676,137.943389892578 41.1640663146973,132.472030639648 45.0026016235352,127.000679016113 48.8411445617676,122.460311889648 52.6796836853027,118.850936889648 55.1432266235352,116.559272766113 57.578125,114.453804016113 59.9843788146973,112.534530639648 62.390625,110.615264892578 64.8111953735352,108.953804016113 67.24609375,107.550155639648 69.6809844970703,106.146514892578 72.2018203735352,105.057968139648 74.80859375,104.284538269043 77.4153594970703,103.511093139648 80.1796875,103.095733642578 83.1015625,103.038436889648 85.1067657470703,102.981147766113 87.18359375,103.468124389648 89.33203125,104.499374389648 91.48046875,105.530624389648 93.4140625,107.077499389648 95.1328125,109.139999389648 96.8515548706055,111.202499389648 98.2695236206055,113.709014892578 99.38671875,116.659530639648 100.503898620605,119.610054016113 101.033843994141,122.947296142578 100.976554870605,126.671249389648 101.033843994141,129.535827636719 100.589836120605,132.400421142578 99.6445236206055,135.264999389648 98.6992111206055,138.129577636719 97.4387969970703,140.951202392578 95.86328125,143.729843139648 94.2877578735352,146.508483886719 92.46875,149.186874389648 90.40625,151.764999389648 88.34375,154.343124389648 86.1953125,156.720733642578 83.9609375,158.897811889648 88.6588516235352,157.121765136719 93.4856719970703,154.944686889648 98.4413986206055,152.366561889648 103.397132873535,149.788436889648 108.35285949707,147.009796142578 113.30859375,144.030624389648 118.264320373535,141.051452636719 123.13410949707,137.957702636719 127.91796875,134.749374389648 132.701812744141,131.541046142578 137.27082824707,128.418640136719 141.625,125.382186889648 142.283843994141,124.923858642578 142.87825012207,124.501327514648 143.408203125,124.114616394043L144.405715942383,123.362648010254 144.4609375,123.276718139648C148.0703125,118.091827392578 151.822906494141,113.637397766113 155.71875,109.913436889648 160.244781494141,105.616561889648 164.98567199707,102.451202392578 169.94140625,100.417350769043 174.897125244141,98.3834915161133 179.98176574707,97.3665618896484 185.1953125,97.3665618896484 186.16926574707,97.3665618896484 187.014312744141,97.5670852661133 187.73046875,97.9681243896484 188.44660949707,98.3691711425781 189.0625,98.8847961425781 189.578125,99.5149993896484 190.09375,100.145210266113 190.55207824707,100.847030639648 190.953125,101.620460510254 191.354156494141,102.393905639648 191.75520324707,103.181671142578 192.15625,103.983749389648 192.385406494141,104.499374389648 192.87239074707,105.072296142578 193.6171875,105.702499389648 194.361968994141,106.332710266113 195.135406494141,106.977241516113 195.9375,107.636093139648 196.73957824707,108.294952392578 197.44140625,108.939483642578 198.04296875,109.569686889648 198.64453125,110.199897766113 198.9453125,110.801460266113 198.9453125,111.374374389648 198.9453125,112.577499389648 198.701812744141,113.909530639648 198.21484375,115.370460510254 197.72785949707,116.831405639648 197.197906494141,118.521514892578 196.625,120.440773010254 196.05207824707,122.360054016113 195.522125244141,124.537139892578 195.03515625,126.972023010254 194.54817199707,129.406921386719 194.3046875,132.199890136719 194.3046875,135.350936889648 194.3046875,137.413436889648 194.490875244141,139.762390136719 194.86328125,142.397811889648 195.23567199707,145.033233642578 195.80859375,147.539733886719 196.58203125,149.917343139648 197.35546875,152.294952392578 198.34375,154.285827636719 199.546875,155.889999389648 200.75,157.494171142578 202.15364074707,158.296249389648 203.7578125,158.296249389648 205.705718994141,158.296249389648 207.65364074707,157.737655639648 209.6015625,156.620468139648 211.549468994141,155.503280639648 213.783843994141,153.942077636719 216.3046875,151.936874389648 221.91926574707,147.468124389648 227.24739074707,142.569686889648 232.2890625,137.241561889648 237.330718994141,131.913436889648 242.486968994141,126.613960266113 247.7578125,121.343124389648L247.835861206055,121.282699584961 250.76448059082,113.780624389648C251.33740234375,112.634796142578 251.93896484375,111.732452392578 252.56916809082,111.073593139648 253.199371337891,110.414741516113 253.843902587891,109.927764892578 254.50276184082,109.612655639648 255.16162109375,109.297554016113 255.84912109375,109.097030639648 256.565246582031,109.011093139648 257.281402587891,108.925155639648 258.011871337891,108.882186889648 258.756652832031,108.882186889648 259.67333984375,108.882186889648 260.48974609375,109.512397766113 261.205871582031,110.772811889648 261.922027587891,112.033233642578 262.280090332031,113.780624389648 262.280090332031,116.014999389648 262.280090332031,117.389999389648 262.16552734375,118.679061889648 261.936340332031,119.882186889648 261.707183837891,121.085311889648 261.39208984375,122.317085266113 260.991027832031,123.577499389648 260.589996337891,124.837921142578 260.160308837891,126.198593139648 259.701965332031,127.659530639648 259.24365234375,129.120468139648 258.785308837891,130.796249389648 258.326965332031,132.686874389648 257.983215332031,134.233749389648 257.596496582031,135.952499389648 257.166809082031,137.843124389648 256.737121582031,139.733749389648 256.336090087891,141.653015136719 255.96369934082,143.600936889648 255.59130859375,145.548858642578 255.27619934082,147.453796386719 255.01838684082,149.315780639648 254.76057434082,151.177764892578 254.63166809082,152.853546142578 254.63166809082,154.343124389648 254.63166809082,155.374374389648 254.80354309082,156.434265136719 255.14729309082,157.522811889648 256.75146484375,157.350936889648 259.386871337891,154.944686889648 263.053527832031,150.304061889648 264.944152832031,147.955108642578 267.02099609375,145.376983642578 269.283996582031,142.569686889648 271.547027587891,139.762390136719 273.996246337891,136.668640136719 276.631652832031,133.288436889648 278.57958984375,130.767608642578 280.51318359375,128.418640136719 282.432434082031,126.241561889648 284.351715087891,124.064483642578 286.342590332031,122.159530639648 288.405090332031,120.526718139648 290.467590332031,118.893905639648 292.658996582031,117.604843139648 294.979309082031,116.659530639648 297.299621582031,115.714218139648 299.863433837891,115.241561889648 302.670715332031,115.241561889648 305.64990234375,115.241561889648 308.127746582031,115.886093139648 310.104309082031,117.175155639648 312.080871582031,118.464218139648 313.670715332031,120.240264892578 314.873840332031,122.503280639648 316.076965332031,124.766304016113 317.007965087891,127.473335266113 317.666809082031,130.624374389648 318.32568359375,133.775421142578 318.855621337891,137.241561889648 319.256652832031,141.022811889648 319.600402832031,144.231140136719 319.929840087891,147.410827636719 320.244934082031,150.561874389648 320.56005859375,153.712921142578 321.175933837891,156.534530639648 322.092590332031,159.026718139648 323.00927734375,161.518905639648 324.326965332031,163.538436889648 326.045715332031,165.085311889648 327.764465332031,166.632186889648 330.22802734375,167.405624389648 333.436340332031,167.405624389648 335.89990234375,167.405624389648 338.47802734375,166.832702636719 341.170715332031,165.686874389648 343.863433837891,164.541046142578 346.699371337891,162.951202392578 349.678527832031,160.917343139648 352.65771484375,158.883483886719 355.737121582031,156.491561889648 358.916809082031,153.741561889648 362.096496582031,150.991561889648 365.37646484375,147.983749389648 368.756652832031,144.718124389648 370.074371337891,143.457702636719 371.52099609375,141.867858886719 373.096496582031,139.948593139648 374.672027587891,138.029327392578 376.218902587891,136.181671142578 377.737121582031,134.405624389648 378.496246337891,133.517608642578 379.230285644531,132.694030761719 379.939300537109,131.934921264648L381.199279785156,130.655120849609 385.427612304688,124.264999389648C388.349487304688,120.254585266113 391.672393798828,116.244171142578 395.396362304688,112.233749389648 399.177612304688,108.223335266113 402.729705810547,105.358749389648 406.052612304688,103.639999389648 410.177612304688,101.405624389648 416.107299804688,100.288436889648 423.841674804688,100.288429260254 426.534362792969,100.288436889648 428.826049804688,101.778022766113 430.716674804688,104.757186889648 432.607299804688,107.736358642578 434.039581298828,111.202499389648 435.013549804688,115.155624389648 435.987487792969,119.337921142578 436.474487304688,122.603546142578 436.474487304688,124.952499389648 437.333862304688,122.145210266113 438.107299804688,119.294952392578 438.794799804688,116.401718139648 439.482299804688,113.508491516113 440.083862304688,110.514999389648 440.599487304688,107.421249389648 441.115112304688,104.327499389648 441.587768554688,101.076202392578 442.017456054688,97.6673431396484 442.447143554688,94.2584915161133 442.833862304688,90.6061477661133 443.177612304688,86.7103118896484 443.292175292969,85.679069519043 443.406768798828,84.3613586425781 443.521362304688,82.7571868896484 443.635925292969,81.1530227661133 443.779174804688,79.2623977661133 443.951049804688,77.0853118896484 444.294799804688,72.6165618896484 444.638549804688,68.8496398925781 444.982299804688,65.7845306396484 445.326049804688,62.7194366455078 445.784362792969,60.7285461425781 446.357299804688,59.8118743896484 447.732299804688,57.4629211425781 450.138549804688,56.2884368896484 453.576049804688,56.2884368896484z" transform="translate(-4.522309515625 -27.1750441384583) scale(0.482782)" />\r
|
|
131
|
+
</svg>\r
|
|
132
|
+
\r
|
|
133
|
+
\r
|
|
134
|
+
\r
|
|
135
|
+
`,eM=()=>i.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:JT}}),tM=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m15 18-6-6 6-6"})}),nM=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 18 6-6-6-6"})}),Tb=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),i.jsx("path",{d:"M12 10.4v4.2"}),i.jsx("path",{d:"M12 7.9h.01"})]}),sM=(e,t)=>{var a;return((a=e[t])==null?void 0:a.trim())??""},Mb=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,aM=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:l,onRespond:o}){const u=t[0]??null,[f,m]=_.useState(null),[y,g]=_.useState(""),[S,p]=_.useState({}),[v,w]=_.useState(0),[N,j]=_.useState(null),[C,R]=_.useState(null);_.useEffect(()=>{m(null),g(""),p({}),w(0),j(null),R(null)},[u==null?void 0:u.id]);const z=u?l===u.id:!1,O=(u==null?void 0:u.kind)==="user_input",k=O&&u.questions.length>0?u.questions[Math.max(0,Math.min(v,u.questions.length-1))]??null:null,L=k?sM(S,k.id):"",K=k?k.options.some(Z=>Z.label===L):!1,J=!!(k&&L&&(!K||N===k.id));_.useEffect(()=>{if(!k){j(null);return}if(K){j(null);return}L&&j(k.id)},[K,k,L]);const q=_.useMemo(()=>!u||z?!1:u.kind==="user_input"?k?!!L:!1:f?!0:u.allow_freeform?!!y.trim():!1,[k,L,u,y,z,f]);if(!u)return null;const Y=u.questions.reduce((Z,he)=>Z+he.options.length,u.options.length),Q=Z=>{z||o({requestId:u.id,optionId:(Z==null?void 0:Z.optionId)??f,text:(Z==null?void 0:Z.text)??y,answers:(Z==null?void 0:Z.answers)??S})},G=()=>{if(!(!u||u.kind!=="user_input"||!k)){if(v<u.questions.length-1){w(Z=>Math.min(Z+1,u.questions.length-1));return}Q()}},ge=()=>{if(!u||u.kind!=="user_input"||!k)return;const Z={...S,[k.id]:"忽略"};if(p(Z),j(null),v<u.questions.length-1){w(he=>Math.min(he+1,u.questions.length-1));return}Q({answers:Z})},me=Z=>{if(!(!u||u.kind!=="user_input"||!k||z)){if(L===Z){G();return}p(he=>({...he,[k.id]:Z})),j(null)}};return i.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${O?"is-user-input-flow":""}`,children:u.kind==="user_input"&&k?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-interaction-flow__header",children:[i.jsx("div",{className:"session-interaction-flow__prompt",children:k.question}),i.jsxs("div",{className:"session-interaction-flow__progress",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:v===0||z,onClick:()=>w(Z=>Math.max(0,Z-1)),children:i.jsx(tM,{})}),i.jsxs("span",{className:"session-interaction-flow__counter",children:[v+1," / ",u.questions.length]}),i.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":v===u.questions.length-1?"提交回复":"下一题",disabled:z||!q,onClick:G,children:i.jsx(nM,{})})]})]}),i.jsx("div",{className:"session-interaction-flow__body",children:i.jsxs("div",{className:"session-interaction-flow__list",children:[k.options.map((Z,he)=>i.jsxs("div",{className:`session-interaction-flow__item is-${Z.emphasis} ${L===Z.label?"is-active":""}`,role:"button",tabIndex:z?-1:0,"aria-pressed":L===Z.label,onClick:()=>me(Z.label),onKeyDown:M=>{M.key==="Enter"&&Mb()&&(M.preventDefault(),me(Z.label))},children:[i.jsxs("span",{className:"session-interaction-flow__item-index",children:[he+1,"."]}),i.jsxs("span",{className:"session-interaction-flow__item-choice",children:[i.jsx("span",{className:"session-interaction-flow__item-label",children:Z.label}),Z.description?i.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${Z.label} 的说明`,"aria-expanded":C===Z.id,onMouseEnter:()=>R(Z.id),onMouseLeave:()=>R(M=>M===Z.id?null:M),onBlur:()=>R(M=>M===Z.id?null:M),onClick:M=>{M.stopPropagation(),R($=>$===Z.id?null:Z.id)},children:i.jsx(Tb,{})}),i.jsx("div",{className:`session-interaction-flow__tooltip ${C===Z.id?"is-visible":""}`,role:"tooltip",children:Z.description})]}):null]})]},Z.id)),i.jsx("div",{className:`session-interaction-flow__item is-custom ${J?"is-active":""}`,children:i.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[i.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:K?"":L,disabled:z,placeholder:k.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{j(k.id),K&&p(Z=>({...Z,[k.id]:""}))},onKeyDown:Z=>{Z.key==="Enter"&&q&&!z&&Mb()&&(Z.preventDefault(),G())},onChange:Z=>{j(k.id),p(he=>({...he,[k.id]:Z.target.value}))}}),i.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[i.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:z,onClick:ge,children:"忽略"}),i.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!q,onClick:G,children:z?"提交中...":v===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"session-interaction-strip__header",children:[i.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:i.jsx(Tb,{})}),i.jsxs("div",{className:"session-interaction-strip__copy",children:[i.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?i.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?i.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?i.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(Z=>i.jsxs("button",{type:"button",className:`session-interaction-option is-${Z.emphasis} ${f===Z.id?"is-active":""}`,disabled:z,onClick:()=>{m(Z.id),!u.allow_freeform&&Y<=3&&Q({optionId:Z.id})},children:[i.jsx("span",{className:"session-interaction-option__label",children:Z.label}),Z.description?i.jsx("span",{className:"session-interaction-option__description",children:Z.description}):null]},Z.id))}):null,u.allow_freeform?i.jsxs("label",{className:"session-interaction-strip__freeform",children:[i.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),i.jsx("textarea",{value:y,disabled:z,placeholder:u.freeform_placeholder??"输入回复内容",onChange:Z=>g(Z.target.value)})]}):null,u.allow_freeform||u.options.length>3?i.jsx("div",{className:"session-interaction-strip__footer",children:i.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!q,onClick:()=>Q(),children:z?"提交中...":u.submit_label??"继续"})}):null]})})}),iM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),rM=({panel:e,isPending:t,onDismiss:a,onSelectOption:l,onSubmitText:o})=>{const[u,f]=_.useState("");return _.useEffect(()=>{f("")},[e.panel_id,e.status]),i.jsxs("section",{className:`session-command-panel is-${e.status}`,children:[i.jsxs("div",{className:"session-command-panel__header",children:[i.jsxs("div",{className:"session-command-panel__command",children:["/",e.command_name]}),i.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:i.jsx(iM,{})})]}),i.jsx("div",{className:"session-command-panel__title",children:e.title}),e.description?i.jsx("div",{className:"session-command-panel__description",children:e.description}):null,i.jsx("pre",{className:"session-command-panel__body",children:e.body}),e.input_type==="choice"&&e.options.length>0?i.jsx("div",{className:"session-command-panel__options",children:e.options.map(m=>i.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>l(m.id),children:[i.jsx("span",{className:"session-command-panel__option-label",children:m.label}),m.description?i.jsx("span",{className:"session-command-panel__option-description",children:m.description}):null]},m.id))}):null,e.input_type==="text"?i.jsxs("form",{className:"session-command-panel__form",onSubmit:m=>{m.preventDefault(),!(!u.trim()||t)&&o(u.trim())},children:[i.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:e.input_placeholder??"继续输入",onChange:m=>f(m.target.value)}),i.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:e.submit_label??"提交"})]}):null]})},lM=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:l}){const[o,u]=_.useState(!0);return t.steps.length?i.jsxs("section",{className:`session-plan-strip ${o?"is-collapsed":""} ${a?"has-strip-above":""} ${l?"has-strip-below":""}`,children:[i.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(f=>!f),"aria-expanded":!o,children:[i.jsxs("div",{className:"session-plan-strip__summary",children:[i.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),i.jsx("path",{d:"M8 9h8"}),i.jsx("path",{d:"M8 13h5.5"}),i.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),i.jsx("span",{className:"session-plan-strip__summary-text",children:i.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),i.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),o?null:i.jsx(i.Fragment,{children:i.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((f,m)=>i.jsxs("div",{className:`session-plan-step is-${f.status}`,children:[i.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:f.status==="in_progress"?i.jsx("span",{className:"session-plan-step__spinner"}):null}),i.jsxs("span",{className:"session-plan-step__index",children:[m+1,"."]}),i.jsx("span",{className:"session-plan-step__label",children:f.step})]},f.id))})})]}):null}),oM=(e,t,a)=>{const l=((a==null?void 0:a.enabled)??!0)&&!!e;return is({queryKey:["project-skills",t??"",e],enabled:l,queryFn:async()=>e?(await xn({projectId:e,agentId:t??null})).client.getProjectSkills(e):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},Rb=24,cM=e=>{const t=cx(e);return t.length===0?i.jsx("span",{children:" "}):t.map((a,l)=>{const o=`skill-aware-token-${l}`;return a.kind==="skill"?i.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},o):a.kind==="command"?i.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},o):a.kind==="code"?i.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},o):a.kind==="path-link"?i.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},o):i.jsx("span",{children:a.value},o)})},Ab=({value:e,onChange:t,onKeyDown:a,placeholder:l,disabled:o=!1,className:u,projectId:f,agentId:m,autoFocus:y=!1})=>{var ee;const g=u.includes("composer-fullscreen-sheet__input"),S=_.useRef(null),p=_.useRef(null),[v,w]=_.useState({start:0,end:0}),[N,j]=_.useState(!1),[C,R]=_.useState(!1),[z,O]=_.useState(0),k=_.useMemo(()=>ux(e,v.start,v.end),[v.end,v.start,e]),L=_.useMemo(()=>dx(e,v.start,v.end),[v.end,v.start,e]),K=N&&!o&&!!k&&!C,J=N&&!o&&!!L&&!C,q=J?"command":K?"skill":null,Y=oM(f,m,{enabled:K}),Q=Y3({enabled:J,scope:m?{agentId:m,projectId:f}:void 0}),G=_.useMemo(()=>GT(Y.data??[],(k==null?void 0:k.query)??"").slice(0,Rb),[k==null?void 0:k.query,Y.data]),ge=_.useMemo(()=>{var oe;return YT(((oe=Q.data)==null?void 0:oe.commands)??[],(L==null?void 0:L.query)??"").slice(0,Rb)},[L==null?void 0:L.query,(ee=Q.data)==null?void 0:ee.commands]);_.useEffect(()=>{O(0)},[k==null?void 0:k.query,k==null?void 0:k.start,L==null?void 0:L.query,e,f]),_.useEffect(()=>{R(!1)},[k==null?void 0:k.query,k==null?void 0:k.start,k==null?void 0:k.end,L==null?void 0:L.query,L==null?void 0:L.start,L==null?void 0:L.end]);const me=()=>{if(!S.current||!p.current)return;p.current.scrollTop=S.current.scrollTop,p.current.scrollLeft=S.current.scrollLeft;const oe=Math.max(0,S.current.offsetWidth-S.current.clientWidth);p.current.style.setProperty("--skill-aware-textarea-scrollbar-width",`${oe}px`)};_.useEffect(()=>{me()},[e]),_.useEffect(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;const oe=S.current;if(!oe)return;const ae=new ResizeObserver(()=>{me()});return ae.observe(oe),me(),()=>{ae.disconnect()}},[]);const Z=()=>{S.current&&w({start:S.current.selectionStart??0,end:S.current.selectionEnd??0})},he=oe=>{if(!S.current)return;const ae=KT(e,S.current.selectionStart??v.start,S.current.selectionEnd??v.end,oe.name);ae&&(t(ae.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(ae.selectionStart,ae.selectionEnd),w({start:ae.selectionStart,end:ae.selectionEnd}))}))},M=oe=>{if(!S.current)return;const ae=QT(e,S.current.selectionStart??v.start,S.current.selectionEnd??v.end,oe.name);ae&&(t(ae.value),typeof window<"u"&&window.requestAnimationFrame(()=>{S.current&&(S.current.focus(),S.current.setSelectionRange(ae.selectionStart,ae.selectionEnd),w({start:ae.selectionStart,end:ae.selectionEnd}))}))},$=oe=>{const ae=q==="skill"&&G.length>0||q==="command"&&ge.length>0;if(q&&ae){if(oe.key==="ArrowDown"){oe.preventDefault();const I=q==="command"?ge.length:G.length;O(ne=>(ne+1)%I);return}if(oe.key==="ArrowUp"){oe.preventDefault();const I=q==="command"?ge.length:G.length;O(ne=>ne-1<0?I-1:ne-1);return}if((oe.key==="Enter"||oe.key==="Tab")&&!oe.shiftKey&&!oe.altKey&&!oe.ctrlKey&&!oe.metaKey){if(oe.preventDefault(),q==="command"){const ne=ge[z]??ge[0];if(!ne)return;M(ne);return}const I=G[z]??G[0];if(!I)return;he(I);return}}if(q&&oe.key==="Escape"){oe.preventDefault(),R(!0);return}a==null||a(oe)};return i.jsxs("div",{className:`skill-aware-textarea ${q?"is-picker-open":""} ${g?"is-fullscreen":""}`,children:[J?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:Q.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):Q.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):ge.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):ge.map((oe,ae)=>{const I=ae===z;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${I?"is-active":""}`,role:"option","aria-selected":I,onMouseDown:ne=>{ne.preventDefault(),M(oe)},onMouseEnter:()=>O(ae),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["/",oe.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:oe.description})]})},oe.name)})}):K?i.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:Y.isLoading?i.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):Y.isError?i.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):G.length===0?i.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):G.map((oe,ae)=>{const I=ae===z;return i.jsx("button",{type:"button",className:`skill-mention-picker__item ${I?"is-active":""}`,role:"option","aria-selected":I,onMouseDown:ne=>{ne.preventDefault(),he(oe)},onMouseEnter:()=>O(ae),children:i.jsxs("span",{className:"skill-mention-picker__main",children:[i.jsxs("span",{className:"skill-mention-picker__name",children:["$",oe.name]}),i.jsx("span",{className:"skill-mention-picker__description",children:oe.description}),i.jsx("span",{className:"skill-mention-picker__scope",children:WT(oe.scope)})]})},`${oe.scope}:${oe.name}:${oe.path}`)})}):null,i.jsxs("div",{className:"skill-aware-textarea__surface",children:[i.jsx("div",{ref:p,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:e?cM(e):i.jsx("span",{children:" "})}),i.jsx("textarea",{ref:S,className:`${u} skill-aware-textarea__input`,value:e,disabled:o,placeholder:l,autoFocus:y,onChange:oe=>{t(oe.target.value),R(!1),w({start:oe.target.selectionStart??0,end:oe.target.selectionEnd??0})},onKeyDown:$,onClick:Z,onSelect:Z,onKeyUp:Z,onFocus:()=>{j(!0),R(!1),Z()},onBlur:()=>{j(!1)},onScroll:me})]})]})},jg=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),uM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"m7 14 5 5 5-5"})]}),dM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M8 3H4v4"}),i.jsx("path",{d:"M16 3h4v4"}),i.jsx("path",{d:"M8 21H4v-4"}),i.jsx("path",{d:"M16 21h4v-4"}),i.jsx("path",{d:"M9 9 4 4"}),i.jsx("path",{d:"m15 9 5-5"}),i.jsx("path",{d:"m9 15-5 5"}),i.jsx("path",{d:"m15 15 5 5"})]}),fM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),Db=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),Ob=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 6h10"}),i.jsx("path",{d:"M9 12h10"}),i.jsx("path",{d:"M9 18h10"}),i.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),i.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),i.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),Ib=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 10V7.8A5 5 0 0 1 12 3a5 5 0 0 1 5 4.8V10"}),i.jsx("path",{d:"M5.5 10h13a1.5 1.5 0 0 1 1.5 1.5v7A2.5 2.5 0 0 1 17.5 21h-11A2.5 2.5 0 0 1 4 18.5v-7A1.5 1.5 0 0 1 5.5 10Z"}),i.jsx("path",{d:"M12 14v2.6"})]}),hM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 16V5"}),i.jsx("path",{d:"m8 9 4-4 4 4"}),i.jsx("path",{d:"M20 16.5v1A2.5 2.5 0 0 1 17.5 20h-11A2.5 2.5 0 0 1 4 17.5v-1"})]}),fx=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:l,composerError:o,onDismissComposerError:u,interactionRequests:f,pendingInteractionRequestId:m,onRespondInteraction:y,parentSession:g,backgroundAgentSessions:S,isBackgroundAgentsOpen:p,planSnapshot:v,onToggleBackgroundAgents:w,onOpenSession:N,getBackgroundAgentStatusLabel:j,getBackgroundAgentAccent:C,formatBackgroundAgentsLabel:R,hasBackgroundAgentStrip:z,commandPanel:O,isCommandPanelPending:k,onDismissCommandPanel:L,onCommandPanelOptionSelect:K,onCommandPanelTextSubmit:J,projectId:q=null,agentId:Y=null,draft:Q,pendingAttachments:G,canSendInput:ge,canSubmitInput:me=!0,isInputLocked:Z=!1,inputPlaceholder:he,readOnlyPlaceholder:M,onDraftChange:$,onUploadFiles:ee,onRemoveAttachment:oe,onSubmit:ae,showStopIcon:I,isSendPending:ne,onInterrupt:U,isFastModeEnabled:ie,isPlanModeEnabled:Se,isYoloModeEnabled:se,onToggleFastMode:we,onTogglePlanMode:ye,onToggleYoloMode:Oe,showModeBadges:Le=!1,selectedModel:_t,modelOptions:Ke=[],selectedReasoning:tt,onSelectModel:nn,onSelectReasoning:Xt,contextUsage:jn,isContextUsageOpen:zt,onToggleContextUsage:Bt,contextUsageRingStyle:yt,usedPercent:bt,remainingPercent:dt,usedTokensLabel:cn,totalTokensLabel:Pn,showJumpToBottom:Ee,onJumpToBottom:V}){const _e=_.useId(),[Te,Ie]=_.useState(!1),[ce,Ae]=_.useState(null),qe=_.useRef(null),xt=_.useRef(null),Dt=f[0]??null,ue=(Dt==null?void 0:Dt.kind)==="user_input",Me=f.length>0,Re=!!v&&!ue,We=!ue&&z,Xe=Re||We,Je=Me||Re||We,Tt={transform:`translateX(${a}px)`,transition:l?"none":void 0},Wt=(!!Q.trim()||G.length>0)&&ge&&me&&!Z&&!ne&&!I,ls=ge&&!Z,Nt=Le&&(ie||Se||se),Un=()=>{Wt&&(Ae(null),ae())},Cn=De=>{De.key!=="Enter"||De.shiftKey||De.altKey||De.ctrlKey||De.metaKey||De.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(De.preventDefault(),Un())};_.useEffect(()=>{if(!Te)return;const De=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=De}},[Te]),_.useEffect(()=>{if(!Te||typeof window>"u")return;const De=window.matchMedia("(min-width: 769px)"),Qt=()=>{De.matches&&Ie(!1)};return Qt(),typeof De.addEventListener=="function"?(De.addEventListener("change",Qt),()=>{De.removeEventListener("change",Qt)}):(De.addListener(Qt),()=>{De.removeListener(Qt)})},[Te]),_.useEffect(()=>{if(!ce)return;const De=On=>{const Ts=On.target;qe.current&&Ts instanceof Node&&qe.current.contains(Ts)||Ae(null)},Qt=On=>{On.key==="Escape"&&Ae(null)};return window.addEventListener("pointerdown",De),window.addEventListener("keydown",Qt),()=>{window.removeEventListener("pointerdown",De),window.removeEventListener("keydown",Qt)}},[ce]);const Dn=De=>Nt?i.jsxs("div",{className:De,"aria-label":"当前已启用的会话模式",children:[ie?i.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Ae(null),we()},"aria-label":"关闭 Fast 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Db,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,Se?i.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Ae(null),ye()},"aria-label":"关闭计划模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Ob,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null,se?i.jsxs("button",{type:"button",className:"composer-mode-badge is-yolo",onClick:()=>{Ae(null),Oe()},"aria-label":"关闭 Yolo 模式",children:[i.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:i.jsx(Ib,{})}),i.jsx("span",{className:"composer-mode-badge__label",children:"Yolo"})]}):null]}):null;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:Tt,children:[o?i.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[i.jsx("span",{className:"composer-alert__text",children:o}),i.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:i.jsx(jg,{})})]}):null,Me?i.jsx(aM,{requests:f,hasStripBelow:Xe,pendingRequestId:m,onRespond:y}):null,Re&&v?i.jsx(lM,{planSnapshot:v,hasStripAbove:Me,hasStripBelow:We}):null,We&&g?i.jsxs("button",{type:"button",className:`background-agents-exit ${Me||Re?"has-strip-above":""}`,onClick:()=>{N(g.id)},children:[i.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M6 12h12"}),i.jsx("path",{d:"m13 7 5 5-5 5"})]})}),i.jsx("span",{children:"返回主会话"})]}):We&&S.length>0?i.jsxs("section",{className:`background-agents-card ${p?"is-open":""} ${Me||Re?"has-strip-above":""}`,children:[i.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:w,"aria-expanded":p,children:[i.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),i.jsx("path",{d:"M12 11v3"}),i.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M4.5 18a4.5 4.5 0 0 1 4.5-4.5h6A4.5 4.5 0 0 1 19.5 18"})]})}),i.jsxs("span",{className:"background-agents-card__summary",children:[i.jsx("span",{className:"background-agents-card__title",children:R(S.length)}),p?i.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),i.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),p?i.jsx("div",{className:"background-agents-card__list",children:S.map(De=>{var Qt,On;return i.jsxs("button",{type:"button",className:`background-agent-row ${De.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":C(De)},onClick:()=>{N(De.id)},children:[i.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),i.jsxs("span",{className:"background-agent-row__meta",children:[i.jsxs("span",{className:"background-agent-row__title",children:[i.jsx("span",{className:"background-agent-row__name",children:((Qt=De.subagent)==null?void 0:Qt.nickname)??De.title}),i.jsxs("span",{className:"background-agent-row__role",children:["(",((On=De.subagent)==null?void 0:On.role)??"agent",")"]})]}),i.jsx("span",{className:"background-agent-row__status",children:j(De)})]}),i.jsx("span",{className:"background-agent-row__open",children:"Open"})]},De.id)})}):null]}):null,O?i.jsx(rM,{panel:O,isPending:k,onDismiss:L,onSelectOption:K,onSubmitText:J}):null,ue?null:i.jsxs("form",{className:`chat-composer ${Je?"is-attached-to-agent-strip":""}`,onSubmit:De=>{De.preventDefault(),Un()},children:[i.jsxs("div",{className:"chat-composer__editor",children:[G.length>0?i.jsx("div",{className:"chat-composer__attachments",children:G.map(De=>{const Qt=E0(De.size_bytes);return i.jsxs("div",{className:"chat-composer__attachment-chip",children:[i.jsxs("div",{className:"chat-composer__attachment-copy",children:[i.jsx("span",{className:"chat-composer__attachment-name",children:De.name}),i.jsxs("span",{className:"chat-composer__attachment-meta",children:[De.kind==="image"?"图片":"文件",Qt?` · ${Qt}`:""]})]}),i.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${De.name}`,onClick:()=>oe(De.id),children:i.jsx(jg,{})})]},De.id)})}):null,i.jsx(Ab,{className:"chat-composer__input",value:Q,disabled:!ls,projectId:q,agentId:Y,placeholder:ls?he??"要求后续变更":M??"当前会话为只读模式",onChange:$,onKeyDown:Cn}),i.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Ie(!0),children:i.jsx(dM,{})}),i.jsx("input",{id:_e,ref:xt,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:De=>{De.target.files&&De.target.files.length>0&&ee(De.target.files),De.target.value=""}})]}),Dn("composer-mode-badges composer-mode-badges--mobile"),i.jsxs("div",{className:"chat-composer__toolbar",children:[i.jsxs("div",{ref:qe,className:"chat-composer__controls",children:[i.jsxs("div",{className:`composer-utility-menu ${ce==="utility"?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":ce==="utility",onClick:()=>Ae(De=>De==="utility"?null:"utility"),children:i.jsx(fM,{})}),ce==="utility"?i.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var De;Ae(null),(De=xt.current)==null||De.click()},children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(hM,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":ie,onClick:we,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Db,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${ie?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":Se,onClick:ye,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Ob,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${Se?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),i.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":se,onClick:Oe,children:[i.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:i.jsx(Ib,{})}),i.jsx("span",{className:"composer-utility-menu__item-label",children:"Yolo 模式"}),i.jsx("span",{className:`composer-utility-menu__switch ${se?"is-on":""}`,"aria-hidden":"true",children:i.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),i.jsxs("div",{className:`composer-choice ${ce==="model"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":ce==="model",onClick:()=>Ae(De=>De==="model"?null:"model"),children:[i.jsx("span",{className:"composer-icon",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),i.jsx("path",{d:"m4 7 8 4 8-4"}),i.jsx("path",{d:"M12 11v10"})]})}),i.jsx("span",{className:"composer-control__value",children:fp(_t,Ke)})]}),ce==="model"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:Ke.map(De=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${_t===De.value?"is-active":""}`,role:"menuitemradio","aria-checked":_t===De.value,onClick:()=>{nn(De.value),Ae(null)},children:[i.jsx("span",{className:"composer-choice-menu__text",children:i.jsx("span",{className:"composer-choice-menu__label",children:De.label})}),_t===De.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},De.value))}):null]}),i.jsxs("div",{className:`composer-choice ${ce==="reasoning"?"is-open":""}`,children:[i.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":ce==="reasoning",onClick:()=>Ae(De=>De==="reasoning"?null:"reasoning"),children:[i.jsx("span",{className:"composer-icon",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M9.5 3a6.5 6.5 0 0 0-3.7 11.84c.53.38.92.95 1.1 1.57l.1.34c.13.44.54.75 1 .75h7c.46 0 .87-.31 1-.75l.1-.34c.18-.62.57-1.2 1.1-1.57A6.5 6.5 0 0 0 14.5 3z"}),i.jsx("path",{d:"M10 21h4"}),i.jsx("path",{d:"M9 18h6"})]})}),i.jsx("span",{className:"composer-control__value",children:KE(tt)})]}),ce==="reasoning"?i.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Af.map(De=>i.jsxs("button",{type:"button",className:`composer-choice-menu__item ${tt===De.value?"is-active":""}`,role:"menuitemradio","aria-checked":tt===De.value,onClick:()=>{Xt(De.value),Ae(null)},children:[i.jsx("span",{className:"composer-choice-menu__label",children:De.label}),tt===De.value?i.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},De.value))}):null]}),Dn("composer-mode-badges composer-mode-badges--inline")]}),i.jsxs("div",{className:"chat-composer__actions",children:[jn?i.jsxs("div",{className:`composer-context ${zt?"is-open":""}`,children:[i.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:De=>{De.stopPropagation(),Bt()},children:i.jsx("span",{className:"composer-context__ring",style:yt,children:i.jsx("span",{className:"composer-context__ring-core"})})}),zt?i.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[i.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),i.jsxs("div",{children:[bt,"% 已用(剩余 ",dt,"%)"]}),i.jsxs("div",{children:["已用 ",cn,",共 ",Pn]})]}):null]}):null,i.jsx("button",{type:I?"button":"submit",className:"composer-send",disabled:I?!ge:!Wt,"aria-label":I?"中断":"发送",onClick:()=>{I&&U()},children:I?i.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:i.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):i.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:i.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Te?i.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:i.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[i.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[i.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Ie(!1),children:i.jsx(jg,{})})]}),i.jsx(Ab,{className:"composer-fullscreen-sheet__input",value:Q,disabled:!ls,projectId:q,agentId:Y,placeholder:ls?he??"要求后续变更":M??"当前会话为只读模式",onChange:$,onKeyDown:Cn,autoFocus:!0}),i.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[i.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[i.jsx("span",{children:_t}),i.jsx("span",{children:tt}),se?i.jsx("span",{children:"Yolo"}):null,G.length>0?i.jsxs("span",{children:[G.length," 个附件"]}):null]}),i.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Ie(!1),children:"关闭"}),I?i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!ge,onClick:U,children:"中断"}):i.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Wt,onClick:()=>{Un(),Ie(!1)},children:"发送"})]})]})]})}):null,Ee?i.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:Tt,onClick:V,"aria-label":"滚动到最下面",children:i.jsx(uM,{})}):null]})}),Lb=10,mM=e=>{const t=e.replace(/\s+/g," ").trim();return t.length<=Lb?t:t.slice(0,Lb).trimEnd()},pM=(e,t)=>{var l,o;const a=mM(e);return a||((o=(l=t[0])==null?void 0:l.name)==null?void 0:o.trim())||"附件"},gM=e=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(e.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},_M=({currentAgent:e,projects:t,sessions:a,initialProjectId:l=null,entryView:o,isDesktopSidebar:u,sidebarOffset:f,isSidebarDragging:m,onOpenSidebar:y,onProjectSelected:g,onSessionCreated:S})=>{const p=Pa(),[v,w]=_.useState(""),[N,j]=_.useState(l),[C,R]=_.useState(null),[z,O]=_.useState(null),[k,L]=_.useState(()=>b_()),[K,J]=_.useState(()=>O3()),[q,Y]=_.useState([]),[Q,G]=_.useState(!1),[ge,me]=_.useState(!1),[Z,he]=_.useState(!1),[M,$]=_.useState(o),ee=w_(),oe=_.useMemo(()=>ee.map(({id:se,...we})=>we),[ee]),ae=_.useMemo(()=>t.find(se=>se.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{vf(k)},[k]),_.useEffect(()=>{I3(K)},[K]),_.useEffect(()=>{oe.length!==0&&(oe.some(se=>se.value===k)||L(oe[0].value))},[oe,k]),_.useEffect(()=>{$(o)},[o]),_.useEffect(()=>{O(null)},[N]),_.useEffect(()=>{var we,ye;if(N&&t.some(Oe=>Oe.id===N))return;const se=(l&&t.some(Oe=>Oe.id===l)?l:null)??((we=a.find(Oe=>!Oe.archived))==null?void 0:we.project_id)??((ye=t[0])==null?void 0:ye.id)??null;j(se)},[l,t,N,a]);const I=ss({mutationFn:async se=>{if(!ae||!se.input.trim()&&se.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await xn({projectId:se.projectId,agentId:e.id})).client.createSession({agentId:e.id,projectId:se.projectId,title:se.title,input:se.input,attachments:se.attachments,model:se.model,reasoningEffort:se.reasoningEffort,serviceTier:se.serviceTier,planMode:se.planMode,yoloMode:se.yoloMode})).session},onMutate:()=>R(null),onSuccess:async(se,we)=>{const ye=new Date().toISOString(),Oe={id:`optimistic-user:${se.id}:create`,kind:"user",title:"你",body:we.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:se.last_event_at||ye,accent:"primary",attachments:ox(we.attachments)};Zi(e.id),sa(se.id),WE(se.id,{isFastModeEnabled:we.serviceTier==="fast",isPlanModeEnabled:we.planMode,isYoloModeEnabled:we.yoloMode}),Wr(se.id),fu(null),XN({sessionId:se.id,agentId:se.agent_id,projectId:se.project_id,createdAt:ye,session:se,project:ae?{id:ae.id,agent_id:ae.agent_id,name:ae.name,display_name:ae.display_name,pinned:ae.pinned,path:ae.path}:null,optimisticEntry:Oe}),p.setQueriesData({queryKey:rs},Le=>g3(Le,se)),p.setQueryData(Po(se.id),Le=>N0(Le,Oe)),G(!1),me(!1),he(!1),S(se.id),p.invalidateQueries({queryKey:["plan",se.id]}),p.invalidateQueries({queryKey:["change-sets",se.id]})},onError:se=>{R(se instanceof Error?se.message:"创建会话失败")}}),ne=(ae==null?void 0:ae.path)??null,U=M==="directory-picker",ie={transform:`translateX(${f}px)`,transition:m?"none":void 0},Se=()=>{const se=v.trim();if(!(!se&&q.length===0||I.isPending||!ae)){if(T_(se)){if(q.length>0){R("命令暂不支持附件,请先移除附件后再执行。");return}const we=gM(se);if(we==="model"){if(w(""),oe.length>0){O({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ae.id}`,command_name:we,command_text:se,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:oe.map(ye=>({id:ye.value,label:ye.label,description:ye.description??null})),input_placeholder:null,submit_label:null,effect:null});return}O({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ae.id}`,command_name:we,command_text:se,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}if(we==="status"){w(""),O({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ae.id}`,command_name:we,command_text:se,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${ae.display_name??ae.name}`,`模型:${k}`,`推理强度:${K}`,`Fast 模式:${Q?"开启":"关闭"}`,`计划模式:${ge?"开启":"关闭"}`,`Yolo 模式:${Z?"开启":"关闭"}`].join(`
|
|
136
|
+
`),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}w(""),O({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${ae.id}`,command_name:we||"unknown",command_text:se,title:`/${we||"unknown"} 暂不可用`,description:"新建线程阶段目前只接入了少量本地命令。",status:"completed",body:"请先进入已有会话后再执行这个命令,或者先使用 /model 调整新会话默认模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}I.mutate({projectId:ae.id,input:se,title:pM(se,q),attachments:q,model:k,reasoningEffort:K,serviceTier:Q?"fast":void 0,planMode:ge,yoloMode:Z})}};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:ie,children:[i.jsxs("div",{className:"conversation-topbar",children:[u?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsx("div",{className:"conversation-topbar__title-row",children:i.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),i.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:i.jsx("div",{className:"conversation-thread conversation-thread--empty",children:U?i.jsx(XT,{agentId:e.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:se=>{p.setQueriesData({queryKey:rs},we=>sE(we,se)),j(se.id),g(se.id),$("composer")}}):i.jsx("section",{className:"new-thread-hero",children:i.jsxs("div",{className:"new-thread-hero__stack",children:[i.jsx(eM,{}),i.jsxs("label",{className:"new-thread-hero__selector",children:[i.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),i.jsx("select",{className:"new-thread-hero__select",value:N??"",onChange:se=>{const we=se.target.value||null;j(we),we&&g(we)},children:t.map(se=>i.jsx("option",{value:se.id,children:se.display_name??se.name},se.id))})]}),ne?i.jsx("div",{className:"new-thread-hero__path",children:ne}):i.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:i.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>$("directory-picker"),children:"新增目录线程"})]})})})})]}),U?null:i.jsx(fx,{isDesktopSidebar:u,sidebarShift:f,isSidebarDragging:m,composerError:C,onDismissComposerError:()=>R(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:se=>`${se} background agents`,hasBackgroundAgentStrip:!1,commandPanel:z,isCommandPanelPending:!1,onDismissCommandPanel:()=>O(null),onCommandPanelOptionSelect:se=>{L(se),O(we=>we&&{...we,status:"completed",body:`新会话默认模型已切换为 ${fp(se,oe)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(ae==null?void 0:ae.id)??null,agentId:e.id,draft:v,pendingAttachments:q,canSendInput:!!ae,inputPlaceholder:ae?`向 ${ae.display_name??ae.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:w,onUploadFiles:se=>{const we=[...se];we.length!==0&&(R(null),Promise.all(we.map(ye=>lx(ye))).then(ye=>{Y(Oe=>[...Oe,...ye])}).catch(ye=>{R(ye instanceof Error?ye.message:"无法读取附件")}))},onRemoveAttachment:se=>{Y(we=>we.filter(ye=>ye.id!==se))},onSubmit:Se,showStopIcon:!1,isSendPending:I.isPending,onInterrupt:()=>{},isFastModeEnabled:Q,isPlanModeEnabled:ge,isYoloModeEnabled:Z,onToggleFastMode:()=>G(se=>!se),onTogglePlanMode:()=>me(se=>!se),onToggleYoloMode:()=>he(se=>!se),showModeBadges:!0,selectedModel:k,modelOptions:oe,selectedReasoning:K,onSelectModel:L,onSelectReasoning:se=>J(se),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},hx="panda:session-timeline-snapshots",Dm=1,yM=1440*60*1e3,mx=12,vM=e=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},bM=(e,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},px=()=>{const e=vM(hx);if(!e||e.version!==Dm||!Array.isArray(e.items))return{version:Dm,items:[]};const t=Date.now(),a=e.items.filter(l=>!!(l&&typeof l.sessionId=="string"&&typeof l.storedAt=="number"&&l.snapshot&&typeof l.snapshot=="object")).filter(l=>t-l.storedAt<=yM).sort((l,o)=>o.storedAt-l.storedAt).slice(0,mx);return{version:Dm,items:a}},xM=e=>{const a=px().items.find(l=>l.sessionId===e);return a?a.snapshot:null},SM=e=>{if(!e||e.view!=="full_compact")return;const t=Date.now(),a=px(),l=[{sessionId:e.session_id,storedAt:t,snapshot:e},...a.items.filter(o=>o.sessionId!==e.session_id)].slice(0,mx);bM(hx,{version:Dm,items:l})},jM=e=>{var t,a,l;return["session-tool-detail",((t=e==null?void 0:e.scope)==null?void 0:t.sessionId)??"",(a=e==null?void 0:e.scope)!=null&&a.sessionId?"":((l=e==null?void 0:e.scope)==null?void 0:l.agentId)??"",(e==null?void 0:e.sessionId)??"",(e==null?void 0:e.entryId)??""]};function wM(e){return is({queryKey:jM(e),enabled:!!((e==null?void 0:e.enabled)??!0)&&!!(e!=null&&e.sessionId)&&!!(e!=null&&e.entryId),queryFn:async()=>!(e!=null&&e.sessionId)||!(e!=null&&e.entryId)?null:(await xn(e.scope)).client.getSessionToolCallDetail(e.sessionId,e.entryId),refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const gx=e=>{var t,a,l;return["workspace-session-detail",((t=e==null?void 0:e.scope)==null?void 0:t.sessionId)??"",(a=e==null?void 0:e.scope)!=null&&a.sessionId?"":((l=e==null?void 0:e.scope)==null?void 0:l.agentId)??"",(e==null?void 0:e.sessionId)??""]};function NM(e){return is({queryKey:gx(e),enabled:!!((e==null?void 0:e.enabled)??!0)&&!!(e!=null&&e.sessionId),queryFn:async()=>e!=null&&e.sessionId?(await xn(e.scope)).client.getWorkspaceSessionDetail(e.sessionId):null,refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:1})}const kM={can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!1,can_show_terminal:!1},EM=e=>({id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent,provider:"codex",mode:"managed",health:"active",branch:"",worktree:"",summary:"",latest_assistant_message:null,context_usage:null,capability:kM}),CM=(e,t)=>e?!t||t.id!==e.id?EM(e):{...t,id:e.id,agent_id:e.agent_id,project_id:e.project_id,archived:e.archived,title:e.title,last_event_at:e.last_event_at,pinned:e.pinned,run_state:e.run_state,run_state_changed_at:e.run_state_changed_at,subagent:e.subagent}:t??null,Pb=e=>{if(!e)return null;const t={};return typeof e.title=="string"&&(t.title=e.title),typeof e.archived=="boolean"&&(t.archived=e.archived),typeof e.pinned=="boolean"&&(t.pinned=e.pinned),typeof e.last_event_at=="string"&&(t.last_event_at=e.last_event_at),(e.run_state==="idle"||e.run_state==="running"||e.run_state==="completed")&&(t.run_state=e.run_state),(e.run_state_changed_at===null||typeof e.run_state_changed_at=="string")&&(t.run_state_changed_at=e.run_state_changed_at),typeof e.summary=="string"&&(t.summary=e.summary),(e.latest_assistant_message===null||typeof e.latest_assistant_message=="string")&&(t.latest_assistant_message=e.latest_assistant_message),typeof e.provider=="string"&&(t.provider=e.provider),typeof e.mode=="string"&&(t.mode=e.mode),typeof e.health=="string"&&(t.health=e.health),typeof e.branch=="string"&&(t.branch=e.branch),typeof e.worktree=="string"&&(t.worktree=e.worktree),(e.context_usage===null||typeof e.context_usage=="object"&&e.context_usage!==null)&&(t.context_usage=e.context_usage),(e.subagent===null||typeof e.subagent=="object"&&e.subagent!==null)&&(t.subagent=e.subagent),typeof e.capability=="object"&&e.capability!==null&&(t.capability=e.capability),Object.keys(t).length>0?t:null},TM=(e,t,a)=>{if(!e||e.session.id!==t)return e;const{last_event_at:l,...o}=a;let u={...e.session,...o};if(typeof l=="string"&&l.trim()){const f=new Date(l).getTime(),m=new Date(e.session.last_event_at).getTime();Number.isFinite(f)&&(!Number.isFinite(m)||f>m)&&(u={...u,last_event_at:l})}return{...e,session:u}},Ub=_.lazy(async()=>({default:(await ao(()=>import("./session-diff-preview-BU4XO0fT.js"),[])).SessionDiffPreview})),wg=["var(--session-git-graph-1)","var(--session-git-graph-2)","var(--session-git-graph-3)","var(--session-git-graph-4)","var(--session-git-graph-5)","var(--session-git-graph-6)"],_x=14,yx=10,Il=24,nu=48,Ng=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m9 6 6 6-6 6"})}),MM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),i.jsx("path",{d:"M20 4v7h-7"})]}),RM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),i.jsx("path",{d:"M3 4v5h5"}),i.jsx("path",{d:"M12 7v5l3 2"})]}),zb=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 14 4 9l5-5"}),i.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),Bb=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),i.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),AM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 16V5"}),i.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),i.jsx("path",{d:"M5 19h14"})]}),DM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6 18 18"}),i.jsx("path",{d:"M18 6 6 18"})]}),OM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4v10"}),i.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),i.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),i.jsx("circle",{cx:"7",cy:"4",r:"2"}),i.jsx("circle",{cx:"17",cy:"6",r:"2"}),i.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),IM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),i.jsx("path",{d:"M8 19h8"}),i.jsx("path",{d:"M10 16v3"}),i.jsx("path",{d:"M14 16v3"})]}),LM=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M7.5 18a4.5 4.5 0 1 1 .9-8.91A5.5 5.5 0 0 1 19 11a3.5 3.5 0 0 1-.5 7Z"})}),PM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M7 4v10"}),i.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),i.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),i.jsx("circle",{cx:"7",cy:"4",r:"2"}),i.jsx("circle",{cx:"17",cy:"6",r:"2"}),i.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),Ll=({label:e,icon:t,onClick:a,disabled:l=!1,variant:o="default",pending:u=!1,className:f})=>i.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${o} ${u?"is-pending":""} ${f??""}`.trim(),onClick:a,disabled:l,"aria-label":e,title:e,children:i.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),Hb=e=>{switch(e){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},UM=e=>e.status==="renamed"&&e.previous_path?`该变更仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":e.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",zM=(e,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":e.status==="renamed"&&e.previous_path?`该提交仅包含重命名:${e.previous_path} -> ${e.path}`:e.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",nf=e=>wg[e%wg.length]??wg[0],Oo=e=>yx+e*_x,_m=(e,t)=>`${e}\0${t}`,M_=e=>Array.isArray(e.parent_oids)?e.parent_oids.filter(Boolean):[],BM=e=>Array.isArray(e.refs)?e.refs.filter(Boolean):[],HM=e=>{var u;const t={};let a=[],l=0;const o=()=>{const f=l;return l+=1,f};for(const f of e){let m=a.findIndex(w=>w.oid===f.oid);m<0&&(a=[...a,{oid:f.oid,colorIndex:o()}],m=a.length-1);const y=a.map(w=>({...w})),g=((u=y[m])==null?void 0:u.colorIndex)??o(),S=[...new Set(M_(f))],p=y.map(w=>({...w}));S.length>0?p[m]={oid:S[0],colorIndex:g}:p.splice(m,1);const v=[];if(S.length>0){const w=p.findIndex(N=>N.oid===S[0]);v.push(w>=0?w:m)}S.slice(1).forEach((w,N)=>{let j=p.findIndex(C=>C.oid===w);j<0&&(j=Math.min(p.length,m+1+N),p.splice(j,0,{oid:w,colorIndex:o()})),v.push(j)}),t[f.oid]={beforeLanes:y,afterLanes:p,laneIndex:m,nodeColorIndex:g,parentLaneIndexes:v},a=p.filter((w,N,j)=>j.findIndex(C=>C.oid===w.oid)===N)}return t},$M=({commit:e,row:t,isLocalHead:a,isRemoteHead:l,isFirstRow:o,maxLaneCount:u})=>{const f=M_(e).length,m=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,yx*2+(m-1)*_x),g=Oo(t.laneIndex),S=f>1?4.7:3.9,p=Math.max(0,Il-S-1.1),v={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/nu)))}px`};return i.jsx("span",{className:"session-git-history__graph",style:v,children:i.jsxs("svg",{className:`session-git-history__graph-svg ${f>1?"is-merge":""}`,viewBox:`0 0 ${y} ${nu}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((w,N)=>i.jsx("path",{d:`M ${Oo(N)} ${o?p:0} L ${Oo(N)} ${p}`,stroke:nf(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:o?0:1},`before:${w.oid}:${N}`)),t.afterLanes.map((w,N)=>{const j=t.beforeLanes.findIndex(O=>O.oid===w.oid),C=j>=0?Oo(j):Oo(N),R=Oo(N),z=C===R?`M ${R} ${Il} L ${R} ${nu}`:`M ${C} ${Il} C ${C} 27 ${R} 31 ${R} ${nu}`;return i.jsx("path",{d:z,stroke:nf(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${w.oid}:${N}`)}),t.parentLaneIndexes.map((w,N)=>{var z;const j=Oo(w),C=nf(((z=t.afterLanes[w])==null?void 0:z.colorIndex)??t.nodeColorIndex),R=j===g?`M ${g} ${Il} L ${j} ${nu}`:`M ${g} ${Il} C ${g} 27 ${j} 31 ${j} ${nu}`;return i.jsx("path",{d:R,stroke:C,strokeWidth:N>0||f>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:N>0||f>1?.96:.88},`parent:${e.oid}:${N}`)}),i.jsx("circle",{cx:g,cy:Il,r:S,fill:"var(--color-surface-panel)",stroke:nf(t.nodeColorIndex),strokeWidth:f>1?"1.8":"1.55"}),i.jsx("circle",{cx:g,cy:Il,r:a||l?1.6:1.05,fill:nf(t.nodeColorIndex)}),a&&l?i.jsx("circle",{cx:g,cy:Il,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},FM=({workspace:e,history:t,isLoading:a,isHistoryLoading:l,error:o,historyError:u,onRefresh:f,onRefreshHistory:m,onRequestHistory:y,onDiscardFile:g,onDiscardAll:S,onCommitAll:p,onSwitchBranch:v,onPush:w,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:j,pendingAction:C,compact:R=!1})=>{const[z,O]=_.useState("changes"),[k,L]=_.useState({}),[K,J]=_.useState({}),[q,Y]=_.useState({}),[Q,G]=_.useState({}),[ge,me]=_.useState({}),[Z,he]=_.useState({}),[M,$]=_.useState({}),[ee,oe]=_.useState({}),[ae,I]=_.useState({}),[ne,U]=_.useState(!1),[ie,Se]=_.useState(null),[se,we]=_.useState(""),[ye,Oe]=_.useState(null),Le=_.useRef(null);_.useEffect(()=>{L(Me=>{if(!(e!=null&&e.files.length))return{};const Re=new Set(e.files.map(Je=>Je.path));let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Me)){if(!Re.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Me});const ue=new Set((e==null?void 0:e.files.map(Me=>Me.path))??[]);J(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ue.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me}),Y(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ue.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me}),G(Me=>{let Re=!1;const We={};for(const[Xe,Je]of Object.entries(Me)){if(!ue.has(Xe)){Re=!0;continue}We[Xe]=Je}return Re?We:Me})},[e==null?void 0:e.files]),_.useEffect(()=>{const ue=new Set((t==null?void 0:t.commits.map(Re=>Re.oid))??[]),Me=new Set((t==null?void 0:t.commits.flatMap(Re=>Re.files.map(We=>_m(Re.oid,We.path))))??[]);me(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!ue.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),he(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!ue.has(Je)){We=!0;continue}if(Tt&&!Me.has(_m(Je,Tt))){We=!0,Xe[Je]=null;continue}Xe[Je]=Tt}return We?Xe:Re}),$(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),oe(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re}),I(Re=>{let We=!1;const Xe={};for(const[Je,Tt]of Object.entries(Re)){if(!Me.has(Je)){We=!0;continue}Xe[Je]=Tt}return We?Xe:Re})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!ne)return;const ue=Me=>{var Re;(Re=Le.current)!=null&&Re.contains(Me.target)||U(!1)};return window.addEventListener("pointerdown",ue),()=>{window.removeEventListener("pointerdown",ue)}},[ne]),_.useEffect(()=>{e&&(ie==="commit"&&(C==null?void 0:C.action)!=="commit-all"&&e.files.length===0&&(Se(null),we("")),ye&&e.branch===ye&&(Oe(null),Se(null),we(""),U(!1)))},[ie,C==null?void 0:C.action,ye,e]),_.useEffect(()=>{e!=null&&e.branches.length||U(!1)},[e==null?void 0:e.branches]),_.useEffect(()=>{J({}),Y({}),G({})},[e==null?void 0:e.updated_at]);const _t=(e==null?void 0:e.files)??[],Ke=(t==null?void 0:t.commits)??[],tt=_t.length>0,nn=Ke.length>0,Xt=(C==null?void 0:C.action)==="discard-all",jn=(C==null?void 0:C.action)==="commit-all",zt=(C==null?void 0:C.action)==="switch-branch",Bt=(C==null?void 0:C.action)==="push",yt=z==="changes",bt=ie==="switch-branch"&&ye?`提交后切换到 ${ye}`:"提交全部改动",dt=_.useMemo(()=>{if(!e)return null;const ue=[];return e.upstream_branch&&ue.push(e.upstream_branch),e.ahead_count>0&&ue.push(`ahead ${e.ahead_count}`),e.behind_count>0&&ue.push(`behind ${e.behind_count}`),ue.join(" · ")},[e]),cn=_.useMemo(()=>{if(!t)return null;const ue=[t.branch];return t.upstream_branch&&ue.push(t.upstream_branch),ue.join(" · ")},[t]),Pn=_.useMemo(()=>z==="history"?HM(Ke):{},[z,Ke]),Ee=_.useMemo(()=>z!=="history"?1:Math.max(1,...Object.values(Pn).map(ue=>Math.max(ue.beforeLanes.length,ue.afterLanes.length,ue.laneIndex+1))),[z,Pn]),V=(ue,Me)=>{K[ue]||q[ue]||(Y(Re=>({...Re,[ue]:!0})),G(Re=>{const We={...Re};return delete We[ue],We}),N(ue,Me).then(Re=>{J(We=>({...We,[ue]:Re}))}).catch(Re=>{G(We=>({...We,[ue]:Re instanceof Error?Re.message:"无法读取该文件的差异。"}))}).finally(()=>{Y(Re=>{const We={...Re};return delete We[ue],We})}))};_.useEffect(()=>{if(!(z!=="changes"||_t.length===0))for(const ue of _t)k[ue.path]&&V(ue.path,ue.previous_path)},[z,k,_t,N,K,q]);const _e=()=>{Se(null),we(""),Oe(null)},Te=()=>{Oe(null),Se(ue=>ue==="commit"?(we(""),null):"commit")},Ie=()=>{const ue=se.trim();if(ue){if(ie==="switch-branch"&&ye){Promise.resolve(v(ye,ue)).catch(()=>{});return}p(ue)}},ce=ue=>{if(!(!e||ue===e.branch||C)){if(U(!1),e.files.length>0){Oe(ue),Se("switch-branch");return}Promise.resolve(v(ue)).catch(()=>{})}},Ae=()=>{if(yt){f();return}m()},qe=()=>{O(ue=>{const Me=ue==="changes"?"history":"changes";return Me==="history"&&y(),Me})},xt=(ue,Me)=>{const Re=_m(ue.oid,Me.path),We=Z[ue.oid]===Me.path;he(Xe=>({...Xe,[ue.oid]:We?null:Me.path})),!(We||M[Re]||ee[Re])&&(oe(Xe=>({...Xe,[Re]:!0})),I(Xe=>{const Je={...Xe};return delete Je[Re],Je}),j(ue.oid,Me.path,Me.previous_path).then(Xe=>{$(Je=>({...Je,[Re]:Xe}))}).catch(Xe=>{I(Je=>({...Je,[Re]:Xe instanceof Error?Xe.message:"无法读取该文件的提交差异。"}))}).finally(()=>{oe(Xe=>{const Je={...Xe};return delete Je[Re],Je})}))},Dt=ue=>{const Me=new Date(ue);return Number.isNaN(Me.getTime())?ue:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(Me)};return i.jsxs("section",{className:`session-git-panel ${R?"is-compact":""}`,children:[i.jsxs("div",{className:"session-git-panel__header",children:[i.jsxs("div",{className:"session-git-panel__heading",ref:Le,children:[i.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>U(ue=>!ue),disabled:!e||!!C,"aria-haspopup":"menu","aria-expanded":ne,title:e?`切换分支:${e.branch}`:"分支加载中",children:[i.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:i.jsx(OM,{})}),i.jsx("span",{className:"session-git-panel__branch",children:(e==null?void 0:e.branch)??"加载中"}),i.jsx("span",{className:`session-git-panel__branch-chevron ${ne?"is-open":""}`,"aria-hidden":"true",children:i.jsx(Ng,{})})]}),ne&&e?i.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:e.branches.map(ue=>{const Me=ue===e.branch,Re=(C==null?void 0:C.action)==="switch-branch"&&C.branch===ue;return i.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${Me?"is-current":""}`,onClick:()=>ce(ue),disabled:Me||!!C,role:"menuitemradio","aria-checked":Me,title:Me?`${ue}(当前)`:`切换到 ${ue}`,children:[i.jsx("span",{className:"session-git-panel__branch-option-name",children:ue}),Me?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,Re?i.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},ue)})}):null]}),i.jsxs("div",{className:"session-git-panel__toolbar",children:[i.jsx(Ll,{label:yt?"切换到提交历史":"返回修改列表",icon:i.jsx(RM,{}),onClick:qe,disabled:!!C,variant:yt?"default":"primary",className:yt?void 0:"is-active"}),i.jsx(Ll,{label:yt?a?"正在刷新":"刷新":l?"正在刷新历史":"刷新历史",icon:i.jsx(MM,{}),onClick:Ae,disabled:yt?a||!!C:l,pending:yt?a:l}),yt&&tt?i.jsxs(i.Fragment,{children:[i.jsx(Ll,{label:Xt?"正在撤回全部修改":"撤回全部修改",icon:i.jsx(zb,{}),onClick:S,disabled:!!C,variant:"danger",pending:Xt}),i.jsx(Ll,{label:jn?"正在提交全部修改":ie==="commit"?"收起提交编辑器":"提交全部修改",icon:i.jsx(Bb,{}),onClick:Te,disabled:!!C,variant:"primary",pending:jn})]}):null,yt&&!tt?i.jsx(Ll,{label:Bt?"正在推送当前分支":"推送当前分支",icon:i.jsx(AM,{}),onClick:w,disabled:!!C,variant:"primary",pending:Bt}):null]})]}),yt&&e?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:tt?`${_t.length} 个文件待处理`:"当前工作区没有待提交改动"}),dt?i.jsx("span",{className:"session-git-panel__summary-meta",children:dt}):null]}):null,!yt&&t?i.jsxs("div",{className:"session-git-panel__summary",children:[i.jsx("span",{className:"session-git-panel__summary-text",children:nn?`${Ke.length} 条最近提交`:"当前分支还没有提交历史"}),cn?i.jsx("span",{className:"session-git-panel__summary-meta",children:cn}):null]}):null,yt&&ie&&tt?i.jsxs("div",{className:"session-git-panel__composer",children:[i.jsx("div",{className:"session-git-panel__composer-title",children:bt}),i.jsxs("div",{className:"session-git-panel__composer-row",children:[i.jsx("input",{value:se,onChange:ue=>we(ue.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!C}),i.jsx(Ll,{label:ie==="switch-branch"?"提交并切换分支":"确认提交",icon:i.jsx(Bb,{}),onClick:Ie,disabled:!se.trim()||!!C,variant:"primary",pending:jn||zt}),i.jsx(Ll,{label:"取消提交",icon:i.jsx(DM,{}),onClick:_e,disabled:!!C})]})]}):null,yt&&o?i.jsx("div",{className:"session-git-panel__notice is-error",children:o}):null,!yt&&u?i.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,yt&&a&&!e?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!yt&&l&&!t?i.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,yt&&!a&&e&&!tt?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!yt&&!l&&t&&!nn?i.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,yt&&tt?i.jsx("div",{className:"session-git-panel__list",children:_t.map(ue=>{const Me=!!k[ue.path],Re=(C==null?void 0:C.action)==="discard-file"&&C.path===ue.path,We=K[ue.path],Xe=!!q[ue.path],Je=Q[ue.path]??null;return i.jsxs("article",{className:`session-git-file ${Me?"is-expanded":""}`,children:[i.jsxs("div",{className:"session-git-file__head",children:[i.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const Tt=!Me;L(Wt=>({...Wt,[ue.path]:Tt})),Tt&&V(ue.path,ue.previous_path)},"aria-expanded":Me,children:[i.jsxs("span",{className:"session-git-file__main",children:[i.jsx("span",{className:"session-git-file__path",children:ue.path}),ue.previous_path?i.jsxs("span",{className:"session-git-file__rename",children:["来自 ",ue.previous_path]}):null]}),i.jsxs("span",{className:"session-git-file__meta",children:[i.jsx("span",{className:`session-git-file__status is-${ue.status}`,children:Hb(ue.status)}),i.jsxs("span",{className:"session-git-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",ue.additions]}),i.jsxs("span",{className:"is-remove",children:["-",ue.deletions]})]}),i.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:i.jsx(Ng,{})})]})]}),i.jsx(Ll,{label:Re?`正在撤回 ${ue.path}`:`撤回 ${ue.path}`,icon:i.jsx(zb,{}),onClick:()=>g(ue.path),disabled:!!C,variant:"danger",pending:Re,className:"session-git-file__action"})]}),Me?i.jsx("div",{className:"session-git-file__detail",children:Je?i.jsx("div",{className:"session-git-panel__notice is-error",children:Je}):Xe?i.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:i.jsx(Ub,{diffText:(We==null?void 0:We.diff)??"",filePath:ue.path,emptyMessage:UM(ue)})})}):null]},ue.path)})}):null,!yt&&nn?i.jsx("div",{className:"session-git-history",children:Ke.map((ue,Me)=>{const Re=!!ge[ue.oid],We=M_(ue),Xe=Z[ue.oid]??null,Je=Pn[ue.oid],Tt=(t==null?void 0:t.head_oid)===ue.oid,Wt=(t==null?void 0:t.upstream_head_oid)===ue.oid,ls=BM(ue).filter(Nt=>!Nt||Nt===(t==null?void 0:t.branch)||Nt===(t==null?void 0:t.upstream_branch)||Nt===`HEAD -> ${t==null?void 0:t.branch}`?!1:Nt!=="HEAD");return i.jsxs("article",{className:`session-git-history__item ${Re?"is-expanded":""} ${We.length>1?"is-merge":""} ${Tt?"is-local-head":""} ${Wt?"is-remote-head":""}`.trim(),children:[i.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>me(Nt=>({...Nt,[ue.oid]:!Nt[ue.oid]})),"aria-expanded":Re,children:[Je?i.jsx($M,{commit:ue,row:Je,isLocalHead:Tt,isRemoteHead:Wt,isFirstRow:Me===0,maxLaneCount:Ee}):null,i.jsxs("span",{className:"session-git-history__content",children:[i.jsx("span",{className:"session-git-history__subject",children:ue.subject}),i.jsxs("span",{className:"session-git-history__meta",children:[i.jsx("span",{children:ue.short_oid}),i.jsx("span",{children:ue.author_name}),i.jsx("span",{children:Dt(ue.committed_at)})]})]}),i.jsxs("span",{className:"session-git-history__refs",children:[Tt?i.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:i.jsx(IM,{})}):null,Wt?i.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:i.jsx(LM,{})}):null,We.length>1?i.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:i.jsx(PM,{})}):null,ls.slice(0,2).map(Nt=>i.jsx("span",{className:"session-git-history__ref is-label",title:Nt,children:Nt},`${ue.oid}:${Nt}`))]}),i.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:i.jsx(Ng,{})})]}),Re?i.jsx("div",{className:"session-git-history__files",children:i.jsx("div",{className:"session-git-history__files-list",children:ue.files.map(Nt=>{const Un=Xe===Nt.path,Cn=_m(ue.oid,Nt.path),Dn=M[Cn],De=!!ee[Cn],Qt=ae[Cn]??null;return i.jsxs("div",{className:`session-git-history-file-row ${Un?"is-selected":""}`,children:[i.jsxs("button",{type:"button",className:`session-git-history-file ${Un?"is-selected":""}`,onClick:()=>xt(ue,Nt),"aria-pressed":Un,children:[i.jsx("span",{className:`session-git-file__status is-${Nt.status}`,children:Hb(Nt.status)}),i.jsx("span",{className:"session-git-history-file__path",children:Nt.path}),Nt.previous_path?i.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",Nt.previous_path]}):null,i.jsx("span",{className:"session-git-history-file__meta",children:Dn?i.jsxs("span",{className:"session-git-history-file__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Dn.additions]}),i.jsxs("span",{className:"is-remove",children:["-",Dn.deletions]})]}):De?i.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):i.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),Un?i.jsxs("div",{className:"session-git-history__diff is-inline",children:[i.jsxs("div",{className:"session-git-history__diff-header",children:[i.jsx("span",{className:"session-git-history__diff-path",children:Nt.path}),Nt.previous_path?i.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",Nt.previous_path]}):null]}),Qt?i.jsx("div",{className:"session-git-panel__notice is-error",children:Qt}):De?i.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:i.jsx(Ub,{diffText:(Dn==null?void 0:Dn.diff)??"",filePath:Nt.path,emptyMessage:zM(Nt,Dn??null)})})]}):null]},`${ue.oid}:${Nt.path}`)})})}):null]},ue.oid)})}):null]})},$b={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},Fb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m8 6 9 6-9 6z"})}),qb=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),qM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),i.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),WM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),KM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),QM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),Wb={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},GM=({commands:e,nodeRuntime:t,error:a,pendingRunCommandId:l,pendingKillCommandId:o,pendingDeleteCommandId:u,isSaving:f,isGenerating:m,isStartingAll:y,isStoppingAll:g,generationReason:S,executionModelLabel:p,onRun:v,onRunAll:w,onRunAllKill:N,onRunKill:j,onSave:C,onDelete:R,onGenerate:z})=>{var he;const[O,k]=_.useState("list"),[L,K]=_.useState(null),[J,q]=_.useState($b),Y=_.useMemo(()=>e.find(M=>M.id===L)??null,[e,L]),Q=_.useMemo(()=>{const M=[...(t==null?void 0:t.versions)??[]];return J.node_version&&!M.includes(J.node_version)&&M.unshift(J.node_version),M},[J.node_version,t==null?void 0:t.versions]),G=_.useMemo(()=>e.filter(M=>!!M.kill_command).length,[e]),ge=()=>{q($b),K(null),k("edit")},me=M=>{q({name:M.name,description:M.description,command:M.command,kill_command:M.kill_command,cwd:M.cwd,shell:M.shell,node_version:M.node_version,port:M.port}),K(M.id),k("edit")},Z=()=>{C({commandId:Y==null?void 0:Y.id,draft:J}),f||(k("list"),K(null))};return i.jsxs("div",{className:"session-run-panel",children:[i.jsxs("div",{className:"session-run-panel__header",children:[i.jsxs("div",{className:"session-run-panel__header-copy",children:[i.jsxs("div",{className:"session-run-panel__title-row",children:[i.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),i.jsxs("span",{className:"session-run-panel__count",children:[e.length," 条"]})]}),i.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",p]})]}),i.jsxs("div",{className:"session-run-panel__header-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:e.length===0||y||g,onClick:w,children:i.jsx(Fb,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":g?"正在一键停止项目命令":"一键停止项目命令",title:g?"正在一键停止项目命令":"一键停止项目命令",disabled:G===0||y||g,onClick:N,children:i.jsx(qb,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":m?"正在一键生成项目命令":"一键生成项目命令",title:m?"正在一键生成项目命令":"一键生成项目命令",disabled:m||y||g,onClick:z,children:i.jsx(qM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:ge,children:i.jsx(QM,{})})]})]}),a?i.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,S?i.jsx("div",{className:"session-run-panel__hint",children:S}):null,O==="edit"?i.jsxs("div",{className:"session-run-panel__card",children:[i.jsx("h3",{className:"session-run-panel__section-title",children:Y?"编辑命令":"新增命令"}),i.jsxs("div",{className:"session-run-panel__form-grid",children:[i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"名称"}),i.jsx("input",{value:J.name,onChange:M=>q($=>({...$,name:M.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"说明"}),i.jsx("input",{value:J.description??"",onChange:M=>q($=>({...$,description:M.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"命令"}),i.jsx("textarea",{value:J.command,onChange:M=>q($=>({...$,command:M.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"停止命令"}),i.jsx("textarea",{value:J.kill_command??"",onChange:M=>q($=>({...$,kill_command:M.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"工作目录"}),i.jsx("input",{value:J.cwd??"",onChange:M=>q($=>({...$,cwd:M.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"端口"}),i.jsx("input",{value:J.port??"",onChange:M=>{const $=Number.parseInt(M.target.value,10);q(ee=>({...ee,port:Number.isFinite($)&&$>0?$:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"Shell"}),i.jsx("select",{value:J.shell,onChange:M=>q($=>({...$,shell:M.target.value})),className:"session-run-panel__select",children:Object.entries(Wb).map(([M,$])=>i.jsx("option",{value:M,children:$},M))})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"Node 环境"}),i.jsxs("select",{value:J.node_version??"",onChange:M=>q($=>({...$,node_version:M.target.value||null})),className:"session-run-panel__select",children:[i.jsx("option",{value:"",children:"默认环境"}),Q.map(M=>i.jsxs("option",{value:M,children:["Node ",M,t!=null&&t.versions.includes(M)?"":"(未检测到)"]},M))]})]})]}),i.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((he=t==null?void 0:t.error)==null?void 0:he.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),i.jsxs("div",{className:"session-run-panel__form-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>k("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!J.name.trim()||!J.command.trim()||f,onClick:Z,children:f?"保存中...":Y?"保存修改":"保存命令"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(M=>i.jsxs("article",{className:"session-run-panel__command-card",children:[i.jsxs("div",{className:"session-run-panel__command-head",children:[i.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>me(M),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:M.name}),M.description?i.jsx("span",{className:"session-run-panel__command-description",children:M.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:M.command})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[M.kill_command?i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${M.name} 的停止命令`,title:`执行 ${M.name} 的停止命令`,disabled:o===M.id,onClick:()=>j(M.id),children:i.jsx(qb,{})}):null,i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${M.name}`,title:`编辑 ${M.name}`,onClick:()=>me(M),children:i.jsx(WM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${M.name}`,title:`删除 ${M.name}`,disabled:u===M.id,onClick:()=>R(M.id),children:i.jsx(KM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${M.name}`,title:`运行 ${M.name}`,disabled:l===M.id,onClick:()=>v(M.id),children:i.jsx(Fb,{})})]})]}),i.jsx("div",{className:"session-run-panel__command-footer",children:i.jsxs("div",{className:"session-run-panel__command-meta",children:[i.jsx("span",{className:"session-run-panel__command-pill",children:Wb[M.shell]}),M.node_version?i.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",M.node_version]}):null,M.port?i.jsxs("span",{className:"session-run-panel__command-pill",children:[":",M.port]}):null,M.kill_command?i.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,i.jsx("span",{className:"session-run-panel__command-pill",children:M.cwd?M.cwd:"项目根目录"})]})})]},M.id)):i.jsxs("div",{className:"session-run-panel__empty",children:[i.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),i.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},Kb={name:"",description:null,url:""},YM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),i.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),VM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),i.jsx("path",{d:"M3.8 12h16.4"}),i.jsx("path",{d:"M12 3.7c2.3 2.4 3.6 5.3 3.6 8.3S14.3 17.9 12 20.3c-2.3-2.4-3.6-5.3-3.6-8.3S9.7 6.1 12 3.7Z"})]}),ZM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),i.jsx("path",{d:"m13.5 6.5 4 4"})]}),XM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M4.5 7h15"}),i.jsx("path",{d:"M9.5 4.5h5"}),i.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),i.jsx("path",{d:"M10 10.5v5.2"}),i.jsx("path",{d:"M14 10.5v5.2"})]}),JM=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]}),eR=({websites:e,error:t,pendingDeleteWebsiteId:a,isSaving:l,isGenerating:o,generationReason:u,executionModelLabel:f,onOpen:m,onSave:y,onDelete:g,onGenerate:S})=>{const[p,v]=_.useState("list"),[w,N]=_.useState(null),[j,C]=_.useState(Kb),R=_.useMemo(()=>e.find(L=>L.id===w)??null,[w,e]),z=()=>{C(Kb),N(null),v("edit")},O=L=>{C({name:L.name,description:L.description,url:L.url}),N(L.id),v("edit")},k=()=>{y({websiteId:R==null?void 0:R.id,draft:j}),l||(v("list"),N(null))};return i.jsxs("div",{className:"session-run-panel",children:[i.jsxs("div",{className:"session-run-panel__header",children:[i.jsxs("div",{className:"session-run-panel__header-copy",children:[i.jsxs("div",{className:"session-run-panel__title-row",children:[i.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),i.jsxs("span",{className:"session-run-panel__count",children:[e.length," 条"]})]}),i.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",f]})]}),i.jsxs("div",{className:"session-run-panel__header-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":o?"正在一键生成项目网页":"一键生成项目网页",title:o?"正在一键生成项目网页":"一键生成项目网页",disabled:o,onClick:S,children:i.jsx(YM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:z,children:i.jsx(JM,{})})]})]}),t?i.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?i.jsx("div",{className:"session-run-panel__hint",children:u}):null,p==="edit"?i.jsxs("div",{className:"session-run-panel__card",children:[i.jsx("h3",{className:"session-run-panel__section-title",children:R?"编辑网页":"新增网页"}),i.jsxs("div",{className:"session-run-panel__form-grid",children:[i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"名称"}),i.jsx("input",{value:j.name,onChange:L=>C(K=>({...K,name:L.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),i.jsxs("label",{className:"session-run-panel__field",children:[i.jsx("span",{children:"说明"}),i.jsx("input",{value:j.description??"",onChange:L=>C(K=>({...K,description:L.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),i.jsxs("label",{className:"session-run-panel__field is-full",children:[i.jsx("span",{children:"地址"}),i.jsx("input",{value:j.url,onChange:L=>C(K=>({...K,url:L.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),i.jsxs("div",{className:"session-run-panel__form-actions",children:[i.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>v("list"),children:"取消"}),i.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!j.name.trim()||!j.url.trim()||l,onClick:k,children:l?"保存中...":R?"保存修改":"保存网页"})]})]}):null,i.jsx("div",{className:"session-run-panel__list",children:e.length>0?e.map(L=>i.jsxs("article",{className:"session-run-panel__command-card",children:[i.jsxs("div",{className:"session-run-panel__command-head",children:[i.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>O(L),children:[i.jsxs("div",{className:"session-run-panel__command-heading",children:[i.jsx("span",{className:"session-run-panel__command-name",children:L.name}),L.description?i.jsx("span",{className:"session-run-panel__command-description",children:L.description}):null]}),i.jsx("div",{className:"session-run-panel__command-line",children:L.url})]}),i.jsxs("div",{className:"session-run-panel__command-actions",children:[i.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${L.name}`,title:`打开 ${L.name}`,href:L.url,target:"_blank",rel:"noreferrer",onClick:()=>m(L),children:i.jsx(VM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${L.name}`,title:`编辑 ${L.name}`,onClick:()=>O(L),children:i.jsx(ZM,{})}),i.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${L.name}`,title:`删除 ${L.name}`,disabled:a===L.id,onClick:()=>g(L.id),children:i.jsx(XM,{})})]})]}),i.jsx("div",{className:"session-run-panel__command-footer",children:i.jsx("div",{className:"session-run-panel__command-meta",children:i.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},L.id)):i.jsxs("div",{className:"session-run-panel__empty",children:[i.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),i.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},tR=/\u001b\[([0-9;]*)m/g,nR={stdout:"",stderr:"stderr",system:"system"},Qb={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"},T0={fg:null,bg:null,bold:!1,dim:!1,underline:!1},sR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6 18 18"}),i.jsx("path",{d:"M18 6 6 18"})]}),aR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M8 4H4v4"}),i.jsx("path",{d:"M16 4h4v4"}),i.jsx("path",{d:"M8 20H4v-4"}),i.jsx("path",{d:"M16 20h4v-4"}),i.jsx("path",{d:"M9 9 4 4"}),i.jsx("path",{d:"m15 9 5-5"}),i.jsx("path",{d:"m9 15-5 5"}),i.jsx("path",{d:"m15 15 5 5"})]}),iR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M9 4H4v5"}),i.jsx("path",{d:"M15 4h5v5"}),i.jsx("path",{d:"M9 20H4v-5"}),i.jsx("path",{d:"M15 20h5v-5"}),i.jsx("path",{d:"m4 9 5-5"}),i.jsx("path",{d:"m20 9-5-5"}),i.jsx("path",{d:"m4 15 5 5"}),i.jsx("path",{d:"m20 15-5 5"})]}),rR=e=>{if(!e)return"刚刚";const t=new Date(e);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},Gb=(e,t)=>{const a=[e];return t.bold&&a.push("is-bold"),t.dim&&a.push("is-dim"),t.underline&&a.push("is-underline"),t.fg&&a.push(`is-fg-${t.fg}`),t.bg&&a.push(`is-bg-${t.bg}`),a.join(" ")},lR=(e,t)=>{if(t===0)return{...T0};if(t===1)return{...e,bold:!0,dim:!1};if(t===2)return{...e,dim:!0,bold:!1};if(t===4)return{...e,underline:!0};if(t===22)return{...e,bold:!1,dim:!1};if(t===24)return{...e,underline:!1};if(t===39)return{...e,fg:null};if(t===49)return{...e,bg:null};const a=Qb[t];if(a)return{...e,fg:a};const l=Qb[t-10];return l&&t>=40?{...e,bg:l}:e},oR=(e,t)=>{const a=[];let l=0,o={...T0};for(const u of e.matchAll(tR)){const f=u.index??0;f>l&&a.push({text:e.slice(l,f),className:Gb(t,o)});const m=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));m.length===0?o={...T0}:o=m.reduce(lR,o),l=f+u[0].length}return l<e.length&&a.push({text:e.slice(l),className:Gb(t,o)}),a.length===0&&a.push({text:e,className:t}),a},vx=_.memo(({chunks:e})=>{const t=_.useMemo(()=>e.map(a=>{const l=nR[a.stream],o=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:l,segments:oR(a.text,o)}}),[e]);return i.jsx(i.Fragment,{children:t.map(a=>i.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?i.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((l,o)=>i.jsx("span",{className:l.className,children:l.text},`${a.cursor}:${o}`))]},a.cursor))})});vx.displayName="TerminalOutput";const cR=({terminals:e,activeTerminalId:t,outputs:a,error:l,compact:o=!1,canToggleFullscreen:u=!1,isFullscreen:f=!1,onSelectTerminal:m,onCloseTerminal:y,onToggleFullscreen:g})=>{const S=_.useRef(null),p=e.find(w=>w.id===t)??e[0]??null,v=p?a[p.id]:null;return _.useEffect(()=>{const w=S.current;w&&(w.scrollTop=w.scrollHeight)},[v==null?void 0:v.chunks,p==null?void 0:p.id]),e.length===0?i.jsx("section",{className:`session-terminal-panel ${o?"is-compact":""}`,children:i.jsxs("div",{className:"session-terminal-panel__empty",children:[i.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),i.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):i.jsxs("section",{className:`session-terminal-panel ${o?"is-compact":""}`,children:[i.jsxs("div",{className:"session-terminal-panel__tabs",children:[i.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:e.map(w=>{const N=w.id===(p==null?void 0:p.id);return i.jsxs("div",{className:`session-terminal-panel__tab ${N?"is-active":""}`,children:[i.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":N,onClick:()=>m(w.id),children:[i.jsx("span",{className:`session-terminal-panel__tab-dot is-${w.status}`,"aria-hidden":"true"}),i.jsx("span",{className:"session-terminal-panel__tab-title",children:w.title}),i.jsx("span",{className:"session-terminal-panel__tab-time",children:rR(w.last_output_at??w.updated_at)})]}),i.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${w.title}`,onClick:j=>{j.stopPropagation(),y(w.id)},children:i.jsx(sR,{})})]},w.id)})}),u&&g?i.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:g,"aria-label":f?"退出终端全屏":"终端全屏",title:f?"退出终端全屏":"终端全屏",children:f?i.jsx(iR,{}):i.jsx(aR,{})}):null]}),p?i.jsxs(i.Fragment,{children:[l?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:l}):null,v!=null&&v.error?i.jsx("div",{className:"session-terminal-panel__notice is-error",children:v.error}):null,v!=null&&v.truncated?i.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,i.jsx("div",{ref:S,className:"session-terminal-panel__output-wrap",children:i.jsx("pre",{className:"session-terminal-output",children:v&&v.chunks.length>0?i.jsx(vx,{chunks:v.chunks}):v!=null&&v.isLoading?i.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):i.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},uR=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:l,sidebarShift:o,isSidebarDragging:u,title:f,titleActions:m,topbarActions:y,onOpenSidebar:g,threadContent:S,connectionStatus:p,sessionRecoveryStatus:v,isConnectionDetailOpen:w,onToggleConnectionDetail:N,showThinkingStatus:j}){const C={transform:`translateX(${o}px)`,transition:u?"none":void 0};return i.jsxs("div",{ref:t,className:`conversation-main ${l?"has-desktop-sidebar":""}`,style:C,children:[i.jsxs("div",{className:"conversation-topbar",children:[l?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:g,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsxs("div",{className:"conversation-topbar__title-row",children:[i.jsx("h1",{children:f}),m]})}),y]}),i.jsx("div",{ref:a,className:"conversation-scroll",children:i.jsxs("div",{className:"conversation-thread",children:[S,p.state!=="connected"?i.jsx("section",{className:"conversation-entry is-connection-status",children:i.jsxs("div",{className:"connection-status",children:[i.jsx("button",{type:"button",className:"connection-status__pill",onClick:R=>{R.stopPropagation(),N()},children:i.jsx("span",{children:p.state==="failed"?"连接异常":`Reconnecting... ${p.attempt}/${p.maxAttempts}`})}),w&&p.error?i.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:p.error}):null]})}):null,p.state==="connected"&&v.state!=="idle"?i.jsx("section",{className:"conversation-entry is-connection-status",children:i.jsxs("div",{className:"connection-status",children:[i.jsx("div",{className:"connection-status__pill",children:i.jsx("span",{children:v.state==="recovering"?"恢复会话中...":"会话恢复失败"})}),v.state==="failed"&&v.error?i.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:v.error}):null]})}):null,j?i.jsx("section",{className:"conversation-entry is-thinking-status",children:i.jsx("div",{className:"thinking-status-pill",children:i.jsx("span",{children:"正在思考"})})}):null]})})]})}),dR="panda:last-session-id",fR=.4,hR=104,mR=1800*1e3,pR=15e3,gR=120*1e3,Yb=1100,bx="panda:desktop-sidebar-width",df="panda:desktop-sidebar-width-version",ff="2026-03-24-narrow",_R=300,xx=232,su=xx,yR=460,Vb=72,kg=72,Zb=120,M0=54,Xb=300,vR=640,bR=4200,Eg="local-model-panel:",xR=160,SR={id:"",agent_id:"",name:"",display_name:null,pinned:!1,path:""},jR={id:"",agent_id:"",project_id:"",archived:!1,title:"",last_event_at:"",pinned:!1,run_state:"idle",run_state_changed_at:null,subagent:null},wR={...jR,provider:"codex",mode:"managed",health:"active",branch:"",worktree:"",summary:"",latest_assistant_message:null,context_usage:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!1,can_show_terminal:!1}},NR=(e,t)=>{if(!t)return e??null;if(e!=null&&e.sessions.some(o=>o.id===t.sessionId))return e;const a=t.project?[t.project,...((e==null?void 0:e.projects)??[]).filter(o=>{var u;return o.id!==((u=t.project)==null?void 0:u.id)})]:[...(e==null?void 0:e.projects)??[]],l=[t.session,...((e==null?void 0:e.sessions)??[]).filter(o=>o.id!==t.sessionId)];return{generated_at:(e==null?void 0:e.generated_at)??t.createdAt,agent:(e==null?void 0:e.agent)??null,projects:a,project_stats:a.map(o=>{const u=l.filter(m=>m.project_id===o.id),f=e==null?void 0:e.project_stats.find(m=>m.project_id===o.id);return{project_id:o.id,visible_session_count:u.filter(m=>!m.archived).length,archived_session_count:(f==null?void 0:f.archived_session_count)??0,hidden_history_count:(f==null?void 0:f.hidden_history_count)??0}}),sessions:l,active_session_id:t.sessionId}},kR={session_id:"",generated_at:"",view:"tail",anchor_entry_id:null,has_earlier_entries:!1,entries:[]},ER=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"6",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:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),CR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),i.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),TR=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),MR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6 6l12 12"}),i.jsx("path",{d:"M18 6 6 18"})]}),RR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m9 18-6-6 6-6"}),i.jsx("path",{d:"m15 6 6 6-6 6"})]}),AR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),i.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),i.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),i.jsx("path",{d:"M8 7.6 10.5 16"}),i.jsx("path",{d:"M16 7.6 13.5 16"}),i.jsx("path",{d:"M8.2 6h7.6"})]}),DR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),i.jsx("path",{d:"M12.8 15H16.5"})]}),OR=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),IR=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),i.jsx("path",{d:"M3.8 12h16.4"}),i.jsx("path",{d:"M12 3.7c2.3 2.3 3.6 5.2 3.6 8.3s-1.3 6-3.6 8.3c-2.3-2.3-3.6-5.2-3.6-8.3s1.3-6 3.6-8.3Z"})]}),LR=()=>i.jsx(VC,{"aria-hidden":"true",strokeWidth:1.9}),Jb=(e,t)=>{const a=new Map;for(const l of e)a.set(l.cursor,l);for(const l of t)a.set(l.cursor,l);return[...a.values()].sort((l,o)=>l.cursor-o.cursor)},PR=800,R_=(e,t,a)=>{const l=e.get(t);if(l!==void 0)return e.delete(t),e.set(t,l),l;const o=a();if(e.set(t,o),e.size>PR){const u=e.keys().next().value;u&&e.delete(u)}return o},UR=new Map,zR=new Map,BR=new Map,R0=()=>ao(()=>import("./session-diff-preview-BU4XO0fT.js"),[]),HR=_.lazy(async()=>({default:(await R0()).SessionDiffPreview})),A0=(e,t,a)=>i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:i.jsx(HR,{diffText:e,filePath:t,emptyMessage:a})}),$R=e=>i.jsx("span",{className:"conversation-inline-link",children:i.jsx("span",{className:"conversation-inline-link__button",title:e,children:Sx(e)})}),FR=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,qR=e=>R_(UR,e,()=>cx(e)),Of=e=>e.replace(/\\/g,"/"),WR=e=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(e.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},KR=e=>e.kind==="system"&&e.title==="context_compacted",e2=e=>e>=1e3?`${Math.round(e/1e3)}k`:String(Math.round(e)),QR=e=>R_(zR,e,()=>{const t=e.replace(/\r\n/g,`
|
|
137
|
+
`).split(`
|
|
138
|
+
`),a=[];let l=[],o=null;const u=()=>{l.length!==0&&(a.push({kind:"paragraph",lines:[...l]}),l=[])},f=()=>{if(!o||o.items.length===0){o=null;return}a.push({kind:"list",ordered:o.ordered,items:[...o.items]}),o=null};for(const m of t){const y=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(m),g=/^\s*([-*])\s+(.+)$/.exec(m),S=/^\s*(\d+)\.\s+(.+)$/.exec(m);if(y){u(),f(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(g||S){u();const p=!!S,v=((S==null?void 0:S[2])??(g==null?void 0:g[2])??"").trim();(!o||o.ordered!==p)&&(f(),o={ordered:p,items:[]}),o.items.push(v);continue}if(!m.trim()){u(),f();continue}f(),l.push(m)}return u(),f(),a}),GR=e=>R_(BR,e,()=>{const t=[];let a=0;e.replace(FR,(o,u,f)=>{const m=e.slice(a,f);return m.trim()&&t.push({kind:"markdown",content:m.trim()}),typeof u=="string"&&u.trim()?t.push({kind:"proposed-plan",content:u.trim()}):o.trim()&&t.push({kind:"markdown",content:o.trim()}),a=f+o.length,o});const l=e.slice(a);return l.trim()&&t.push({kind:"markdown",content:l.trim()}),t.length===0&&e.trim()&&t.push({kind:"markdown",content:e.trim()}),t}),YR=e=>{const t=e.files.filter(a=>!!a.item_id);return t.length>0?t:e.files.filter(a=>!a.item_id)},t2=(e,t,a)=>{const l=new Map(((a==null?void 0:a.files)??[]).map(f=>[f.path,f])),o=e.files.filter(f=>!f.item_id);if(o.length>0)return o.map(f=>{var m;return{changeSetId:e.id,path:f.path,pathLabel:Qr(f.path,t),additions:f.additions,deletions:f.deletions,itemId:f.item_id,diffAvailable:f.diff_available,diffText:(m=l.get(f.path))==null?void 0:m.diffText,emptyMessage:"此变更没有可展示的补丁内容"}});const u=new Map;for(const f of e.files)u.set(f.path,f);return[...u.values()].map(f=>{var m;return{changeSetId:e.id,path:f.path,pathLabel:Qr(f.path,t),additions:f.additions,deletions:f.deletions,itemId:f.item_id,diffAvailable:f.diff_available,diffText:(m=l.get(f.path))==null?void 0:m.diffText,emptyMessage:"此变更没有可展示的补丁内容"}})},Om=(e,t,a)=>`${e}:${a??"summary"}:${t}`,Cg=e=>`turn-summary:${e}`,n2=(e,t)=>`${e}:${t}`,VR=e=>{var t,a;for(let l=e.length-1;l>=0;l-=1)if(((t=e[l])==null?void 0:t.kind)==="user")return((a=e[l])==null?void 0:a.id)??null;return null},s2=(e,t,a)=>({session_id:e,generated_at:new Date().toISOString(),view:"tail",anchor_entry_id:VR(t),has_earlier_entries:a,entries:t}),A_=e=>Array.isArray(e),ym=e=>A_(e)?e:Array.isArray(e==null?void 0:e.entries)?e.entries:[],vm=e=>A_(e)?!1:(e==null?void 0:e.has_earlier_entries)??!1,Tg=e=>A_(e)?"tail":(e==null?void 0:e.view)??"tail",ZR=(e,t)=>{const a=new Map((e??[]).map(l=>[l.id,l]));for(const l of t)a.set(l.id,l);return[...a.values()].sort((l,o)=>+new Date(l.started_at)-+new Date(o.started_at))},XR=e=>`${e} background agent${e===1?"":"s"}`,JR=e=>e.startsWith("Reconnecting...")?"retrying":"error",eA=e=>e.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",Sx=e=>{const t=Of(e).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},a2=e=>`${e.kind}\0${e.title}\0${e.body}\0${e.accent}`,tA=(e,t)=>{if(!t||t.length===0||e.length===0)return e;let a=0;for(;a<e.length&&a<t.length&&a2(e[a])===a2(t[a]);)a+=1;return a<=0||a>=e.length?e:e.slice(a)},nA=e=>{const t=e.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const l=t.lastIndexOf("}");if(l<=a)return null;try{const o=JSON.parse(t.slice(a,l+1)),u=p=>typeof p=="string"?p.trim():"";if(typeof o.status=="string"){const p=o.status.trim();if(p==="shutdown")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理已关闭",state:"shutdown"};if(p==="completed")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理已完成",state:"completed"};if(p==="errored")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理异常结束",state:"errored"};if(p==="working")return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:"子代理处理中",state:"working"}}const f=o.status&&typeof o.status=="object"?o.status:null,m=u(f==null?void 0:f.completed),y=u(f==null?void 0:f.errored),g=u(f==null?void 0:f.working),S=u(f==null?void 0:f.shutdown);if(m)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:m,state:"completed"};if(y)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:y,state:"errored"};if(g)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:g,state:"working"};if(S)return{agentId:typeof o.agent_id=="string"?o.agent_id:null,body:S||"子代理已关闭",state:"shutdown"}}catch{return null}return null},Mg=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],jx=e=>{const t=(e??"").trim();if(!t)return Mg[0];let a=0;for(let l=0;l<t.length;l+=1)a=a*31+t.charCodeAt(l)>>>0;return Mg[a%Mg.length]},sA=e=>{var t;return jx(((t=e.subagent)==null?void 0:t.nickname)??e.title??e.id)},wx=e=>{let t=-1,a=-1;return e.forEach((l,o)=>{if(!(l.kind!=="system"||l.title!=="status")){if(l.body==="开始处理请求"){t=o;return}l.body==="处理完成"&&(a=o)}}),t>a?t:-1},aA=e=>{var a;const t=wx(e);return t<0?null:((a=e[t])==null?void 0:a.timestamp)??null},iA=e=>{const t=wx(e);if(t<0)return new Set;const a=[],l=new Set;for(const o of e.slice(t)){if(o.kind!=="tool")continue;if(o.title!=="tool-output"){if(a.push({name:o.title}),o.title==="close_agent"){const f=o.session_ids[0]??null;f&&l.delete(f)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const f=o.session_ids[0]??null;f&&l.add(f)}}return l},rA=e=>e.run_state==="running"?"is working":e.run_state==="completed"?"completed":"is awaiting instruction",Nx=1e4,sf=1200,kx=e=>new Set(((e==null?void 0:e.files)??[]).map(t=>Of(t.path))),Ex=(e,t)=>{if(t.size===0)return 0;let a=0;for(const l of e.files)t.has(Of(l.path))&&(a+=1);return a},lA=(e,t,a)=>{const l=+new Date(t);if(!Number.isFinite(l))return!1;const o=kx(a);return e.some(u=>{if(u.source!=="app-server")return!1;const f=+new Date(u.updated_at);return!Number.isFinite(f)||Math.abs(f-l)>Nx?!1:o.size===0?!0:Ex(u,o)>0})},oA=(e,t)=>{if(!e)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(e).getTime()),l=Math.max(0,Math.round(a/1e3)),o=Math.floor(l/60),u=l%60;return o<=0?`已处理 ${u}s`:`已处理 ${o}m ${u}s`},Qr=(e,t)=>{const a=Of(e),l=t?Of(t).replace(/\/+$/,""):"";return l&&a.toLowerCase().startsWith(`${l.toLowerCase()}/`)?a.slice(l.length+1):a},Cx=(e,t)=>!e||e.files.length===0?null:{files:e.files.map(a=>({path:a.path,displayPath:Qr(a.path,t),operation:"update",additions:a.additions,deletions:a.deletions,diffText:""})),additions:e.additions,deletions:e.deletions},Tx=(e,t)=>{const a=e.split(/\r?\n/),l=[];let o=null,u=[];const f=()=>{o&&(l.push({...o,diffText:u.join(`
|
|
139
|
+
`).trim()}),o=null,u=[])};for(const m of a){const y=m.replace(/\r$/,""),g=y.trimStart();if(y.startsWith("*** Add File: ")){f();const S=y.slice(14).trim();o={path:S,displayPath:Qr(S,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){f();const S=y.slice(17).trim();o={path:S,displayPath:Qr(S,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){f();const S=y.slice(17).trim();o={path:S,displayPath:Qr(S,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(o){if(y.startsWith("*** End Patch")){f();continue}if(y.startsWith("*** ")){f();continue}y.startsWith("+")?o.additions+=1:y.startsWith("-")&&(o.deletions+=1),(g.startsWith("@@")||y.startsWith("+")||y.startsWith("-")||y.startsWith(" "))&&u.push(g.startsWith("@@")?g:y)}}return f(),l.length===0?null:{files:l,additions:l.reduce((m,y)=>m+y.additions,0),deletions:l.reduce((m,y)=>m+y.deletions,0)}},cA=e=>{if(e.length===0)return null;const t=new Map;for(const l of e)for(const o of l.files){const u=t.get(o.path);if(!u){t.set(o.path,{...o});continue}u.additions+=o.additions,u.deletions+=o.deletions,u.diffText=[u.diffText,o.diffText].filter(Boolean).join(`
|
|
140
|
+
`),u.operation=o.operation}const a=[...t.values()];return{files:a,additions:a.reduce((l,o)=>l+o.additions,0),deletions:a.reduce((l,o)=>l+o.deletions,0)}},bm=(e,t=hR)=>{const a=e.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},D_=e=>{try{return JSON.parse(e)}catch{return null}},uA=e=>{const t=D_(e.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const l of a){const o=t[l];if(typeof o=="string"&&o.trim())return bm(o)}}return e.title&&e.title!=="tool-output"?e.body.trim().startsWith("{")||e.body.trim().startsWith("[")?bm(e.title.replace(/-/g," ")):bm(e.body||e.title):bm(e.body||"工具执行")},dA=e=>{if(e.title==="apply_patch")return e.body.trim();const t=D_(e.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():e.body.trim()||e.title},fA=e=>e.map(t=>{const a=D_(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
|
|
141
|
+
|
|
142
|
+
`),hA=e=>e.kind==="entry"&&e.entry.kind==="user",Mx=e=>e.kind==="entry"&&e.entry.kind==="assistant",mA=e=>hA(e)||Mx(e),pA=e=>e.kind==="tool-group"?!0:e.entry.kind==="assistant"||e.entry.kind==="thinking"||e.entry.kind==="tool",gA=e=>{if(e.length<=1)return e;const t=[];for(const a of e){const l=t[t.length-1];if(l&&l.kind==="entry"&&a.kind==="entry"&&l.entry.kind==="assistant"&&a.entry.kind==="assistant"&&l.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},_A=e=>`展开 ${e.length} 条过程消息`,yA=e=>`收起 ${e.length} 条过程消息`,vA=(e,t)=>{const a=gA(e.items),{completion:l}=e,o=a.findLastIndex(m=>Mx(m));if(o===-1||!l||!t)return{id:e.id,startedAt:e.startedAt,visibleStartItems:o===-1?a:a.slice(0,o),hiddenItems:[],visibleEndItems:o===-1?[]:a.slice(o),completion:l};const u=[],f=[];return a.forEach((m,y)=>{if(y!==o){if(mA(m)){u.push(m);return}f.push(m)}}),{id:e.id,startedAt:e.startedAt,visibleStartItems:u,hiddenItems:f,visibleEndItems:[a[o]],completion:l}},bA=(e,t)=>{const a=[];let l=[],o=null;const u=()=>{for(const m of l)a.push({kind:"item",id:m.kind==="entry"?m.entry.id:m.group.id,item:m});l=[]},f=()=>{o&&((o.items.length>0||o.completion)&&a.push({kind:"turn",turn:vA(o,t)}),o=null)};for(const m of e){if(m.kind==="turn-start"){f(),o={id:m.id,startedAt:m.startedAt,items:l,completion:null},l=[];continue}if(m.kind==="turn-complete"){if(o){o.completion=m;continue}o={id:m.id,startedAt:null,items:l,completion:m},l=[];continue}if(o){if(o.completion&&!pA(m)){f(),l.push(m);continue}o.items.push(m);continue}l.push(m)}return f(),u(),a},xA=e=>e.run_state!=="running"&&Date.now()-new Date(e.last_event_at).getTime()>=mR,SA=(e,t)=>{var g,S;const a=t==null?void 0:t.projectPath,l=(t==null?void 0:t.compactCompletedTurns)??!1,o=[];let u=null,f=!1,m=null,y=[];for(let p=0;p<e.length;p+=1){const v=e[p];if(v.kind==="system"&&v.body==="开始处理请求"){o.push({kind:"turn-start",id:v.id,startedAt:v.timestamp}),m=v.timestamp,y=[];continue}if(v.kind==="system"&&v.body==="处理完成"){o.push({kind:"turn-complete",id:v.id,durationLabel:oA(m,v.timestamp),patchSummary:cA(y),completedAt:v.timestamp}),m=null,y=[];continue}if(v.kind==="tool"&&v.title!=="tool-output"){const w=[];let N=p+1;for(;N<e.length&&((g=e[N])==null?void 0:g.kind)==="tool"&&((S=e[N])==null?void 0:S.title)==="tool-output";)w.push(e[N]),N+=1;u=v.id;const j=v.title==="apply_patch"?Cx(v.patch_summary,a)??Tx(v.body,a):null;j&&y.push(j),w.length===0&&(f=!0),o.push({kind:"tool-group",group:{id:v.id,commandEntry:v,outputEntries:w,patchSummary:j}}),p=N-1;continue}if(v.kind==="tool"&&v.title==="tool-output"){o.push({kind:"tool-group",group:{id:v.id,commandEntry:v,outputEntries:[],patchSummary:null}}),u=v.id;continue}o.push({kind:"entry",entry:v})}return{blocks:bA(o,l),lastToolGroupId:u,hasRunningToolGroup:f}},jA=e=>e.kind==="entry"?e.entry.timestamp:e.group.commandEntry.timestamp,wA=(e,t)=>{var f,m;const a=[...e.visibleStartItems,...e.hiddenItems,...e.visibleEndItems].map(jA).filter(y=>!!y),l=a.length>0?a[a.length-1]:null,o=e.startedAt??a[0]??((f=e.completion)==null?void 0:f.completedAt)??null,u=((m=e.completion)==null?void 0:m.completedAt)??l??o;return{startMs:o?+new Date(o):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},NA=(e,t)=>{const a=+new Date(e.started_at),l=e.completed_at?+new Date(e.completed_at):null,o=t.startMs??(t.endMs!==null?t.endMs-sf:null),u=t.nextStartMs??(t.endMs!==null?t.endMs+sf:Number.POSITIVE_INFINITY);return o!==null&&a<o-sf?!1:a<=u+sf?!0:l!==null&&l<=u+sf},kA=(e,t)=>{if(t===null)return Number.POSITIVE_INFINITY;const a=+new Date(e.updated_at);return Number.isFinite(a)?Math.abs(a-t):Number.POSITIVE_INFINITY},EA=(e,t)=>{const a=[...t].sort((f,m)=>+new Date(f.started_at)-+new Date(m.started_at)),l=new Set,o=e.filter(f=>f.kind==="turn"),u=new Map(o.map((f,m)=>[f.turn.id,m]));return e.map(f=>{var j,C,R;if(f.kind!=="turn")return f;const m=u.get(f.turn.id)??-1,y=m>=0?((j=o[m+1])==null?void 0:j.turn)??null:null,g=wA(f.turn,y),S=((C=f.turn.completion)==null?void 0:C.patchSummary)??null,p=kx(S),w=((R=a.filter(z=>!l.has(z.id)).map(z=>({changeSet:z,overlapCount:Ex(z,p),updatedAtDistance:kA(z,g.endMs)})).filter(z=>z.overlapCount>0&&z.updatedAtDistance<=Nx).sort((z,O)=>O.overlapCount!==z.overlapCount?O.overlapCount-z.overlapCount:z.changeSet.source!==O.changeSet.source?z.changeSet.source==="app-server"?-1:1:z.updatedAtDistance!==O.updatedAtDistance?z.updatedAtDistance-O.updatedAtDistance:+new Date(z.changeSet.started_at)-+new Date(O.changeSet.started_at))[0])==null?void 0:R.changeSet)??a.find(z=>l.has(z.id)?!1:NA(z,g))??null;return w&&l.add(w.id),{kind:"turn",turn:f.turn,changeSet:w}})},CA=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),D0=e=>Math.max(xx,Math.min(yR,e)),TA=()=>{if(typeof window>"u")return su;try{const e=window.localStorage.getItem(bx),t=window.localStorage.getItem(df);if(!e)return window.localStorage.setItem(df,ff),su;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(df,ff),su;const o=t!==ff||a===_R||a>su?su:a;return window.localStorage.setItem(df,ff),D0(o)}catch{return su}};function xm({active:e,render:t,fallback:a=null}){const[l,o]=_.useState(!e);return _.useEffect(()=>{if(!e){o(!1);return}o(!1);const u=window.requestAnimationFrame(()=>{o(!0)});return()=>{window.cancelAnimationFrame(u)}},[e]),e?l?i.jsx(i.Fragment,{children:t()}):i.jsx(i.Fragment,{children:a}):null}const MA=_.memo(function({sessionId:t,group:a,projectPath:l}){const[o,u]=_.useState({}),f=a.commandEntry.detail_available||a.outputEntries.some(j=>j.detail_available),m=wM({sessionId:t,entryId:a.commandEntry.id,scope:{sessionId:t},enabled:f}),y=m.data,g=(y==null?void 0:y.command_entry)??a.commandEntry,S=y!=null&&y.output_entries&&y.output_entries.length>0?y.output_entries:a.outputEntries,p=g.title==="apply_patch"?Tx(g.body,l)??Cx(g.patch_summary,l)??a.patchSummary:a.patchSummary,v=dA(g),w=fA(S),N=j=>{u(C=>({...C,[j]:!C[j]}))};return m.isPending&&f&&!y?i.jsx("div",{className:"patch-file-card__empty",children:"正在加载工具详情…"}):g.title==="apply_patch"&&p?p.files.length>1?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"tool-entry__patch-list",children:p.files.map(j=>{const C=`${a.id}:${j.path}`,R=!!o[C];return i.jsxs("div",{className:`tool-entry tool-entry--patch-file ${R?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>N(C),"aria-expanded":R,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:"已编辑"}),i.jsx("span",{className:"tool-entry__command",children:$R(j.displayPath)}),i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),R?i.jsx("div",{className:"tool-entry__details",children:j.diffText.trim()?i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:j.displayPath}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:A0(j.diffText,j.path,"此变更没有可展示的补丁内容")})]}):i.jsx("div",{className:"patch-file-card__empty",children:"此变更没有可展示的补丁内容"})}):null]},C)})}),m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]}):i.jsxs("div",{className:"tool-entry__patch-list",children:[p.files.map(j=>i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:j.displayPath}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",j.additions]}),i.jsxs("span",{className:"is-remove",children:["-",j.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:A0(j.diffText,j.path,"此变更没有可展示的补丁内容")})]},`${a.id}-${j.path}`)),m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:"命令"}),i.jsx("pre",{className:"tool-entry__pre",children:v})]}),w?i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:"输出"}),i.jsx("pre",{className:"tool-entry__pre",children:w})]}):null,m.isError?i.jsx("div",{className:"patch-file-card__empty",children:m.error instanceof Error?m.error.message:"无法加载工具详情。"}):null]})}),RA=_.memo(function({sessionId:t,sessions:a,sessionRunState:l,isDesktopSidebar:o,projectPath:u,renderedBlocks:f,lastToolGroupId:m,sessionChangeSets:y,isSubagentTimelinePending:g,isInitialTimelinePending:S,hasTimeline:p,proposedPlanReplyDrafts:v,pendingProposedPlanReplyEntryId:w,canRespondToProposedPlan:N,onProposedPlanReplyDraftChange:j,onSubmitProposedPlanReply:C,onPreviewImage:R,changeSetDiffs:z,changeSetDiffErrors:O,loadingChangeSetDiffKeys:k,onLoadSessionChangeSets:L,onLoadChangeSetFileDiff:K,onLoadFullTimeline:J,timelineLoadState:q}){const[Y,Q]=_.useState({}),[G,ge]=_.useState({}),[me,Z]=_.useState({}),[he,M]=_.useState(null),[$,ee]=_.useState(null),oe=_.useRef(null);_.useEffect(()=>{const Ee=V=>{const _e=V.target;_e instanceof Element&&_e.closest(".conversation-inline-link")||M(null)};return window.addEventListener("pointerdown",Ee),()=>{window.removeEventListener("pointerdown",Ee)}},[]),_.useEffect(()=>()=>{oe.current!==null&&window.clearTimeout(oe.current)},[]);const ae=Ee=>{Q(V=>({...V,[Ee]:!V[Ee]}))},I=Ee=>{ge(V=>({...V,[Ee]:!V[Ee]}))},ne=Ee=>{Z(V=>({...V,[Ee]:!V[Ee]}))};_.useEffect(()=>{var V;const Ee=new Map;for(const _e of f){if(_e.kind!=="turn")continue;const Te=_e.changeSet;if(!Te||Te.status!=="completed"||Te.files.length===0)continue;const Ie=Cg(_e.turn.id),ce=t2(Te,u,((V=_e.turn.completion)==null?void 0:V.patchSummary)??null);for(const Ae of ce){if(!Ae.changeSetId||!Ae.diffAvailable)continue;const qe=n2(Ie,Ae.path);if(!me[qe])continue;const xt=Om(Ae.changeSetId,Ae.path,Ae.itemId);z[xt]||k[xt]||Ee.set(xt,{changeSetId:Ae.changeSetId,path:Ae.path,itemId:Ae.itemId??null})}}for(const _e of Ee.values())K(_e)},[z,me,k,K,u,f]);const U=async(Ee,V)=>{var Ie;const _e=V.trim();if(!_e)return;const Te=()=>{const ce=document.createElement("textarea");ce.value=_e,ce.setAttribute("readonly","true"),ce.style.position="fixed",ce.style.opacity="0",ce.style.pointerEvents="none",document.body.appendChild(ce),ce.select(),document.execCommand("copy"),document.body.removeChild(ce)};try{(Ie=navigator.clipboard)!=null&&Ie.writeText?await navigator.clipboard.writeText(_e):Te(),ee(Ee),oe.current!==null&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{ee(ce=>ce===Ee?null:ce),oe.current=null},1400)}catch{}};function ie(Ee,V,_e){return A0(Ee,V,_e)}function Se(Ee,V,_e){const Te=he===_e,Ie=()=>{M(ce=>ce===_e?null:_e)};return i.jsxs("span",{className:`conversation-inline-link ${Te?"is-active":""}`,children:[i.jsx("span",{role:"button",tabIndex:0,className:"conversation-inline-link__button",onClick:ce=>{ce.stopPropagation(),Ie()},onKeyDown:ce=>{ce.key!=="Enter"&&ce.key!==" "||(ce.preventDefault(),ce.stopPropagation(),Ie())},children:Ee}),Te?i.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:V}):null]},_e)}function se(Ee,V,_e=Qr(Ee,u)){return Se(Sx(_e),_e,V)}function we(Ee,V){return qR(Ee).map((Te,Ie)=>{const ce=`${V}-${Ie}`;return Te.kind==="text"?i.jsx("span",{children:Te.value},ce):Te.kind==="code"?i.jsx("code",{className:"conversation-inline-code",children:Te.value},ce):Te.kind==="strong"?i.jsx("strong",{children:we(Te.value,`${ce}-strong`)},ce):Te.kind==="emphasis"?i.jsx("em",{children:we(Te.value,`${ce}-emphasis`)},ce):Te.kind==="skill"?i.jsx("span",{className:"conversation-skill-token",children:Te.raw},ce):Te.kind==="command"?i.jsx("span",{className:"conversation-command-token",children:Te.raw},ce):Se(Te.label,Te.path,ce)})}function ye(Ee,V){return QR(Ee).map((Te,Ie)=>{const ce=`${V}-block-${Ie}`;if(Te.kind==="heading"){const Ae=Math.min(Te.level,3),qe=Ae===1?"h1":Ae===2?"h2":"h3";return i.jsx(qe,{className:`conversation-markdown-heading is-level-${Ae}`,children:we(Te.text,`${ce}-heading`)},ce)}if(Te.kind==="list"){const Ae=Te.ordered?"ol":"ul";return i.jsx(Ae,{className:"conversation-markdown-list",children:Te.items.map((qe,xt)=>i.jsx("li",{children:we(qe,`${ce}-item-${xt}`)},`${ce}-item-${xt}`))},ce)}return i.jsx("p",{className:"conversation-markdown-paragraph",children:Te.lines.map((Ae,qe)=>i.jsxs("span",{children:[qe>0?i.jsx("br",{}):null,we(Ae,`${ce}-line-${qe}`)]},`${ce}-line-${qe}`))},ce)})}function Oe(Ee,V,_e){const Te=`${Ee.id}:proposed-plan:${_e}`,Ie=v[Te]??"",ce=w===Te,Ae=!N||ce;return i.jsxs("div",{className:"proposed-plan-card",children:[i.jsx("div",{className:"proposed-plan-card__content",children:ye(V,`${Te}:content`)}),i.jsxs("div",{className:"proposed-plan-card__footer",children:[i.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),i.jsxs("div",{className:"proposed-plan-card__actions",children:[i.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ae,onClick:()=>{C(Te,"是,实施此计划")},children:ce?"回复中…":"是,实施此计划"}),i.jsxs("div",{className:"proposed-plan-card__custom",children:[i.jsx("input",{type:"text",className:"proposed-plan-card__input",value:Ie,disabled:Ae,placeholder:"否,请告知如何调整",onChange:qe=>{j(Te,qe.target.value)},onKeyDown:qe=>{qe.key!=="Enter"||!Ie.trim()||Ae||(qe.preventDefault(),C(Te,Ie))}}),i.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ae||!Ie.trim(),onClick:()=>{C(Te,Ie)},children:ce?"回复中…":"回复"})]})]})]})]},Te)}function Le(Ee){const V=GR(Ee.body);return V.some(Te=>Te.kind==="proposed-plan")?V.map((Te,Ie)=>{const ce=`${Ee.id}-content-${Ie}`;return Te.kind==="markdown"?i.jsx("div",{className:"conversation-entry__rich-block",children:ye(Te.content,ce)},ce):Oe(Ee,Te.content,Ie)}):ye(Ee.body,Ee.id)}function _t(Ee){const V=C6([],Ee.attachments);if(V.length===0)return null;const _e=V.filter(wb),Te=V.filter(Ie=>!wb(Ie));return i.jsxs("div",{className:"conversation-entry__attachments",children:[_e.length>0?i.jsx("div",{className:"conversation-entry__attachment-grid",children:_e.map(Ie=>{const ce=E0(Ie.size_bytes),Ae=Ie.name??"图片",qe=`图片${ce?` · ${ce}`:""}`,xt=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"conversation-entry__attachment-media",children:Ie.content_url?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:Ie.content_url,alt:Ae,loading:"lazy"}),i.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):i.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),i.jsxs("div",{className:"conversation-entry__attachment-caption",children:[i.jsx("span",{className:"conversation-entry__attachment-title",children:Ae}),i.jsx("span",{className:"conversation-entry__attachment-meta",children:qe})]})]});return Ie.content_url?i.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>R({src:Ie.content_url,label:Ae,meta:qe}),"aria-label":`预览 ${Ae}`,children:xt},`${Ee.id}:${Ie.id}`):i.jsx("div",{className:"conversation-entry__attachment-card is-image",children:xt},`${Ee.id}:${Ie.id}`)})}):null,Te.length>0?i.jsx("div",{className:"conversation-entry__file-list",children:Te.map(Ie=>{const ce=E0(Ie.size_bytes),Ae=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),i.jsx("path",{d:"M14 3v5h5"}),i.jsx("path",{d:"M9 13h6"}),i.jsx("path",{d:"M9 17h4"})]})}),i.jsxs("span",{className:"conversation-entry__file-copy",children:[i.jsx("span",{className:"conversation-entry__file-title",children:Ie.name??"附件"}),i.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",ce?` · ${ce}`:""]})]})]});return Ie.content_url?i.jsx("a",{className:"conversation-entry__file-card",href:Ie.content_url,download:Ie.name??void 0,target:"_blank",rel:"noreferrer",children:Ae},`${Ee.id}:${Ie.id}`):i.jsx("div",{className:"conversation-entry__file-card",children:Ae},`${Ee.id}:${Ie.id}`)})}):null]})}function Ke(Ee,V){return i.jsx("div",{className:"turn-patch-summary__files",children:V.map(_e=>{const Te=n2(Ee,_e.path),Ie=!!me[Te],ce=_e.changeSetId?Om(_e.changeSetId,_e.path,_e.itemId):null,Ae=ce?z[ce]:void 0,qe=ce?k[ce]===!0:!1,xt=ce?O[ce]??null:null,Dt=(Ae==null?void 0:Ae.file.diff)??_e.diffText??"",ue=(Ae==null?void 0:Ae.empty_message)??_e.emptyMessage;return i.jsxs("div",{className:`turn-patch-file ${Ie?"is-expanded":""}`,children:[i.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>{ne(Te),_e.changeSetId||L(),ce&&_e.changeSetId&&_e.diffAvailable&&!Ae&&!qe&&K({changeSetId:_e.changeSetId,path:_e.path,itemId:_e.itemId??null})},"aria-expanded":Ie,children:[i.jsx("div",{className:"turn-patch-file__path",children:_e.pathLabel}),i.jsxs("div",{className:"turn-patch-file__meta",children:[i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",_e.additions]}),i.jsxs("span",{className:"is-remove",children:["-",_e.deletions]})]}),i.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),Ie?i.jsx("div",{className:"turn-patch-file__detail",children:qe?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}):xt?i.jsx("div",{className:"patch-file-card__empty",children:xt}):_e.diffAvailable===!1&&!Dt.trim()?i.jsx("div",{className:"patch-file-card__empty",children:ue}):i.jsx(xm,{active:Ie,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>ie(Dt,_e.path,ue)})}):null]},Te)})})}function tt(Ee){return YR(Ee).map(V=>{const _e=`live:${Ee.id}:${V.item_id??"summary"}:${V.path}`,Te=!!me[_e],Ie=Ee.status==="running",ce=Om(Ee.id,V.path,V.item_id),Ae=z[ce],qe=k[ce]===!0,xt=O[ce]??null,Dt=(Ae==null?void 0:Ae.file.diff)??"",ue=(Ae==null?void 0:Ae.empty_message)??"此变更还没有可展示的补丁内容";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${Ie?"is-running":"is-complete"} ${Te?"is-expanded":""} is-patch`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>{ne(_e),V.diff_available&&!Ae&&!qe&&K({changeSetId:Ee.id,path:V.path,itemId:V.item_id??null})},"aria-expanded":Te,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:"已编辑"}),i.jsx("span",{className:"tool-entry__command",children:se(V.path,`${_e}:live-link`,Qr(V.path,u))}),i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",V.additions]}),i.jsxs("span",{className:"is-remove",children:["-",V.deletions]})]})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?i.jsx("div",{className:"tool-entry__details",children:qe?i.jsx("div",{className:"patch-file-card__empty",children:"正在载入详情…"}):xt?i.jsx("div",{className:"patch-file-card__empty",children:xt}):!V.diff_available&&!Dt.trim()?i.jsx("div",{className:"patch-file-card__empty",children:ue}):i.jsx(xm,{active:Te,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsx("div",{className:"tool-entry__patch-list",children:i.jsxs("div",{className:"patch-file-card",children:[i.jsxs("div",{className:"patch-file-card__header",children:[i.jsx("div",{className:"patch-file-card__path",children:Qr(V.path,u)}),i.jsxs("div",{className:"patch-file-card__counts",children:[i.jsxs("span",{className:"is-add",children:["+",V.additions]}),i.jsxs("span",{className:"is-remove",children:["-",V.deletions]})]})]}),i.jsx("div",{className:"patch-file-card__diff",children:ie(Dt,V.path,ue)})]})})})}):null]})},_e)})}function nn(Ee,V,_e){const Te=t2(Ee,u,_e),Ie=Te.reduce((Ae,qe)=>Ae+qe.additions,0),ce=Te.reduce((Ae,qe)=>Ae+qe.deletions,0);return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsx("div",{className:"turn-patch-summary__header",children:i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[Te.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",Ie]}),i.jsxs("span",{className:"is-remove",children:["-",ce]})]})]})}),Ke(V,Te)]})}function Xt(Ee,V){return i.jsxs("div",{className:"turn-patch-summary",children:[i.jsx("div",{className:"turn-patch-summary__header",children:i.jsxs("div",{className:"turn-patch-summary__title",children:[i.jsxs("span",{children:[V.files.length," 个文件已更改"]}),i.jsxs("span",{className:"turn-patch-summary__counts",children:[i.jsxs("span",{className:"is-add",children:["+",V.additions]}),i.jsxs("span",{className:"is-remove",children:["-",V.deletions]})]})]})}),Ke(Ee,V.files.map(_e=>({path:_e.path,pathLabel:_e.displayPath,additions:_e.additions,deletions:_e.deletions,diffText:_e.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function jn(Ee,V){var Dt,ue;const _e=V.agentId?a.find(Me=>Me.id===V.agentId)??null:null,Te=jx(((Dt=_e==null?void 0:_e.subagent)==null?void 0:Dt.nickname)??(_e==null?void 0:_e.title)??V.agentId),Ie=`subagent:${Ee.id}`,ce=!!Y[Ie],Ae=V.state==="working",qe=V.state==="completed"?"子代理返回":V.state==="shutdown"?"子代理已关闭":V.state==="errored"?"子代理异常":"子代理处理中",xt=((ue=_e==null?void 0:_e.subagent)==null?void 0:ue.nickname)??(_e==null?void 0:_e.title)??"子代理";return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry is-subagent ${Ae?"is-running":"is-complete"} ${ce?"is-expanded":""}`,style:{"--subagent-accent":Te},children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>ae(Ie),"aria-expanded":ce,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:qe}),i.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:xt})]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),ce?i.jsx("div",{className:"tool-entry__details",children:i.jsx(xm,{active:ce,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsxs("div",{className:"tool-entry__section",children:[i.jsx("div",{className:"tool-entry__label",children:xt}),i.jsx("div",{className:"tool-entry__markdown",children:ye(V.body,`${Ee.id}-subagent`)})]})})}):null]})},Ee.id)}function zt(Ee){var Te,Ie;if(Ee.kind==="tool-group"){const{group:ce}=Ee;if(ce.commandEntry.title==="apply_patch"&&lA(y,ce.commandEntry.timestamp,ce.patchSummary))return null;const Ae=!!Y[ce.id],qe=l==="running"&&m===ce.id&&ce.outputEntries.length===0,xt=ce.commandEntry.title==="apply_patch"&&!!ce.patchSummary,Dt=xt&&(((Te=ce.patchSummary)==null?void 0:Te.files.length)??0)>1,ue=xt?ce.patchSummary.files.length===1?ce.patchSummary.files[0].displayPath:`${ce.patchSummary.files.length} 个文件`:uA(ce.commandEntry);return i.jsx("section",{className:"conversation-entry is-tool-group",children:i.jsxs("div",{className:`tool-entry ${qe?"is-running":"is-complete"} ${Ae?"is-expanded":""} ${xt?"is-patch":""} ${Dt?"has-flat-patch-list":""}`,children:[i.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>ae(ce.id),"aria-expanded":Ae,children:[i.jsxs("div",{className:"tool-entry__summary",children:[i.jsx("span",{className:"tool-entry__status",children:xt?"已编辑":qe?"正在执行":"已执行"}),i.jsx("span",{className:"tool-entry__command",children:xt&&((Ie=ce.patchSummary)==null?void 0:Ie.files.length)===1?se(ce.patchSummary.files[0].path,`${ce.id}:patch-link`,ce.patchSummary.files[0].displayPath):ue}),xt&&ce.patchSummary?i.jsxs("span",{className:"tool-entry__counts",children:[i.jsxs("span",{className:"is-add",children:["+",ce.patchSummary.additions]}),i.jsxs("span",{className:"is-remove",children:["-",ce.patchSummary.deletions]})]}):null]}),i.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ae?i.jsx("div",{className:"tool-entry__details",children:i.jsx(xm,{active:Ae,fallback:i.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>i.jsx(MA,{sessionId:t,group:ce,projectPath:u})})}):null]})},ce.id)}const V=Ee.entry,_e=V.kind==="user"?nA(V.body):null;if(_e)return jn(V,_e);if(V.kind==="thinking")return l!=="running"?null:i.jsx("section",{className:"conversation-entry is-thinking-status",children:i.jsx("div",{className:"thinking-status-pill",children:i.jsx("span",{children:"正在思考"})})},V.id);if(KR(V))return i.jsx("section",{className:"conversation-context-compact",children:i.jsx("div",{className:"context-compact-divider",children:i.jsx("span",{children:"背景信息已自动压缩"})})},V.id);if(V.kind==="system"&&V.title==="system_prompt")return null;if(V.kind==="system"&&V.title==="runtime-status"){const ce=JR(V.body);return i.jsx("section",{className:"conversation-entry is-runtime-status",children:i.jsxs("div",{className:`runtime-status-entry is-${ce}`,children:[i.jsx("div",{className:"runtime-status-entry__label",children:eA(V.body)}),i.jsx("pre",{className:"runtime-status-entry__body",children:V.body})]})},V.id)}return i.jsx("section",{className:`conversation-entry ${V.kind==="user"?"is-user":"is-system"} is-${V.kind}`,children:V.kind==="user"?i.jsxs("div",{className:"conversation-entry__stack",children:[i.jsxs("div",{className:"conversation-entry__body",children:[V.body.trim()?ye(V.body,V.id):null,V.attachments.length>0?_t(V):null]}),V.body.trim()?i.jsxs("button",{type:"button",className:`conversation-entry__copy ${$===V.id?"is-copied":""}`,onClick:()=>{U(V.id,V.body)},"aria-label":$===V.id?"已复制消息":"复制消息",children:[i.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:$===V.id?i.jsx(TR,{}):i.jsx(CR,{})}),i.jsx("span",{className:"sr-only",children:$===V.id?"已复制":"复制"})]}):null]}):i.jsxs("div",{className:"conversation-entry__body",children:[V.body.trim()?V.kind==="assistant"?Le(V):ye(V.body,V.id):null,V.attachments.length>0?_t(V):null]})},V.id)}if(g)return i.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"});if(S)return i.jsxs("div",{className:"empty-panel empty-panel--loading",role:"status","aria-live":"polite","aria-busy":"true",children:[i.jsxs("span",{className:"empty-panel__loading-dots","aria-hidden":"true",children:[i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"})]}),i.jsx("span",{className:"sr-only",children:"正在加载会话记录"})]});if(!p)return i.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"});const Bt=q.canLoadEarlierEntries||q.isPulling||q.isLoadingFull,yt=q.isPulling||q.isLoadingFull||q.triggerSource==="click",bt=q.isLoadingFull?"正在加载全部对话…":q.isPulling?q.isReadyToLoad?"松开加载全部":"下拉加载更多":o?"加载全部对话":"点击加载全部",dt=q.isLoadingFull||q.triggerSource==="click"?M0:q.indicatorOffset,cn={opacity:yt?1:0,transform:`translate3d(-50%, calc(-100% + ${dt}px), 0) scale(${yt?1:.92})`},Pn={transform:`rotate(${q.indicatorRotation}deg)`};return i.jsxs(i.Fragment,{children:[Bt?i.jsx("section",{className:`conversation-entry is-history-loader ${q.isReadyToLoad?"is-ready":""}`,children:i.jsxs("div",{className:`timeline-history-loader ${q.isLoadingFull?"is-loading":""} ${q.triggerSource==="click"?"is-click-loading":""}`,children:[i.jsx("span",{className:"timeline-history-loader__indicator",style:cn,"aria-hidden":"true",children:i.jsx("span",{className:"timeline-history-loader__indicator-surface",children:i.jsx("span",{className:"timeline-history-loader__indicator-track",style:Pn,children:i.jsx("span",{className:`timeline-history-loader__indicator-spin ${q.isLoadingFull?"is-loading":""}`,children:i.jsx("span",{className:"timeline-history-loader__indicator-icon",children:i.jsx(LR,{})})})})})}),i.jsx("div",{className:"turn-complete-divider timeline-history-loader__divider",children:q.isLoadingFull?i.jsx("span",{className:"timeline-history-loader__content is-loading",children:i.jsx("span",{children:bt})}):i.jsx("button",{type:"button",className:`timeline-history-loader__button ${q.isPulling?"is-pulling":""}`,onClick:()=>J("click"),children:bt})})]})}):null,f.map(Ee=>{var qe;if(Ee.kind==="item")return zt(Ee.item);const{turn:V}=Ee,_e=Ee.changeSet,Te=((qe=V.completion)==null?void 0:qe.patchSummary)??null,Ie=!!G[V.id],ce=V.hiddenItems.length>0&&!Ie,Ae=Ie?yA(V.hiddenItems):_A(V.hiddenItems);return i.jsxs("section",{className:"conversation-turn",children:[V.visibleStartItems.map(xt=>zt(xt)),V.hiddenItems.length>0?i.jsxs("div",{className:"conversation-turn__history",children:[i.jsxs("button",{type:"button",className:`turn-history-toggle ${Ie?"is-expanded":""}`,onClick:()=>I(V.id),"aria-expanded":Ie,children:[i.jsx("span",{className:"turn-history-toggle__label",children:Ae}),i.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),ce?null:V.hiddenItems.map(xt=>zt(xt))]}):null,V.completion&&V.visibleEndItems.length>0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:V.completion.durationLabel})})}):null,V.visibleEndItems.map(xt=>zt(xt)),_e&&_e.source==="app-server"&&_e.files.length>0?tt(_e):null,V.completion&&V.visibleEndItems.length===0?i.jsx("section",{className:"conversation-turn-complete",children:i.jsx("div",{className:"turn-complete-divider",children:i.jsx("span",{children:V.completion.durationLabel})})}):null,_e&&_e.status==="completed"&&_e.files.length>0?nn(_e,Cg(V.id),Te):Te?Xt(Cg(V.id),Te):null]},V.id)})]})}),AA=({sessionId:e,workspaceDirectorySnapshot:t=null,workspaceAgentIndicatorState:a,embedded:l=!1,isDesktopSidebar:o,sidebarOffset:u=0,isSidebarDragging:f=!1,onOpenSidebar:m,onSelectSession:y,onExitToNodes:g}={})=>{var zi,Bi,bd,xd,xr,gl,So,_l,jo,Sd,Hi,jd,vi,Ac,Dc,bi,xi,yl;const{sessionId:S}=qu({strict:!1}),p=e??S??"",v=c_(p),w=(v==null?void 0:v.agentId)??uc(),N=Ei(),j=Pa(),{data:C}=J3({scope:{sessionId:p,agentId:w??void 0},selectedSessionId:p,enabled:!l&&!t}),R=_.useMemo(()=>NR(t??C,v),[C,v,t]),z=(R==null?void 0:R.sessions.find(b=>b.id===p))??null,O=!!(z||v!=null&&v.session),k=NM({sessionId:p,scope:{sessionId:p,agentId:w??void 0},enabled:!!p}),{historyState:L,archivedState:K,loadMoreHistory:J,loadMoreArchived:q,reset:Y}=tx({scope:{sessionId:p},selectedSessionId:p}),Q=_.useRef(null),G=_.useRef(null),ge=_.useRef(null),me=_.useRef(null),Z=_.useRef(null),[he,M]=_.useState(!1),[$,ee]=_.useState(()=>typeof window<"u"&&window.innerWidth>=Yb),[oe,ae]=_.useState(()=>TA()),[I,ne]=_.useState(!1),[U,ie]=_.useState(""),[Se,se]=_.useState([]),[we,ye]=_.useState(null),[Oe,Le]=_.useState(null),[_t,Ke]=_.useState(null),[tt,nn]=_.useState(()=>b_()),[Xt,jn]=_.useState(()=>O3()),[zt,Bt]=_.useState(()=>ab(p)),[yt,bt]=_.useState(()=>ib(p)),[dt,cn]=_.useState(()=>rb(p)),Pn=w_(),Ee=_.useMemo(()=>Pn.map(({id:b,...D})=>D),[Pn]),[V,_e]=_.useState({}),[Te,Ie]=_.useState(null),[ce,Ae]=_.useState(!1),[qe,xt]=_.useState(!1),[Dt,ue]=_.useState(""),[Me,Re]=_.useState(!1),[We,Xe]=_.useState(!1),[Je,Tt]=_.useState(null),[Wt,ls]=_.useState(null),[Nt,Un]=_.useState(!1),[Cn,Dn]=_.useState(!1),[De,Qt]=_.useState("code"),[On,Ts]=_.useState(!1),[Ua,Us]=_.useState(null),[Ci,Fn]=_.useState(null),[Vs,te]=_.useState(!1),[Pe,$e]=_.useState(!1),[at,Ut]=_.useState(!1),[ft,Mt]=_.useState(!1),[qn,jt]=_.useState(null),[zs,Kt]=_.useState(null),[bs,Wn]=_.useState({}),[P,be]=_.useState(!1),[Ue,He]=_.useState({state:"connected",attempt:0,maxAttempts:5}),[Ge,ht]=_.useState({sessionId:p??null,pending:!!p,error:null}),[mt,ot]=_.useState({state:"idle"}),Xn=_.useRef({}),Jt=_.useRef(R),Jn=_.useRef(null);_.useEffect(()=>{vf(tt)},[tt]),_.useEffect(()=>{I3(Xt)},[Xt]),_.useEffect(()=>{Ee.length!==0&&(Ee.some(b=>b.value===tt)||nn(Ee[0].value))},[Ee,tt]),_.useEffect(()=>{Bt(ab(p)),bt(ib(p)),cn(rb(p)),Ke(null),Qt("code"),Ts(!1),Us(null),Fn(null),te(!1),$e(!1),Ut(!1),Mt(!1),jt(null),Kt(null),Wn({}),er({}),nr({}),Ba({}),Ha(0),Xs(!1),ir(!1),li(null),Mi.current=null,Js.current=null,Yu.current=null,oi.current=null,wa.current=!1,lo.current=!!p},[p]),_.useEffect(()=>{Xn.current=bs},[bs]),_.useEffect(()=>{Jt.current=R},[R]),_.useEffect(()=>{L3(p,zt)},[zt,p]),_.useEffect(()=>{P3(p,yt)},[yt,p]),_.useEffect(()=>{U3(p,dt)},[dt,p]),_.useEffect(()=>{_e({}),Ie(null)},[p]),_.useEffect(()=>{A.current=null},[p]),_.useEffect(()=>{if(!we)return;const b=F=>{F.key==="Escape"&&ye(null)},D=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",b),()=>{document.body.style.overflow=D,window.removeEventListener("keydown",b)}},[we]);const[as,In]=_.useState(!1),pn=_.useRef(null),sn=_.useRef(null),wn=_.useRef(null),xs=_.useRef(0),A=_.useRef(null),pe=_.useRef(0),et=_.useRef(0),Lt=_.useRef(0),pt=_.useRef(null),ct=_.useRef(null),gn=_.useRef(0),zn=_.useRef(null),za=_.useRef(!1),Bs=_.useRef(!1),Hs=_.useRef(!1),Zs=_.useRef(0),$s=_.useRef(p??null),ri=_.useRef({sessionId:p??null,agentId:null,embedded:l}),[Ti,er]=_.useState({}),[tr,nr]=_.useState({}),[sr,Ba]=_.useState({}),[Ms,Ha]=_.useState(0),[ar,Xs]=_.useState(!1),[Ss,ir]=_.useState(!1),[rr,li]=_.useState(null),Mi=_.useRef(null),Js=_.useRef(null),Yu=_.useRef(null),oi=_.useRef(null),wa=_.useRef(!1),lo=_.useRef(!1),Ri=_.useRef(new Set),lr=_.useCallback(b=>{if(b.length===0)return;const D=b.map(je=>`${je}:`),F=je=>D.some(Fe=>je.startsWith(Fe));er(je=>Object.fromEntries(Object.entries(je).filter(([Fe])=>!F(Fe)))),nr(je=>Object.fromEntries(Object.entries(je).filter(([Fe])=>!F(Fe)))),Ba(je=>Object.fromEntries(Object.entries(je).filter(([Fe])=>!F(Fe))))},[]),Ai=_.useCallback(b=>{Ri.current.add(b)},[]),Di=_.useCallback(b=>{Ri.current.delete(b)},[]),Vu=_.useRef(null),os=_.useRef(null),es=_.useRef(null),Vr=_.useRef(null),ci=_.useRef(oe),oo=_.useRef(null),$a=_.useRef(null);let fe=CM(z,(zi=k.data)==null?void 0:zi.session)??(v==null?void 0:v.session)??null;const on=(R==null?void 0:R.agent)??null;let Rs=(R==null?void 0:R.projects.find(b=>b.id===(fe==null?void 0:fe.project_id)))??(v==null?void 0:v.project);const ui=(fe==null?void 0:fe.capability.can_show_git)??!1,Na=(fe==null?void 0:fe.capability.can_show_terminal)??!1;ri.current={sessionId:p??null,agentId:(fe==null?void 0:fe.agent_id)??(on==null?void 0:on.id)??w,embedded:l};const _n=_.useCallback(()=>{var D;const b=(fe==null?void 0:fe.agent_id)??(on==null?void 0:on.id)??w;return b&&((D=ct.current)==null?void 0:D.agentId)===b?Promise.resolve(ct.current.target):xn({sessionId:p,agentId:b})},[on==null?void 0:on.id,w,fe==null?void 0:fe.agent_id,p]),Zr=_.useCallback(async b=>{if(l){y==null||y(b);return}sa(b),Wr(b),on!=null&&on.id&&Zi(on.id),await N({to:"/",replace:!0})},[on==null?void 0:on.id,l,N,y]),Xr=_.useCallback(async()=>{if(l){g==null||g();return}await N({to:"/nodes"})},[l,N,g]),Yf=b=>b instanceof Element&&!!b.closest('button, textarea, input, a, [role="button"], [role="dialog"]'),Vf=b=>Yf(b),fc=()=>{const b=ge.current;if(!b)return;const D=()=>{b.scrollTo({top:b.scrollHeight,behavior:"auto"})};D(),window.requestAnimationFrame(()=>{D(),window.requestAnimationFrame(D)})},Zf=_.useCallback(()=>{const b=ge.current;return b?b.scrollHeight-b.scrollTop-b.clientHeight<=Vb:!0},[]),kp=_.useCallback(b=>{(b!=null&&b.force||Zf())&&fc()},[Zf]),hc=()=>{const b=ge.current;if(!b){be(!1);return}const D=b.scrollHeight-b.scrollTop-b.clientHeight;be(D>Vb)},ps=_.useCallback(b=>{j.setQueriesData({queryKey:rs},b)},[j]),Zu=_.useCallback((b,D)=>{j.setQueryData(gx({sessionId:b,scope:{sessionId:b}}),F=>TM(F??void 0,b,D)??F)},[j]),Ep=(R==null?void 0:R.projects)??[],or=(R==null?void 0:R.sessions)??[],Xu=(R==null?void 0:R.project_stats)??[],bn=_.useMemo(()=>{var b;return(b=fe==null?void 0:fe.subagent)!=null&&b.parent_session_id?or.find(D=>{var F;return D.id===((F=fe==null?void 0:fe.subagent)==null?void 0:F.parent_session_id)})??null:null},[(Bi=fe==null?void 0:fe.subagent)==null?void 0:Bi.parent_session_id,or]),Jr=_.useCallback(b=>{const D=b.session_id;D&&(j.setQueryData(Po(D),F=>ix(F,b.entries)),j.setQueryData(["timeline",D],F=>{const je=LT(F,b);return je.view==="full_compact"&&SM(je),je}))},[j]),Xf=_.useCallback(b=>{var un,Os;const D=b.session_id;if(!D)return;const F=ri.current.sessionId===D;Jr(b.timeline),j.setQueryData(["interactions",D],b.interactions),F&&Tt(dn=>dn&&b.interactions.some(ds=>ds.id===dn)?dn:null),j.setQueryData(["plan",D],b.plan_snapshot),b.change_sets.length>0?(lr(b.change_sets.map(dn=>dn.id)),j.setQueryData(["change-sets",D],b.change_sets),Ai(D)):Ri.current.has(D)||(j.setQueryData(["change-sets",D],[]),Di(D)),j.setQueryData(["session-run-workbench",D],b.run_workbench);const je=(un=b.timeline.entries.at(-1))==null?void 0:un.timestamp,Fe=je&&(!b.session_patch.last_event_at||+new Date(je)>+new Date(b.session_patch.last_event_at))?{...b.session_patch,last_event_at:je}:b.session_patch,kt=Pb(Fe);kt&&Zu(D,kt);const Ve=v0(Fe);Ve&&lp(Jt.current??void 0,D)&&ps(dn=>cf(dn,D,Ve)),F&&(b.session_patch.run_state==="running"||b.session_patch.run_state==="completed"||b.session_patch.run_state==="idle")&&(Re(b.session_patch.run_state==="running"),b.session_patch.run_state!=="running"&&Xe(!1)),F&&((Os=b.run_workbench)!=null&&Os.terminal_snapshot)&&Wn(dn=>{var ze;const ds=new Set((ze=b.run_workbench)==null?void 0:ze.terminal_snapshot.terminals.map(Bn=>Bn.id)),Ln={};for(const[Bn,Ns]of Object.entries(dn))ds.has(Bn)&&(Ln[Bn]=Ns);return Ln}),bn!=null&&bn.id&&j.invalidateQueries({queryKey:["timeline",bn.id,"prefix-source"],exact:!0})},[Jr,lr,Zu,Ai,bn==null?void 0:bn.id,j,Di]),co=_.useCallback(async b=>{var je;if(!p)return null;const D=p;if(((je=pt.current)==null?void 0:je.sessionId)===D)return pt.current.promise;const F=(async()=>{var kt;const Fe=++xs.current;ot({state:"recovering"});try{const un=await(await _n()).client.getSessionBootstrap(p);return xs.current!==Fe?null:(Xf(un),et.current=Date.now(),ot({state:"idle"}),un)}catch(Ve){return xs.current!==Fe||ot({state:"failed",error:Ve instanceof Error?Ve.message:b==="initial"?"会话加载失败。":"会话同步失败。"}),null}finally{((kt=pt.current)==null?void 0:kt.sessionId)===D&&(pt.current=null)}})();return pt.current={sessionId:D,promise:F},F},[Xf,_n,p]),Ju=_.useCallback(b=>{p&&(Lt.current>0||(Lt.current=Date.now(),co(b).then(D=>{ht({sessionId:p,pending:!1,error:D?null:"Unable to load session bootstrap."})}).catch(D=>{ht({sessionId:p,pending:!1,error:D instanceof Error?D.message:"Unable to load session bootstrap."})})))},[co,p]),Jf=_.useCallback(async()=>{if(!p||Ri.current.has(p))return;const D=await(await _n()).client.getSessionChangeSets(p);lr(D.map(F=>F.id)),j.setQueryData(["change-sets",p],D),Ai(p)},[lr,Ai,j,_n,p]),mc=_.useCallback(async(b="click")=>{if(!p||Ss)return;const D=ge.current;D&&(oi.current=D.scrollHeight,wa.current=!0),li(b),ir(!0);const F=Date.now();try{const Fe=await(await _n()).client.getSessionTimeline(p,{view:"full_compact"});Jr(Fe)}finally{if(b==="click"){const je=vR-(Date.now()-F);je>0&&await new Promise(Fe=>{window.setTimeout(Fe,je)})}ir(!1),Ha(0),Xs(!1),li(null)}},[Jr,Ss,_n,p]),eh=_.useCallback(async b=>{if(!p)return;const D=Om(b.changeSetId,b.path,b.itemId);if(!(Ti[D]||sr[D])){Ba(F=>({...F,[D]:!0})),nr(F=>({...F,[D]:void 0}));try{const je=await(await _n()).client.getSessionChangeSetFileDiff(p,b);er(Fe=>({...Fe,[D]:je}))}catch(F){nr(je=>({...je,[D]:F instanceof Error?F.message:"无法读取这个文件的差异详情。"}))}finally{Ba(F=>({...F,[D]:!1}))}}},[Ti,sr,_n,p]),ra=is({queryKey:["timeline",p],enabled:!1,queryFn:async()=>kR,initialData:p?xM(p)??j.getQueryData(["timeline",p]):void 0,refetchInterval:!1}),uo=is({queryKey:Po(p),enabled:!1,queryFn:async()=>[],initialData:[]});_.useEffect(()=>{const b=v==null?void 0:v.optimisticEntry;!p||(v==null?void 0:v.sessionId)!==p||!b||j.setQueryData(Po(p),D=>D!=null&&D.some(F=>F.id===b.id)?D:N0(D,b))},[v,j,p]),_.useEffect(()=>{var D;(v==null?void 0:v.sessionId)!==p||!(((D=k.data)==null?void 0:D.session.id)===p||C!=null&&C.sessions.some(F=>F.id===p))||JN(p)},[C,v==null?void 0:v.sessionId,(bd=k.data)==null?void 0:bd.session.id,p]);const Cp=ym(ra.data),Tp=uo.data??[],pc=Cp.length>0||Tp.length>0||!!(v!=null&&v.optimisticEntry),di=is({queryKey:["timeline",bn==null?void 0:bn.id,"prefix-source"],enabled:!!(bn!=null&&bn.id),queryFn:async()=>(await(await xn({sessionId:bn.id,projectId:bn.project_id,agentId:bn.agent_id})).client.getSessionTimeline(bn.id,{view:"tail"})).entries,refetchInterval:!1}),el=_.useMemo(()=>{const b=ym(ra.data);return fe!=null&&fe.subagent?new Set:iA(b)},[fe==null?void 0:fe.subagent,ra.data]),ed=_.useMemo(()=>aA(ym(ra.data)),[ra.data]),td=_.useMemo(()=>fe!=null&&fe.subagent?[]:or.filter(b=>{var D;return b.id!==p&&((D=b.subagent)==null?void 0:D.parent_session_id)===p&&!b.archived}).filter(b=>{if(b.run_state==="running")return!0;if(!((fe==null?void 0:fe.run_state)==="running"||Me))return!1;if(el.has(b.id))return!0;if(!ed)return!1;const D=new Date(ed).getTime(),F=new Date(b.last_event_at).getTime();return Number.isFinite(D)&&Number.isFinite(F)&&F>=D-gR}).sort((b,D)=>+new Date(D.last_event_at)-+new Date(b.last_event_at)),[ed,Me,el,fe==null?void 0:fe.run_state,fe==null?void 0:fe.subagent,p,or]);_.useEffect(()=>{if(!p){Jn.current=null,Hs.current=!1,Zs.current=0,$s.current=null,ht({sessionId:null,pending:!1,error:null}),He({state:"connected",attempt:0,maxAttempts:5});return}const b=!pc;ht({sessionId:p,pending:b,error:null}),et.current=b?0:Date.now(),Lt.current=0},[pc,p]),_.useEffect(()=>{if(!p||!Ge.pending)return;if(Ue.state==="failed"){Ju("initial");return}if(Ue.state!=="connected")return;const b=pe.current;if(b<=0)return;const D=window.setTimeout(()=>{et.current>=b||Ju("initial")},1200);return()=>{window.clearTimeout(D)}},[Ue.state,Ge.pending,Ju,p]),_.useEffect(()=>{if(!p||Ue.state!=="connected"||Ge.pending||pc||!Hs.current||$s.current!==p)return;const b=Zs.current;if(b<=0)return;const D=window.setTimeout(()=>{if(Hs.current&&Zs.current===b){if(et.current>=b){Hs.current=!1,Zs.current=0,$s.current=null;return}Hs.current=!1,Zs.current=0,$s.current=null,co("connected")}},1200);return()=>{window.clearTimeout(D)}},[Ue.state,co,pc,Ge.pending,p]);const th=is({queryKey:["change-sets",p],enabled:!1,queryFn:async()=>p?(await _n()).client.getSessionChangeSets(p):[],initialData:p?j.getQueryData(["change-sets",p])??[]:[],refetchInterval:!1}),cr=is({queryKey:["session-git-workspace",p],enabled:!!(p&&ui&&De==="git"),queryFn:async()=>(await _n()).client.getSessionGitWorkspace(p),refetchInterval:!1}),ka=is({queryKey:["session-git-history",p],enabled:!1,queryFn:async()=>(await _n()).client.getSessionGitHistory(p),refetchInterval:!1}),ur=is({queryKey:["session-run-workbench",p],enabled:!1,queryFn:async()=>null,initialData:p?j.getQueryData(["session-run-workbench",p])??null:null,refetchInterval:!1}),la=is({queryKey:["plan",p],enabled:!1,queryFn:async()=>null,initialData:p?j.getQueryData(["plan",p])??null:null,refetchInterval:!1}),nd=is({queryKey:["interactions",p],enabled:!1,queryFn:async()=>[],initialData:p?j.getQueryData(["interactions",p])??[]:[],refetchInterval:!1}),gc=_.useCallback(async(b,D)=>{if(p){Wn(F=>{var je,Fe,kt;return{...F,[b]:{chunks:((je=F[b])==null?void 0:je.chunks)??[],nextCursor:((Fe=F[b])==null?void 0:Fe.nextCursor)??0,truncated:((kt=F[b])==null?void 0:kt.truncated)??!1,isLoading:!0,error:null}}});try{const F=await _n(),je=Xn.current[b],Fe=await F.client.getSessionTerminalOutput({sessionId:p,terminalId:b,cursor:D!=null&&D.force||je!=null&&je.truncated||je==null?void 0:je.nextCursor});Wn(kt=>{const Ve=kt[b],un=D!=null&&D.force||Fe.truncated||!Ve?Fe.chunks:Jb(Ve.chunks,Fe.chunks);return{...kt,[b]:{chunks:un,nextCursor:Fe.next_cursor,truncated:Fe.truncated,isLoading:!1,error:null}}})}catch(F){Wn(je=>{var Fe,kt,Ve;return{...je,[b]:{chunks:((Fe=je[b])==null?void 0:Fe.chunks)??[],nextCursor:((kt=je[b])==null?void 0:kt.nextCursor)??0,truncated:((Ve=je[b])==null?void 0:Ve.truncated)??!1,isLoading:!1,error:F instanceof Error?F.message:"无法读取终端输出。"}}})}}},[p]);_.useEffect(()=>{var je,Fe;const b=(je=ur.data)==null?void 0:je.terminal_snapshot.active_terminal_id,D=(Fe=ur.data)==null?void 0:Fe.terminal_snapshot.terminals.find(kt=>kt.id===b);if(!b||!D)return;const F=bs[b];(!F||F.truncated||F.nextCursor<D.output_cursor)&&gc(b)},[gc,ur.data,bs]);const nh=!!(fe!=null&&fe.subagent&&(bn!=null&&bn.id)&&di.isPending&&!di.data),tl=_.useMemo(()=>{const b=ym(ra.data);return fe!=null&&fe.subagent?bn!=null&&bn.id&&di.isPending&&!di.data?[]:tA(b,di.data):b},[bn==null?void 0:bn.id,di.data,di.isPending,fe==null?void 0:fe.subagent,ra.data]),nl=_.useMemo(()=>IT(tl,uo.data),[tl,uo.data]);_.useEffect(()=>{p&&window.localStorage.setItem(dR,p)},[p]),_.useEffect(()=>{const b=wn.current;b&&((uo.data??[]).some(D=>D.id===b.optimisticEntryId)||(wn.current=null))},[uo.data]),_.useEffect(()=>{Dn(!1)},[p]),_.useEffect(()=>{ue((fe==null?void 0:fe.title)??""),xt(!1)},[fe==null?void 0:fe.title,p]),_.useEffect(()=>{Xe(!1)},[p]),_.useEffect(()=>()=>{pn.current&&window.clearTimeout(pn.current),sn.current&&window.clearTimeout(sn.current),$a.current&&window.cancelAnimationFrame($a.current)},[]),_.useEffect(()=>{if(sn.current&&(window.clearTimeout(sn.current),sn.current=null),!!Oe)return sn.current=window.setTimeout(()=>{Le(null),sn.current=null},bR),()=>{sn.current&&(window.clearTimeout(sn.current),sn.current=null)}},[Oe]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(bx,String(D0(oe))),window.localStorage.setItem(df,ff)}catch{}},[oe]),_.useEffect(()=>{ci.current=oe},[oe]),_.useEffect(()=>{if(typeof window>"u")return;const b=()=>{const D=window.innerWidth>=Yb;ee(D),D&&M(!1)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[]),_.useEffect(()=>{if(!I)return;const b=F=>{const je=Vr.current;if(!je)return;const Fe=F.clientX-je.startX,kt=D0(je.startWidth+Fe);oo.current=kt,$a.current===null&&($a.current=window.requestAnimationFrame(()=>{$a.current=null;const Ve=oo.current,un=Q.current;Ve===null||!un||un.style.setProperty("--desktop-sidebar-width",`${Ve}px`)}))},D=()=>{$a.current!==null&&(window.cancelAnimationFrame($a.current),$a.current=null);const F=oo.current??ci.current;oo.current=null,Vr.current=null,ne(!1),ci.current=F,ae(F)};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[I]),_.useEffect(()=>{const b=D=>{const F=D.target;Un(!1),In(!1),!(F instanceof Element&&(F.closest(".conversation-topbar__actions")||F.closest(".conversation-topbar__title-actions")||F.closest(".picker-sheet")||F.closest(".picker-sheet-wrap")))&&(Ae(!1),te(!1),$e(!1))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[]),_.useEffect(()=>{const b=Q.current;if(!b||$)return;const D=kt=>{const Ve=kt.touches[0];kt.touches.length!==1||!Ve||Vf(kt.target)||(os.current={startX:Ve.clientX,startY:Ve.clientY})},F=kt=>{if(kt.touches.length!==1)return;const Ve=kt.touches[0];if(!es.current){const Os=os.current;if(!Os)return;const dn=Ve.clientX-Os.startX,ds=Ve.clientY-Os.startY;if(Math.abs(dn)<8&&Math.abs(ds)<8)return;if(Math.abs(dn)<=Math.abs(ds)){os.current=null;return}Ec(Os.startX,Os.startY)}ud(Ve.clientX,Ve.clientY)&&kt.preventDefault()},je=kt=>{if(os.current=null,!es.current)return;const Ve=kt.changedTouches[0];if(!Ve){es.current=null,Va(null);return}us(Ve.clientX,Ve.clientY)},Fe=()=>{os.current=null,es.current=null,Va(null)};return b.addEventListener("touchstart",D,{passive:!0,capture:!0}),b.addEventListener("touchmove",F,{passive:!1,capture:!0}),b.addEventListener("touchend",je,{capture:!0}),b.addEventListener("touchcancel",Fe,{capture:!0}),()=>{b.removeEventListener("touchstart",D,{capture:!0}),b.removeEventListener("touchmove",F,{capture:!0}),b.removeEventListener("touchend",je,{capture:!0}),b.removeEventListener("touchcancel",Fe,{capture:!0})}},[$,he]),_.useEffect(()=>{const b=ge.current;if(!b)return;if(wa.current&&oi.current!==null){const F=oi.current,je=b.scrollHeight;b.scrollTop+=Math.max(0,je-F),wa.current=!1,oi.current=null;return}if(!p||!lo.current||tl.length===0)return;fc();const D=window.setTimeout(()=>{fc(),lo.current=!1},120);return()=>{window.clearTimeout(D)}},[tl.length,p]),_.useEffect(()=>{const b=ge.current;if(!b)return;const D=()=>{hc()};return D(),b.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),()=>{b.removeEventListener("scroll",D),window.removeEventListener("resize",D)}},[tl.length,p]),_.useEffect(()=>{const b=ge.current;if(!b)return;const D=ra.data,F=(vm(D)||Tg(D)!=="full_compact")&&!Ss,je=()=>{Mi.current=null,Js.current=null,Ha(0),Xs(!1)},Fe=()=>{const dn=F&&Js.current!==null&&Ms>=kg;je(),dn&&mc("pull")},kt=dn=>{var ds,Ln;!F||dn.touches.length!==1||b.scrollTop>0||Yf(dn.target)||(Mi.current=((ds=dn.touches[0])==null?void 0:ds.clientX)??null,Js.current=((Ln=dn.touches[0])==null?void 0:Ln.clientY)??null)},Ve=dn=>{if(dn.defaultPrevented)return;const ds=Mi.current,Ln=Js.current;if(ds===null||Ln===null||dn.touches.length!==1)return;const ze=dn.touches[0],Bn=((ze==null?void 0:ze.clientX)??ds)-ds,Ns=((ze==null?void 0:ze.clientY)??Ln)-Ln;if(Math.abs(Bn)>Math.abs(Ns)){je();return}if(Ns<=0){Ha(0),Xs(!1);return}if(b.scrollTop>0){je();return}dn.cancelable&&dn.preventDefault(),Xs(!0),Ha(Math.min(Zb,Ns))},un=()=>{Fe()},Os=()=>{je()};return b.addEventListener("touchstart",kt,{passive:!0}),b.addEventListener("touchmove",Ve,{passive:!1}),b.addEventListener("touchend",un),b.addEventListener("touchcancel",Os),()=>{b.removeEventListener("touchstart",kt),b.removeEventListener("touchmove",Ve),b.removeEventListener("touchend",un),b.removeEventListener("touchcancel",Os)}},[Ss,mc,Ms,ra.data]),_.useEffect(()=>{var kt,Ve;if(!p){zn.current!==null&&(clearTimeout(zn.current),zn.current=null),(kt=ct.current)==null||kt.stream.setSessionId(null);return}let b=!1;const D=++gn.current,F=ri.current.agentId,je=()=>{zn.current!==null&&(clearTimeout(zn.current),zn.current=null)},Fe=()=>{l||(je(),zn.current=setTimeout(()=>{zn.current=null;const un=ri.current;uf(j,{scope:{sessionId:un.sessionId,agentId:un.agentId},selectedSessionId:un.sessionId})},xR))};return F&&((Ve=ct.current)==null?void 0:Ve.agentId)===F?(ct.current.stream.setSessionId(p),()=>{b=!0}):(_n().then(un=>{var ds,Ln;if(b||gn.current!==D)return;const Os=un.client.getConnectionKey();if(((ds=ct.current)==null?void 0:ds.key)===Os){ct.current.stream.setSessionId(p);return}(Ln=ct.current)==null||Ln.stream.close(),za.current=!1,Bs.current=!1;const dn=un.client.createEventStream(ze=>{var Ks,Qn,wo,Xa,Ot,yn,Zn,No,Sr,$i,ko,vl,jr,bh,Hn,Oc,Ic,wd,Nd,xh,Lc,Pc;const Bn=typeof((Ks=ze.payload)==null?void 0:Ks.sessionId)=="string"?ze.payload.sessionId:null,Ns=ri.current.sessionId,an=Bn===Ns?Ns:null,Za=typeof((Qn=ze.payload)==null?void 0:Qn.projectId)=="string"?ze.payload.projectId:null;if(ze.type==="agent.online"){if(Bs.current){Bs.current=!1;return}Y(),Fe();return}if(ze.type==="timeline.reset"&&an){et.current=Date.now(),Hs.current=!1,Zs.current=0,$s.current=null,ht({sessionId:an,pending:!1,error:null});const it=Array.isArray((wo=ze.payload)==null?void 0:wo.entries)?ze.payload.entries:[],Et=vm(j.getQueryData(["timeline",an]));Jr(s2(an,it,Et));const Ct=(Xa=it[it.length-1])==null?void 0:Xa.timestamp;Ct&&ps(Yt=>b0(Yt,an,Ct)),window.requestAnimationFrame(hc);return}if(ze.type==="interaction.reset"&&an){const it=Array.isArray((Ot=ze.payload)==null?void 0:Ot.requests)?ze.payload.requests:[];j.setQueryData(["interactions",an],it),Tt(Et=>Et&&it.some(Ct=>Ct.id===Et)?Et:null);return}if(ze.type==="plan.reset"&&an){const it=(yn=ze.payload)!=null&&yn.planSnapshot&&typeof ze.payload.planSnapshot=="object"?ze.payload.planSnapshot:null;j.setQueryData(["plan",an],it);return}if(ze.type==="timeline.delta"&&an){const it=Array.isArray((Zn=ze.payload)==null?void 0:Zn.entries)?ze.payload.entries:[],Et=vm(j.getQueryData(["timeline",an]));Jr(s2(an,ax(void 0,it),Et));const Ct=(No=it[it.length-1])==null?void 0:No.timestamp;Ct&&ps(Yt=>b0(Yt,an,Ct)),kp(),window.requestAnimationFrame(hc);return}if(ze.type==="interaction.delta"&&an){const it=Array.isArray((Sr=ze.payload)==null?void 0:Sr.requests)?ze.payload.requests:[],Et=Array.isArray(($i=ze.payload)==null?void 0:$i.resolvedRequestIds)?ze.payload.resolvedRequestIds.filter(Ct=>typeof Ct=="string"&&Ct.trim().length>0):[];j.setQueryData(["interactions",an],Ct=>{const Yt=new Map((Ct??[]).map(Nn=>[Nn.id,Nn]));for(const Nn of it)Yt.set(Nn.id,Nn);for(const Nn of Et)Yt.delete(Nn);return[...Yt.values()].sort((Nn,ha)=>+new Date(ha.updated_at)-+new Date(Nn.updated_at))}),Et.length>0&&Tt(Ct=>Ct&&Et.includes(Ct)?null:Ct);return}if(ze.type==="plan.delta"&&an){const it=(ko=ze.payload)!=null&&ko.planSnapshot&&typeof ze.payload.planSnapshot=="object"?ze.payload.planSnapshot:null;j.setQueryData(["plan",an],it);return}if(ze.type==="changeset.reset"&&an){const it=Array.isArray((vl=ze.payload)==null?void 0:vl.changeSets)?ze.payload.changeSets:[];it.length>0?(lr(it.map(Et=>Et.id)),j.setQueryData(["change-sets",an],it),Ai(an)):Ri.current.has(an)||(j.setQueryData(["change-sets",an],[]),Di(an));return}if(ze.type==="changeset.delta"&&an){const it=Array.isArray((jr=ze.payload)==null?void 0:jr.changeSets)?ze.payload.changeSets:[];lr(it.map(Et=>Et.id)),j.setQueryData(["change-sets",an],Et=>ZR(Et,it));return}if(ze.type==="terminal.snapshot"&&an){const it=(bh=ze.payload)!=null&&bh.snapshot&&typeof ze.payload.snapshot=="object"?ze.payload.snapshot:null;if(!it)return;j.setQueryData(["session-run-workbench",an],Et=>Et&&{...Et,terminal_snapshot:it}),Wn(Et=>{const Ct=new Set(it.terminals.map(Nn=>Nn.id)),Yt={};for(const[Nn,ha]of Object.entries(Et))Ct.has(Nn)&&(Yt[Nn]=ha);return Yt});return}if(ze.type==="terminal.delta"&&an){const it=(Hn=ze.payload)!=null&&Hn.terminal&&typeof ze.payload.terminal=="object"?ze.payload.terminal:null,Et=Array.isArray((Oc=ze.payload)==null?void 0:Oc.chunks)?ze.payload.chunks:[],Ct=typeof((Ic=ze.payload)==null?void 0:Ic.activeTerminalId)=="string"?ze.payload.activeTerminalId:null;if(!it)return;j.setQueryData(["session-run-workbench",an],Yt=>{if(!Yt)return Yt;const Nn=Yt.terminal_snapshot.terminals.filter(Ra=>Ra.id!==it.id),ha=Yt.terminal_snapshot.terminals.findIndex(Ra=>Ra.id===it.id),Eo=[...Nn];return ha<=0?Eo.unshift(it):Eo.splice(ha,0,it),{...Yt,terminal_snapshot:{...Yt.terminal_snapshot,active_terminal_id:Ct,updated_at:it.updated_at,terminals:Eo}}}),Wn(Yt=>{var ha;if(Et.length===0)return Yt;const Nn=Yt[it.id];return{...Yt,[it.id]:{chunks:Jb((Nn==null?void 0:Nn.chunks)??[],Et),nextCursor:typeof((ha=ze.payload)==null?void 0:ha.nextCursor)=="number"?ze.payload.nextCursor:it.output_cursor,truncated:(Nn==null?void 0:Nn.truncated)??!1,isLoading:!1,error:null}}});return}if(ze.type==="thread.updated"&&Za){const it=typeof((wd=ze.payload)==null?void 0:wd.action)=="string"?ze.payload.action:"",Et=(Nd=ze.payload)!=null&&Nd.projectPatch&&typeof ze.payload.projectPatch=="object"?ze.payload.projectPatch:null,Ct=Array.isArray((xh=ze.payload)==null?void 0:xh.orderedProjectIds)?ze.payload.orderedProjectIds.filter(Yt=>typeof Yt=="string"&&Yt.trim().length>0):[];if((it==="pin"||it==="unpin"||it==="rename")&&Et){ps(Yt=>pu(Yt,Za,Et));return}if(it==="reorder"&&Ct.length>0){ps(Yt=>cp(Yt,Ct));return}if(it==="remove"||it==="archive"){Y(),ps(Yt=>up(Yt,Za));return}if(it==="unarchive"){Y(),Fe();return}}if(ze.type==="session.updated"&&Bn){const it=(Lc=ze.payload)!=null&&Lc.sessionPatch&&typeof ze.payload.sessionPatch=="object"?v0(ze.payload.sessionPatch):null,Et=(Pc=ze.payload)!=null&&Pc.sessionPatch&&typeof ze.payload.sessionPatch=="object"?Pb(ze.payload.sessionPatch):null;Et&&Zu(Bn,Et);const Ct=lp(Jt.current??void 0,Bn);if(it&&Ct)ps(Yt=>cf(Yt,Bn,it));else{if(ri.current.embedded&&Bn===Ns&&!Jt.current)return;if(Ct)return;Fe()}an&&((it==null?void 0:it.run_state)==="running"||(it==null?void 0:it.run_state)==="completed"||(it==null?void 0:it.run_state)==="idle")&&(Re(it.run_state==="running"),it.run_state!=="running"&&Xe(!1));return}ze.type==="turn.completed"&&an&&(Re(!1),Xe(!1),j.setQueryData(["plan",an],null))},{sessionId:p,reconnectWhenHidden:!0,onStatus:ze=>{if(He(ze),ze.state==="connected"){const Bn=Date.now(),Ns=za.current;pe.current=Bn,Hs.current=Ns,Zs.current=Ns?Bn:0,$s.current=Ns?p:null,Bs.current=!0,Ns&&(Y(),Fe()),za.current=!0,In(!1);return}xs.current+=1,ot({state:"idle"})}});ct.current={key:Os,agentId:F,target:un,stream:dn},dn.setSessionId(p)}).catch(un=>{b||gn.current!==D||He({state:"failed",attempt:0,maxAttempts:5,error:un instanceof Error?un.message:"Unable to connect to live session."})}),()=>{b=!0})},[l,_n,p]),_.useEffect(()=>()=>{var b;gn.current+=1,zn.current!==null&&(clearTimeout(zn.current),zn.current=null),(b=ct.current)==null||b.stream.close(),ct.current=null},[]),_.useEffect(()=>{if(!p||(fe==null?void 0:fe.run_state)!=="running"||fe.context_usage)return;if(A.current!==p){A.current=p;return}let b=!1;const D=window.setTimeout(()=>{b||k.refetch()},1200);return()=>{b=!0,window.clearTimeout(D)}},[p,fe==null?void 0:fe.context_usage,fe==null?void 0:fe.run_state,k.refetch]),_.useEffect(()=>{var Fe,kt;if(!p||!O||!fe||!Rs||((Fe=k.data)==null?void 0:Fe.session.id)===p||k.isFetching||Jn.current===p||typeof window>"u")return;Jn.current=p;const b=window,D=()=>{k.refetch()},F=(kt=b.requestIdleCallback)==null?void 0:kt.call(b,D,{timeout:1500}),je=F===void 0?window.setTimeout(D,320):null;return()=>{var Ve;F!==void 0&&((Ve=b.cancelIdleCallback)==null||Ve.call(b,F)),je!==null&&window.clearTimeout(je)}},[Rs,fe,(xd=k.data)==null?void 0:xd.session.id,k.isFetching,k.refetch,O,p]),_.useEffect(()=>{Ae(!1)},[$,p]);const sl=_.useCallback(b=>{var D;Ke(b),((D=b.effect)==null?void 0:D.type)==="set_session_model"&&(nn(b.effect.model),b.effect.reasoning_effort&&jn(b.effect.reasoning_effort))},[]),oa=ss({mutationFn:async b=>(await _n()).client.sendSessionInput(b),onMutate:async b=>{await j.cancelQueries({queryKey:["timeline",b.sessionId]}),Le(null),Xe(!1),Re(!0),Ie(b.proposedPlanEntryId??null);const D=b.clearComposer!==!1;D&&(ie(""),se([])),pn.current&&window.clearTimeout(pn.current);const F=new Date().toISOString(),je=`${k_}${b.sessionId}:${Date.now()}`;wn.current=D?{optimisticEntryId:je,draft:b.input,attachments:b.attachments}:null,j.setQueryData(Po(b.sessionId),Fe=>N0(Fe,{id:je,kind:"user",title:"你",body:b.input,body_truncated:!1,detail_available:!1,patch_summary:null,session_ids:[],timestamp:F,accent:"primary",attachments:ox(b.attachments)})),ps(Fe=>cf(Fe,b.sessionId,{run_state:"running",run_state_changed_at:F,last_event_at:F}))},onSuccess:async(b,D)=>{Ie(null),D.proposedPlanEntryId&&_e(F=>{const je={...F};return delete je[D.proposedPlanEntryId],je}),await j.invalidateQueries({queryKey:rs}),await j.invalidateQueries({queryKey:["plan",D.sessionId]}),await j.invalidateQueries({queryKey:["change-sets",D.sessionId]}),pn.current=null},onError:(b,D)=>{Ie(null),Re(!1);const F=wn.current;F&&(j.setQueryData(Po(D.sessionId),je=>PT(je,F.optimisticEntryId)),ie(je=>je||F.draft),se(je=>je.length>0?je:F.attachments),wn.current=null),Le(b instanceof Error?b.message:"无法发送消息")}}),_c=ss({mutationFn:async b=>(await _n()).client.executeSessionCommand(b),onMutate:b=>{Le(null),ie(""),se([]);const D=b.input.slice(1).trim().split(/\s+/)[0]??"",F=new Date().toISOString();Ke({panel_id:`command-panel-pending-${Date.now()}`,session_id:b.sessionId,command_name:D,command_text:b.input,title:`正在执行 /${D}`,description:null,status:"running",body:"命令执行中…",submitted_at:F,updated_at:F,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async b=>{sl(b.panel),await j.invalidateQueries({queryKey:rs})},onError:(b,D)=>{Ke(null),ie(F=>F||D.input),Le(b instanceof Error?b.message:"无法执行命令")}}),fi=ss({mutationFn:async b=>(await _n()).client.respondToSessionCommand(b),onMutate:()=>{Le(null)},onSuccess:async b=>{sl(b.panel),await j.invalidateQueries({queryKey:rs})},onError:b=>{Le(b instanceof Error?b.message:"无法继续执行命令")}}),sd=ss({mutationFn:async b=>(await _n()).client.respondToSessionInteraction(b),onMutate:async b=>{Le(null),Tt(b.requestId),j.setQueryData(["interactions",b.sessionId],D=>(D??[]).map(F=>F.id===b.requestId?{...F,status:"submitting",updated_at:new Date().toISOString()}:F))},onSuccess:async(b,D)=>{await j.invalidateQueries({queryKey:["interactions",D.sessionId]})},onError:(b,D)=>{j.setQueryData(["interactions",D.sessionId],F=>(F??[]).map(je=>je.id===D.requestId?{...je,status:"pending"}:je)),Tt(null),Le(b instanceof Error?b.message:"无法提交确认回复")}}),Fa=ss({mutationFn:async b=>(await _n()).client.interruptSession(b),onMutate:async b=>{Le(null),Xe(!0),Re(!1),pn.current&&(window.clearTimeout(pn.current),pn.current=null);const D=new Date().toISOString();ps(F=>cf(F,b,{run_state:"completed",run_state_changed_at:D,last_event_at:D})),j.setQueryData(["plan",b],null)},onSuccess:(b,D)=>{Xe(!1),j.invalidateQueries({queryKey:rs}),j.invalidateQueries({queryKey:["timeline",D]}),j.invalidateQueries({queryKey:["change-sets",D]})},onError:(b,D)=>{Xe(!1),Re(!0),j.invalidateQueries({queryKey:rs}),j.invalidateQueries({queryKey:["plan",D]}),Le(b instanceof Error?b.message:"无法中断会话")}});_.useEffect(()=>{!p||!fe||We||Fa.isPending||Re(fe.run_state==="running")},[Fa.isPending,We,fe,fe==null?void 0:fe.run_state,p]);const Kn=ss({mutationFn:async b=>(await xn({sessionId:b.sessionId})).client.updateSession(b)}),al=ss({mutationFn:async b=>(await xn({projectId:b.projectId,agentId:b.agentId})).client.updateThread(b)}),Fs=ss({mutationFn:async b=>(await _n()).client.executeSessionGitAction({sessionId:p,action:b.action,path:b.path,branch:b.branch,message:b.message}),onMutate:async()=>{Us(null)},onSuccess:(b,D)=>{j.setQueryData(["session-git-workspace",p],b.workspace),(D.action==="commit-all"||D.action==="switch-branch")&&j.invalidateQueries({queryKey:["session-git-history",p]})},onError:b=>{Us(b instanceof Error?b.message:"无法执行 git 操作")}}),qa=ss({mutationFn:async b=>(await _n()).client.saveSessionRunCommand({sessionId:p,action:b.action,commandId:b.commandId,command:b.command}),onMutate:()=>{Fn(null)},onSuccess:({catalog:b})=>{j.setQueryData(["session-run-workbench",p],D=>D&&{...D,command_catalog:b})},onError:b=>{Fn(b instanceof Error?b.message:"无法保存项目命令。")}}),Wa=ss({mutationFn:async b=>(await _n()).client.saveSessionRunWebsite({sessionId:p,action:b.action,websiteId:b.websiteId,website:b.website}),onMutate:()=>{Fn(null)},onSuccess:({catalog:b})=>{j.setQueryData(["session-run-workbench",p],D=>D&&{...D,website_catalog:b})},onError:b=>{Fn(b instanceof Error?b.message:"无法保存项目网页。")}}),yc=ss({mutationFn:async()=>(await _n()).client.generateSessionRunCommand({sessionId:p,prompt:"",model:Am()}),onMutate:()=>{Fn(null),jt(null)},onSuccess:({generation:b,catalog:D})=>{j.setQueryData(["session-run-workbench",p],F=>F&&{...F,command_catalog:D}),jt(b.reason)},onError:b=>{Fn(b instanceof Error?b.message:"无法一键生成项目命令。")}}),vc=ss({mutationFn:async()=>(await _n()).client.generateSessionRunWebsite({sessionId:p,prompt:"",model:Am()}),onMutate:()=>{Fn(null),Kt(null)},onSuccess:({generation:b,catalog:D})=>{j.setQueryData(["session-run-workbench",p],F=>F&&{...F,website_catalog:D}),Kt(b.reason)},onError:b=>{Fn(b instanceof Error?b.message:"无法一键生成项目网页。")}}),cs=ss({mutationFn:async b=>(await _n()).client.executeSessionTerminalAction({sessionId:p,action:b.action,commandId:b.commandId,terminalId:b.terminalId}),onMutate:()=>{Fn(null)},onSuccess:async(b,D)=>{j.setQueryData(["session-run-workbench",p],F=>F&&{...F,terminal_snapshot:b.snapshot}),(D.action==="run-command"||D.action==="run-kill-command")&&b.terminal&&(te(!1),Qt("terminal"),await gc(b.terminal.id,{force:!0})),D.action==="focus"&&D.terminalId&&await gc(D.terminalId),D.action==="close"&&D.terminalId&&Wn(F=>{const je={...F};return delete je[D.terminalId],je})},onError:b=>{Fn(b instanceof Error?b.message:"无法执行终端操作。")}}),bc=th.data??[],sh=fe&&Tg(ra.data)!=="tail"?xA(fe):!1,js=_.useMemo(()=>SA(nl,{projectPath:Rs==null?void 0:Rs.path,compactCompletedTurns:sh}),[sh,Rs==null?void 0:Rs.path,nl]),dr=_.useMemo(()=>EA(js.blocks,bc),[js.blocks,bc]),ad=_.useMemo(()=>{const b=ra.data,D=vm(b),F=Tg(b),je=Math.max(0,Math.min(Zb,Ms)),Fe=Math.max(0,Math.min(1,je/kg));return{hasEarlierEntries:D,canLoadEarlierEntries:D||F!=="full_compact",isPulling:ar,pullDistance:je,isReadyToLoad:je>=kg,isLoadingFull:Ss,indicatorOffset:Ss?M0:Math.min(M0,je*.75),indicatorRotation:Ss?Xb:Math.round(Fe*Xb),triggerSource:rr}},[Ss,ar,rr,Ms,ra.data]),il=[...dr].reverse().find(b=>b.kind==="turn"&&!b.turn.completion)??null;_.useEffect(()=>{var je;if(typeof window>"u")return;const b=window,D=(je=b.requestIdleCallback)==null?void 0:je.call(b,()=>{R0()},{timeout:1500}),F=D===void 0?window.setTimeout(()=>{R0()},320):null;return()=>{var Fe;D!==void 0&&((Fe=b.cancelIdleCallback)==null||Fe.call(b,D)),F!==null&&window.clearTimeout(F)}},[]);const fo=!!(fe&&Rs),ah=!!p&&k.isPending&&!fe;fe??(fe=wR),Rs??(Rs=SR);const xc=!!p&&Ge.sessionId!==p,ih=!!p&&!fo&&(Ge.pending||xc||ah),rl=ih?"正在载入会话…":k.error instanceof Error?k.error.message:Ge.error?Ge.error:"没有找到这个会话。",ho=fe.capability.can_send_input&&!We,fr=ho&&(a===void 0||a==="online"),ll=(nd.data??[]).filter(b=>b.status==="pending"||b.status==="submitting"),id=(fe.run_state==="running"||Me)&&!We||Fa.isPending,Ka=ho&&ll.length===0&&!id&&!oa.isPending,Oi=(on==null?void 0:on.id)??fe.agent_id,Sc=_.useCallback((b,D)=>{_e(F=>{if(!D.trim()){if(!(b in F))return F;const je={...F};return delete je[b],je}return{...F,[b]:D}})},[]),rd=_.useCallback((b,D)=>{const F=D.trim();!F||!Ka||oa.mutate({sessionId:fe.id,input:F,attachments:[],model:tt,reasoningEffort:Xt,serviceTier:zt?"fast":void 0,planMode:yt,yoloMode:dt,clearComposer:!1,proposedPlanEntryId:b})},[Ka,zt,yt,dt,tt,Xt,oa,fe.id]),hr=_.useMemo(()=>i.jsx(RA,{sessionId:fe.id,sessions:or,sessionRunState:fe.run_state,isDesktopSidebar:l?!!o:$,projectPath:Rs.path,renderedBlocks:dr,lastToolGroupId:js.lastToolGroupId,sessionChangeSets:bc,isSubagentTimelinePending:nh,isInitialTimelinePending:!!p&&nl.length===0&&(Ge.pending||xc),hasTimeline:nl.length>0,proposedPlanReplyDrafts:V,pendingProposedPlanReplyEntryId:Te,canRespondToProposedPlan:Ka,onProposedPlanReplyDraftChange:Sc,onSubmitProposedPlanReply:rd,onPreviewImage:ye,changeSetDiffs:Ti,changeSetDiffErrors:tr,loadingChangeSetDiffKeys:sr,onLoadSessionChangeSets:Jf,onLoadChangeSetFileDiff:eh,onLoadFullTimeline:()=>{mc()},timelineLoadState:ad},fe.id),[Ka,tr,Ti,Sc,rd,l,$,o,nh,Jf,eh,mc,sr,Te,Rs.path,V,dr,js.lastToolGroupId,fe.id,fe.run_state,bc,or,nl.length,ad]),Ii=_.useCallback(async(b,D,F)=>{var je;Le(null),Ae(!1),D==="pin"||D==="unpin"?ki.flushSync(()=>{ps(Fe=>op(Fe,b,{pinned:D==="pin"}))}):D==="rename"&&(F!=null&&F.trim())&&ps(Fe=>op(Fe,b,{title:F.trim()}));try{const Fe=await Kn.mutateAsync({sessionId:b,action:D,name:F}),kt=(je=Fe.affectedSessionIds)!=null&&je.length?Fe.affectedSessionIds:[b];if(D==="delete"){ps(Ve=>p3(Ve,kt)),Y();for(const Ve of kt)j.removeQueries({queryKey:["timeline",Ve],exact:!0}),j.removeQueries({queryKey:Po(Ve),exact:!0}),j.removeQueries({queryKey:["change-sets",Ve],exact:!0}),Di(Ve)}else ps(Ve=>m3(Ve,kt,{...D==="rename"&&(F!=null&&F.trim())?{title:F.trim()}:{pinned:D==="pin"}}));if(b===fe.id&&D==="delete"){const Ve=Fe.nextSessionId;Ve?await Zr(Ve):await Xr()}}catch(Fe){j.invalidateQueries({queryKey:rs}),Le(Fe instanceof Error?Fe.message:"无法更新会话")}},[Xr,Zr,j,Y,Di,fe.id,Kn]),rh=_.useCallback(async(b,D,F)=>{var Fe,kt;Le(null),Ae(!1);const je=(Fe=F==null?void 0:F.name)==null?void 0:Fe.trim();D==="pin"||D==="unpin"?ki.flushSync(()=>{ps(Ve=>pu(Ve,b,{pinned:D==="pin"}))}):D==="rename"&&je?ps(Ve=>pu(Ve,b,{display_name:je})):D==="reorder"&&((kt=F==null?void 0:F.orderedProjectIds)!=null&&kt.length)?ps(Ve=>cp(Ve,F.orderedProjectIds??[])):D==="remove"||D==="archive"?(ps(Ve=>up(Ve,b)),Y()):D==="unarchive"&&(Y(),j.invalidateQueries({queryKey:rs}));try{const Ve=await al.mutateAsync({projectId:b,agentId:(on==null?void 0:on.id)??fe.agent_id,action:D,name:F==null?void 0:F.name,orderedProjectIds:F==null?void 0:F.orderedProjectIds});if(D==="remove"||D==="archive"||D==="unarchive"){const un=Ve.nextSessionId;un?await Zr(un):await Xr()}}catch(Ve){j.invalidateQueries({queryKey:rs}),Le(Ve instanceof Error?Ve.message:"无法更新线程")}},[Xr,Zr,j,Y,al]),lh=_.useCallback(async b=>{Oi&&(Zi(Oi),sa(null),Wr(null),fu(b),await N({to:"/"}))},[Oi,N]),Mp=((xr=la.data)==null?void 0:xr.steps.some(b=>b.status==="pending"||b.status==="in_progress"))??!1,oh=fe.run_state==="running"||Me,Rp=!!((gl=la.data)!=null&&gl.updated_at&&Date.now()-new Date(la.data.updated_at).getTime()<=pR),ch=la.data&&(Mp||oh&&Rp)?la.data:null,ca=fe.context_usage,jc=ca?Math.round(ca.percent_used):0,Ea=Math.max(0,100-jc),wc=ca?{"--usage-progress":`${Math.max(0,Math.min(100,ca.percent_used))}%`}:void 0,ua=Ue.state==="connected"&&mt.state==="idle"&&oh&&!We&&!Fa.isPending&&!(il!=null&&il.turn.completion),ol=!!bn||td.length>0;_.useEffect(()=>{p&&(xs.current+=1,ot({state:"idle"}))},[p]),_.useEffect(()=>{if(!Je)return;(nd.data??[]).some(D=>D.id===Je&&D.status==="submitting")||Tt(null)},[nd.data,Je]),_.useEffect(()=>{var b;!p||!fo||fe.run_state==="running"||oa.isPending||Fa.isPending||il||(b=la.data)!=null&&b.is_active||(pn.current&&(window.clearTimeout(pn.current),pn.current=null),Re(!1))},[il,fo,Fa.isPending,(So=la.data)==null?void 0:So.is_active,oa.isPending,fe,fe==null?void 0:fe.run_state,p]);const ea=$?0:CA(),Nc=$||he,mo=$?0:Wt??(he?ea:0),ld=qe&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{xt(!1),ue(fe.title)},"aria-label":"关闭重命名会话面板"}),i.jsx("div",{className:"sheet-wrap__center",children:i.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[i.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),i.jsx("input",{className:"sheet-panel__input",value:Dt,onChange:b=>ue(b.target.value),placeholder:"输入会话名称",autoFocus:!0}),i.jsxs("div",{className:"sheet-panel__actions",children:[i.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{xt(!1),ue(fe.title)},children:"取消"}),i.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Dt.trim()||Kn.isPending&&((_l=Kn.variables)==null?void 0:_l.sessionId)===fe.id,onClick:()=>{Ii(fe.id,"rename",Dt.trim()),xt(!1)},children:"保存"})]})]})})]}),document.body):null,mr=!(l?o:$)&&ce&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Ae(!1),"aria-label":"关闭会话操作菜单"}),i.jsxs("div",{className:"picker-sheet",children:[i.jsx("div",{className:"picker-sheet__header",children:i.jsx("strong",{children:fe.title})}),i.jsxs("div",{className:"picker-sheet__list",children:[i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Kn.isPending&&((jo=Kn.variables)==null?void 0:jo.sessionId)===fe.id,onClick:()=>void Ii(fe.id,fe.pinned?"unpin":"pin"),children:i.jsx("span",{children:fe.pinned?"取消置顶会话":"置顶会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item",disabled:Kn.isPending&&((Sd=Kn.variables)==null?void 0:Sd.sessionId)===fe.id,onClick:()=>{Ae(!1),xt(!0)},children:i.jsx("span",{children:"重命名会话"})}),i.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:Kn.isPending&&((Hi=Kn.variables)==null?void 0:Hi.sessionId)===fe.id,onClick:()=>void Ii(fe.id,"delete"),children:i.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,uh=$?1:ea>0?mo/ea:0,po=!$&&Wt!==null,cl=$?{"--desktop-sidebar-width":`${oe}px`}:void 0,As=l?!!o:$,Ds=l?u:mo,go=l?f:po,hi=Fs.isPending?Fs.variables??null:null,dh=Ua??(cr.error instanceof Error?cr.error.message:null),kc=ka.error instanceof Error?ka.error.message:null,Qa=Ci??(ur.error instanceof Error?ur.error.message:null),qs=ur.data??null,Ca=(qs==null?void 0:qs.terminal_snapshot)??null,mi=(qs==null?void 0:qs.command_catalog.commands)??[],od=(qs==null?void 0:qs.website_catalog.websites)??[],Ws=fp(Am(),Ee),Li=(Ca==null?void 0:Ca.terminals.find(b=>b.id===Ca.active_terminal_id))??(Ca==null?void 0:Ca.terminals[0])??null,pi=Na&&De==="terminal",ul=ui&&De==="git",Ta=As&&pi&&On,da=ul&&As,ws=(pi||ul)&&As&&!Ta,Pi=(pi||ul)&&!As,Ma=cs.isPending&&((jd=cs.variables)==null?void 0:jd.action)==="run-command"?cs.variables.commandId??null:null,Ga=cs.isPending&&((vi=cs.variables)==null?void 0:vi.action)==="run-kill-command"?cs.variables.commandId??null:null,Ya=qa.isPending&&((Ac=qa.variables)==null?void 0:Ac.action)==="delete"?qa.variables.commandId??null:null,cd=Wa.isPending&&((Dc=Wa.variables)==null?void 0:Dc.action)==="delete"?Wa.variables.websiteId??null:null;_.useEffect(()=>{!As&&On&&Ts(!1)},[On,As]);const Va=b=>{Vu.current=b,ls(b)},Ec=(b,D,F)=>(es.current={mode:he?"close":"open",startX:b,startY:D,axis:"pending",pointerId:F},!0),ud=(b,D)=>{const F=es.current;if(!F)return!1;const je=b-F.startX,Fe=D-F.startY;if(F.axis==="pending"){if(Math.abs(je)<8&&Math.abs(Fe)<8)return!1;if(F.axis=Math.abs(je)>Math.abs(Fe)?"x":"y",F.axis==="y")return es.current=null,Va(null),!1}const kt=F.mode==="open"?Math.max(0,Math.min(ea,je)):Math.max(0,Math.min(ea,ea+je));return Va(kt),!0},us=(b,D)=>{const F=es.current;if(!F)return;const je=b-F.startX,Fe=D-F.startY;if(F.axis==="pending"&&Math.abs(Fe)>48){es.current=null,Va(null);return}const Ve=(F.axis==="x"?Vu.current??(F.mode==="open"?Math.max(0,Math.min(ea,je)):Math.max(0,Math.min(ea,ea+je))):he?ea:0)>=ea*fR;M(Ve),es.current=null,Va(null)},Tn=_.useCallback(()=>{if(l){m==null||m();return}M(!0)},[l,m]),Gt=_.useCallback(()=>{In(b=>!b)},[]),Ui=_.useCallback(()=>{Le(null)},[]),fa=_.useCallback(()=>{Dn(b=>!b)},[]),dd=_.useCallback(b=>{Zr(b)},[Zr]),gi=_.useCallback(b=>{const D=new Date().toISOString();if(Ee.length===0){Ke({panel_id:`${Eg}${Date.now()}`,session_id:fe.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:D,updated_at:D,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}Ke({panel_id:`${Eg}${Date.now()}`,session_id:fe.id,command_name:"model",command_text:b,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:D,updated_at:D,input_type:"choice",options:Ee.map(F=>({id:F.value,label:F.label,description:F.description??null})),input_placeholder:null,submit_label:null,effect:null})},[Ee,fe.id]),fh=_.useCallback(()=>{if(fr){if(T_(U)){if(Se.length>0){Le("命令暂不支持附件,请先移除附件后再执行。");return}if(WR(U)==="model"){Le(null),ie(""),gi(U);return}_c.mutate({sessionId:fe.id,input:U});return}oa.mutate({sessionId:fe.id,input:U.trim(),attachments:Se,model:tt,reasoningEffort:Xt,serviceTier:zt?"fast":void 0,planMode:yt,yoloMode:dt})}},[fr,U,zt,yt,dt,_c,gi,Se,tt,Xt,oa,fe.id]),hh=_.useCallback(()=>{Ke(null)},[]),dl=_.useCallback(b=>{if(_t){if(_t.panel_id.startsWith(Eg)){nn(b),Ke(D=>D&&{...D,status:"completed",body:`后续消息将优先使用 ${fp(b,Ee)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}fi.mutate({sessionId:fe.id,panelId:_t.panel_id,optionId:b})}},[_t,fi,Ee,fe.id]),pr=_.useCallback(b=>{_t&&fi.mutate({sessionId:fe.id,panelId:_t.panel_id,text:b})},[_t,fi,fe.id]),fd=_.useCallback(b=>{sd.mutate({sessionId:fe.id,requestId:b.requestId,optionId:b.optionId??null,text:b.text??null,answers:b.answers})},[sd,fe.id]),_o=_.useCallback(b=>{const D=[...b];D.length!==0&&(Le(null),Promise.all(D.map(F=>lx(F))).then(F=>{se(je=>[...je,...F])}).catch(F=>{Le(F instanceof Error?F.message:"无法读取附件")}))},[]),hd=_.useCallback(b=>{se(D=>D.filter(F=>F.id!==b))},[]),gr=_.useCallback(()=>{Fa.isPending||We||Fa.mutate(fe.id)},[Fa,We,fe.id]),_i=_.useCallback(()=>{Un(b=>!b)},[]),ta=_.useCallback(b=>{b==="git"&&!ui||b==="terminal"&&!Na||(Us(null),Fn(null),te(!1),$e(!1),Ts(!1),Qt(b))},[ui,Na]);_.useEffect(()=>{if(!ws)return;const b=D=>{var je,Fe;const F=D.target;F instanceof Node&&((je=me.current)!=null&&je.contains(F)||(Fe=Z.current)!=null&&Fe.contains(F)||ta("code"))};return window.addEventListener("pointerdown",b),()=>{window.removeEventListener("pointerdown",b)}},[ta,ws]);const yi=_.useCallback(()=>{Us(null),cr.refetch()},[cr]),md=_.useCallback(()=>{ka.refetch()},[ka]),pd=_.useCallback(()=>{ka.data||ka.isFetching||ka.refetch()},[ka]),fl=_.useCallback(b=>{Fs.mutate({action:"discard-file",path:b})},[Fs]),Cc=_.useCallback(()=>{Fs.mutate({action:"discard-all"})},[Fs]),_r=_.useCallback(b=>{Fs.mutate({action:"commit-all",message:b})},[Fs]),gs=_.useCallback(async(b,D)=>{Us(null);const F=(D==null?void 0:D.trim())??"";F&&await Fs.mutateAsync({action:"commit-all",message:F}),await Fs.mutateAsync({action:"switch-branch",branch:b})},[Fs]),Tc=_.useCallback(()=>{Fs.mutate({action:"push"})},[Fs]),mh=_.useCallback(async(b,D,F)=>(await _n()).client.getSessionGitHistoryFileDiff(fe.id,{commitOid:b,path:D,previousPath:F}),[_n,fe.id]),Ap=_.useCallback(async(b,D)=>(await _n()).client.getSessionGitWorkspaceFileDiff(fe.id,{path:b,previousPath:D}),[_n,fe.id]),ph=_.useCallback(b=>{cs.mutate({action:"run-command",commandId:b})},[cs]),gh=_.useCallback(async()=>{if(!(mi.length===0||at||ft)){Ut(!0);try{for(const b of mi)await cs.mutateAsync({action:"run-command",commandId:b.id})}finally{Ut(!1)}}},[at,ft,mi,cs]),Vn=_.useCallback(async()=>{if(at||ft)return;const b=mi.filter(D=>!!D.kill_command);if(b.length!==0){Mt(!0);try{for(const D of b)await cs.mutateAsync({action:"run-kill-command",commandId:D.id})}finally{Mt(!1)}}},[at,ft,mi,cs]),gd=_.useCallback(b=>{cs.mutate({action:"run-kill-command",commandId:b})},[cs]),hl=_.useCallback(b=>{qa.mutate({action:b.commandId?"update":"create",commandId:b.commandId,command:b.draft})},[qa]),ml=_.useCallback(b=>{qa.mutate({action:"delete",commandId:b})},[qa]),Mc=_.useCallback(()=>{yc.mutate()},[yc]),yr=_.useCallback(b=>{Wa.mutate({action:b.websiteId?"update":"create",websiteId:b.websiteId,website:b.draft})},[Wa]),vr=_.useCallback(b=>{Wa.mutate({action:"delete",websiteId:b})},[Wa]),_h=_.useCallback(()=>{vc.mutate()},[vc]),_d=_.useCallback(()=>{$e(!1)},[]),Dp=_.useCallback(b=>{cs.mutate({action:"focus",terminalId:b}),Qt("terminal")},[cs]),yh=_.useCallback(b=>{cs.mutate({action:"close",terminalId:b})},[cs]),br=_.useCallback(()=>{!As||!Na||(Qt("terminal"),Ts(b=>!b))},[Na,As]),Rc=_.useMemo(()=>{var b,D,F;return i.jsxs("div",{className:"conversation-topbar__title-actions",children:[i.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Ae(je=>!je),"aria-label":"更多会话选项",children:i.jsx(ER,{})}),ce&&As?i.jsxs("div",{className:"topbar-menu",role:"menu",children:[i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Kn.isPending&&((b=Kn.variables)==null?void 0:b.sessionId)===fe.id,onClick:()=>void Ii(fe.id,fe.pinned?"unpin":"pin"),children:fe.pinned?"取消置顶会话":"置顶会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item",disabled:Kn.isPending&&((D=Kn.variables)==null?void 0:D.sessionId)===fe.id,onClick:()=>{Ae(!1),xt(!0)},children:"重命名会话"}),i.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:Kn.isPending&&((F=Kn.variables)==null?void 0:F.sessionId)===fe.id,onClick:()=>void Ii(fe.id,"delete"),children:"删除会话"})]}):null]})},[Ii,ce,As,fe.id,fe.pinned,Kn.isPending,(bi=Kn.variables)==null?void 0:bi.sessionId]),yo=_.useMemo(()=>Na||ui?i.jsxs("div",{className:"conversation-topbar__actions",children:[Na?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Vs?"is-active":""}`,onClick:()=>{$e(!1),te(b=>!b)},"aria-expanded":Vs,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:i.jsx(OR,{})}),Vs?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:i.jsx(GM,{commands:mi,nodeRuntime:(qs==null?void 0:qs.node_runtime)??null,error:Qa,pendingRunCommandId:Ma,pendingKillCommandId:Ga,pendingDeleteCommandId:Ya,isSaving:qa.isPending,isGenerating:yc.isPending,isStartingAll:at,isStoppingAll:ft,generationReason:qn,executionModelLabel:Ws,onRun:ph,onRunAll:gh,onRunAllKill:Vn,onRunKill:gd,onSave:hl,onDelete:ml,onGenerate:Mc})}):null]}):null,Na?i.jsxs("div",{className:"conversation-topbar__run-group",children:[i.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Pe?"is-active":""}`,onClick:()=>{te(!1),$e(b=>!b)},"aria-expanded":Pe,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:i.jsx(IR,{})}),Pe?i.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:i.jsx(eR,{websites:od,error:Qa,pendingDeleteWebsiteId:cd,isSaving:Wa.isPending,isGenerating:vc.isPending,generationReason:zs,executionModelLabel:Ws,onOpen:_d,onSave:yr,onDelete:vr,onGenerate:_h})}):null]}):null,Na||ui?i.jsxs("div",{ref:Z,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="code"?"is-active":""}`,onClick:()=>ta("code"),"aria-pressed":De==="code","aria-label":"切换到代码会话视图",children:i.jsx(RR,{})}),Na?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="terminal"?"is-active":""}`,onClick:()=>ta("terminal"),"aria-pressed":De==="terminal","aria-label":"切换到终端视图",children:i.jsx(DR,{})}):null,ui?i.jsx("button",{type:"button",className:`conversation-topbar__view-button ${De==="git"?"is-active":""}`,onClick:()=>ta("git"),"aria-pressed":De==="git","aria-label":"切换到 git 视图",children:i.jsx(AR,{})}):null]}):null]}):null,[De,ui,Na,qn,zs,at,ft,Ws,yc.isPending,vc.isPending,ml,Mc,vr,_h,_d,ph,gh,Vn,hl,yr,ta,Vs,Pe,Ya,cd,Ma,mi,od,Qa,qa.isPending,Wa.isPending]),vh=i.jsx(FM,{workspace:cr.data??null,history:ka.data??null,isLoading:cr.isPending,isHistoryLoading:ka.isFetching,error:dh,historyError:kc,onRefresh:yi,onRefreshHistory:md,onRequestHistory:pd,onDiscardFile:fl,onDiscardAll:Cc,onCommitAll:_r,onSwitchBranch:gs,onPush:Tc,onLoadWorkspaceFileDiff:Ap,onLoadHistoryFileDiff:mh,pendingAction:hi,compact:da}),pl=i.jsx(cR,{terminals:(Ca==null?void 0:Ca.terminals)??[],activeTerminalId:(Li==null?void 0:Li.id)??null,outputs:bs,error:Qa,compact:ws||Ta,canToggleFullscreen:As,isFullscreen:Ta,onSelectTerminal:Dp,onCloseTerminal:yh,onToggleFullscreen:br}),yd=i.jsx(fx,{isDesktopSidebar:As,sidebarShift:Ds,isSidebarDragging:go,composerError:Oe,onDismissComposerError:Ui,interactionRequests:ll,pendingInteractionRequestId:Je,onRespondInteraction:fd,parentSession:bn,backgroundAgentSessions:td,isBackgroundAgentsOpen:Cn,planSnapshot:ch,onToggleBackgroundAgents:fa,onOpenSession:dd,getBackgroundAgentStatusLabel:rA,getBackgroundAgentAccent:sA,formatBackgroundAgentsLabel:XR,hasBackgroundAgentStrip:ol,commandPanel:_t,isCommandPanelPending:_c.isPending||fi.isPending,onDismissCommandPanel:hh,onCommandPanelOptionSelect:dl,onCommandPanelTextSubmit:pr,projectId:fe.project_id,agentId:(on==null?void 0:on.id)??fe.agent_id,draft:U,pendingAttachments:Se,canSendInput:ho,canSubmitInput:fr,isInputLocked:ll.length>0,readOnlyPlaceholder:ll.length>0?"请先处理上方确认请求":void 0,onDraftChange:ie,onUploadFiles:_o,onRemoveAttachment:hd,onSubmit:fh,showStopIcon:id,isSendPending:oa.isPending||_c.isPending||fi.isPending,onInterrupt:gr,isFastModeEnabled:zt,isPlanModeEnabled:yt,isYoloModeEnabled:dt,onToggleFastMode:()=>Bt(b=>!b),onTogglePlanMode:()=>bt(b=>!b),onToggleYoloMode:()=>cn(b=>!b),showModeBadges:!0,selectedModel:tt,modelOptions:Ee,selectedReasoning:Xt,onSelectModel:nn,onSelectReasoning:b=>jn(b),contextUsage:ca,isContextUsageOpen:Nt,onToggleContextUsage:_i,contextUsageRingStyle:wc,usedPercent:jc,remainingPercent:Ea,usedTokensLabel:e2((ca==null?void 0:ca.used_tokens)??0),totalTokensLabel:e2((ca==null?void 0:ca.total_tokens)??0),showJumpToBottom:P,onJumpToBottom:fc}),vo=pi?pl:vh,bo=Pi||Ta,vd=bo?i.jsxs("div",{ref:G,className:`conversation-main ${As?"has-desktop-sidebar":""} ${Ta?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${Ds}px)`,transition:go?"none":void 0},children:[i.jsxs("div",{className:"conversation-topbar",children:[As?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:Tn,"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]}),i.jsx("div",{className:"conversation-topbar__meta",children:i.jsxs("div",{className:"conversation-topbar__title-row",children:[i.jsx("h1",{children:fe.title}),Rc]})}),yo]}),i.jsx("div",{ref:ge,className:`conversation-scroll ${bo?"conversation-scroll--workbench":""}`,children:i.jsx("div",{className:`session-workbench-surface ${Ta?"is-terminal-fullscreen":""}`,children:vo})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`session-detail-workspace ${ws?"has-workbench-panel":""}`,children:[i.jsx(uR,{conversationMainRef:G,conversationScrollRef:ge,isDesktopSidebar:As,sidebarShift:Ds,isSidebarDragging:go,title:fe.title,titleActions:Rc,topbarActions:yo,onOpenSidebar:Tn,threadContent:hr,connectionStatus:Ue,sessionRecoveryStatus:mt,isConnectionDetailOpen:as,onToggleConnectionDetail:Gt,showThinkingStatus:ua}),ws?i.jsx("aside",{ref:me,className:"session-workbench-rail",children:vo}):null]}),Ta?null:yd]}),xo=i.jsxs(i.Fragment,{children:[ld,mr,we&&typeof document<"u"?ki.createPortal(i.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${we.label}`,children:[i.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ye(null),"aria-label":"关闭图片预览"}),i.jsxs("div",{className:"attachment-lightbox__panel",children:[i.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ye(null),"aria-label":"关闭图片预览",children:i.jsx(MR,{})}),i.jsx("div",{className:"attachment-lightbox__frame",children:i.jsx("img",{src:we.src,alt:we.label,className:"attachment-lightbox__image"})}),i.jsxs("div",{className:"attachment-lightbox__meta",children:[i.jsx("div",{className:"attachment-lightbox__title",children:we.label}),i.jsx("div",{className:"attachment-lightbox__hint",children:we.meta})]})]})]}),document.body):null]});if(!fo){const b=i.jsx("div",{className:"conversation-main conversation-main--empty",children:ih?i.jsxs("div",{className:"empty-panel empty-panel--loading",role:"status","aria-live":"polite","aria-busy":"true",children:[i.jsxs("span",{className:"empty-panel__loading-dots","aria-hidden":"true",children:[i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"}),i.jsx("span",{className:"empty-panel__loading-dot"})]}),i.jsx("span",{className:"sr-only",children:"正在加载会话"})]}):i.jsx("div",{className:"empty-panel",children:rl})});return l?i.jsxs(i.Fragment,{children:[b,xo]}):i.jsxs("div",{className:"conversation-page",children:[b,xo]})}return l?i.jsxs(i.Fragment,{children:[vd,xo]}):i.jsxs("div",{ref:Q,className:`conversation-page ${$?"has-desktop-sidebar":""}`,style:cl,onPointerDown:b=>{$||b.pointerType!=="touch"&&(b.pointerType==="mouse"&&b.button!==0||Vf(b.target)||(Ec(b.clientX,b.clientY,b.pointerId),b.currentTarget.setPointerCapture(b.pointerId)))},onPointerMove:b=>{if($||b.pointerType==="touch")return;const D=es.current;!D||D.pointerId!==b.pointerId||!ud(b.clientX,b.clientY)||b.preventDefault()},onPointerUp:b=>{if($||b.pointerType==="touch")return;const D=es.current;!D||D.pointerId!==b.pointerId||us(b.clientX,b.clientY)},onPointerCancel:b=>{if($||b.pointerType==="touch")return;const D=es.current;!D||D.pointerId!==b.pointerId||(es.current=null,Va(null))},children:[i.jsx(sx,{open:Nc,progress:uh,isDragging:po,desktopPinned:$,isDesktopResizing:I,onClose:()=>{$||(M(!1),Va(null))},onDesktopResizeStart:b=>{oo.current=ci.current,Vr.current={startX:b,startWidth:ci.current},ne(!0)},currentAgent:on??void 0,agentIndicatorState:on?a??(on.status==="online"?"online":"offline"):void 0,projects:Ep,sessions:or,projectStats:Xu,historySessionsByProject:Object.fromEntries(Object.entries(L).map(([b,D])=>[b,D.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(K).map(([b,D])=>[b,D.sessions])),historyPageStateByProject:L,archivedPageStateByProject:K,activeSessionId:fe.id,onCreateSession:b=>{lh(b)},onSessionAction:Ii,onThreadAction:rh,onLoadMoreHistory:b=>{J(b)},onLoadMoreArchived:b=>{q(b)},pendingSessionActionId:Kn.isPending?((xi=Kn.variables)==null?void 0:xi.sessionId)??null:null,pendingThreadActionId:al.isPending?((yl=al.variables)==null?void 0:yl.projectId)??null:null}),vd,xo]})},DA=({mode:e,agentName:t,agentStatus:a,onOpenNodes:l,onCreateThread:o})=>{if(e==="node")return i.jsxs("section",{className:"session-empty-state is-node-mode",children:[i.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),i.jsx("div",{className:"session-empty-state__actions",children:i.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:l,children:"选择节点"})})]});const u=a==="online";return i.jsxs("section",{className:"session-empty-state is-session-mode",children:[i.jsxs("div",{className:"session-empty-state__status-row",children:[i.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),i.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),i.jsxs("div",{className:"session-empty-state__actions",children:[o?i.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:o,children:"新建会话"}):null,i.jsx("button",{type:"button",className:"session-empty-state__button",onClick:l,children:"切换节点"})]})]})},i2=1100,Rx="panda:desktop-sidebar-width",hf="panda:desktop-sidebar-width-version",mf="2026-03-24-narrow",OA=300,Ax=232,au=Ax,IA=460,r2=.4,LA=56,PA=160,l2=5,o2=e=>{const t=new Date((e==null?void 0:e.generated_at)??"").getTime();return Number.isFinite(t)?t:0},UA=(e,t)=>{var l;if(!t)return;let a;for(const[,o]of e)!o||!(((l=o.agent)==null?void 0:l.id)===t||o.projects.some(f=>f.agent_id===t)||o.sessions.some(f=>f.agent_id===t))||(!a||o2(o)>o2(a))&&(a=o);return a},zA=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),O0=e=>Math.max(Ax,Math.min(IA,e)),BA=()=>{if(typeof window>"u")return au;try{const e=window.localStorage.getItem(Rx),t=window.localStorage.getItem(hf);if(!e)return window.localStorage.setItem(hf,mf),au;const a=Number(e);if(!Number.isFinite(a))return window.localStorage.setItem(hf,mf),au;const o=t!==mf||a===OA||a>au?au:a;return window.localStorage.setItem(hf,mf),O0(o)}catch{return au}},Dx=()=>{var Fn,Vs;const e=Sa(te=>te.openSettingsOverlay),{agentId:t}=qu({strict:!1}),a=Ei(),l=Pa(),o=_.useRef(null),[u,f]=_.useState(()=>uc()),[m,y]=_.useState(()=>tk()??np()),[g,S]=_.useState(()=>nk()),[p,v]=_.useState(()=>sk()?"directory-picker":"composer"),[w,N]=_.useState(!1),[j,C]=_.useState(()=>typeof window<"u"&&window.innerWidth>=i2),[R,z]=_.useState(()=>BA()),[O,k]=_.useState(!1),[L,K]=_.useState({state:"connected",attempt:0,maxAttempts:l2}),[J,q]=_.useState(null),Y=_.useRef(null),Q=_.useRef(null),G=_.useRef(null),ge=_.useRef(null),me=_.useRef(R),Z=_.useRef(null),he=_.useRef(null),M=_.useRef(null),$=_.useRef(0),ee=_.useRef(null),oe=_.useRef(!1),ae=_.useRef(!1),I=_.useRef(!1),ne=_.useRef(null),U=_.useRef(null),ie=t??u??null,Se=ie?{agentId:ie}:void 0,we=l.getQueryData(x0({scope:Se}))??UA(l.getQueriesData({queryKey:rs}),ie),ye=m&&!(we!=null&&we.sessions.some(te=>te.id===m))?m:null,Oe=_.useRef({agentId:ie,selectedSessionIdHint:ye});Ff(ie);const Le=N_({enabled:!1}),_t=Le.data,Ke=J3({scope:Se,selectedSessionId:ye,enabled:!!ie}),tt=Ke.data??we,{historyState:nn,archivedState:Xt,loadMoreHistory:jn,loadMoreArchived:zt,reset:Bt}=tx({scope:Se,selectedSessionId:m??null}),yt=[...Object.values(nn).flatMap(te=>te.sessions),...Object.values(Xt).flatMap(te=>te.sessions)];_.useEffect(()=>{t&&(f(t),Zi(t),y(null))},[t]),_.useEffect(()=>{tt&&(f(te=>{var Pe;return te&&(((Pe=tt.agent)==null?void 0:Pe.id)===te||_t!=null&&_t.agents.some($e=>$e.id===te))?te:null}),y(te=>te&&(tt.sessions.some(Pe=>Pe.id===te)||yt.some(Pe=>Pe.id===te)||Ke.isPending||Ke.isFetching||Ke.isError)?te:null))},[_t==null?void 0:_t.agents,yt,tt,Ke.isError,Ke.isFetching,Ke.isPending]),_.useEffect(()=>{t||u||(A6(),a({to:"/nodes",replace:!0}))},[a,t,u]),_.useEffect(()=>{if(!tt||t||!u||m)return;const te=np(),Pe=tt.sessions.find($e=>$e.id===te)??null;Pe&&(y(Pe.id),sa(Pe.id))},[t,u,m,tt]);const bt=(ie?(_t==null?void 0:_t.agents.find(te=>te.id===ie))??null:null)??null,dt=_.useMemo(()=>{const te=(tt==null?void 0:tt.agent)??(bt?{id:bt.id,name:bt.name,display_name:bt.display_name,status:bt.status}:null);if(!te)return null;const Pe=(bt==null?void 0:bt.status)??te.status,$e=(bt==null?void 0:bt.name)??te.name,at=(bt==null?void 0:bt.display_name)??te.display_name;return te.status===Pe&&te.name===$e&&te.display_name===at?te:{...te,name:$e,display_name:at,status:Pe}},[bt,tt==null?void 0:tt.agent]),cn=dt?iT(dt.status,L.state):void 0,Pn=(tt==null?void 0:tt.projects)??[],Ee=(tt==null?void 0:tt.sessions)??[],V=(tt==null?void 0:tt.project_stats)??[],_e=m?Ee.find(te=>te.id===m)??null:null,Te=!!ie&&!dt&&(Le.isPending||Le.isFetching||Ke.isPending||Ke.isFetching),Ie=!!m&&!Ee.some(te=>te.id===m)&&(Ke.isPending||Ke.isFetching),ce=Te||Ie,Ae=(_e==null?void 0:_e.id)??(ce?m??null:null);Oe.current={agentId:(dt==null?void 0:dt.id)??ie,selectedSessionIdHint:ye},_.useEffect(()=>{const te=(bt==null?void 0:bt.status)??null,Pe=ne.current;ne.current=te;const $e=(ie==null?void 0:ie.trim())??"";if(!$e||te!=="online"){te!=="online"&&(U.current=null);return}if(!(Pe!=="online"||!tt))return;const Ut=`${$e}:${Pe!=="online"?"online":"missing"}:${ye??""}`;U.current!==Ut&&(U.current=Ut,uf(l,{scope:{agentId:$e},selectedSessionId:ye}))},[ie,bt==null?void 0:bt.status,l,tt,ye]),_.useEffect(()=>{var Ut;if(!Oe.current.agentId){ee.current!==null&&(clearTimeout(ee.current),ee.current=null),(Ut=M.current)==null||Ut.stream.close(),M.current=null,oe.current=!1,ae.current=!1,I.current=!1;return}let te=!1;const Pe=++$.current,$e=()=>{ee.current!==null&&(clearTimeout(ee.current),ee.current=null)},at=ft=>{const Mt=(ft==null?void 0:ft.includeHubDirectory)??!1;$e(),ee.current=setTimeout(()=>{ee.current=null;const qn=Oe.current,jt=[uf(l,{scope:qn.agentId?{agentId:qn.agentId}:void 0,selectedSessionId:qn.selectedSessionIdHint})];Mt&&jt.unshift(v3(l)),Promise.allSettled(jt)},PA)};return xn({agentId:Oe.current.agentId}).then(ft=>{var jt,zs;if(te||$.current!==Pe)return;const Mt=ft.client.getConnectionKey();if(((jt=M.current)==null?void 0:jt.key)===Mt)return;(zs=M.current)==null||zs.stream.close(),oe.current=!1,ae.current=!1,I.current=!1;const qn=ft.client.createEventStream(Kt=>{var P,be,Ue,He,Ge,ht;const bs=typeof((P=Kt.payload)==null?void 0:P.sessionId)=="string"?Kt.payload.sessionId:null,Wn=typeof((be=Kt.payload)==null?void 0:be.projectId)=="string"?Kt.payload.projectId:null;if(Kt.type==="agent.online"){if(I.current){I.current=!1;return}Bt(),at({includeHubDirectory:!0});return}if(Kt.type==="thread.updated"&&Wn){const mt=typeof((Ue=Kt.payload)==null?void 0:Ue.action)=="string"?Kt.payload.action:"",ot=(He=Kt.payload)!=null&&He.projectPatch&&typeof Kt.payload.projectPatch=="object"?Kt.payload.projectPatch:null,Xn=Array.isArray((Ge=Kt.payload)==null?void 0:Ge.orderedProjectIds)?Kt.payload.orderedProjectIds.filter(Jt=>typeof Jt=="string"&&Jt.trim().length>0):[];if((mt==="pin"||mt==="unpin"||mt==="rename")&&ot){l.setQueriesData({queryKey:rs},Jt=>pu(Jt,Wn,ot));return}if(mt==="reorder"&&Xn.length>0){l.setQueriesData({queryKey:rs},Jt=>cp(Jt,Xn));return}if(mt==="remove"||mt==="archive"){Bt(),l.setQueriesData({queryKey:rs},Jt=>up(Jt,Wn));return}if(mt==="unarchive"){Bt();const Jt=Oe.current;uf(l,{scope:Jt.agentId?{agentId:Jt.agentId}:void 0,selectedSessionId:Jt.selectedSessionIdHint});return}}if(Kt.type==="session.updated"&&bs){const mt=(ht=Kt.payload)!=null&&ht.sessionPatch&&typeof Kt.payload.sessionPatch=="object"?v0(Kt.payload.sessionPatch):null,ot=Oe.current,Xn=l.getQueryData(x0({scope:ot.agentId?{agentId:ot.agentId}:void 0,selectedSessionId:ot.selectedSessionIdHint})),Jt=lp(Xn,bs);if(mt&&Jt){l.setQueriesData({queryKey:rs},Jn=>cf(Jn,bs,mt));return}if(Jt)return;uf(l,{scope:ot.agentId?{agentId:ot.agentId}:void 0,selectedSessionId:ot.selectedSessionIdHint})}},{onStatus:Kt=>{if(K(Kt),Kt.state==="connected"){I.current=!0,oe.current&&ae.current&&(ae.current=!1,Bt(),at({includeHubDirectory:ft.mode==="hub"})),oe.current=!0;return}oe.current&&(ae.current=!0)}});M.current={key:Mt,stream:qn}}).catch(ft=>{te||$.current!==Pe||K({state:"failed",attempt:0,maxAttempts:l2,error:ft instanceof Error?ft.message:"无法建立节点工作区连接"})}),()=>{te=!0}},[dt==null?void 0:dt.id,dt==null?void 0:dt.status,ie,l,Bt]),_.useEffect(()=>()=>{var te;$.current+=1,ee.current!==null&&(clearTimeout(ee.current),ee.current=null),(te=M.current)==null||te.stream.close(),M.current=null},[]),_.useEffect(()=>{me.current=R},[R]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Rx,String(O0(R))),window.localStorage.setItem(hf,mf)}catch{}},[R]),_.useEffect(()=>{if(typeof window>"u")return;const te=()=>{const Pe=window.innerWidth>=i2;C(Pe),Pe&&(N(!1),q(null))};return te(),window.addEventListener("resize",te),()=>{window.removeEventListener("resize",te)}},[]),_.useEffect(()=>{if(!O)return;const te=$e=>{const at=ge.current;if(!at)return;const Ut=$e.clientX-at.startX,ft=O0(at.startWidth+Ut);Z.current=ft,he.current===null&&(he.current=window.requestAnimationFrame(()=>{he.current=null;const Mt=Z.current;Mt!==null&&z(Mt)}))},Pe=()=>{he.current!==null&&(window.cancelAnimationFrame(he.current),he.current=null);const $e=Z.current??me.current;Z.current=null,ge.current=null,k(!1),me.current=$e,z($e)};return window.addEventListener("pointermove",te),window.addEventListener("pointerup",Pe),()=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",Pe)}},[O]),_.useEffect(()=>()=>{he.current!==null&&window.cancelAnimationFrame(he.current)},[]);const qe=ss({mutationFn:async te=>(await xn({sessionId:te.sessionId})).client.updateSession(te)}),xt=ss({mutationFn:async te=>(await xn({projectId:te.projectId,agentId:te.agentId})).client.updateThread(te)}),Dt=te=>{l.setQueriesData({queryKey:rs},te)},ue=te=>Ee.find(Pe=>Pe.id===te)??yt.find(Pe=>Pe.id===te)??((_e==null?void 0:_e.id)===te?_e:null),Me=async(te,Pe,$e)=>{var ft;const at=await qe.mutateAsync({sessionId:te,action:Pe,name:$e}),Ut=(ft=at.affectedSessionIds)!=null&&ft.length?at.affectedSessionIds:[te];if(Pe==="delete"?(Dt(Mt=>p3(Mt,Ut)),Bt()):Dt(Mt=>m3(Mt,Ut,{...Pe==="rename"&&($e!=null&&$e.trim())?{title:$e.trim()}:{pinned:Pe==="pin"}})),Pe==="delete"&&m===te){const Mt=at.nextSessionId;Mt?(sa(Mt),y(Mt)):(sa(null),y(null))}},Re=async(te,Pe,$e)=>{var ft,Mt;const at=await xt.mutateAsync({projectId:te,agentId:(dt==null?void 0:dt.id)??u??t??"",action:Pe,name:$e==null?void 0:$e.name,orderedProjectIds:$e==null?void 0:$e.orderedProjectIds}),Ut=(ft=$e==null?void 0:$e.name)==null?void 0:ft.trim();Pe==="pin"||Pe==="unpin"?Dt(qn=>pu(qn,te,{pinned:Pe==="pin"})):Pe==="rename"&&Ut?Dt(qn=>pu(qn,te,{display_name:Ut})):Pe==="reorder"&&((Mt=$e==null?void 0:$e.orderedProjectIds)!=null&&Mt.length)?Dt(qn=>cp(qn,$e.orderedProjectIds??[])):Pe==="remove"||Pe==="archive"?(Dt(qn=>up(qn,te)),Bt()):Pe==="unarchive"&&(Bt(),l.invalidateQueries({queryKey:rs})),_e&&_e.project_id===te&&(Pe==="remove"||Pe==="archive"||Pe==="unarchive")&&(at.nextSessionId?(sa(at.nextSessionId),y(at.nextSessionId)):(sa(null),y(null)))},We=async te=>{dt&&(Zi(dt.id),sa(null),Wr(null),of(!1),fu(te),S(te),v("composer"),y(null),await a({to:"/"}))},Xe=async()=>{dt&&(j||(N(!1),De(null)),Zi(dt.id),sa(null),Wr(null),fu(null),of(!0),S(null),v("directory-picker"),y(null),await a({to:"/"}))},Je=async te=>{await We(te)},Tt=async te=>{const Pe=ue(te);S(null),v("composer"),of(!1),fu(null),Wr(null),Pe&&!Ee.some(at=>at.id===te)&&Dt(at=>g3(at,Pe)),y(te),sa(te);const $e=(Pe==null?void 0:Pe.agent_id)??(dt==null?void 0:dt.id)??ie;$e&&(f($e),Zi($e)),t&&await a({to:"/",replace:!0})},Wt=j?0:zA(),ls=j||w,Nt=j?0:J??(w?Wt:0),Un=j?1:Wt>0?Nt/Wt:0,Cn=!j&&J!==null,Dn=j?{"--desktop-sidebar-width":`${R}px`}:void 0,De=te=>{Y.current=te,q(te)},Qt=te=>te instanceof Element&&!!te.closest('button, textarea, input, a, [role="dialog"]'),On=te=>Qt(te),Ts=(te,Pe,$e)=>(G.current={mode:w?"close":"open",startX:te,startY:Pe,axis:"pending",pointerId:$e},!0),Ua=(te,Pe)=>{const $e=G.current;if(!$e)return!1;const at=te-$e.startX,Ut=Pe-$e.startY;if($e.axis==="pending"){if(Math.abs(at)<8&&Math.abs(Ut)<8)return!1;if($e.axis=Math.abs(at)>Math.abs(Ut)?"x":"y",$e.axis==="y")return G.current=null,De(null),!1}const ft=$e.mode==="open"?Math.max(0,Math.min(Wt,at)):Math.max(0,Math.min(Wt,Wt+at));return De(ft),!0},Us=(te,Pe)=>{const $e=G.current;if(!$e)return;const at=te-$e.startX,Ut=Pe-$e.startY;if($e.axis==="pending"&&Math.abs(Ut)>48){G.current=null,De(null);return}const ft=$e.axis==="x"?Y.current??($e.mode==="open"?Math.max(0,Math.min(Wt,at)):Math.max(0,Math.min(Wt,Wt+at))):w?Wt:0,Mt=$e.mode==="open"?ft>=Math.min(LA,Wt*r2):ft>=Wt*r2;N(Mt),G.current=null,De(null)};_.useEffect(()=>{const te=o.current;if(!te||j)return;const Pe=ft=>{const Mt=ft.touches[0];ft.touches.length!==1||!Mt||On(ft.target)||(Q.current={startX:Mt.clientX,startY:Mt.clientY})},$e=ft=>{if(ft.touches.length!==1)return;const Mt=ft.touches[0];if(!G.current){const jt=Q.current;if(!jt)return;const zs=Mt.clientX-jt.startX,Kt=Mt.clientY-jt.startY;if(Math.abs(zs)<8&&Math.abs(Kt)<8)return;if(Math.abs(zs)<=Math.abs(Kt)){Q.current=null;return}Ts(jt.startX,jt.startY),Q.current=null}Ua(Mt.clientX,Mt.clientY)&&ft.cancelable&&ft.preventDefault()},at=ft=>{if(Q.current=null,!G.current)return;const Mt=ft.changedTouches[0];if(!Mt){G.current=null,De(null);return}Us(Mt.clientX,Mt.clientY)},Ut=()=>{Q.current=null,G.current=null,De(null)};return te.addEventListener("touchstart",Pe,{passive:!0,capture:!0}),te.addEventListener("touchmove",$e,{passive:!1,capture:!0}),te.addEventListener("touchend",at,{capture:!0}),te.addEventListener("touchcancel",Ut,{capture:!0}),()=>{te.removeEventListener("touchstart",Pe,{capture:!0}),te.removeEventListener("touchmove",$e,{capture:!0}),te.removeEventListener("touchend",at,{capture:!0}),te.removeEventListener("touchcancel",Ut,{capture:!0})}},[j,w]);const Ci=()=>i.jsx(i.Fragment,{children:i.jsxs("div",{className:`conversation-main ${j?"has-desktop-sidebar":""}`,style:{transform:`translateX(${Nt}px)`,transition:Cn?"none":void 0},children:[i.jsx("div",{className:"conversation-topbar",children:j?null:i.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>N(!0),"aria-label":"打开侧边栏",children:[i.jsx("span",{}),i.jsx("span",{className:"short"})]})}),i.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:i.jsx("div",{className:"conversation-thread conversation-thread--empty",children:i.jsx(DA,{mode:"node",agentName:dt?ic(dt):void 0,agentStatus:(dt==null?void 0:dt.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return i.jsxs("div",{ref:o,className:`conversation-page ${j?"has-desktop-sidebar":""}`,style:Dn,onPointerDown:te=>{j||te.pointerType!=="touch"&&(te.pointerType==="mouse"&&te.button!==0||On(te.target)||(Ts(te.clientX,te.clientY,te.pointerId),te.currentTarget.setPointerCapture(te.pointerId)))},onPointerMove:te=>{if(j||te.pointerType==="touch")return;const Pe=G.current;!Pe||Pe.pointerId!==te.pointerId||!Ua(te.clientX,te.clientY)||te.preventDefault()},onPointerUp:te=>{if(j||te.pointerType==="touch")return;const Pe=G.current;!Pe||Pe.pointerId!==te.pointerId||Us(te.clientX,te.clientY)},onPointerCancel:te=>{if(j||te.pointerType==="touch")return;const Pe=G.current;!Pe||Pe.pointerId!==te.pointerId||(G.current=null,De(null))},children:[i.jsx(sx,{open:ls,progress:Un,isDragging:Cn,desktopPinned:j,isDesktopResizing:O,onClose:()=>{j||(N(!1),De(null))},onDesktopResizeStart:te=>{Z.current=me.current,ge.current={startX:te,startWidth:me.current},k(!0)},currentAgent:dt??void 0,agentIndicatorState:cn,projects:Pn,sessions:Ee,projectStats:V,historySessionsByProject:Object.fromEntries(Object.entries(nn).map(([te,Pe])=>[te,Pe.sessions])),archivedSessionsByProject:Object.fromEntries(Object.entries(Xt).map(([te,Pe])=>[te,Pe.sessions])),historyPageStateByProject:nn,archivedPageStateByProject:Xt,activeSessionId:_e==null?void 0:_e.id,onCreateSession:te=>{Je(te)},onCreateDirectoryThread:()=>{Xe()},onSelectSession:te=>{Tt(te)},onSessionAction:Me,onThreadAction:Re,onOpenSettings:e,onLoadMoreHistory:te=>{jn(te)},onLoadMoreArchived:te=>{zt(te)},pendingSessionActionId:qe.isPending?((Fn=qe.variables)==null?void 0:Fn.sessionId)??null:null,pendingThreadActionId:xt.isPending?((Vs=xt.variables)==null?void 0:Vs.projectId)??null:null}),Ae?i.jsx(AA,{sessionId:Ae,workspaceDirectorySnapshot:tt??null,workspaceAgentIndicatorState:cn,embedded:!0,isDesktopSidebar:j,sidebarOffset:Nt,isSidebarDragging:Cn,onOpenSidebar:()=>N(!0),onSelectSession:te=>{te&&Tt(te)},onExitToNodes:()=>{Wr(null),sa(null),y(null),a({to:"/nodes"})}}):dt?_e?null:i.jsx(_M,{currentAgent:dt,projects:Pn,sessions:Ee,initialProjectId:g,entryView:p,isDesktopSidebar:j,sidebarOffset:Nt,isSidebarDragging:Cn,onOpenSidebar:()=>N(!0),onProjectSelected:te=>{S(te),v("composer"),of(!1)},onSessionCreated:te=>{Tt(te)}}):Ci()]})},HA=24,$A=32,FA=72,c2="panda:native-safe-area-change",O_=e=>{const t=Number(e);if(!Number.isFinite(t))return 0;const a=typeof window<"u"&&Number.isFinite(window.devicePixelRatio)&&window.devicePixelRatio>0?window.devicePixelRatio:1;return Math.max(0,t/a)},Rg=e=>`${Math.round(O_(e)*100)/100}px`,qA=e=>`${Math.round(e*100)/100}px`,WA=e=>{const t=O_(e);if(!_p())return`${Math.round(t*100)/100}px`;const a=Math.min($A,Math.max(HA,t+1));return`${Math.round(a*100)/100}px`},KA=()=>{if(typeof window>"u")return 0;const e=window.visualViewport;if(!e)return 0;const t=window.innerHeight-(e.height+e.offsetTop);return Number.isFinite(t)?Math.max(0,t):0},QA=e=>{var o;if(!Ys())return"0px";const t=KA(),a=O_((o=e==null?void 0:e.getKeyboardInsetPx)==null?void 0:o.call(e)),l=t>0?t:a;return l<FA?"0px":qA(l)},GA=()=>{var a,l,o,u;if(typeof document>"u"||typeof window>"u")return;const e=window.PandaSafeArea,t=document.documentElement.style;e&&(t.setProperty("--native-safe-area-top",WA((a=e.getTopInsetPx)==null?void 0:a.call(e))),t.setProperty("--native-safe-area-right",Rg((l=e.getRightInsetPx)==null?void 0:l.call(e))),t.setProperty("--native-safe-area-bottom",Rg((o=e.getBottomInsetPx)==null?void 0:o.call(e))),t.setProperty("--native-safe-area-left",Rg((u=e.getLeftInsetPx)==null?void 0:u.call(e)))),t.setProperty("--native-keyboard-inset-bottom",QA(e))},YA=()=>{var u,f;if(typeof window>"u"||typeof document>"u")return()=>{};const e=()=>{GA()},t=new Set,a=m=>{const y=window.setTimeout(()=>{t.delete(y),e()},m);t.add(y)},l=()=>{e(),a(120),a(280)};let o=null;return e(),a(0),a(250),a(800),window.addEventListener("load",e,{once:!0}),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),window.addEventListener(c2,e),document.addEventListener("visibilitychange",e),document.addEventListener("focusin",l,!0),document.addEventListener("focusout",l,!0),(u=window.visualViewport)==null||u.addEventListener("resize",e),(f=window.visualViewport)==null||f.addEventListener("scroll",e),w3.addListener("resume",e).then(m=>{o=()=>{m.remove()}}).catch(()=>{}),()=>{var m,y;window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e),window.removeEventListener(c2,e),document.removeEventListener("visibilitychange",e),document.removeEventListener("focusin",l,!0),document.removeEventListener("focusout",l,!0),(m=window.visualViewport)==null||m.removeEventListener("resize",e),(y=window.visualViewport)==null||y.removeEventListener("scroll",e);for(const g of t)window.clearTimeout(g);t.clear(),o==null||o()}},Ag=new D9,VA=async()=>{},ZA=_.lazy(async()=>({default:(await ao(()=>import("./diagnostics-page-BKp7IiZk.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),XA=()=>i.jsx(_.Suspense,{fallback:i.jsx("main",{className:"diagnostics-page",children:i.jsx("div",{className:"diagnostics-shell",children:i.jsx("section",{className:"diagnostics-card",children:i.jsx("p",{children:"正在载入诊断页…"})})})}),children:i.jsx(ZA,{})}),dc=O7({component:zC}),JA=lc({getParentRoute:()=>dc,path:"/",component:Dx}),eD=lc({getParentRoute:()=>dc,path:"/nodes",component:tT}),tD=lc({getParentRoute:()=>dc,path:"/session/$sessionId",component:aT}),nD=lc({getParentRoute:()=>dc,path:"/new-thread/$agentId",component:Dx}),sD=lc({getParentRoute:()=>dc,path:"/settings",component:V3}),aD=lc({getParentRoute:()=>dc,path:"/diagnostics",component:XA}),iD=dc.addChildren([JA,eD,tD,nD,sD,aD]),rD=$7({routeTree:iD,defaultPreload:"intent"});typeof document<"u"&&(K3(W3()),YA());VA().catch(()=>{}).then(async()=>{await hk(),await Wk(Ag),Qk(Ag)}).finally(()=>{e9.createRoot(document.getElementById("root")).render(i.jsx(O9,{client:Ag,children:i.jsx(W7,{router:rD})}))});export{d4 as B,cg as C,Tu as E,e0 as L,t6 as W,W5 as g,i as j,_ as r,Ei as u};
|