hob-bot 1.3.0 → 1.4.0
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 +31 -23
- package/README.zh-CN.md +32 -24
- package/dist/web/assets/{DesktopView-lixZfbYr.js → DesktopView-A11jmUwu.js} +1 -1
- package/dist/web/assets/index-B-YlVbpo.js +270 -0
- package/dist/web/assets/index-DkSQ-ygR.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/web/mock/readme-cover.svg +13 -0
- package/dist/web/mock/readme-page.html +7 -0
- package/package.json +1 -1
- package/server/src/assistant-skills.ts +2 -2
- package/server/src/delete-skill.ts +19 -0
- package/server/src/desktop-tools.ts +4 -5
- package/server/src/http.ts +24 -4
- package/server/src/job-view.ts +2 -2
- package/server/src/jobs.ts +105 -62
- package/server/src/knowledge-tools.ts +1 -1
- package/server/src/main.ts +2 -0
- package/server/src/memory.ts +2 -2
- package/server/src/now.ts +1 -1
- package/server/src/overview.ts +1 -2
- package/server/src/pages.ts +4 -4
- package/server/src/prompt.ts +46 -110
- package/server/src/router-tools.ts +47 -27
- package/server/src/router.ts +2 -1
- package/server/src/routines.ts +8 -3
- package/server/src/runtime.ts +12 -1
- package/server/src/settings.ts +37 -0
- package/server/src/transcript.ts +14 -4
- package/server/src/usage-prices.ts +165 -0
- package/server/src/usage.ts +281 -0
- package/server/src/worker-tools.ts +6 -9
- package/shared/types.ts +83 -2
- package/dist/web/assets/index-BZhge0qe.js +0 -267
- package/dist/web/assets/index-DIo1ArRa.css +0 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/math-weKGDUmL.js","assets/math-C-EwFotM.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function i(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=i(c);fetch(c.href,d)}})();var ff={exports:{}},Ii={};/**
|
|
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 vx;function X1(){if(vx)return Ii;vx=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(o,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:n,type:o,key:h,ref:c!==void 0?c:null,props:d}}return Ii.Fragment=a,Ii.jsx=i,Ii.jsxs=i,Ii}var xx;function V1(){return xx||(xx=1,ff.exports=X1()),ff.exports}var s=V1(),hf={exports:{}},Gi={},mf={exports:{}},pf={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* scheduler.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 bx;function Q1(){return bx||(bx=1,(function(n){function a(ue,xe){var ge=ue.length;ue.push(xe);e:for(;0<ge;){var Re=ge-1>>>1,Te=ue[Re];if(0<c(Te,xe))ue[Re]=xe,ue[ge]=Te,ge=Re;else break e}}function i(ue){return ue.length===0?null:ue[0]}function o(ue){if(ue.length===0)return null;var xe=ue[0],ge=ue.pop();if(ge!==xe){ue[0]=ge;e:for(var Re=0,Te=ue.length,pt=Te>>>1;Re<pt;){var wt=2*(Re+1)-1,gt=ue[wt],D=wt+1,se=ue[D];if(0>c(gt,ge))D<Te&&0>c(se,gt)?(ue[Re]=se,ue[D]=ge,Re=D):(ue[Re]=gt,ue[wt]=ge,Re=wt);else if(D<Te&&0>c(se,ge))ue[Re]=se,ue[D]=ge,Re=D;else break e}}return xe}function c(ue,xe){var ge=ue.sortIndex-xe.sortIndex;return ge!==0?ge:ue.id-xe.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,x=null,w=3,E=!1,T=!1,C=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function W(ue){for(var xe=i(g);xe!==null;){if(xe.callback===null)o(g);else if(xe.startTime<=ue)o(g),xe.sortIndex=xe.expirationTime,a(p,xe);else break;xe=i(g)}}function ee(ue){if(C=!1,W(ue),!T)if(i(p)!==null)T=!0,I||(I=!0,oe());else{var xe=i(g);xe!==null&&Ce(ee,xe.startTime-ue)}}var I=!1,j=-1,y=5,S=-1;function U(){return M?!0:!(n.unstable_now()-S<y)}function Z(){if(M=!1,I){var ue=n.unstable_now();S=ue;var xe=!0;try{e:{T=!1,C&&(C=!1,$(j),j=-1),E=!0;var ge=w;try{t:{for(W(ue),x=i(p);x!==null&&!(x.expirationTime>ue&&U());){var Re=x.callback;if(typeof Re=="function"){x.callback=null,w=x.priorityLevel;var Te=Re(x.expirationTime<=ue);if(ue=n.unstable_now(),typeof Te=="function"){x.callback=Te,W(ue),xe=!0;break t}x===i(p)&&o(p),W(ue)}else o(p);x=i(p)}if(x!==null)xe=!0;else{var pt=i(g);pt!==null&&Ce(ee,pt.startTime-ue),xe=!1}}break e}finally{x=null,w=ge,E=!1}xe=void 0}}finally{xe?oe():I=!1}}}var oe;if(typeof O=="function")oe=function(){O(Z)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ke=ce.port2;ce.port1.onmessage=Z,oe=function(){ke.postMessage(null)}}else oe=function(){A(Z,0)};function Ce(ue,xe){j=A(function(){ue(n.unstable_now())},xe)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(ue){ue.callback=null},n.unstable_forceFrameRate=function(ue){0>ue||125<ue?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y=0<ue?Math.floor(1e3/ue):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_next=function(ue){switch(w){case 1:case 2:case 3:var xe=3;break;default:xe=w}var ge=w;w=xe;try{return ue()}finally{w=ge}},n.unstable_requestPaint=function(){M=!0},n.unstable_runWithPriority=function(ue,xe){switch(ue){case 1:case 2:case 3:case 4:case 5:break;default:ue=3}var ge=w;w=ue;try{return xe()}finally{w=ge}},n.unstable_scheduleCallback=function(ue,xe,ge){var Re=n.unstable_now();switch(typeof ge=="object"&&ge!==null?(ge=ge.delay,ge=typeof ge=="number"&&0<ge?Re+ge:Re):ge=Re,ue){case 1:var Te=-1;break;case 2:Te=250;break;case 5:Te=1073741823;break;case 4:Te=1e4;break;default:Te=5e3}return Te=ge+Te,ue={id:v++,callback:xe,priorityLevel:ue,startTime:ge,expirationTime:Te,sortIndex:-1},ge>Re?(ue.sortIndex=ge,a(g,ue),i(p)===null&&ue===i(g)&&(C?($(j),j=-1):C=!0,Ce(ee,ge-Re))):(ue.sortIndex=Te,a(p,ue),T||E||(T=!0,I||(I=!0,oe()))),ue},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(ue){var xe=w;return function(){var ge=w;w=xe;try{return ue.apply(this,arguments)}finally{w=ge}}}})(pf)),pf}var kx;function J1(){return kx||(kx=1,mf.exports=Q1()),mf.exports}var gf={exports:{}},Se={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* react.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 yx;function P1(){if(yx)return Se;yx=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),E=Symbol.iterator;function T(D){return D===null||typeof D!="object"?null:(D=E&&D[E]||D["@@iterator"],typeof D=="function"?D:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,A={};function $(D,se,L){this.props=D,this.context=se,this.refs=A,this.updater=L||C}$.prototype.isReactComponent={},$.prototype.setState=function(D,se){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,se,"setState")},$.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function O(){}O.prototype=$.prototype;function W(D,se,L){this.props=D,this.context=se,this.refs=A,this.updater=L||C}var ee=W.prototype=new O;ee.constructor=W,M(ee,$.prototype),ee.isPureReactComponent=!0;var I=Array.isArray;function j(){}var y={H:null,A:null,T:null,S:null},S=Object.prototype.hasOwnProperty;function U(D,se,L){var G=L.ref;return{$$typeof:n,type:D,key:se,ref:G!==void 0?G:null,props:L}}function Z(D,se){return U(D.type,se,D.props)}function oe(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function ce(D){var se={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(L){return se[L]})}var ke=/\/+/g;function Ce(D,se){return typeof D=="object"&&D!==null&&D.key!=null?ce(""+D.key):se.toString(36)}function ue(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(j,j):(D.status="pending",D.then(function(se){D.status==="pending"&&(D.status="fulfilled",D.value=se)},function(se){D.status==="pending"&&(D.status="rejected",D.reason=se)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function xe(D,se,L,G,R){var te=typeof D;(te==="undefined"||te==="boolean")&&(D=null);var ae=!1;if(D===null)ae=!0;else switch(te){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(D.$$typeof){case n:case a:ae=!0;break;case v:return ae=D._init,xe(ae(D._payload),se,L,G,R)}}if(ae)return R=R(D),ae=G===""?"."+Ce(D,0):G,I(R)?(L="",ae!=null&&(L=ae.replace(ke,"$&/")+"/"),xe(R,se,L,"",function(tt){return tt})):R!=null&&(oe(R)&&(R=Z(R,L+(R.key==null||D&&D.key===R.key?"":(""+R.key).replace(ke,"$&/")+"/")+ae)),se.push(R)),1;ae=0;var fe=G===""?".":G+":";if(I(D))for(var ve=0;ve<D.length;ve++)G=D[ve],te=fe+Ce(G,ve),ae+=xe(G,se,L,te,R);else if(ve=T(D),typeof ve=="function")for(D=ve.call(D),ve=0;!(G=D.next()).done;)G=G.value,te=fe+Ce(G,ve++),ae+=xe(G,se,L,te,R);else if(te==="object"){if(typeof D.then=="function")return xe(ue(D),se,L,G,R);throw se=String(D),Error("Objects are not valid as a React child (found: "+(se==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":se)+"). If you meant to render a collection of children, use an array instead.")}return ae}function ge(D,se,L){if(D==null)return D;var G=[],R=0;return xe(D,G,"","",function(te){return se.call(L,te,R++)}),G}function Re(D){if(D._status===-1){var se=D._result,L=se();L.then(function(G){(D._status===0||D._status===-1)&&(D._status=1,D._result=G,L.status===void 0&&(L.status="fulfilled",L.value=G))},function(G){(D._status===0||D._status===-1)&&(D._status=2,D._result=G,L.status===void 0&&(L.status="rejected",L.reason=G))}),D._status===-1&&(D._status=0,D._result=L)}if(D._status===1)return D._result.default;throw D._result}var Te=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var se=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(se))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function pt(D){var se=y.T,L={};L.types=se!==null?se.types:null,y.T=L;try{var G=D(),R=y.S;R!==null&&R(L,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(j,Te)}catch(te){Te(te)}finally{se!==null&&L.types!==null&&(se.types=L.types),y.T=se}}function wt(D){var se=y.T;if(se!==null){var L=se.types;L===null?se.types=[D]:L.indexOf(D)===-1&&L.push(D)}else pt(wt.bind(null,D))}var gt={map:ge,forEach:function(D,se,L){ge(D,function(){se.apply(this,arguments)},L)},count:function(D){var se=0;return ge(D,function(){se++}),se},toArray:function(D){return ge(D,function(se){return se})||[]},only:function(D){if(!oe(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Se.Activity=x,Se.Children=gt,Se.Component=$,Se.Fragment=i,Se.Profiler=c,Se.PureComponent=W,Se.StrictMode=o,Se.Suspense=p,Se.ViewTransition=w,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,Se.__COMPILER_RUNTIME={__proto__:null,c:function(D){return y.H.useMemoCache(D)}},Se.addTransitionType=wt,Se.cache=function(D){return function(){return D.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(D,se,L){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var G=M({},D.props),R=D.key;if(se!=null)for(te in se.key!==void 0&&(R=""+se.key),se)!S.call(se,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&se.ref===void 0||(G[te]=se[te]);var te=arguments.length-2;if(te===1)G.children=L;else if(1<te){for(var ae=Array(te),fe=0;fe<te;fe++)ae[fe]=arguments[fe+2];G.children=ae}return U(D.type,R,G)},Se.createContext=function(D){return D={$$typeof:h,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},Se.createElement=function(D,se,L){var G,R={},te=null;if(se!=null)for(G in se.key!==void 0&&(te=""+se.key),se)S.call(se,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(R[G]=se[G]);var ae=arguments.length-2;if(ae===1)R.children=L;else if(1<ae){for(var fe=Array(ae),ve=0;ve<ae;ve++)fe[ve]=arguments[ve+2];R.children=fe}if(D&&D.defaultProps)for(G in ae=D.defaultProps,ae)R[G]===void 0&&(R[G]=ae[G]);return U(D,te,R)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(D){return{$$typeof:m,render:D}},Se.isValidElement=oe,Se.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:Re}},Se.memo=function(D,se){return{$$typeof:g,type:D,compare:se===void 0?null:se}},Se.startTransition=pt,Se.unstable_useCacheRefresh=function(){return y.H.useCacheRefresh()},Se.use=function(D){return y.H.use(D)},Se.useActionState=function(D,se,L){return y.H.useActionState(D,se,L)},Se.useCallback=function(D,se){return y.H.useCallback(D,se)},Se.useContext=function(D){return y.H.useContext(D)},Se.useDebugValue=function(){},Se.useDeferredValue=function(D,se){return y.H.useDeferredValue(D,se)},Se.useEffect=function(D,se){return y.H.useEffect(D,se)},Se.useEffectEvent=function(D){return y.H.useEffectEvent(D)},Se.useId=function(){return y.H.useId()},Se.useImperativeHandle=function(D,se,L){return y.H.useImperativeHandle(D,se,L)},Se.useInsertionEffect=function(D,se){return y.H.useInsertionEffect(D,se)},Se.useLayoutEffect=function(D,se){return y.H.useLayoutEffect(D,se)},Se.useMemo=function(D,se){return y.H.useMemo(D,se)},Se.useOptimistic=function(D,se){return y.H.useOptimistic(D,se)},Se.useReducer=function(D,se,L){return y.H.useReducer(D,se,L)},Se.useRef=function(D){return y.H.useRef(D)},Se.useState=function(D){return y.H.useState(D)},Se.useSyncExternalStore=function(D,se,L){return y.H.useSyncExternalStore(D,se,L)},Se.useTransition=function(){return y.H.useTransition()},Se.version="19.3.1",Se}var jx;function uh(){return jx||(jx=1,gf.exports=P1()),gf.exports}var vf={exports:{}},Mt={};/**
|
|
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 wx;function F1(){if(wx)return Mt;wx=1;var n=uh();function a(v){var x="https://react.dev/errors/"+v;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)x+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+v+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(a(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal"),d=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function m(v,x,w){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:E==null?null:E===h?h:""+E,children:v,containerInfo:x,implementation:w}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,x){if(v==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return Mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Mt.browser=function(v){return{$$typeof:d,_reason:v}},Mt.createPortal=function(v,x){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(a(299));return m(v,x,null,w)},Mt.flushSync=function(v){var x=p.T,w=o.p;try{if(p.T=null,o.p=2,v)return v()}finally{p.T=x,o.p=w,o.d.f()}},Mt.preconnect=function(v,x){typeof v=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,o.d.C(v,x))},Mt.prefetchDNS=function(v){typeof v=="string"&&o.d.D(v)},Mt.preinit=function(v,x){if(typeof v=="string"&&x&&typeof x.as=="string"){var w=x.as,E=g(w,x.crossOrigin),T=typeof x.integrity=="string"?x.integrity:void 0,C=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;w==="style"?o.d.S(v,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:E,integrity:T,fetchPriority:C}):w==="script"&&o.d.X(v,{crossOrigin:E,integrity:T,fetchPriority:C,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},Mt.preinitModule=function(v,x){if(typeof v=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var w=g(x.as,x.crossOrigin);o.d.M(v,{crossOrigin:w,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}}else x==null&&o.d.M(v)},Mt.preload=function(v,x){if(typeof v=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var w=x.as,E=g(w,x.crossOrigin);o.d.L(v,w,{crossOrigin:E,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},Mt.preloadModule=function(v,x){if(typeof v=="string")if(x){var w=g(x.as,x.crossOrigin);o.d.m(v,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:w,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}else o.d.m(v)},Mt.requestFormReset=function(v){o.d.r(v)},Mt.unstable_batchedUpdates=function(v,x){return v(x)},Mt.useFormState=function(v,x,w){return p.H.useFormState(v,x,w)},Mt.useFormStatus=function(){return p.H.useHostTransitionStatus()},Mt.version="19.3.1",Mt}var Nx;function r0(){if(Nx)return vf.exports;Nx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),vf.exports=F1(),vf.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 Sx;function W1(){if(Sx)return Gi;Sx=1;var n=J1(),a=uh(),i=r0();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){for(var t=e,l=t;l&&!l.alternate;)t=l,(t.flags&4098)!==0&&(e=t.return),l=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,r=t;;){var u=l.return;if(u===null)break;var f=u.alternate;if(f===null){if(r=u.return,r!==null){l=r;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===l)return p(u),e;if(f===r)return p(u),t;f=f.sibling}throw Error(o(188))}if(l.return!==r.return)l=u,r=f;else{for(var b=!1,N=u.child;N;){if(N===l){b=!0,l=u,r=f;break}if(N===r){b=!0,r=u,l=f;break}N=N.sibling}if(!b){for(N=f.child;N;){if(N===l){b=!0,l=f,r=u;break}if(N===r){b=!0,r=f,l=u;break}N=N.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==r)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}function x(e,t,l,r,u,f){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&l(e,r,u,f)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&x(e.child,t,l,r,u,f))return!0;e=e.sibling}return!1}function w(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function E(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function T(e){var t=[null,null],l=w(e);return l===null||C(t,e,l.child,{foundSelf:!1}),t}function C(e,t,l,r){for(;l!==null;){if(l===t)r.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(r.foundSelf)return e[1]=l,!0;e[0]=l}else if((l.tag!==22||l.memoizedState===null)&&C(e,t,l.child,r))return!0;l=l.sibling}return!1}function M(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var A=null,$=null;function O(e,t,l){return e===l?!0:e===t?(A=e,!0):!1}function W(e,t,l){return e===l?($=e,!1):e===t?($!==null&&(A=e),!0):!1}function ee(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function I(e,t,l){for(var r=0,u=e;u;u=l(u))r++;u=0;for(var f=t;f;f=l(f))u++;for(;0<r-u;)e=l(e),r--;for(;0<u-r;)t=l(t),u--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=l(e),t=l(t)}return null}var j=Object.assign,y=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),ce=Symbol.for("react.profiler"),ke=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),ge=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),Te=Symbol.for("react.lazy"),pt=Symbol.for("react.activity"),wt=Symbol.for("react.legacy_hidden"),gt=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),se=Symbol.for("react.recoverable"),L=Symbol.iterator;function G(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var R=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===R?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case ce:return"Profiler";case oe:return"StrictMode";case xe:return"Suspense";case ge:return"SuspenseList";case pt:return"Activity";case D:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case U:return"Portal";case Ce:return e.displayName||"Context";case ke:return(e._context.displayName||"Context")+".Consumer";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ae=Array.isArray,fe=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,tt={pending:!1,data:null,method:null,action:null},at=[],ot=-1;function Dt(e){return{current:e}}function nt(e){0>ot||(e.current=at[ot],at[ot]=null,ot--)}function qe(e,t){ot++,at[ot]=e.current,e.current=t}var $t=Dt(null),Ut=Dt(null),An=Dt(null),el=Dt(null);function kr(e,t){switch(qe(An,t),qe(Ut,e),qe($t,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Tv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Tv(t),e=Cv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}nt($t),qe($t,e)}function Bl(){nt($t),nt(Ut),nt(An)}function zc(e){var t=e.memoizedState;t!==null&&(Ca._currentValue=t.memoizedState,qe(el,e)),t=$t.current;var l=Cv(t,e.type);t!==l&&(qe(Ut,e),qe($t,l))}function yr(e){Ut.current===e&&(nt($t),nt(Ut)),el.current===e&&(nt(el),Ca._currentValue=tt)}var Rc,Xh;function ws(e){if(Rc===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Rc=t&&t[1]||"",Xh=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Rc+e+Xh}var Oc=!1;function _c(e,t){if(!e||Oc)return"";Oc=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(de){var H=de}Reflect.construct(e,[],F)}else{try{F.call()}catch(de){H=de}F=!1;try{var K=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),F=!0,new e}finally{F&&(K!==void 0?Object.defineProperty(e.prototype,"props",K):delete e.prototype.props)}}}else{try{throw Error()}catch(de){H=de}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(de){if(de&&H&&typeof de.stack=="string")return[de.stack,H.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=r.DetermineComponentFrameRoot(),b=f[0],N=f[1];if(b&&N){var z=b.split(`
|
|
45
|
+
`),q=N.split(`
|
|
46
|
+
`);for(u=r=0;r<z.length&&!z[r].includes("DetermineComponentFrameRoot");)r++;for(;u<q.length&&!q[u].includes("DetermineComponentFrameRoot");)u++;if(r===z.length||u===q.length)for(r=z.length-1,u=q.length-1;1<=r&&0<=u&&z[r]!==q[u];)u--;for(;1<=r&&0<=u;r--,u--)if(z[r]!==q[u]){if(r!==1||u!==1)do if(r--,u--,0>u||z[r]!==q[u]){var V=`
|
|
47
|
+
`+z[r].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=r&&0<=u);break}}}finally{Oc=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ws(l):""}function Pk(e,t){switch(e.tag){case 26:case 27:case 5:return ws(e.type);case 16:return ws("Lazy");case 13:return e.child!==t&&t!==null?ws("Suspense Fallback"):ws("Suspense");case 19:return ws("SuspenseList");case 0:case 15:return _c(e.type,!1);case 11:return _c(e.type.render,!1);case 1:return _c(e.type,!0);case 31:return ws("Activity");case 30:return ws("ViewTransition");default:return""}}function Vh(e){try{var t="",l=null;do t+=Pk(e,l),l=e,e=e.return;while(e);return t}catch(r){return`
|
|
48
|
+
Error generating stack: `+r.message+`
|
|
49
|
+
`+r.stack}}var Dc=Object.prototype.hasOwnProperty,$c=n.unstable_scheduleCallback,Uc=n.unstable_cancelCallback,Fk=n.unstable_shouldYield,Wk=n.unstable_requestPaint,Wt=n.unstable_now,ey=n.unstable_getCurrentPriorityLevel,Qh=n.unstable_ImmediatePriority,Jh=n.unstable_UserBlockingPriority,jr=n.unstable_NormalPriority,ty=n.unstable_LowPriority,Ph=n.unstable_IdlePriority,ny=n.log,sy=n.unstable_setDisableYieldValue,Qa=null,en=null;function Ns(e){if(typeof ny=="function"&&sy(e),en&&typeof en.setStrictMode=="function")try{en.setStrictMode(Qa,e)}catch{}}var tn=Math.clz32?Math.clz32:iy,ly=Math.log,ay=Math.LN2;function iy(e){return e>>>=0,e===0?32:31-(ly(e)/ay|0)|0}var wr=256,Nr=262144,Sr=4194304;function tl(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Tr(e,t,l){var r=e.pendingLanes;if(r===0)return 0;var u=0,f=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var N=r&134217727;return N!==0?(r=N&~f,r!==0?u=tl(r):(b&=N,b!==0?u=tl(b):l||(l=N&~e,l!==0&&(u=tl(l))))):(N=r&~f,N!==0?u=tl(N):b!==0?u=tl(b):l||(l=r&~e,l!==0&&(u=tl(l)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,l=t&-t,f>=l||f===32&&(l&4194048)!==0)?t:u}function Ja(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fh(e,t){(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var r=31-tn(l),u=1<<r;t|=e[r],l&=~u}return t}function ry(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Wh(){var e=Sr;return Sr<<=1,(Sr&62914560)===0&&(Sr=4194304),e}function Lc(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Pa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function oy(e,t,l,r,u,f){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var N=e.entanglements,z=e.expirationTimes,q=e.hiddenUpdates;for(l=b&~l;0<l;){var V=31-tn(l),F=1<<V;N[V]=0,z[V]=-1;var H=q[V];if(H!==null)for(q[V]=null,V=0;V<H.length;V++){var K=H[V];K!==null&&(K.lane&=-536870913)}l&=~F}r!==0&&em(e,r,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(b&~t))}function em(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tn(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|l&261930}function tm(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var r=31-tn(l),u=1<<r;u&t|e[r]&t&&(e[r]|=t),l&=~u}}function nm(e,t){var l=t&-t;return l=(l&42)!==0?1:Hc(l),(l&(e.suspendedLanes|t))!==0?0:l}function Hc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Bc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function sm(){var e=ve.p;return e!==0?e:(e=window.event,e===void 0?32:ux(e.type))}function lm(e,t){var l=ve.p;try{return ve.p=e,t()}finally{ve.p=l}}var ss=Math.random().toString(36).slice(2),Nt="__reactFiber$"+ss,Yt="__reactProps$"+ss,ql="__reactContainer$"+ss,am="__reactEvents$"+ss,cy="__reactListeners$"+ss,uy="__reactHandles$"+ss,im="__reactResources$"+ss,Fa="__reactMarker$"+ss,Cr="__reactLoad$"+ss;function Er(e){delete e[Nt],delete e[Yt],delete e[cy],delete e[uy]}function nl(e){var t;if(t=e[Nt])return t;for(var l=e.parentNode;l;){if(t=l[ql]||l[Nt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Yv(e);e!==null;){if(l=e[Nt])return l;e=Yv(e)}return t}e=l,l=e.parentNode}return null}function Il(e){if(e=e[Nt]||e[ql]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Wa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Gl(e){var t=e[im];return t||(t=e[im]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function bt(e){e[Fa]=!0}function rm(e){e[Cr]=void 0}var om=new Set,cm={};function sl(e,t){Yl(e,t),Yl(e+"Capture",t)}function Yl(e,t){for(cm[e]=t,e=0;e<t.length;e++)om.add(t[e])}var dy=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]*$"),um={},dm={};function fy(e){return Dc.call(dm,e)?!0:Dc.call(um,e)?!1:dy.test(e)?dm[e]=!0:(um[e]=!0,!1)}var Ie=!1;function fm(){var e=Ie;return Ie=!1,e}function Ar(e,t,l){if(fy(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,l)}}function Mr(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,l)}}function ls(e,t,l,r){if(r===null)e.removeAttribute(l);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,r)}}function nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hy(e,t,l){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var u=r.get,f=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){l=""+b,f.call(this,b)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qc(e){if(!e._valueTracker){var t=hm(e)?"checked":"value";e._valueTracker=hy(e,t,""+e[t])}}function mm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),r="";return e&&(r=hm(e)?e.checked?"true":"false":e.value),e=r,e!==l?(t.setValue(e),!0):!1}var my=/[\n"\\]/g;function mn(e){return e.replace(my,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ic(e,t,l,r,u,f,b,N){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+nn(t)):e.value!==""+nn(t)&&(e.value=""+nn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?b==="number"&&e.value==t?Gc(e,nn(e.value)):Gc(e,nn(t)):l!=null?Gc(e,nn(l)):r!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+nn(N):e.removeAttribute("name")}function pm(e,t,l,r,u,f,b,N){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||l!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){qc(e);return}l=l!=null?""+nn(l):"",t=t!=null?""+nn(t):l,N||t===e.value||(e.value=t),e.defaultValue=t}r=r??u,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=N?e.checked:!!r,e.defaultChecked=!!r,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),qc(e)}function Gc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Kl(e,t,l,r){if(e=e.options,t){t={};for(var u=0;u<l.length;u++)t["$"+l[u]]=!0;for(l=0;l<e.length;l++)u=t.hasOwnProperty("$"+e[l].value),e[l].selected!==u&&(e[l].selected=u),u&&r&&(e[l].defaultSelected=!0)}else{for(l=""+nn(l),t=null,u=0;u<e.length;u++){if(e[u].value===l){e[u].selected=!0,r&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function gm(e,t,l){if(t!=null&&(t=""+nn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+nn(l):""}function vm(e,t,l,r){if(t==null){if(r!=null){if(l!=null)throw Error(o(92));if(ae(r)){if(1<r.length)throw Error(o(93));r=r[0]}l=r}l==null&&(l=""),t=l}l=nn(t),e.defaultValue=l,r=e.textContent,r===l&&r!==""&&r!==null&&(e.value=r),qc(e)}function Zl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var py=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 xm(e,t,l){var r=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,l):typeof l!="number"||l===0||py.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function bm(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var r in l)!l.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="",Ie=!0);for(var u in t)r=t[u],t.hasOwnProperty(u)&&l[u]!==r&&(xm(e,u,r),Ie=!0)}else for(var f in t)t.hasOwnProperty(f)&&xm(e,f,t[f])}function Yc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gy=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"],["maskType","mask-type"],["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"]]),vy=/^[\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 zr(e){return vy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Gn(){}var Kc=null;function Zc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xl=null,Vl=null;function km(e){var t=Il(e);if(t&&(e=t.stateNode)){var l=e[Yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ic(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+mn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var r=l[t];if(r!==e&&r.form===e.form){var u=r[Yt]||null;if(!u)throw Error(o(90));Ic(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<l.length;t++)r=l[t],r.form===e.form&&mm(r)}break e;case"textarea":gm(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Kl(e,!!l.multiple,t,!1)}}}var Xc=!1;function ym(e,t,l){if(Xc)return e(t,l);Xc=!0;try{var r=e(t);return r}finally{if(Xc=!1,(Xl!==null||Vl!==null)&&(Ro(),Xl&&(t=Xl,e=Vl,Vl=Xl=null,km(t),e)))for(t=0;t<e.length;t++)km(e[t])}}function ei(e,t){var l=e.stateNode;if(l===null)return null;var r=l[Yt]||null;if(r===null)return null;l=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var as=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vc=!1;if(as)try{var ti={};Object.defineProperty(ti,"passive",{get:function(){Vc=!0}}),window.addEventListener("test",ti,ti),window.removeEventListener("test",ti,ti)}catch{Vc=!1}var Ss=null,Qc=null,Rr=null;function jm(){if(Rr)return Rr;var e,t=Qc,l=t.length,r,u="value"in Ss?Ss.value:Ss.textContent,f=u.length;for(e=0;e<l&&t[e]===u[e];e++);var b=l-e;for(r=1;r<=b&&t[l-r]===u[f-r];r++);return Rr=u.slice(e,1<r?1-r:void 0)}function Or(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _r(){return!0}function wm(){return!1}function Lt(e){function t(l,r,u,f,b){this._reactName=l,this._targetInst=u,this.type=r,this.nativeEvent=f,this.target=b,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(l=e[N],this[N]=l?l(f):f[N]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?_r:wm,this.isPropagationStopped=wm,this}return j(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=_r)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=_r)},persist:function(){},isPersistent:_r}),t}var Ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Lt(Ts),ni=j({},Ts,{view:0,detail:0}),xy=Lt(ni),Jc,Pc,si,$r=j({},ni,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==si&&(si&&e.type==="mousemove"?(Jc=e.screenX-si.screenX,Pc=e.screenY-si.screenY):Pc=Jc=0,si=e),Jc)},movementY:function(e){return"movementY"in e?e.movementY:Pc}}),Nm=Lt($r),by=j({},$r,{dataTransfer:0}),ky=Lt(by),yy=j({},ni,{relatedTarget:0}),Fc=Lt(yy),jy=j({},Ts,{animationName:0,elapsedTime:0,pseudoElement:0}),wy=Lt(jy),Ny=j({},Ts,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Sy=Lt(Ny),Ty=j({},Ts,{data:0}),Sm=Lt(Ty),Cy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ey={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"},Ay={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function My(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ay[e])?!!t[e]:!1}function Wc(){return My}var zy=j({},ni,{key:function(e){if(e.key){var t=Cy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Or(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ey[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?Or(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Or(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ry=Lt(zy),Oy=j({},$r,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tm=Lt(Oy),_y=j({},Ts,{submitter:0}),Dy=Lt(_y),$y=j({},ni,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),Uy=Lt($y),Ly=j({},Ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=Lt(Ly),By=j({},$r,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qy=Lt(By),Iy=j({},Ts,{newState:0,oldState:0,source:0}),Gy=Lt(Iy),Yy=[9,13,27,32],eu=as&&"CompositionEvent"in window,li=null;as&&"documentMode"in document&&(li=document.documentMode);var Ky=as&&"TextEvent"in window&&!li,Cm=as&&(!eu||li&&8<li&&11>=li),Em=" ",Am=!1;function Mm(e,t){switch(e){case"keyup":return Yy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ql=!1;function Zy(e,t){switch(e){case"compositionend":return zm(t);case"keypress":return t.which!==32?null:(Am=!0,Em);case"textInput":return e=t.data,e===Em&&Am?null:e;default:return null}}function Xy(e,t){if(Ql)return e==="compositionend"||!eu&&Mm(e,t)?(e=jm(),Rr=Qc=Ss=null,Ql=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Cm&&t.locale!=="ko"?null:t.data;default:return null}}var Vy={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 Rm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vy[e.type]:t==="textarea"}function Om(e,t,l,r){Xl?Vl?Vl.push(r):Vl=[r]:Xl=r,t=Lo(t,"onChange"),0<t.length&&(l=new Dr("onChange","change",null,l,r),e.push({event:l,listeners:t}))}var ai=null,ii=null;function Qy(e){kv(e,0)}function Ur(e){var t=Wa(e);if(mm(t))return e}function _m(e,t){if(e==="change")return t}var Dm=!1;if(as){var tu;if(as){var nu="oninput"in document;if(!nu){var $m=document.createElement("div");$m.setAttribute("oninput","return;"),nu=typeof $m.oninput=="function"}tu=nu}else tu=!1;Dm=tu&&(!document.documentMode||9<document.documentMode)}function Um(){ai&&(ai.detachEvent("onpropertychange",Lm),ii=ai=null)}function Lm(e){if(e.propertyName==="value"&&Ur(ii)){var t=[];Om(t,ii,e,Zc(e)),ym(Qy,t)}}function Jy(e,t,l){e==="focusin"?(Um(),ai=t,ii=l,ai.attachEvent("onpropertychange",Lm)):e==="focusout"&&Um()}function Py(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ur(ii)}function Fy(e,t){if(e==="click")return Ur(t)}function Wy(e,t){if(e==="input"||e==="change")return Ur(t)}function ej(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sn=typeof Object.is=="function"?Object.is:ej;function ri(e,t){if(sn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),r=Object.keys(t);if(l.length!==r.length)return!1;for(r=0;r<l.length;r++){var u=l[r];if(!Dc.call(t,u)||!sn(e[u],t[u]))return!1}return!0}function su(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Hm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Bm(e,t){var l=Hm(e);e=0;for(var r;l;){if(l.nodeType===3){if(r=e+l.textContent.length,e<=t&&r>=t)return{node:l,offset:t-e};e=r}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Hm(l)}}function qm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Im(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=su(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=su(e.document)}return t}function lu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var tj=as&&"documentMode"in document&&11>=document.documentMode,Jl=null,au=null,oi=null,iu=!1;function Gm(e,t,l){var r=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;iu||Jl==null||Jl!==su(r)||(r=Jl,"selectionStart"in r&&lu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),oi&&ri(oi,r)||(oi=r,r=Lo(au,"onSelect"),0<r.length&&(t=new Dr("onSelect","select",null,t,l),e.push({event:t,listeners:r}),t.target=Jl)))}function ll(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Pl={animationend:ll("Animation","AnimationEnd"),animationiteration:ll("Animation","AnimationIteration"),animationstart:ll("Animation","AnimationStart"),transitionrun:ll("Transition","TransitionRun"),transitionstart:ll("Transition","TransitionStart"),transitioncancel:ll("Transition","TransitionCancel"),transitionend:ll("Transition","TransitionEnd")},ru={},Ym={};as&&(Ym=document.createElement("div").style,"AnimationEvent"in window||(delete Pl.animationend.animation,delete Pl.animationiteration.animation,delete Pl.animationstart.animation),"TransitionEvent"in window||delete Pl.transitionend.transition);function al(e){if(ru[e])return ru[e];if(!Pl[e])return e;var t=Pl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Ym)return ru[e]=t[l];return e}var Km=al("animationend"),Zm=al("animationiteration"),Xm=al("animationstart"),nj=al("transitionrun"),sj=al("transitionstart"),lj=al("transitioncancel"),Vm=al("transitionend"),Qm=new Map,ou="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");ou.push("scrollEnd");function Mn(e,t){Qm.set(e,t),sl(t,[e])}var aj=0;function is(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=_n.identifierPrefix;var l=aj++;return e="_"+e+"t_"+l.toString(32)+"_",t.autoName=e}function Jm(e){if(e==null||typeof e=="string")return e;var t=null,l=va;if(l!==null)for(var r=0;r<l.length;r++){var u=e[l[r]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function rs(e,t){return e=Jm(e),t=Jm(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Lr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},pn=[],Fl=0,cu=0;function Hr(){for(var e=Fl,t=cu=Fl=0;t<e;){var l=pn[t];pn[t++]=null;var r=pn[t];pn[t++]=null;var u=pn[t];pn[t++]=null;var f=pn[t];if(pn[t++]=null,r!==null&&u!==null){var b=r.pending;b===null?u.next=u:(u.next=b.next,b.next=u),r.pending=u}f!==0&&Pm(l,u,f)}}function Br(e,t,l,r){pn[Fl++]=e,pn[Fl++]=t,pn[Fl++]=l,pn[Fl++]=r,cu|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function uu(e,t,l,r){return Br(e,t,l,r),qr(e)}function il(e,t){return Br(e,null,null,t),qr(e)}function Pm(e,t,l){e.lanes|=l;var r=e.alternate;r!==null&&(r.lanes|=l);for(var u=!1,f=e.return;f!==null;)f.childLanes|=l,r=f.alternate,r!==null&&(r.childLanes|=l),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-tn(l),e=f.hiddenUpdates,r=e[u],r===null?e[u]=[t]:r.push(t),t.lane=l|536870912),f):null}function qr(e){if(50<Mi)throw Mi=0,zo=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Wl={};function ij(e,t,l,r){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,l,r){return new ij(e,t,l,r)}function du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function os(e,t){var l=e.alternate;return l===null?(l=Kt(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&1206910976,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Fm(e,t){e.flags&=1206910978;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ir(e,t,l,r,u,f){var b=0;if(r=e,typeof r=="function")du(r)&&(b=1);else if(typeof r=="string")b=_1(e,l,$t.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(r){case pt:return e=Kt(31,l,t,u),e.elementType=pt,e.lanes=f,e;case Z:return rl(l.children,u,f,t);case oe:b=8,u|=24;break;case ce:return e=Kt(12,l,t,u|2),e.elementType=ce,e.lanes=f,e;case xe:return e=Kt(13,l,t,u),e.elementType=xe,e.lanes=f,e;case ge:return e=Kt(19,l,t,u),e.elementType=ge,e.lanes=f,e;case wt:case D:return e=u|32,e=Kt(30,l,t,e),e.elementType=D,e.lanes=f,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Ce:b=10;break e;case ke:b=9;break e;case ue:b=11;break e;case Re:b=14;break e;case Te:b=16,r=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),r=null}return t=Kt(b,l,t,u),t.elementType=e,t.type=r,t.lanes=f,t}function rl(e,t,l,r){return e=Kt(7,e,r,t),e.lanes=l,e}function fu(e,t,l){return e=Kt(6,e,null,t),e.lanes=l,e}function Wm(e){var t=Kt(18,null,null,0);return t.stateNode=e,t}function hu(e,t,l){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ep=new WeakMap;function gn(e,t){if(typeof e=="object"&&e!==null){var l=ep.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Vh(t)},ep.set(e,t),t)}return{value:e,source:t,stack:Vh(t)}}var ea=[],ta=0,Gr=null,ci=0,vn=[],xn=0,Cs=null,Yn=1,Kn="";function cs(e,t){ea[ta++]=ci,ea[ta++]=Gr,Gr=e,ci=t}function tp(e,t,l){vn[xn++]=Yn,vn[xn++]=Kn,vn[xn++]=Cs,Cs=e;var r=Yn;e=Kn;var u=32-tn(r)-1;r&=~(1<<u),l+=1;var f=32-tn(t)+u;if(30<f){var b=u-u%5;f=(r&(1<<b)-1).toString(32),r>>=b,u-=b,Yn=1<<32-tn(t)+u|l<<u|r,Kn=f+e}else Yn=1<<f|l<<u|r,Kn=e}function Yr(e){e.return!==null&&(cs(e,1),tp(e,1,0))}function mu(e){for(;e===Gr;)Gr=ea[--ta],ea[ta]=null,ci=ea[--ta],ea[ta]=null;for(;e===Cs;)Cs=vn[--xn],vn[xn]=null,Kn=vn[--xn],vn[xn]=null,Yn=vn[--xn],vn[xn]=null}function np(e,t){vn[xn++]=Yn,vn[xn++]=Kn,vn[xn++]=Cs,Yn=t.id,Kn=t.overflow,Cs=e}var kt=null,We=null,Oe=!1,Es=null,bn=!1,pu=Error(o(519));function As(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ui(gn(t,e)),pu}function sp(e){var t=e.stateNode,l=e.type,r=e.memoizedProps;switch(t[Nt]=e,t[Yt]=r,l){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(l=0;l<Ri.length;l++)De(Ri[l],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),pm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),vm(t,r.value,r.defaultValue,r.children)}l=r.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||r.suppressHydrationWarning===!0||Nv(t.textContent,l)?(r.popover!=null&&(De("beforetoggle",t),De("toggle",t)),r.onScroll!=null&&De("scroll",t),r.onScrollEnd!=null&&De("scrollend",t),r.onClick!=null&&(t.onclick=Gn),t=!0):t=!1,t||As(e,!0)}function Kr(e){for(kt=e.return;kt;)switch(kt.tag){case 5:case 31:case 13:bn=!1;return;case 27:case 3:bn=!0;return;default:kt=kt.return}}function na(e){if(e!==kt)return!1;if(!Oe)return Kr(e),Oe=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Kd(e.type,e.memoizedProps)),l=!l),l&&We&&As(e),Kr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Gv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Gv(e)}else t===27?(t=We,Ks(e.type)?(e=ef,ef=null,We=e):We=t):We=kt?yn(e.stateNode.nextSibling):null;return!0}function ol(){We=kt=null,Oe=!1}function gu(){var e=Es;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Es=null),e}function ui(e){Es===null?Es=[e]:Es.push(e)}var vu=Dt(null),cl=null,us=null;function Ms(e,t,l){qe(vu,t._currentValue),t._currentValue=l}function ds(e){e._currentValue=vu.current,nt(vu)}function Zr(e,t,l){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===l)break;e=e.return}}function xu(e,t,l,r){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var b=u.child;f=f.firstContext;e:for(;f!==null;){var N=f;f=u;for(var z=0;z<t.length;z++)if(N.context===t[z]){f.lanes|=l,N=f.alternate,N!==null&&(N.lanes|=l),Zr(f.return,l,e),r||(b=null);break e}f=N.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(o(341));b.lanes|=l,f=b.alternate,f!==null&&(f.lanes|=l),Zr(b,l,e),b=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=l,b=u.alternate,b!==null&&(b.lanes|=l),Zr(u.return,l,e),b=u.child,b=b!==null?b.sibling:null):b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function ul(e,t,l,r){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var N=u.type;sn(u.pendingProps.value,b.value)||(e!==null?e.push(N):e=[N])}}else if(u===el.current){if(b=u.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ca):e=[Ca])}u=u.return}return e!==null&&xu(t,e,l,r),t.flags|=262144,e!==null}function Xr(e){for(e=e.firstContext;e!==null;){if(!sn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function dl(e){cl=e,us=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return lp(cl,e)}function Vr(e,t){return cl===null&&dl(e),lp(e,t)}function lp(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},us===null){if(e===null)throw Error(o(308));us=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else us=us.next=t;return l}var rj=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},oj=n.unstable_scheduleCallback,cj=n.unstable_NormalPriority,dt={$$typeof:Ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bu(){return{controller:new rj,data:new Map,refCount:0}}function di(e){e.refCount--,e.refCount===0&&oj(cj,function(){e.controller.abort()})}function ap(e,t){if((e.pendingLanes&4194048)!==0){var l=e.transitionTypes;for(l===null&&(l=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];l.indexOf(r)===-1&&l.push(r)}}}var fi=null;function uj(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var hi=null,ku=0,fl=0,sa=null;function dj(e,t){if(hi===null){var l=hi=[];ku=0,fl=$d(),sa={status:"pending",value:void 0,then:function(r){l.push(r)}}}return ku++,t.then(ip,ip),t}function ip(){if(--ku===0&&(fi=null,hi!==null)){sa!==null&&(sa.status="fulfilled");var e=hi;hi=null,fl=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fj(e,t){var l=[],r={status:"pending",value:null,reason:null,then:function(u){l.push(u)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var u=0;u<l.length;u++)(0,l[u])(t)},function(u){for(r.status="rejected",r.reason=u,u=0;u<l.length;u++)(0,l[u])(void 0)}),r}var rp=fe.S;fe.S=function(e,t){if(Wg=Wt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&dj(e,t),fi!==null)for(var l=ya;l!==null;)ap(l,fi),l=l.next;if(l=e.types,l!==null){for(var r=ya;r!==null;)ap(r,l),r=r.next;if(fl!==0){r=fi,r===null&&(r=fi=[]);for(var u=0;u<l.length;u++){var f=l[u];r.indexOf(f)===-1&&r.push(f)}}}rp!==null&&rp(e,t)};var hl=Dt(null);function yu(){var e=hl.current;return e!==null?e:Pe.pooledCache}function Qr(e,t){t===null?qe(hl,hl.current):qe(hl,t.pool)}function op(){var e=yu();return e===null?null:{parent:dt._currentValue,pool:e}}var la=Error(o(460)),ju=Error(o(474)),Jr=Error(o(542)),Pr={then:function(){}};function cp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function up(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Gn,Gn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fp(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(Gn,Gn);else{if(e=Pe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=r}},function(r){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fp(e),e}throw pl=t,la}}function ml(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(pl=l,la):l}}var pl=null;function dp(){if(pl===null)throw Error(o(459));var e=pl;return pl=null,e}function fp(e){if(e===la||e===Jr)throw Error(o(483))}var aa=null,mi=0;function Fr(e){var t=mi;return mi+=1,aa===null&&(aa=[]),up(aa,e,t)}function zs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Wr(e,t){throw t.$$typeof===y?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function hp(e){function t(B,_){if(e){var Y=B.deletions;Y===null?(B.deletions=[_],B.flags|=16):Y.push(_)}}function l(B,_){if(!e)return null;for(;_!==null;)t(B,_),_=_.sibling;return null}function r(B){for(var _=new Map;B!==null;)B.key===null?_.set(B.index,B):_.set(B.key,B),B=B.sibling;return _}function u(B,_){return B=os(B,_),B.index=0,B.sibling=null,B}function f(B,_,Y){return B.index=Y,e?(Y=B.alternate,Y!==null?(Y=Y.index,Y<_?(B.flags|=2,_):Y):(B.flags|=134217730,_)):(B.flags|=1048576,_)}function b(B){return e&&B.alternate===null&&(B.flags|=134217730),B}function N(B,_,Y,P){return _===null||_.tag!==6?(_=fu(Y,B.mode,P),_.return=B,_):(_=u(_,Y),_.return=B,_)}function z(B,_,Y,P){var pe=Y.type;return pe===Z?(B=V(B,_,Y.props.children,P,Y.key),zs(B,Y),B):_!==null&&(_.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Te&&ml(pe)===_.type)?(_=u(_,Y.props),zs(_,Y),_.return=B,_):(_=Ir(Y.type,Y.key,Y.props,null,B.mode,P),zs(_,Y),_.return=B,_)}function q(B,_,Y,P){return _===null||_.tag!==4||_.stateNode.containerInfo!==Y.containerInfo||_.stateNode.implementation!==Y.implementation?(_=hu(Y,B.mode,P),_.return=B,_):(_=u(_,Y.children||[]),_.return=B,_)}function V(B,_,Y,P,pe){return _===null||_.tag!==7?(_=rl(Y,B.mode,P,pe),_.return=B,_):(_=u(_,Y),_.return=B,_)}function F(B,_,Y){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=fu(""+_,B.mode,Y),_.return=B,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case S:return Y=Ir(_.type,_.key,_.props,null,B.mode,Y),zs(Y,_),Y.return=B,Y;case U:return _=hu(_,B.mode,Y),_.return=B,_;case Te:return _=ml(_),F(B,_,Y)}if(ae(_)||G(_))return _=rl(_,B.mode,Y,null),_.return=B,_;if(typeof _.then=="function")return F(B,Fr(_),Y);if(_.$$typeof===Ce)return F(B,Vr(B,_),Y);Wr(B,_)}return null}function H(B,_,Y,P){var pe=_!==null?_.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return pe!==null?null:N(B,_,""+Y,P);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return Y.key===pe?z(B,_,Y,P):null;case U:return Y.key===pe?q(B,_,Y,P):null;case Te:return Y=ml(Y),H(B,_,Y,P)}if(ae(Y)||G(Y))return pe!==null?null:V(B,_,Y,P,null);if(typeof Y.then=="function")return H(B,_,Fr(Y),P);if(Y.$$typeof===Ce)return H(B,_,Vr(B,Y),P);Wr(B,Y)}return null}function K(B,_,Y,P,pe){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return B=B.get(Y)||null,N(_,B,""+P,pe);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case S:return B=B.get(P.key===null?Y:P.key)||null,z(_,B,P,pe);case U:return B=B.get(P.key===null?Y:P.key)||null,q(_,B,P,pe);case Te:return P=ml(P),K(B,_,Y,P,pe)}if(ae(P)||G(P))return B=B.get(Y)||null,V(_,B,P,pe,null);if(typeof P.then=="function")return K(B,_,Y,Fr(P),pe);if(P.$$typeof===Ce)return K(B,_,Y,Vr(_,P),pe);Wr(_,P)}return null}function de(B,_,Y,P){for(var pe=null,He=null,je=_,Ne=_=0,mt=null;je!==null&&Ne<Y.length;Ne++){je.index>Ne?(mt=je,je=null):mt=je.sibling;var Be=H(B,je,Y[Ne],P);if(Be===null){je===null&&(je=mt);break}e&&je&&Be.alternate===null&&t(B,je),_=f(Be,_,Ne),He===null?pe=Be:He.sibling=Be,He=Be,je=mt}if(Ne===Y.length)return l(B,je),Oe&&cs(B,Ne),pe;if(je===null){for(;Ne<Y.length;Ne++)je=F(B,Y[Ne],P),je!==null&&(_=f(je,_,Ne),He===null?pe=je:He.sibling=je,He=je);return Oe&&cs(B,Ne),pe}for(je=r(je);Ne<Y.length;Ne++)mt=K(je,B,Ne,Y[Ne],P),mt!==null&&(e&&(Be=mt.alternate,Be!==null&&je.delete(Be.key===null?Ne:Be.key)),_=f(mt,_,Ne),He===null?pe=mt:He.sibling=mt,He=mt);return e&&je.forEach(function(Js){return t(B,Js)}),Oe&&cs(B,Ne),pe}function be(B,_,Y,P){if(Y==null)throw Error(o(151));for(var pe=null,He=null,je=_,Ne=_=0,mt=null,Be=Y.next();je!==null&&!Be.done;Ne++,Be=Y.next()){je.index>Ne?(mt=je,je=null):mt=je.sibling;var Js=H(B,je,Be.value,P);if(Js===null){je===null&&(je=mt);break}e&&je&&Js.alternate===null&&t(B,je),_=f(Js,_,Ne),He===null?pe=Js:He.sibling=Js,He=Js,je=mt}if(Be.done)return l(B,je),Oe&&cs(B,Ne),pe;if(je===null){for(;!Be.done;Ne++,Be=Y.next())Be=F(B,Be.value,P),Be!==null&&(_=f(Be,_,Ne),He===null?pe=Be:He.sibling=Be,He=Be);return Oe&&cs(B,Ne),pe}for(je=r(je);!Be.done;Ne++,Be=Y.next())Be=K(je,B,Ne,Be.value,P),Be!==null&&(e&&(mt=Be.alternate,mt!==null&&je.delete(mt.key===null?Ne:mt.key)),_=f(Be,_,Ne),He===null?pe=Be:He.sibling=Be,He=Be);return e&&je.forEach(function(Z1){return t(B,Z1)}),Oe&&cs(B,Ne),pe}function Me(B,_,Y,P){if(typeof Y=="object"&&Y!==null&&Y.type===Z&&Y.key===null&&Y.props.ref===void 0&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:e:{for(var pe=Y.key;_!==null;){if(_.key===pe){if(pe=Y.type,pe===Z){if(_.tag===7){l(B,_.sibling),P=u(_,Y.props.children),zs(P,Y),P.return=B,B=P;break e}}else if(_.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Te&&ml(pe)===_.type){l(B,_.sibling),P=u(_,Y.props),zs(P,Y),P.return=B,B=P;break e}l(B,_);break}else t(B,_);_=_.sibling}Y.type===Z?(P=rl(Y.props.children,B.mode,P,Y.key),zs(P,Y),P.return=B,B=P):(P=Ir(Y.type,Y.key,Y.props,null,B.mode,P),zs(P,Y),P.return=B,B=P)}return b(B);case U:e:{for(pe=Y.key;_!==null;){if(_.key===pe)if(_.tag===4&&_.stateNode.containerInfo===Y.containerInfo&&_.stateNode.implementation===Y.implementation){l(B,_.sibling),P=u(_,Y.children||[]),P.return=B,B=P;break e}else{l(B,_);break}else t(B,_);_=_.sibling}P=hu(Y,B.mode,P),P.return=B,B=P}return b(B);case Te:return Y=ml(Y),Me(B,_,Y,P)}if(ae(Y))return de(B,_,Y,P);if(G(Y)){if(pe=G(Y),typeof pe!="function")throw Error(o(150));return Y=pe.call(Y),be(B,_,Y,P)}if(typeof Y.then=="function")return Me(B,_,Fr(Y),P);if(Y.$$typeof===Ce)return Me(B,_,Vr(B,Y),P);Wr(B,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,_!==null&&_.tag===6?(l(B,_.sibling),P=u(_,Y),P.return=B,B=P):(l(B,_),P=fu(Y,B.mode,P),P.return=B,B=P),b(B)):l(B,_)}return function(B,_,Y,P){try{mi=0;var pe=Me(B,_,Y,P);return aa=null,pe}catch(je){if(je===la||je===Jr)throw je;var He=Kt(29,je,null,B.mode);return He.lanes=P,He.return=B,He}finally{}}}var gl=hp(!0),mp=hp(!1),Rs=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _s(e,t,l){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ge&2)!==0){var u=r.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),r.pending=t,t=qr(e),Pm(e,null,l),t}return Br(e,r,t,l),qr(e)}function pi(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,l|=r,t.lanes=l,tm(e,l)}}function Su(e,t){var l=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,l===r)){var u=null,f=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};f===null?u=f=b:f=f.next=b,l=l.next}while(l!==null);f===null?u=f=t:f=f.next=t}else u=f=t;l={baseState:r.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:r.shared,callbacks:r.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Tu=!1;function gi(){if(Tu){var e=sa;if(e!==null)throw e}}function vi(e,t,l,r){Tu=!1;var u=e.updateQueue;Rs=!1;var f=u.firstBaseUpdate,b=u.lastBaseUpdate,N=u.shared.pending;if(N!==null){u.shared.pending=null;var z=N,q=z.next;z.next=null,b===null?f=q:b.next=q,b=z;var V=e.alternate;V!==null&&(V=V.updateQueue,N=V.lastBaseUpdate,N!==b&&(N===null?V.firstBaseUpdate=q:N.next=q,V.lastBaseUpdate=z))}if(f!==null){var F=u.baseState;b=0,V=q=z=null,N=f;do{var H=N.lane&-536870913,K=H!==N.lane;if(K?(Le&H)===H:(r&H)===H){H!==0&&H===fl&&(Tu=!0),V!==null&&(V=V.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var de=e,be=N;H=t;var Me=l;switch(be.tag){case 1:if(de=be.payload,typeof de=="function"){F=de.call(Me,F,H);break e}F=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=be.payload,H=typeof de=="function"?de.call(Me,F,H):de,H==null)break e;F=j({},F,H);break e;case 2:Rs=!0}}H=N.callback,H!==null&&(e.flags|=64,K&&(e.flags|=8192),K=u.callbacks,K===null?u.callbacks=[H]:K.push(H))}else K={lane:H,tag:N.tag,payload:N.payload,callback:N.callback,next:null},V===null?(q=V=K,z=F):V=V.next=K,b|=H;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;K=N,N=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);V===null&&(z=F),u.baseState=z,u.firstBaseUpdate=q,u.lastBaseUpdate=V,f===null&&(u.shared.lanes=0),qs|=b,e.lanes=b,e.memoizedState=F}}function pp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function gp(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)pp(l[e],t)}var Ds=Dt(null),eo=Dt(0);function vp(e,t){e=gs,qe(eo,e),qe(Ds,t),gs=e|t.baseLanes}function Cu(){qe(eo,gs),qe(Ds,Ds.current)}function Eu(){gs=eo.current,nt(Ds),nt(eo)}var Tt=Dt(null),Rt=null;function $s(e){var t=e.alternate;qe(Ct,Ct.current&1),qe(Tt,e),Rt===null&&(t===null||Ds.current!==null||t.memoizedState!==null)&&(Rt=e)}function Au(e){qe(Ct,Ct.current),qe(Tt,e),Rt===null&&(Rt=e)}function xp(e){e.tag===22?(qe(Ct,Ct.current),qe(Tt,e),Rt===null&&(Rt=e)):Us()}function Us(){qe(Ct,Ct.current),qe(Tt,Tt.current)}function ln(e){nt(Tt),Rt===e&&(Rt=null),nt(Ct)}var Ct=Dt(0);function xi(e,t){qe(Tt,Tt.current),qe(Ct,t)}function Mu(e){nt(Ct),nt(Tt),Rt===e&&(Rt=null)}function to(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Fd(l)||Wd(l)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fs=0,Ae=null,Je=null,ft=null,no=!1,ia=!1,vl=!1,so=0,bi=0,ra=null,hj=0;function it(){throw Error(o(321))}function zu(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!sn(e[l],t[l]))return!1;return!0}function Ru(e,t,l,r,u,f){return fs=f,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fe.H=e===null||e.memoizedState===null?tg:ng,vl=!1,f=l(r,u),vl=!1,ia&&(f=kp(t,l,r,u)),bp(e),f}function bp(e){fe.H=uo;var t=Je!==null&&Je.next!==null;if(fs=0,ft=Je=Ae=null,no=!1,bi=0,ra=null,t)throw Error(o(300));e===null||ht||(e=e.dependencies,e!==null&&Xr(e)&&(ht=!0))}function kp(e,t,l,r){Ae=e;var u=0;do{if(ia&&(ra=null),bi=0,ia=!1,25<=u)throw Error(o(301));if(u+=1,ft=Je=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}fe.H=yj,f=t(l,r)}while(ia);return f}function mj(){var e=fe.H,t=e.useState()[0];return t=typeof t.then=="function"?ki(t):t,e=e.useState()[0],(Je!==null?Je.memoizedState:null)!==e&&(Ae.flags|=1024),t}function Ou(){var e=so!==0;return so=0,e}function _u(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Du(e){if(no){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}no=!1}fs=0,ft=Je=Ae=null,ia=!1,bi=so=0,ra=null}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Ae.memoizedState=ft=e:ft=ft.next=e,ft}function ct(){if(Je===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=ft===null?Ae.memoizedState:ft.next;if(t!==null)ft=t,Je=e;else{if(e===null)throw Ae.alternate===null?Error(o(467)):Error(o(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},ft===null?Ae.memoizedState=ft=e:ft=ft.next=e}return ft}function lo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ki(e){var t=bi;return bi+=1,ra===null&&(ra=[]),e=up(ra,e,t),t=Ae,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,fe.H=t===null||t.memoizedState===null?tg:ng),e}function ao(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ki(e);if(e.$$typeof===se)return;if(e.$$typeof===Ce)return St(e)}throw Error(o(438,String(e)))}function $u(e){var t=null,l=Ae.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var r=Ae.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=lo(),Ae.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),r=0;r<e;r++)l[r]=gt;return t.index++,l}function hs(e,t){return typeof t=="function"?t(e):t}function io(e){var t=ct();return Uu(t,Je,e)}function Uu(e,t,l){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=l;var u=e.baseQueue,f=r.pending;if(f!==null){if(u!==null){var b=u.next;u.next=f.next,f.next=b}t.baseQueue=u=f,r.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var N=b=null,z=null,q=t,V=!1;do{var F=q.lane&-536870913;if(F!==q.lane?(Le&F)===F:(fs&F)===F){var H=q.revertLane;if(H===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),F===fl&&(V=!0);else if((fs&H)===H){q=q.next,H===fl&&(V=!0);continue}else F={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},z===null?(N=z=F,b=f):z=z.next=F,Ae.lanes|=H,qs|=H;F=q.action,vl&&l(f,F),f=q.hasEagerState?q.eagerState:l(f,F)}else H={lane:F,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},z===null?(N=z=H,b=f):z=z.next=H,Ae.lanes|=F,qs|=F;q=q.next}while(q!==null&&q!==t);if(z===null?b=f:z.next=N,!sn(f,e.memoizedState)&&(ht=!0,V&&(l=sa,l!==null)))throw l;e.memoizedState=f,e.baseState=b,e.baseQueue=z,r.lastRenderedState=f}return u===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Lu(e){var t=ct(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var r=l.dispatch,u=l.pending,f=t.memoizedState;if(u!==null){l.pending=null;var b=u=u.next;do f=e(f,b.action),b=b.next;while(b!==u);sn(f,t.memoizedState)||(ht=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),l.lastRenderedState=f}return[f,r]}function yp(e,t,l){var r=Ae,u=ct(),f=Oe;if(f){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!sn((Je||u).memoizedState,l);if(b&&(u.memoizedState=l,ht=!0),u=u.queue,qu(Np.bind(null,r,u,e),[e]),e=u.getSnapshot!==t||b||ft!==null&&(ft.memoizedState.tag&1)!==0,oa(e?9:8,{destroy:void 0},wp.bind(null,r,u,l,t),null),e){if(r.flags|=2048,Pe===null)throw Error(o(349));f||(fs&127)!==0||jp(r,t,l)}return l}function jp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Ae.updateQueue,t===null?(t=lo(),Ae.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function wp(e,t,l,r){t.value=l,t.getSnapshot=r,Sp(t)&&Tp(e)}function Np(e,t,l){return l(function(){Sp(t)&&Tp(e)})}function Sp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!sn(e,l)}catch{return!0}}function Tp(e){var t=il(e,2);t!==null&&Qt(t,e,2)}function Hu(e){var t=Ht();if(typeof e=="function"){var l=e;if(e=l(),vl){Ns(!0);try{l()}finally{Ns(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},t}function Cp(e,t,l,r){return e.baseState=l,Uu(e,Je,typeof r=="function"?r:hs)}function pj(e,t,l,r,u){if(co(e))throw Error(o(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){f.listeners.push(b)}};fe.T!==null?l(!0):f.isTransition=!1,r(f),l=t.pending,l===null?(f.next=t.pending=f,Ep(t,f)):(f.next=l.next,t.pending=l.next=f)}}function Ep(e,t){var l=t.action,r=t.payload,u=e.state;if(t.isTransition){var f=fe.T,b={};b.types=f!==null?f.types:null,fe.T=b;try{var N=l(u,r),z=fe.S;z!==null&&z(b,N),Ap(e,t,N)}catch(q){Bu(e,t,q)}finally{f!==null&&b.types!==null&&(f.types=b.types),fe.T=f}}else try{f=l(u,r),Ap(e,t,f)}catch(q){Bu(e,t,q)}}function Ap(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(r){Mp(e,t,r)},function(r){return Bu(e,t,r)}):Mp(e,t,l)}function Mp(e,t,l){t.status="fulfilled",t.value=l,zp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Ep(e,l)))}function Bu(e,t,l){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=l,zp(t),t=t.next;while(t!==r)}e.action=null}function zp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rp(e,t){return t}function Op(e,t){if(Oe){var l=Pe.formState;if(l!==null){e:{var r=Ae;if(Oe){if(We){t:{for(var u=We,f=bn;u.nodeType!==8;){if(!f){u=null;break t}if(u=yn(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){We=yn(u.nextSibling),r=u.data==="F!";break e}}As(r)}r=!1}r&&(t=l[0])}}return l=Ht(),l.memoizedState=l.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rp,lastRenderedState:t},l.queue=r,l=Fp.bind(null,Ae,r),r.dispatch=l,r=Hu(!1),f=Zu.bind(null,Ae,!1,r.queue),r=Ht(),u={state:t,dispatch:null,action:e,pending:null},r.queue=u,l=pj.bind(null,Ae,u,f,l),u.dispatch=l,r.memoizedState=e,[t,l,!1]}function _p(e){var t=ct();return Dp(t,Je,e)}function Dp(e,t,l){if(t=Uu(e,t,Rp)[0],e=io(hs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=ki(t)}catch(b){throw b===la?Jr:b}else r=t;t=ct();var u=t.queue,f=u.dispatch;return l!==t.memoizedState&&(Ae.flags|=2048,oa(9,{destroy:void 0},gj.bind(null,u,l),null)),[r,f,e]}function gj(e,t){e.action=t}function $p(e){var t=ct(),l=Je;if(l!==null)return Dp(t,l,e);ct(),t=t.memoizedState,l=ct();var r=l.queue.dispatch;return l.memoizedState=e,[t,r,!1]}function oa(e,t,l,r){return e={tag:e,create:l,deps:r,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=lo(),Ae.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(r=l.next,l.next=e,e.next=r,t.lastEffect=e),e}function Up(){return ct().memoizedState}function ro(e,t,l,r){var u=Ht();Ae.flags|=e,u.memoizedState=oa(1|t,{destroy:void 0},l,r===void 0?null:r)}function oo(e,t,l,r){var u=ct();r=r===void 0?null:r;var f=u.memoizedState.inst;Je!==null&&r!==null&&zu(r,Je.memoizedState.deps)?u.memoizedState=oa(t,f,l,r):(Ae.flags|=e,u.memoizedState=oa(1|t,f,l,r))}function Lp(e,t){ro(8390656,8,e,t)}function qu(e,t){oo(2048,8,e,t)}function vj(e){Ae.flags|=4;var t=Ae.updateQueue;if(t===null)t=lo(),Ae.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Hp(e){var t=ct().memoizedState;return vj({ref:t,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Bp(e,t){return oo(4,2,e,t)}function qp(e,t){return oo(4,4,e,t)}function Ip(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Gp(e,t,l){l=l!=null?l.concat([e]):null,oo(4,4,Ip.bind(null,t,e),l)}function Iu(){}function Yp(e,t){var l=ct();t=t===void 0?null:t;var r=l.memoizedState;return t!==null&&zu(t,r[1])?r[0]:(l.memoizedState=[e,t],e)}function Kp(e,t){var l=ct();t=t===void 0?null:t;var r=l.memoizedState;if(t!==null&&zu(t,r[1]))return r[0];if(r=e(),vl){Ns(!0);try{e()}finally{Ns(!1)}}return l.memoizedState=[r,t],r}function Gu(e,t,l){return l===void 0||(fs&1073741824)!==0&&(Le&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=tv(),Ae.lanes|=e,qs|=e,l)}function Zp(e,t,l,r){return sn(l,t)?l:Ds.current!==null?(e=Gu(e,l,r),sn(e,t)||(ht=!0),e):(fs&106)===0||(fs&1073741824)!==0&&(Le&261930)===0?(ht=!0,e.memoizedState=l):(e=tv(),Ae.lanes|=e,qs|=e,t)}function Xp(e,t,l,r,u){var f=ve.p;ve.p=f!==0&&8>f?f:8;var b=fe.T,N={};N.types=b!==null?b.types:null,fe.T=N,Zu(e,!1,t,l);try{var z=u(),q=fe.S;if(q!==null&&q(N,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var V=fj(z,r);yi(e,t,V,cn(e))}else yi(e,t,r,cn(e))}catch(F){yi(e,t,{then:function(){},status:"rejected",reason:F},cn())}finally{ve.p=f,b!==null&&N.types!==null&&(b.types=N.types),fe.T=b}}function xj(){}function Yu(e,t,l,r){if(e.tag!==5)throw Error(o(476));var u=Vp(e).queue;Xp(e,u,t,tt,l===null?xj:function(){return Qp(e),l(r)})}function Vp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:tt,baseState:tt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:tt},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Qp(e){var t=Vp(e);t.next===null&&(t=e.alternate.memoizedState),yi(e,t.next.queue,{},cn())}function Ku(){return St(Ca)}function Jp(){return ct().memoizedState}function Pp(){return ct().memoizedState}function bj(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=cn();e=Os(l);var r=_s(t,e,l);r!==null&&(Qt(r,t,l),pi(r,t,l)),t={cache:bu()},e.payload=t;return}t=t.return}}function kj(e,t,l){var r=cn();l={lane:r,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},co(e)?Wp(t,l):(l=uu(e,t,l,r),l!==null&&(Qt(l,e,r),eg(l,t,r)))}function Fp(e,t,l){var r=cn();yi(e,t,l,r)}function yi(e,t,l,r){var u={lane:r,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(co(e))Wp(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var b=t.lastRenderedState,N=f(b,l);if(u.hasEagerState=!0,u.eagerState=N,sn(N,b))return Br(e,t,u,0),Pe===null&&Hr(),!1}catch{}finally{}if(l=uu(e,t,u,r),l!==null)return Qt(l,e,r),eg(l,t,r),!0}return!1}function Zu(e,t,l,r){if(r={lane:2,revertLane:$d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},co(e)){if(t)throw Error(o(479))}else t=uu(e,l,r,2),t!==null&&Qt(t,e,2)}function co(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function Wp(e,t){ia=no=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function eg(e,t,l){if((l&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,l|=r,t.lanes=l,tm(e,l)}}var uo={readContext:St,use:ao,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it,useEffectEvent:it},tg={readContext:St,use:ao,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Lp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,ro(4194308,4,Ip.bind(null,t,e),l)},useLayoutEffect:function(e,t){return ro(4194308,4,e,t)},useInsertionEffect:function(e,t){ro(4,2,e,t)},useMemo:function(e,t){var l=Ht();t=t===void 0?null:t;var r=e();if(vl){Ns(!0);try{e()}finally{Ns(!1)}}return l.memoizedState=[r,t],r},useReducer:function(e,t,l){var r=Ht();if(l!==void 0){var u=l(t);if(vl){Ns(!0);try{l(t)}finally{Ns(!1)}}}else u=t;return r.memoizedState=r.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},r.queue=e,e=e.dispatch=kj.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:function(e){e=Hu(e);var t=e.queue,l=Fp.bind(null,Ae,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Iu,useDeferredValue:function(e,t){var l=Ht();return Gu(l,e,t)},useTransition:function(){var e=Hu(!1);return e=Xp.bind(null,Ae,e.queue,!0,!1),Ht().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var r=Ae,u=Ht();if(Oe){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Pe===null)throw Error(o(349));(Le&127)!==0||jp(r,t,l)}u.memoizedState=l;var f={value:l,getSnapshot:t};return u.queue=f,Lp(Np.bind(null,r,f,e),[e]),r.flags|=2048,oa(9,{destroy:void 0},wp.bind(null,r,f,l,t),null),l},useId:function(){var e=Ht(),t=Pe.identifierPrefix;if(Oe){var l=Kn,r=Yn;l=(r&~(1<<32-tn(r)-1)).toString(32)+l,t="_"+t+"R_"+l,l=so++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=hj++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ku,useFormState:Op,useActionState:Op,useOptimistic:function(e){var t=Ht();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Zu.bind(null,Ae,!0,l),l.dispatch=t,[e,t]},useMemoCache:$u,useCacheRefresh:function(){return Ht().memoizedState=bj.bind(null,Ae)},useEffectEvent:function(e){var t=Ht(),l={impl:e};return t.memoizedState=l,function(){if((Ge&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},ng={readContext:St,use:ao,useCallback:Yp,useContext:St,useEffect:qu,useImperativeHandle:Gp,useInsertionEffect:Bp,useLayoutEffect:qp,useMemo:Kp,useReducer:io,useRef:Up,useState:function(){return io(hs)},useDebugValue:Iu,useDeferredValue:function(e,t){var l=ct();return Zp(l,Je.memoizedState,e,t)},useTransition:function(){var e=io(hs)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:ki(e),t]},useSyncExternalStore:yp,useId:Jp,useHostTransitionStatus:Ku,useFormState:_p,useActionState:_p,useOptimistic:function(e,t){var l=ct();return Cp(l,Je,e,t)},useMemoCache:$u,useCacheRefresh:Pp,useEffectEvent:Hp},yj={readContext:St,use:ao,useCallback:Yp,useContext:St,useEffect:qu,useImperativeHandle:Gp,useInsertionEffect:Bp,useLayoutEffect:qp,useMemo:Kp,useReducer:Lu,useRef:Up,useState:function(){return Lu(hs)},useDebugValue:Iu,useDeferredValue:function(e,t){var l=ct();return Je===null?Gu(l,e,t):Zp(l,Je.memoizedState,e,t)},useTransition:function(){var e=Lu(hs)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:ki(e),t]},useSyncExternalStore:yp,useId:Jp,useHostTransitionStatus:Ku,useFormState:$p,useActionState:$p,useOptimistic:function(e,t){var l=ct();return Je!==null?Cp(l,Je,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:$u,useCacheRefresh:Pp,useEffectEvent:Hp};function Xu(e,t,l,r){t=e.memoizedState,l=l(r,t),l=l==null?t:j({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Vu={enqueueSetState:function(e,t,l){e=e._reactInternals;var r=cn(),u=Os(r);u.payload=t,l!=null&&(u.callback=l),t=_s(e,u,r),t!==null&&(Qt(t,e,r),pi(t,e,r))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var r=cn(),u=Os(r);u.tag=1,u.payload=t,l!=null&&(u.callback=l),t=_s(e,u,r),t!==null&&(Qt(t,e,r),pi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=cn(),r=Os(l);r.tag=2,t!=null&&(r.callback=t),t=_s(e,r,l),t!==null&&(Qt(t,e,l),pi(t,e,l))}};function sg(e,t,l,r,u,f,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,f,b):t.prototype&&t.prototype.isPureReactComponent?!ri(l,r)||!ri(u,f):!0}function lg(e,t,l,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,r),t.state!==e&&Vu.enqueueReplaceState(t,t.state,null)}function xl(e,t){var l=t;if("ref"in t){l={};for(var r in t)r!=="ref"&&(l[r]=t[r])}if(e=e.defaultProps){l===t&&(l=j({},l));for(var u in e)l[u]===void 0&&(l[u]=e[u])}return l}function ag(e){Lr(e)}function ig(e){console.error(e)}function rg(e){Lr(e)}function fo(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function og(e,t,l){try{var r=e.onCaughtError;r(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Qu(e,t,l){return l=Os(l),l.tag=3,l.payload={element:null},l.callback=function(){fo(e,t)},l}function cg(e){return e=Os(e),e.tag=3,e}function ug(e,t,l,r){var u=l.type.getDerivedStateFromError;if(typeof u=="function"){var f=r.value;e.payload=function(){return u(f)},e.callback=function(){og(t,l,r)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){og(t,l,r),typeof u!="function"&&(Is===null?Is=new Set([this]):Is.add(this));var N=r.stack;this.componentDidCatch(r.value,{componentStack:N!==null?N:""})})}function jj(e,t,l,r,u){if(l.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=l.alternate,t!==null&&ul(t,l,u,!0),l=Tt.current,l!==null){switch(l.tag){case 31:case 13:case 19:return Rt===null?Oo():l.alternate===null&&rt===0&&(rt=3),l.flags&=-257,l.flags|=65536,l.lanes=u,r===Pr?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([r]):t.add(r),Od(e,r,u)),!1;case 22:return l.flags|=65536,r===Pr?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([r]):l.add(r)),Od(e,r,u)),!1}throw Error(o(435,l.tag))}return Od(e,r,u),Oo(),!1}if(Oe)return t=Tt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,r!==pu&&(e=Error(o(422),{cause:r}),ui(gn(e,l)))):(r!==pu&&(t=Error(o(423),{cause:r}),ui(gn(t,l))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,r=gn(r,l),u=Qu(e.stateNode,r,u),Su(e,u),rt!==4&&(rt=2)),!1;var f=Error(o(520),{cause:r});if(f=gn(f,l),Ai===null?Ai=[f]:Ai.push(f),rt!==4&&(rt=2),t===null)return!0;r=gn(r,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=u&-u,l.lanes|=e,e=Qu(l.stateNode,r,e),Su(l,e),!1;case 1:if(t=l.type,f=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Is===null||!Is.has(f))))return l.flags|=65536,u&=-u,l.lanes|=u,u=cg(u),ug(u,e,l,r),Su(l,u),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var Ju=Error(o(461)),ht=!1;function vt(e,t,l,r){t.child=e===null?mp(t,null,l,r):gl(t,e.child,l,r)}function dg(e,t,l,r,u){l=l.render;var f=t.ref;if("ref"in r){var b={};for(var N in r)N!=="ref"&&(b[N]=r[N])}else b=r;return dl(t),r=Ru(e,t,l,b,f,u),N=Ou(),e!==null&&!ht?(_u(e,t,u),ms(e,t,u)):(Oe&&N&&Yr(t),t.flags|=1,vt(e,t,r,u),t.child)}function fg(e,t,l,r,u){if(e===null){var f=l.type;return typeof f=="function"&&!du(f)&&f.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=f,hg(e,t,f,r,u)):(e=Ir(l.type,null,r,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!ld(e,u)){var b=f.memoizedProps;if(l=l.compare,l=l!==null?l:ri,l(b,r)&&e.ref===t.ref)return ms(e,t,u)}return t.flags|=1,e=os(f,r),e.ref=t.ref,e.return=t,t.child=e}function hg(e,t,l,r,u){if(e!==null){var f=e.memoizedProps;if(ri(f,r)&&e.ref===t.ref)if(ht=!1,t.pendingProps=r=f,ld(e,u))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,ms(e,t,u)}return Pu(e,t,l,r,u)}function mg(e,t,l,r){var u=r.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|l:l,e!==null){for(r=t.child=e.child,u=0;r!==null;)u=u|r.lanes|r.childLanes,r=r.sibling;r=u&~f}else r=0,t.child=null;return pg(e,t,f,l,r)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Qr(t,f!==null?f.cachePool:null),f!==null?vp(t,f):Cu(),xp(t);else return r=t.lanes=536870912,pg(e,t,f!==null?f.baseLanes|l:l,l,r)}else f!==null?(Qr(t,f.cachePool),vp(t,f),Us(),t.memoizedState=null):(e!==null&&Qr(t,null),Cu(),Us());return vt(e,t,u,l),t.child}function ji(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pg(e,t,l,r,u){var f=yu();return f=f===null?null:{parent:dt._currentValue,pool:f},t.memoizedState={baseLanes:l,cachePool:f},e!==null&&Qr(t,null),Cu(),xp(t),e!==null&&ul(e,t,r,!0),t.childLanes=u,null}function ho(e,t){return t=mo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function gg(e,t,l){return gl(t,e.child,null,l),e=ho(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function wj(e,t,l){var r=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Oe){if(r.mode==="hidden")return e=ho(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},ji(null,e);if(Au(t),(e=We)?(e=Iv(e,bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:Yn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},l=Wm(e),l.return=t,t.child=l,kt=t,We=null)):e=null,e===null)throw As(t);return t.lanes=536870912,null}return ho(t,r)}var f=e.memoizedState;if(f!==null){var b=f.dehydrated;if(Au(t),u)if(t.flags&256)t.flags&=-257,t=gg(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ht||ul(e,t,l,!1),u=(l&e.childLanes)!==0,ht||u){if(Ds.current===null){if(r=Pe,r!==null&&(b=nm(r,l),b!==0&&b!==f.retryLane))throw f.retryLane=b,il(e,b),Qt(r,e,b),Ju;Oo()}t=gg(e,t,l)}else e=f.treeContext,We=yn(b.nextSibling),kt=t,Oe=!0,Es=null,bn=!1,e!==null&&np(t,e),t=ho(t,r),t.flags|=134221824;return t}return e=os(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ca(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Pu(e,t,l,r,u){return dl(t),l=Ru(e,t,l,r,void 0,u),r=Ou(),e!==null&&!ht?(_u(e,t,u),ms(e,t,u)):(Oe&&r&&Yr(t),t.flags|=1,vt(e,t,l,u),t.child)}function vg(e,t,l,r,u,f){return dl(t),t.updateQueue=null,l=kp(t,r,l,u),bp(e),r=Ou(),e!==null&&!ht?(_u(e,t,f),ms(e,t,f)):(Oe&&r&&Yr(t),t.flags|=1,vt(e,t,l,f),t.child)}function xg(e,t,l,r,u){if(dl(t),t.stateNode===null){var f=Wl,b=l.contextType;typeof b=="object"&&b!==null&&(f=St(b)),f=new l(r,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Vu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=r,f.state=t.memoizedState,f.refs={},wu(t),b=l.contextType,f.context=typeof b=="object"&&b!==null?St(b):Wl,f.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Xu(t,l,b,r),f.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(b=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),b!==f.state&&Vu.enqueueReplaceState(f,f.state,null),vi(t,r,f,u),gi(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){f=t.stateNode;var N=t.memoizedProps,z=xl(l,N);f.props=z;var q=f.context,V=l.contextType;b=Wl,typeof V=="object"&&V!==null&&(b=St(V));var F=l.getDerivedStateFromProps;V=typeof F=="function"||typeof f.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,V||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(N||q!==b)&&lg(t,f,r,b),Rs=!1;var H=t.memoizedState;f.state=H,vi(t,r,f,u),gi(),q=t.memoizedState,N||H!==q||Rs?(typeof F=="function"&&(Xu(t,l,F,r),q=t.memoizedState),(z=Rs||sg(t,l,z,r,H,q,b))?(V||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=q),f.props=r,f.state=q,f.context=b,r=z):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{f=t.stateNode,Nu(e,t),b=t.memoizedProps,V=xl(l,b),f.props=V,F=t.pendingProps,H=f.context,q=l.contextType,z=Wl,typeof q=="object"&&q!==null&&(z=St(q)),N=l.getDerivedStateFromProps,(q=typeof N=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==F||H!==z)&&lg(t,f,r,z),Rs=!1,H=t.memoizedState,f.state=H,vi(t,r,f,u),gi();var K=t.memoizedState;b!==F||H!==K||Rs||e!==null&&e.dependencies!==null&&Xr(e.dependencies)?(typeof N=="function"&&(Xu(t,l,N,r),K=t.memoizedState),(V=Rs||sg(t,l,V,r,H,K,z)||e!==null&&e.dependencies!==null&&Xr(e.dependencies))?(q||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(r,K,z),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(r,K,z)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=K),f.props=r,f.state=K,f.context=z,r=V):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),r=!1)}return f=r,ca(e,t),r=(t.flags&128)!==0,f||r?(f=t.stateNode,l=r&&typeof l.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&r?(t.child=gl(t,e.child,null,u),t.child=gl(t,null,l,u)):vt(e,t,l,u),t.memoizedState=f.state,e=t.child):e=ms(e,t,u),e}function bg(e,t,l,r){return ol(),t.flags|=256,vt(e,t,l,r),t.child}var Fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:op()}}function ed(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=on),e}function kg(e,t,l){var r=t.pendingProps,u=!1,f=(t.flags&128)!==0,b;if((b=f)||(b=e!==null&&e.memoizedState===null?!1:(Ct.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Oe){if(u?$s(t):Us(),(e=We)?(e=Iv(e,bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:Yn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},l=Wm(e),l.return=t,t.child=l,kt=t,We=null)):e=null,e===null)throw As(t);return Wd(e)?t.lanes=32:t.lanes=536870912,null}return f=r.children,r=r.fallback,u?(Us(),u=t.mode,f=mo({mode:"hidden",children:f},u),r=rl(r,u,l,null),f.return=t,r.return=t,f.sibling=r,t.child=f,r=t.child,r.memoizedState=Wu(l),r.childLanes=ed(e,b,l),t.memoizedState=Fu,ji(null,r)):($s(t),td(t,f))}var N=e.memoizedState;if(N!==null){var z=N.dehydrated;if(z!==null)return Nj(e,t,f,b,r,z,N,l)}return u?(Us(),u=r.fallback,f=t.mode,N=e.child,z=N.sibling,r=os(N,{mode:"hidden",children:r.children}),r.subtreeFlags=N.subtreeFlags&1206910976,z!==null?u=os(z,u):(u=rl(u,f,l,null),u.flags|=2),u.return=t,r.return=t,r.sibling=u,t.child=r,ji(null,r),r=t.child,u=e.child.memoizedState,u===null?u=Wu(l):(f=u.cachePool,f!==null?(N=dt._currentValue,f=f.parent!==N?{parent:N,pool:N}:f):f=op(),u={baseLanes:u.baseLanes|l,cachePool:f}),r.memoizedState=u,r.childLanes=ed(e,b,l),t.memoizedState=Fu,ji(e.child,r)):($s(t),l=e.child,e=l.sibling,l=os(l,{mode:"visible",children:r.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function td(e,t){return t=mo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function mo(e,t){return e=Kt(22,e,null,t),e.lanes=0,e}function po(e,t,l){return gl(t,e.child,null,l),e=td(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nj(e,t,l,r,u,f,b,N){if(l)return t.flags&256?($s(t),t.flags&=-257,po(e,t,N)):t.memoizedState!==null?(Us(),t.child=e.child,t.flags|=128,null):(Us(),f=u.fallback,b=t.mode,u=mo({mode:"visible",children:u.children},b),f=rl(f,b,N,null),f.flags|=2,u.return=t,f.return=t,u.sibling=f,t.child=u,gl(t,e.child,null,N),u=t.child,u.memoizedState=Wu(N),u.childLanes=ed(e,r,N),t.memoizedState=Fu,ji(null,u));if($s(t),Wd(f)){if(r=f.nextSibling&&f.nextSibling.dataset,r)var z=r.dgst;return r=z,r!==""&&(u=Error(o(419)),u.stack="",u.digest=r,ui({value:u,source:null,stack:null})),po(e,t,N)}if(ht||ul(e,t,N,!1),r=(N&e.childLanes)!==0,ht||r){if(Ds.current!==null)return po(e,t,N);if(r=Pe,r!==null&&(u=nm(r,N),u!==0&&u!==b.retryLane))throw b.retryLane=u,il(e,u),Qt(r,e,u),Ju;return Fd(f)||Oo(),po(e,t,N)}return Fd(f)?(t.flags|=192,t.child=e.child,null):(e=b.treeContext,We=yn(f.nextSibling),kt=t,Oe=!0,Es=null,bn=!1,e!==null&&np(t,e),t=td(t,u.children),t.flags|=134221824,t)}function yg(e,t,l){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zr(e.return,t,l)}function jg(e){for(var t=null;e!==null;){var l=e.alternate;l!==null&&to(l)===null&&(t=e),e=e.sibling}return t}function go(e,t,l,r,u,f){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:l,tailMode:u,treeForkCount:f}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=r,b.tail=l,b.tailMode=u,b.treeForkCount=f)}function nd(e){var t=e.child;for(e.child=null;t!==null;){var l=t.sibling;t.sibling=e.child,e.child=t,t=l}}function sd(e,t,l){var r=t.pendingProps,u=r.revealOrder,f=r.tail;r=r.children;var b=Ct.current;if(t.flags&128)return xi(t,b),null;var N=(b&2)!==0;if(N?(b=b&1|2,t.flags|=128):b&=1,xi(t,b),u==="backwards"&&e!==null?(nd(e),vt(e,t,r,l),nd(e)):vt(e,t,r,l),r=Oe?ci:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yg(e,l,t);else if(e.tag===19)yg(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"backwards":l=jg(t.child),l===null?(u=t.child,t.child=null):(u=l.sibling,l.sibling=null,nd(t)),go(t,!0,u,null,f,r);break;case"unstable_legacy-backwards":for(l=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&to(e)===null){t.child=u;break}e=u.sibling,u.sibling=l,l=u,u=e}go(t,!0,l,null,f,r);break;case"together":go(t,!1,null,null,void 0,r);break;case"independent":t.memoizedState=null;break;default:l=jg(t.child),l===null?(u=t.child,t.child=null):(u=l.sibling,l.sibling=null),go(t,!1,u,l,f,r)}return t.child}function wg(e,t,l){var r=t.pendingProps;return Ms(t,t.type,r.value),vt(e,t,r.children,l),t.child}function ms(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),qs|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=os(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=os(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function ld(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Xr(e)))}function Sj(e,t,l){switch(t.tag){case 3:kr(t,t.stateNode.containerInfo),Ms(t,dt,e.memoizedState.cache),ol();break;case 27:case 5:zc(t);break;case 4:kr(t,t.stateNode.containerInfo);break;case 10:Ms(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Au(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return $s(t),t.flags|=128,null;r=ul(e,t,l,!1);var u=t.child.childLanes;return r||(l&u)!==0?kg(e,t,l):($s(t),e=ms(e,t,l),e!==null?e.sibling:null)}$s(t);break;case 19:if(t.flags&128)return sd(e,t,l);if(u=(e.flags&128)!==0,r=(l&t.childLanes)!==0,r||(ul(e,t,l,!1),r=(l&t.childLanes)!==0),u){if(r)return sd(e,t,l);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),xi(t,Ct.current),r)break;return null;case 22:return t.lanes=0,mg(e,t,l,t.pendingProps);case 24:Ms(t,dt,e.memoizedState.cache)}return ms(e,t,l)}function Ng(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!ld(e,l)&&(t.flags&128)===0)return ht=!1,Sj(e,t,l);ht=(e.flags&131072)!==0}else ht=!1,Oe&&(t.flags&1048576)!==0&&tp(t,ci,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ml(t.elementType),t.type=e,typeof e=="function")du(e)?(r=xl(e,r),t.tag=1,t=xg(null,t,e,r,l)):(t.tag=0,t=Pu(null,t,e,r,l));else{if(e!=null){var u=e.$$typeof;if(u===ue){t.tag=11,t=dg(null,t,e,r,l);break e}else if(u===Re){t.tag=14,t=fg(null,t,e,r,l);break e}else if(u===Ce){t.tag=10,t.type=e,t=wg(null,t,l);break e}}throw t=te(e)||e,Error(o(306,t,""))}}return t;case 0:return Pu(e,t,t.type,t.pendingProps,l);case 1:return r=t.type,u=xl(r,t.pendingProps),xg(e,t,r,u,l);case 3:e:{if(kr(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var f=t.memoizedState;u=f.element,Nu(e,t),vi(t,r,null,l);var b=t.memoizedState;if(r=b.cache,Ms(t,dt,r),r!==f.cache&&xu(t,[dt],l,!0),gi(),r=b.element,f.isDehydrated)if(f={element:r,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=bg(e,t,r,l);break e}else if(r!==u){u=gn(Error(o(424)),t),ui(u),t=bg(e,t,r,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=yn(e.firstChild),kt=t,Oe=!0,Es=null,bn=!0,l=mp(t,null,r,l),t.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling}else{if(ol(),r===u){t=ms(e,t,l);break e}vt(e,t,r,l)}t=t.child}return t;case 26:return ca(e,t),e===null?(l=Qv(t.type,null,t.pendingProps,null))?t.memoizedState=l:Oe||(t.stateNode=Ev(t.type,t.pendingProps,An.current,t)):t.memoizedState=Qv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return zc(t),e===null&&Oe&&(r=t.stateNode=Kv(t.type,t.pendingProps,An.current),kt=t,bn=!0,u=We,Ks(t.type)?(ef=u,We=yn(r.firstChild)):We=u),vt(e,t,t.pendingProps.children,l),ca(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oe&&((u=r=We)&&(r=b1(r,t.type,t.pendingProps,bn),r!==null?(t.stateNode=r,kt=t,We=yn(r.firstChild),bn=!1,u=!0):u=!1),u||As(t)),zc(t),u=t.type,f=t.pendingProps,b=e!==null?e.memoizedProps:null,r=f.children,Kd(u,f)?r=null:b!==null&&Kd(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Ru(e,t,mj,null,null,l),Ca._currentValue=u),ca(e,t),vt(e,t,r,l),t.child;case 6:return e===null&&Oe&&((e=l=We)&&(l=k1(l,t.pendingProps,bn),l!==null?(t.stateNode=l,kt=t,We=null,e=!0):e=!1),e||As(t)),null;case 13:return kg(e,t,l);case 4:return kr(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gl(t,null,r,l):vt(e,t,r,l),t.child;case 11:return dg(e,t,t.type,t.pendingProps,l);case 7:return r=t.pendingProps,ca(e,t),vt(e,t,r,l),t.child;case 8:return vt(e,t,t.pendingProps.children,l),t.child;case 12:return vt(e,t,t.pendingProps.children,l),t.child;case 10:return wg(e,t,l);case 9:return u=t.type._context,r=t.pendingProps.children,dl(t),u=St(u),r=r(u),t.flags|=1,vt(e,t,r,l),t.child;case 14:return fg(e,t,t.type,t.pendingProps,l);case 15:return hg(e,t,t.type,t.pendingProps,l);case 19:return sd(e,t,l);case 31:return wj(e,t,l);case 22:return mg(e,t,l,t.pendingProps);case 24:return dl(t),r=St(dt),e===null?(u=yu(),u===null&&(u=Pe,f=bu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=l),u=f),t.memoizedState={parent:r,cache:u},wu(t),Ms(t,dt,u)):((e.lanes&l)!==0&&(Nu(e,t),vi(t,null,null,l),gi()),u=e.memoizedState,f=t.memoizedState,u.parent!==r?(u={parent:r,cache:r},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Ms(t,dt,r)):(r=f.cache,Ms(t,dt,r),r!==u.cache&&xu(t,[dt],l,!0))),vt(e,t,t.pendingProps.children,l),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!=="auto"?t.flags|=e===null?18882560:18874368:Oe&&Yr(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:ca(e,t),vt(e,t,r.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ps(e){e.flags|=4}function ad(e,t,l,r,u){var f;if((f=(e.mode&32)!==0)&&(f=l===null?Wv(t,r):Wv(t,r)&&(r.src!==l.src||r.srcSet!==l.srcSet)),f){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(av())e.flags|=8192;else throw pl=Pr,ju}else e.flags&=-16777217}function Sg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ex(t))if(av())e.flags|=8192;else throw pl=Pr,ju}function vo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Wh():536870912,e.lanes|=t,ma|=t)}function wi(e,t){if(!Oe)switch(e.tailMode){case"visible":break;case"collapsed":for(var l=e.tail,r=null;l!==null;)l.alternate!==null&&(r=l),l=l.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,r=0;if(t)for(var u=e.child;u!==null;)l|=u.lanes|u.childLanes,r|=u.subtreeFlags&1206910976,r|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)l|=u.lanes|u.childLanes,r|=u.subtreeFlags,r|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=r,e.childLanes=l,t}function Tj(e,t,l){var r=t.pendingProps;switch(mu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return l=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ds(dt),Bl(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(na(t)?ps(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,gu())),et(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(ps(t),f!==null?(et(t),Sg(t,f)):(et(t),ad(t,u,null,r,l))):f?f!==e.memoizedState?(ps(t),et(t),Sg(t,f)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ps(t),et(t),ad(t,u,e,r,l)),null;case 27:if(yr(t),l=An.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}e=$t.current,na(t)?sp(t):(e=Kv(u,r,l),t.stateNode=e,ps(t))}return et(t),t.subtreeFlags&=-33554433,null;case 5:if(yr(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}if(f=$t.current,na(t))sp(t);else{var b=_i(An.current);switch(f){case 1:f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=b.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof r.is=="string"?b.createElement("select",{is:r.is}):b.createElement("select"),r.multiple?f.multiple=!0:r.size&&(f.size=r.size);break;default:f=typeof r.is=="string"?b.createElement(u,{is:r.is}):b.createElement(u)}}f[Nt]=t,f[Yt]=r;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)f.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=f;e:switch(At(f,u,r),u){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ps(t)}}return et(t),t.subtreeFlags&=-33554433,ad(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(o(166));if(e=An.current,na(t)){if(e=t.stateNode,l=t.memoizedProps,r=null,u=kt,u!==null)switch(u.tag){case 27:case 5:r=u.memoizedProps}e[Nt]=t,e=!!(e.nodeValue===l||r!==null&&r.suppressHydrationWarning===!0||Nv(e.nodeValue,l)),e||As(t,!0)}else e=_i(e).createTextNode(r),e[Nt]=t,t.stateNode=e}return et(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(r=na(t),l!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Nt]=t}else ol(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else l=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(o(558))}return et(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=na(t),r!==null&&r.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Nt]=t}else ol(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),u=!1}else u=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=l,t):(l=r!==null,e=e!==null&&e.memoizedState!==null,l&&(r=t.child,u=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(u=r.alternate.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==u&&(r.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vo(t,t.updateQueue),et(t),null);case 4:return Bl(),e===null&&Bd(t.stateNode.containerInfo),t.flags|=67108864,et(t),null;case 10:return ds(t.type),et(t),null;case 19:if(Mu(t),r=t.memoizedState,r===null)return et(t),null;if(u=(t.flags&128)!==0,f=r.rendering,f===null)if(u)wi(r,!1);else{if(rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=to(e),f!==null){for(t.flags|=128,wi(r,!1),e=f.updateQueue,t.updateQueue=e,vo(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Fm(l,e),l=l.sibling;return xi(t,Ct.current&1|2),Oe&&cs(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Wt()>Ao&&(t.flags|=128,u=!0,wi(r,!1),t.lanes=4194304)}else{if(!u)if(e=to(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,vo(t,e),wi(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!f.alternate&&!Oe)return et(t),null}else 2*Wt()-r.renderingStartTime>Ao&&l!==536870912&&(t.flags|=128,u=!0,wi(r,!1),t.lanes=4194304);r.isBackwards?(f.sibling=t.child,t.child=f):(e=r.last,e!==null?e.sibling=f:t.child=f,r.last=f)}if(r.tail!==null){e=r.tail;e:{for(l=e;l!==null;){if(l.alternate!==null){l=!1;break e}l=l.sibling}l=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Wt(),e.sibling=null,f=Ct.current,f=u?f&1|2:f&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!l||Oe?xi(t,f):(l=f,qe(Tt,t),qe(Ct,l),Rt===null&&(Rt=t)),Oe&&cs(t,r.treeForkCount),e}return et(t),null;case 22:case 23:return ln(t),Eu(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(l&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),l=t.updateQueue,l!==null&&vo(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==l&&(t.flags|=2048),e!==null&&nt(hl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ds(dt),et(t),null;case 25:return null;case 30:return t.flags|=33554432,et(t),null}throw Error(o(156,t.tag))}function Cj(e,t){switch(mu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ds(dt),Bl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return yr(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(o(340));ol()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ol()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Bl(),null;case 10:return ds(t.type),null;case 22:case 23:return ln(t),Eu(),e!==null&&nt(hl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ds(dt),null;case 25:return null;default:return null}}function Tg(e,t){switch(mu(t),t.tag){case 3:ds(dt),Bl();break;case 26:case 27:case 5:yr(t);break;case 4:Bl();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:Mu(t);break;case 10:ds(t.type);break;case 22:case 23:ln(t),Eu(),e!==null&&nt(hl);break;case 24:ds(dt)}}function Ni(e,t){try{var l=t.updateQueue,r=l!==null?l.lastEffect:null;if(r!==null){var u=r.next;l=u;do{if((l.tag&e)===e){r=void 0;var f=l.create,b=l.inst;r=f(),b.destroy=r}l=l.next}while(l!==u)}}catch(N){Ze(t,t.return,N)}}function Ls(e,t,l){try{var r=t.updateQueue,u=r!==null?r.lastEffect:null;if(u!==null){var f=u.next;r=f;do{if((r.tag&e)===e){var b=r.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,u=t;var z=l,q=N;try{q()}catch(V){Ze(u,z,V)}}}r=r.next}while(r!==f)}}catch(V){Ze(t,t.return,V)}}function Cg(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{gp(t,l)}catch(r){Ze(e,e.return,r)}}}function Eg(e,t,l){l.props=xl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(r){Ze(e,t,r)}}function Zn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var u=e.stateNode,f=is(e.memoizedProps,u);(u.ref===null||u.ref.name!==f)&&(u.ref=Dv(f)),r=u.ref;break;case 7:if(e.stateNode===null){var b=new un(e);x(e.child,!1,v1,b,void 0,void 0),e.stateNode=b}r=e.stateNode;break;default:r=e.stateNode}typeof l=="function"?e.refCleanup=l(r):l.current=r}}catch(N){Ze(e,t,N)}}function Et(e,t){var l=e.ref,r=e.refCleanup;if(l!==null)if(typeof r=="function")try{r()}catch(u){Ze(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Ze(e,t,u)}else l.current=null}function xo(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var l=0;l<t.length;l++)qv(e.stateNode,t[l])}function Ag(e){for(var t=e.return;t!==null&&(rd(t)&&qv(e.stateNode,t.stateNode),!id(t));)t=t.return}function Si(e){for(var t=e.return;t!==null&&(rd(t)&&x1(e.stateNode,t.stateNode),!id(t));)t=t.return}function id(e){return e.tag===5||e.tag===3||e.tag===27}function rd(e){return e&&e.tag===7&&e.stateNode!==null}function od(e){var t=e.type,l=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break e;case"img":l.src?r.src=l.src:l.srcSet&&(r.srcset=l.srcSet)}}catch(u){Ze(e,e.return,u)}}function cd(e,t,l){try{var r=e.stateNode;Wj(r,e.type,l,t),r[Yt]=t}catch(u){Ze(e,e.return,u)}}function Mg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ks(e.type)||e.tag===4}function ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ks(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function dd(e,t,l,r){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(u,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(u),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Gn)),xo(e,r),Ie=!0;else if(u!==4&&(u===27&&(xo(e,r),r=null,Ks(e.type)&&(l=e.stateNode,t=null)),e=e.child,e!==null))for(dd(e,t,l,r),e=e.sibling;e!==null;)dd(e,t,l,r),e=e.sibling}function bo(e,t,l,r){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?l.insertBefore(u,t):l.appendChild(u),xo(e,r),Ie=!0;else if(u!==4&&(u===27&&(xo(e,r),r=null,Ks(e.type)&&(l=e.stateNode)),e=e.child,e!==null))for(bo(e,t,l,r),e=e.sibling;e!==null;)bo(e,t,l,r),e=e.sibling}function zg(e){var t=e.stateNode,l=e.memoizedProps;try{for(var r=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);At(t,r,l),t[Nt]=e,t[Yt]=l}catch(f){Ze(e,e.return,f)}}var ko=!1,an=null;function Rg(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(ko=!0)}var Xn=null;function Og(){var e=Xn;return Xn=null,e}var Zt=0;function ua(e,t,l,r,u){return Zt=0,_g(e.child,t,l,r,u)}function _g(e,t,l,r,u){for(var f=!1;e!==null;){if(e.tag===5){var b=e.stateNode;if(r!==null){var N=Vd(b);r.push(N),N.view&&(f=!0)}else f||Vd(b).view&&(f=!0);ko=!0,Ov(b,Zt===0?t:t+"_"+Zt,l),Zt++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||_g(e.child,t,l,r,u)&&(f=!0));e=e.sibling}return f}function Vn(e,t){for(;e!==null;)e.tag===5?_v(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Vn(e.child,t)),e=e.sibling}function yo(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(yo(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(o(544));var l=t.name;t=rs(t.default,t.share),t!=="none"&&(ua(e,l,t,null,!1)||Vn(e.child,!1))}e=e.sibling}}function fd(e,t){if(e.tag===30){var l=e.stateNode,r=e.memoizedProps,u=is(r,l),f=rs(r.default,l.paired?r.share:r.enter);f!=="none"?ua(e,u,f,null,!1)?(yo(e),l.paired||t||xa(e,r.onEnter)):Vn(e.child,!1):yo(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)fd(e,t),e=e.sibling;else yo(e)}function hd(e){if(an!==null&&an.size!==0){var t=an;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var l=e.memoizedProps,r=l.name;if(r!=null&&r!=="auto"){var u=t.get(r);if(u!==void 0){var f=rs(l.default,l.share);if(f!=="none"&&(ua(e,r,f,null,!1)?(f=e.stateNode,u.paired=f,f.paired=u,xa(e,l.onShare)):Vn(e.child,!1)),t.delete(r),t.size===0)break}}}hd(e)}e=e.sibling}}}function md(e){if(e.tag===30){var t=e.memoizedProps,l=is(t,e.stateNode),r=an!==null?an.get(l):void 0,u=rs(t.default,r!==void 0?t.share:t.exit);u!=="none"&&(ua(e,l,u,null,!1)?r!==void 0?(u=e.stateNode,r.paired=u,u.paired=r,an.delete(l),xa(e,t.onShare)):xa(e,t.onExit):Vn(e.child,!1)),an!==null&&hd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)md(e),e=e.sibling;else an!==null&&hd(e)}function Dg(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,l=is(t,e.stateNode);t=rs(t.default,t.update),e.flags&=-5,t!=="none"&&ua(e,l,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Dg(e);e=e.sibling}}function pd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Vn(e.child,!1))}pd(e)}e=e.sibling}}function jo(e){if(e.tag===30)e.stateNode.paired=null,Vn(e.child,!1),pd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)jo(e),e=e.sibling;else pd(e)}function $g(e){for(e=e.child;e!==null;)e.tag===30?Vn(e.child,!1):(e.subtreeFlags&33554432)!==0&&$g(e),e=e.sibling}function gd(e,t,l,r,u,f,b){for(var N=!1;t!==null;){if(t.tag===5){var z=t.stateNode;if(f!==null&&Zt<f.length){var q=f[Zt],V=Vd(z);(q.view||V.view)&&(N=!0);var F;if(F=(e.flags&4)===0)if(V.clip)F=!0;else{F=q.rect;var H=V.rect;F=F.y!==H.y||F.x!==H.x||F.height!==H.height||F.width!==H.width}F&&(e.flags|=4),V.abs?V=!q.abs:(q=q.rect,V=V.rect,V=q.height!==V.height||q.width!==V.width),V&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Ov(z,Zt===0?l:l+"_"+Zt,u),N&&(e.flags&4)!==0||(Xn===null&&(Xn=[]),Xn.push(z,Zt===0?r:r+"_"+Zt,t.memoizedProps)),Zt++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&b?e.flags|=t.flags&32:gd(e,t.child,l,r,u,f,b)&&(N=!0));t=t.sibling}return N}function Ug(e,t){for(e=e.child;e!==null;){if(e.tag===30){var l=e.memoizedProps,r=e.stateNode,u=is(l,r),f=rs(l.default,l.update),b;b=e.memoizedState,e.memoizedState=null,r=e;var N=e.child;Zt=0,u=gd(r,N,u,u,f,b,!1),(e.flags&4)!==0&&u&&xa(e,l.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Ug(e);e=e.sibling}}var yt=!1,Ye=!1,Qn=!1,vd=!1,Lg=typeof WeakSet=="function"?WeakSet:Set,jt=null,Jn=!1,Ti=!1,wo=!1,xd=!1;function Ej(e,t,l){if(e=e.containerInfo,Gd=Ea,e=Im(e),lu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var u=r.getSelection&&r.getSelection();if(u&&u.rangeCount!==0){r=u.anchorNode;var f=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{r.nodeType,b.nodeType}catch{r=null;break e}var N=0,z=-1,q=-1,V=0,F=0,H=e,K=null;t:for(;;){for(var de;H!==r||f!==0&&H.nodeType!==3||(z=N+f),H!==b||u!==0&&H.nodeType!==3||(q=N+u),H.nodeType===3&&(N+=H.nodeValue.length),(de=H.firstChild)!==null;)K=H,H=de;for(;;){if(H===e)break t;if(K===r&&++V===f&&(z=N),K===b&&++F===u&&(q=N),(de=H.nextSibling)!==null)break;H=K,K=H.parentNode}H=de}r=z===-1||q===-1?null:{start:z,end:q}}else r=null}r=r||{start:0,end:0}}else r=null;for(Yd={focusedElem:e,selectionRange:r},Ea=!1,l=(l&335544064)===l,jt=t,t=l?9270:1024;jt!==null;){if(e=jt,l&&(r=e.deletions,r!==null))for(f=0;f<r.length;f++)l&&md(r[f]);if(e.alternate===null&&(e.flags&2)!==0)l&&Rg(e),No(l);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&l&&md(r),No(l);continue}else if(r!==null&&r.memoizedState!==null){l&&Rg(e),No(l);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,jt=r):(l&&Dg(e),No(l))}}an=null}function No(e){for(;jt!==null;){var t=jt,l=e,r=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&r!==null){l=void 0,u=r.memoizedProps,r=r.memoizedState;var f=t.stateNode;try{var b=xl(t.type,u);l=f.getSnapshotBeforeUpdate(b,r),f.__reactInternalSnapshotBeforeUpdate=l}catch(N){Ze(t,t.return,N)}}break;case 3:if((u&1024)!==0){if(r=t.stateNode.containerInfo,l=r.nodeType,l===9)Pd(r);else if(l===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Pd(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&r!==null&&(l=is(r.memoizedProps,r.stateNode),u=t.memoizedProps,u=rs(u.default,u.update),u!=="none"&&ua(r,l,u,r.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,jt=r;break}jt=t.return}}function Hg(e,t,l){var r=l.flags;switch(l.tag){case 0:case 11:case 15:Pn(e,l),r&4&&Ni(5,l);break;case 1:if(Pn(e,l),r&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){Ze(l,l.return,b)}else{var u=xl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ze(l,l.return,b)}}r&64&&Cg(l),r&512&&Zn(l,l.return);break;case 3:if(Pn(e,l),r&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{gp(e,t)}catch(b){Ze(l,l.return,b)}}break;case 27:t===null&&r&4&&zg(l);case 26:case 5:Pn(e,l),t===null&&r&4&&od(l),r&512&&Zn(l,l.return);break;case 12:Pn(e,l);break;case 31:Pn(e,l),r&4&&Gg(e,l);break;case 13:Pn(e,l),r&4&&Yg(e,l),r&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Bj.bind(null,l),y1(e,l))));break;case 22:if(r=l.memoizedState!==null||yt,!r){var f=t!==null&&t.memoizedState!==null||Ye;t=yt,u=Ye,yt=r,(Ye=f)&&!u?(r=2,(l.subtreeFlags&8772)!==0&&(r|=1),On(e,l,r)):Pn(e,l),yt=t,Ye=u}break;case 30:Pn(e,l),r&512&&Zn(l,l.return);break;case 7:r&512&&Zn(l,l.return);default:Pn(e,l)}}function bd(e,t){for(e=e.child;e!==null;)Bg(e,t),e=e.sibling}function Bg(e,t){switch(e.tag){case 5:case 26:try{var l=e.stateNode;if(t){var r=l.style;typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none"}else{var u=e.stateNode,f=e.memoizedProps.style,b=f!=null&&f.hasOwnProperty("display")?f.display:null;u.style.display=b==null||typeof b=="boolean"?"":(""+b).trim()}}catch(z){Ze(e,e.return,z)}kd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Ie=!0}catch(z){Ze(e,e.return,z)}break;case 18:try{var N=e.stateNode;t?Rv(N,!0):Rv(e.stateNode,!1)}catch(z){Ze(e,e.return,z)}break;case 22:case 23:e.memoizedState===null&&bd(e,t);break;default:bd(e,t)}}function kd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var l=e,r=t;switch(l.tag){case 4:Bg(l,r);break e;case 22:l.memoizedState===null&&kd(l,r);break e;default:kd(l,r)}}e=e.sibling}}function qg(e){var t=e.alternate;t!==null&&(e.alternate=null,qg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Er(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Xt=!1;function zn(e,t,l){for(l=l.child;l!==null;)Ig(e,t,l),l=l.sibling}function Ig(e,t,l){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(Qa,l)}catch{}switch(l.tag){case 26:Ye||Et(l,t),zn(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!Ye&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Ye||Et(l,t),Si(l);var r=st,u=Xt;Ks(l.type)&&(st=l.stateNode,Xt=!1),zn(e,t,l),Zv(l.stateNode,l.type,l.memoizedProps),st=r,Xt=u;break;case 5:Ye||Et(l,t),Si(l);case 6:if(l.tag===6&&Si(l),r=st,u=Xt,st=null,zn(e,t,l),st=r,Xt=u,st!==null)if(Xt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(l.stateNode),Ie=!0}catch(f){Ze(l,t,f)}else try{st.removeChild(l.stateNode),Ie=!0}catch(f){Ze(l,t,f)}break;case 18:st!==null&&(Xt?(e=st,zv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Aa(e)):zv(st,l.stateNode));break;case 4:r=st,u=Xt,st=l.stateNode.containerInfo,Xt=!0,zn(e,t,l),st=r,Xt=u;break;case 0:case 11:case 14:case 15:Ls(2,l,t),Ye||Ls(4,l,t),zn(e,t,l);break;case 1:Ye||(Et(l,t),r=l.stateNode,typeof r.componentWillUnmount=="function"&&Eg(l,t,r)),zn(e,t,l);break;case 21:zn(e,t,l);break;case 22:Ye=(r=Ye)||l.memoizedState!==null,zn(e,t,l),Ye=r;break;case 30:Et(l,t),zn(e,t,l);break;case 7:Ye||Et(l,t),zn(e,t,l);break;default:zn(e,t,l)}}function Gg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Aa(e)}catch(l){Ze(t,t.return,l)}}}function Yg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Aa(e)}catch(l){Ze(t,t.return,l)}}function Aj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Lg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Lg),t;default:throw Error(o(435,e.tag))}}function So(e,t){var l=Aj(e);t.forEach(function(r){if(!l.has(r)){l.add(r);var u=qj.bind(null,e,r);r.then(u,u)}})}function Bt(e,t,l){var r=t.deletions;if(r!==null)for(var u=0;u<r.length;u++){var f=r[u],b=e,N=t,z=N;e:for(;z!==null;){switch(z.tag){case 27:if(Ks(z.type)){st=z.stateNode,Xt=!1;break e}break;case 5:st=z.stateNode,Xt=!1;break e;case 3:case 4:st=z.stateNode.containerInfo,Xt=!0;break e}z=z.return}if(st===null)throw Error(o(160));Ig(b,N,f),st=null,Xt=!1,b=f.alternate,b!==null&&(b.return=null),f.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Kg(t,e,l),t=t.sibling}var Rn=null;function Kg(e,t,l){var r=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(r=e.updateQueue,r=r!==null?r.events:null,r!==null))for(var f=0;f<r.length;f++){var b=r[f];b.ref.impl=b.nextImpl}Bt(t,e,l),qt(e),u&4&&(Ls(3,e,e.return),Ni(3,e),Ls(5,e,e.return));break;case 1:Bt(t,e,l),qt(e),u&512&&(Ye||r===null||Et(r,r.return)),u&64&&yt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?t:l.concat(t))));break;case 26:if(f=Rn,Bt(t,e,l),qt(e),u&512&&(Ye||r===null||Et(r,r.return)),u&4)if(u=r!==null?r.memoizedState:null,l=e.memoizedState,r===null)if(l===null)if(e.stateNode===null)if(yt)e.stateNode=Ev(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,l=e.memoizedProps,u=f.ownerDocument||f;t:switch(t){case"title":r=u.getElementsByTagName("title")[0],(!r||r[Fa]||r[Nt]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=u.createElement(t),u.head.insertBefore(r,u.querySelector("head > title"))),At(r,t,l),r[Nt]=e,bt(r),t=r;break e;case"link":if(f=Fv("link","href",u).get(t+(l.href||""))){for(b=0;b<f.length;b++)if(r=f[b],r.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&r.getAttribute("rel")===(l.rel==null?null:l.rel)&&r.getAttribute("title")===(l.title==null?null:l.title)&&r.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){f.splice(b,1);break t}}r=u.createElement(t),At(r,t,l),u.head.appendChild(r);break;case"meta":if(f=Fv("meta","content",u).get(t+(l.content||""))){for(b=0;b<f.length;b++)if(r=f[b],r.getAttribute("content")===(l.content==null?null:""+l.content)&&r.getAttribute("name")===(l.name==null?null:l.name)&&r.getAttribute("property")===(l.property==null?null:l.property)&&r.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&r.getAttribute("charset")===(l.charSet==null?null:l.charSet)){f.splice(b,1);break t}}r=u.createElement(t),At(r,t,l),u.head.appendChild(r);break;default:throw Error(o(468,t))}r[Nt]=e,bt(r),t=r}e.stateNode=t}else yt||lf(f,e.type,e.stateNode);else e.stateNode=Pv(f,l,e.memoizedProps);else u!==l?(u===null?(t=r.stateNode,t===null||Ye||t.parentNode.removeChild(t)):u.count--,l===null?yt||lf(f,e.type,e.stateNode):Pv(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&cd(e,e.memoizedProps,r.memoizedProps);break;case 27:Bt(t,e,l),qt(e),u&512&&(Ye||r===null||Et(r,r.return)),r!==null&&u&4&&cd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(f=Qn,Qn=!1,Bt(t,e,l),Qn=f,qt(e),u&512&&(Ye||r===null||Et(r,r.return)),e.flags&32){t=e.stateNode;try{Zl(t,""),Ie=!0}catch(V){Ze(e,e.return,V)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,cd(e,t,r!==null?r.memoizedProps:t)),u&1024&&(vd=!0);break;case 6:if(Bt(t,e,l),qt(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,l=e.stateNode;try{l.nodeValue=t,Ie=!0}catch(V){Ze(e,e.return,V)}}break;case 3:if(Ie=!1,Bo=null,f=Rn,Rn=Di(t.containerInfo),Bt(t,e,l),Rn=f,qt(e),u&4&&r!==null&&r.memoizedState.isDehydrated)try{Aa(t.containerInfo)}catch(V){Ze(e,e.return,V)}vd&&(vd=!1,Zg(e)),Ie=!1;break;case 4:u=Qn,Qn=yt,r=fm(),f=Rn,Rn=Di(e.stateNode.containerInfo),Bt(t,e,l),qt(e),Rn=f,Ie&&Ti&&(wo=!0),Ie=r,Qn=u;break;case 12:Bt(t,e,l),qt(e);break;case 31:Bt(t,e,l),qt(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,So(e,t)));break;case 13:Bt(t,e,l),qt(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Eo=Wt()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,So(e,t)));break;case 22:f=e.memoizedState!==null,b=r!==null&&r.memoizedState!==null;var N=yt,z=Ye,q=Qn;yt=N||f,Qn=q||f,Ye=z||b,Bt(t,e,l),Ye=z,Qn=q,yt=N,qt(e),u&8192&&(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,!f||r===null||b||yt||Ye||(t=b||Ye,l=yt,r=Ye,yt=f||yt,Ye=t,Hs(e,2),yt=l,Ye=r),!f&&Qn||bd(e,f)),u&4&&(t=e.updateQueue,t!==null&&(l=t.retryQueue,l!==null&&(t.retryQueue=null,So(e,l))));break;case 19:Bt(t,e,l),qt(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,So(e,t)));break;case 30:u&512&&(Ye||r===null||Et(r,r.return)),u=fm(),f=Ti,b=(l&335544064)===l,N=e.memoizedProps,Ti=b&&rs(N.default,N.update)!=="none",Bt(t,e,l),qt(e),b&&r!==null&&Ie&&(e.flags|=4),Ti=f,Ie=u;break;case 21:break;case 7:u&512&&(Ye||r===null||Et(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Bt(t,e,l),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{for(var l,r=e.return;r!==null;){if(Mg(r)){l=r;break}r=r.return}r=null;for(var u=e.return;u!==null;){if(rd(u)){var f=u.stateNode;r===null?r=[f]:r.push(f)}if(id(u))break;u=u.return}var b=r;if(l==null)throw Error(o(160));switch(l.tag){case 27:var N=l.stateNode,z=ud(e);bo(e,z,N,b);break;case 5:var q=l.stateNode;l.flags&32&&(Zl(q,""),l.flags&=-33);var V=ud(e);bo(e,V,q,b);break;case 3:case 4:var F=l.stateNode.containerInfo,H=ud(e);dd(e,H,F,b);break;default:throw Error(o(161))}}catch(K){Ze(e,e.return,K)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Zg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Zg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ea=!0,t.reset(),Ea=!1),e=e.sibling}}function da(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Xg(t,e),t=t.sibling;else Ug(t)}function Xg(e,t){var l=e.alternate;if(l===null)fd(e,!1);else switch(e.tag){case 3:if(xd=Jn=!1,Og(),da(t,e),!Jn&&!wo){if(e=Xn,e!==null)for(var r=0;r<e.length;r+=3){l=e[r];var u=e[r+1];_v(l,e[r+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),xd=!0}Xn=null;break;case 5:da(t,e);break;case 4:r=Jn,Jn=!1,da(t,e),Jn&&(wo=!0),Jn=r;break;case 22:e.memoizedState===null&&(l.memoizedState!==null?fd(e,!1):da(t,e));break;case 30:r=Jn,u=Og(),Jn=!1,da(t,e),Jn&&(e.flags|=4);var f=e.memoizedProps,b=e.stateNode;t=is(f,b),b=is(l.memoizedProps,b);var N=rs(f.default,f.update);N==="none"?t=!1:(f=l.memoizedState,l.memoizedState=null,l=e.child,Zt=0,t=gd(e,l,t,b,N,f,!0),Zt!==(f===null?0:f.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(xa(e,e.memoizedProps.onUpdate),Xn=u):u!==null&&(u.push.apply(u,Xn),Xn=u),Jn=(e.flags&32)!==0?!0:r;break;default:da(t,e)}}function Pn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hg(e,t.alternate,t),t=t.sibling}function Hs(e,t){for(e=e.child;e!==null;){var l=e,r=t;switch(l.tag){case 0:case 11:case 14:case 15:Ls(4,l,l.return),Hs(l,r);break;case 1:Et(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&Eg(l,l.return,u),Hs(l,r);break;case 27:(r&2)!==0&&Zv(l.stateNode,l.type,l.memoizedProps);case 5:Et(l,l.return),l.tag!==5&&l.tag!==27||Si(l),Hs(l,r);break;case 6:Si(l);break;case 26:Et(l,l.return),u=l.stateNode,l.memoizedState!==null||u===null||Ye||u.parentNode.removeChild(u),Hs(l,r);break;case 22:l.memoizedState===null&&Hs(l,r);break;case 30:Et(l,l.return),Hs(l,r);break;case 7:Et(l,l.return);default:Hs(l,r)}e=e.sibling}}function On(e,t,l){for(l=(t.subtreeFlags&8772)!==0?l:l&-2,t=t.child;t!==null;){var r=t.alternate,u=e,f=t,b=f.flags,N=(l&1)!==0;switch(f.tag){case 0:case 11:case 15:On(u,f,l),Ni(4,f);break;case 1:if(On(u,f,l),r=f,u=r.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(V){Ze(r,r.return,V)}if(r=f,u=r.updateQueue,u!==null){var z=r.stateNode;try{var q=u.shared.hiddenCallbacks;if(q!==null)for(u.shared.hiddenCallbacks=null,u=0;u<q.length;u++)pp(q[u],z)}catch(V){Ze(r,r.return,V)}}N&&b&64&&Cg(f),Zn(f,f.return);break;case 27:(l&2)!==0&&zg(f);case 5:f.tag!==5&&f.tag!==27||Ag(f),On(u,f,l),N&&r===null&&b&4&&od(f),Zn(f,f.return);break;case 6:Ag(f);break;case 26:z=f.stateNode,f.memoizedState!==null||z===null||yt||lf(Di(z.ownerDocument),f.type,z),On(u,f,l),N&&r===null&&b&4&&od(f),Zn(f,f.return);break;case 12:On(u,f,l);break;case 31:On(u,f,l),N&&b&4&&Gg(u,f);break;case 13:On(u,f,l),N&&b&4&&Yg(u,f);break;case 22:f.memoizedState===null&&On(u,f,l),Zn(f,f.return);break;case 30:On(u,f,l),Zn(f,f.return);break;case 7:Zn(f,f.return);default:On(u,f,l)}t=t.sibling}}function yd(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&di(l))}function jd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&di(e))}function kn(e,t,l,r){var u=(l&335544064)===l;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)Vg(e,t,l,r),t=t.sibling;else u&&$g(t)}function Vg(e,t,l,r){var u=(l&335544064)===l;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&jo(t);var f=t.flags;switch(t.tag){case 0:case 11:case 15:kn(e,t,l,r),f&2048&&Ni(9,t);break;case 1:kn(e,t,l,r);break;case 3:kn(e,t,l,r),u&&xd&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),f&2048&&(f=null,t.alternate!==null&&(f=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==f&&(t.refCount++,f!=null&&di(f)));break;case 12:if(f&2048){kn(e,t,l,r),f=t.stateNode;try{var b=t.memoizedProps,N=b.id,z=b.onPostCommit;typeof z=="function"&&z(N,t.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(q){Ze(t,t.return,q)}}else kn(e,t,l,r);break;case 31:kn(e,t,l,r);break;case 13:kn(e,t,l,r);break;case 23:break;case 22:b=t.stateNode,N=t.alternate,t.memoizedState!==null?(u&&N!==null&&N.memoizedState===null&&jo(N),b._visibility&2?kn(e,t,l,r):Ci(e,t)):(u&&N!==null&&N.memoizedState!==null&&jo(t),b._visibility&2?kn(e,t,l,r):(b._visibility|=2,fa(e,t,l,r,(t.subtreeFlags&10256)!==0||!1))),f&2048&&yd(N,t);break;case 24:kn(e,t,l,r),f&2048&&jd(t.alternate,t);break;case 30:u&&(f=t.alternate,f!==null&&(Vn(f.child,!0),Vn(t.child,!0))),kn(e,t,l,r);break;default:kn(e,t,l,r)}}function fa(e,t,l,r,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,b=t,N=l,z=r,q=b.flags;switch(b.tag){case 0:case 11:case 15:fa(f,b,N,z,u),Ni(8,b);break;case 23:break;case 22:var V=b.stateNode;b.memoizedState!==null?V._visibility&2?fa(f,b,N,z,u):Ci(f,b):(V._visibility|=2,fa(f,b,N,z,u)),u&&q&2048&&yd(b.alternate,b);break;case 24:fa(f,b,N,z,u),u&&q&2048&&jd(b.alternate,b);break;default:fa(f,b,N,z,u)}t=t.sibling}}function Ci(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,r=t,u=r.flags;switch(r.tag){case 22:Ci(l,r),u&2048&&yd(r.alternate,r);break;case 24:Ci(l,r),u&2048&&jd(r.alternate,r);break;default:Ci(l,r)}t=t.sibling}}var bl=8192;function kl(e,t,l){if(e.subtreeFlags&bl)for(e=e.child;e!==null;)Qg(e,t,l),e=e.sibling}function Qg(e,t,l){switch(e.tag){case 26:kl(e,t,l),e.flags&bl&&(e.memoizedState!==null?D1(l,Rn,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&nx(l,e)));break;case 5:kl(e,t,l),e.flags&bl&&(e=e.stateNode,(t&335544128)===t&&nx(l,e));break;case 3:case 4:var r=Rn;Rn=Di(e.stateNode.containerInfo),kl(e,t,l),Rn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=bl,bl=16777216,kl(e,t,l),bl=r):kl(e,t,l));break;case 30:if((e.flags&bl)!==0&&(r=e.memoizedProps.name,r!=null&&r!=="auto")){var u=e.stateNode;u.paired=null,an===null&&(an=new Map),an.set(r,u)}kl(e,t,l);break;default:kl(e,t,l)}}function Jg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ei(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var r=t[l];jt=r,Fg(r,e)}Jg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pg(e),e=e.sibling}function Pg(e){switch(e.tag){case 0:case 11:case 15:Ei(e),e.flags&2048&&Ls(9,e,e.return);break;case 3:Ei(e);break;case 12:Ei(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,To(e)):Ei(e);break;default:Ei(e)}}function To(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var r=t[l];jt=r,Fg(r,e)}Jg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ls(8,t,t.return),To(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,To(t));break;default:To(t)}e=e.sibling}}function Fg(e,t){for(;jt!==null;){var l=jt;switch(l.tag){case 0:case 11:case 15:Ls(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var r=l.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:di(l.memoizedState.cache)}if(r=l.child,r!==null)r.return=l,jt=r;else e:for(l=e;jt!==null;){r=jt;var u=r.sibling,f=r.return;if(qg(r),r===l){jt=null;break e}if(u!==null){u.return=f,jt=u;break e}jt=f}}}var Mj={getCacheForType:function(e){var t=St(dt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return St(dt).controller.signal}},zj=typeof WeakMap=="function"?WeakMap:Map,Ge=0,Pe=null,_e=null,Le=0,Ke=0,rn=null,Bs=!1,ha=!1,wd=!1,gs=0,rt=0,qs=0,yl=0,Co=0,on=0,ma=0,Ai=null,Vt=null,Nd=!1,Eo=0,Wg=0,Ao=1/0,Mo=null,Is=null,lt=0,_n=null,jl=null,Fn=0,Sd=0,Td=null,ev=null,pa=null,ga=null,va=null,Mi=0,zo=null;function cn(){return(Ge&2)!==0&&Le!==0?Le&-Le:fe.T!==null?$d():sm()}function tv(){if(on===0)if((Le&536870912)===0||Oe){var e=Nr;Nr<<=1,(Nr&3932160)===0&&(Nr=262144),on=e}else on=536870912;return e=Tt.current,e!==null&&(e.flags|=32),on}function xa(e,t){if(t!=null){var l=e.stateNode,r=l.ref;r===null&&(r=l.ref=Dv(is(e.memoizedProps,l))),ga===null&&(ga=[]),ga.push(t.bind(null,r))}}function Qt(e,t,l){(e===Pe&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(ba(e,0),Gs(e,Le,on,!1)),Pa(e,l),((Ge&2)===0||e!==Pe)&&(e===Pe&&((Ge&2)===0&&(yl|=l),rt===4&&Gs(e,Le,on,!1)),Wn(e))}function nv(e,t,l){if((Ge&6)!==0)throw Error(o(327));var r=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Ja(e,t),u=r?_j(e,t):Ed(e,t,!0),f=r;do{if(u===0){ha&&!r&&Gs(e,t,0,!1);break}else{if(l=e.current.alternate,f&&!Rj(l)){u=Ed(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var N=e;u=Ai;var z=N.current.memoizedState.isDehydrated;if(z&&(ba(N,b).flags|=256),b=Ed(N,b,!1),b!==2&&b!==6){if(wd&&!z){N.errorRecoveryDisabledLanes|=f,yl|=f,u=4;break e}f=Vt,Vt=u,f!==null&&(Vt===null?Vt=f:Vt.push.apply(Vt,f))}u=b}if(f=!1,u!==2)continue}}if(u===1){ba(e,0),Gs(e,t,0,!0);break}e:{switch(r=e,f=u,f){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Gs(r,t,on,!Bs);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Eo+300-Wt(),10<u)){if(Gs(r,t,on,!Bs),Tr(r,0,!0)!==0)break e;Fn=t,r.timeoutHandle=Xd(sv.bind(null,r,l,Vt,Mo,Nd,t,on,yl,ma,Bs,f,"Throttled",-0,0),u);break e}sv(r,l,Vt,Mo,Nd,t,on,yl,ma,Bs,f,null,-0,0)}}break}while(!0);Wn(e)}function sv(e,t,l,r,u,f,b,N,z,q,V,F,H,K){e.timeoutHandle=-1;var de=t.subtreeFlags,be=(f&335544064)===f;if(F=null,(be||de&8192||(de&16785408)===16785408)&&(F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gn},an=null,Qg(t,f,F),be&&(de=F,be=e.containerInfo,be=(be.nodeType===9?be:be.ownerDocument).__reactViewTransition,be!=null&&(de.count++,de.waitingForViewTransition=!0,de=Li.bind(de),be.finished.then(de,de))),de=(f&62914560)===f?Eo-Wt():(f&4194048)===f?Wg-Wt():0,de=$1(F,de),de!==null)){Fn=f,e.cancelPendingCommit=de(dv.bind(null,e,t,f,l,r,u,b,N,z,q,V,F,null,H,K)),Gs(e,f,b,!q);return}dv(e,t,f,l,r,u,b,N,z,q,V,F)}function Rj(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var r=0;r<l.length;r++){var u=l[r],f=u.getSnapshot;u=u.value;try{if(!sn(f(),u))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gs(e,t,l,r){t=Fh(e,t),t&=~Co,t&=~yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var u=t;0<u;){var f=31-tn(u),b=1<<f;r[f]=-1,u&=~b}l!==0&&em(e,l,t)}function Ro(){return(Ge&6)===0?(zi(0),!1):!0}function Cd(){if(_e!==null){if(Ke===0)var e=_e.return;else e=_e,us=cl=null,Du(e),aa=null,mi=0,e=_e;for(;e!==null;)Tg(e.alternate,e),e=e.return;_e=null}}function ba(e,t){var l=e.timeoutHandle;return l!==-1&&(e.timeoutHandle=-1,n1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Fn=0,Cd(),Pe=e,_e=l=os(e.current,null),Le=t,Ke=0,rn=null,Bs=!1,ha=Ja(e,t),wd=!1,ma=on=Co=yl=qs=rt=0,Vt=Ai=null,Nd=!1,gs=Fh(e,t),Hr(),l}function lv(e,t){Ae=null,fe.H=uo,t===la||t===Jr?(t=dp(),Ke=3):t===ju?(t=dp(),Ke=4):Ke=t===Ju?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,_e===null&&(rt=1,fo(e,gn(t,e.current)))}function av(){var e=Tt.current;return e===null?!0:(Le&4194048)===Le?Rt===null:(Le&62914560)===Le||(Le&536870912)!==0?e===Rt:!1}function iv(){var e=fe.H;return fe.H=uo,e===null?uo:e}function rv(){var e=fe.A;return fe.A=Mj,e}function Oo(){rt=4,Bs||(Le&4194048)!==Le&&Tt.current!==null||(ha=!0),(qs&134217727)===0&&(yl&134217727)===0||Pe===null||Gs(Pe,Le,on,!1)}function Ed(e,t,l){var r=Ge;Ge|=2;var u=iv(),f=rv();(Pe!==e||Le!==t)&&(Mo=null,ba(e,t)),t=!1;var b=rt;e:do try{if(Ke!==0&&_e!==null){var N=_e,z=rn;switch(Ke){case 8:Cd(),b=6;break e;case 3:case 2:case 9:case 6:Tt.current===null&&(t=!0);var q=Ke;if(Ke=0,rn=null,ka(e,N,z,q),l&&ha){b=0;break e}break;default:q=Ke,Ke=0,rn=null,ka(e,N,z,q)}}Oj(),b=rt;break}catch(V){lv(e,V)}while(!0);return t&&e.shellSuspendCounter++,us=cl=null,Ge=r,fe.H=u,fe.A=f,_e===null&&(Pe=null,Le=0,Hr()),b}function Oj(){for(;_e!==null;)ov(_e)}function _j(e,t){var l=Ge;Ge|=2;var r=iv(),u=rv();Pe!==e||Le!==t?(Mo=null,Ao=Wt()+500,ba(e,t)):ha=Ja(e,t);e:do try{if(Ke!==0&&_e!==null){t=_e;var f=rn;t:switch(Ke){case 1:Ke=0,rn=null,ka(e,t,f,1);break;case 2:case 9:if(cp(f)){Ke=0,rn=null,cv(t);break}t=function(){Ke!==2&&Ke!==9||Pe!==e||(Ke=7),Wn(e)},f.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:cp(f)?(Ke=0,rn=null,cv(t)):(Ke=0,rn=null,ka(e,t,f,7));break;case 5:var b=null;switch(_e.tag){case 26:b=_e.memoizedState;case 5:case 27:var N=_e;if(b?ex(b):N.stateNode.complete){Ke=0,rn=null;var z=N.sibling;if(z!==null)_e=z;else{var q=N.return;q!==null?(_e=q,_o(q)):_e=null}break t}}Ke=0,rn=null,ka(e,t,f,5);break;case 6:Ke=0,rn=null,ka(e,t,f,6);break;case 8:Cd(),rt=6;break e;default:throw Error(o(462))}}Dj();break}catch(V){lv(e,V)}while(!0);return us=cl=null,fe.H=r,fe.A=u,Ge=l,_e!==null?0:(Pe=null,Le=0,Hr(),rt)}function Dj(){for(;_e!==null&&!Fk();)ov(_e)}function ov(e){var t=Ng(e.alternate,e,gs);e.memoizedProps=e.pendingProps,t===null?_o(e):_e=t}function cv(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=vg(l,t,t.pendingProps,t.type,void 0,Le);break;case 11:t=vg(l,t,t.pendingProps,t.type.render,t.ref,Le);break;case 5:Du(t);var r=t;r===kt&&(Oe?(Kr(r),r.tag===5&&r.stateNode!=null&&(We=r.stateNode)):(Kr(r),Oe=!0));default:Tg(l,t),t=_e=Fm(t,gs),t=Ng(l,t,gs)}e.memoizedProps=e.pendingProps,t===null?_o(e):_e=t}function ka(e,t,l,r){us=cl=null,Du(t),aa=null,mi=0;var u=t.return;try{if(jj(e,u,t,l,Le)){rt=1,fo(e,gn(l,e.current)),_e=null;return}}catch(f){if(u!==null)throw _e=u,f;rt=1,fo(e,gn(l,e.current)),_e=null;return}t.flags&32768?(Oe||r===1?e=!0:ha||(Le&536870912)!==0?e=!1:(Bs=e=!0,(r===2||r===9||r===3||r===6)&&(r=Tt.current,r!==null&&r.tag===13&&(r.flags|=16384))),uv(t,e)):_o(t)}function _o(e){var t=e;do{if((t.flags&32768)!==0){uv(t,Bs);return}e=t.return;var l=Tj(t.alternate,t,gs);if(l!==null){_e=l;return}if(t=t.sibling,t!==null){_e=t;return}_e=t=e}while(t!==null);rt===0&&(rt=5)}function uv(e,t){do{var l=Cj(e.alternate,e);if(l!==null){l.flags&=32767,_e=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){_e=e;return}_e=e=l}while(e!==null);rt=6,_e=null}function dv(e,t,l,r,u,f,b,N,z,q,V,F){e.cancelPendingCommit=null;do Do();while(lt!==0);if((Ge&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Pe&&(_e=Pe=null,Le=0),jl=t,_n=e,Fn=l,Td=u,ev=r,$j(e,t,l,b,N,z,F)}}function $j(e,t,l,r,u,f,b){var N=t.lanes|t.childLanes;if(Sd=N,N|=cu,oy(e,l,N,r,u,f),ga=null,(l&335544064)===l?(va=uj(e),r=10262):(va=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Ij(jr,function(){return Rd(),null})):(e.callbackNode=null,e.callbackPriority=0),ko=!1,r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=fe.T,fe.T=null,u=ve.p,ve.p=2,f=Ge,Ge|=4;try{Ej(e,t,l)}finally{Ge=f,ve.p=u,fe.T=r}}lt=1,ko?pa=o1(b,e.containerInfo,va,Ad,Md,Lj,zd,Rd,Uj):(Ad(),Md(),zd())}function Uj(e){if(lt!==0){var t=_n.onRecoverableError;t(e,{componentStack:null})}}function Lj(){lt===3&&(lt=0,Xg(jl,_n),lt=4)}function Ad(){if(lt===1){lt=0;var e=_n,t=jl,l=Fn,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=fe.T,fe.T=null;var u=ve.p;ve.p=2;var f=Ge;Ge|=4;try{Ti=wo=!1,Kg(t,e,l),l=Yd;var b=Im(e.containerInfo),N=l.focusedElem,z=l.selectionRange;if(b!==N&&N&&N.ownerDocument&&qm(N.ownerDocument.documentElement,N)){if(z!==null&&lu(N)){var q=z.start,V=z.end;if(V===void 0&&(V=q),"selectionStart"in N)N.selectionStart=q,N.selectionEnd=Math.min(V,N.value.length);else{var F=N.ownerDocument||document,H=F&&F.defaultView||window;if(H.getSelection){var K=H.getSelection(),de=N.textContent.length,be=Math.min(z.start,de),Me=z.end===void 0?be:Math.min(z.end,de);!K.extend&&be>Me&&(b=Me,Me=be,be=b);var B=Bm(N,be),_=Bm(N,Me);if(B&&_&&(K.rangeCount!==1||K.anchorNode!==B.node||K.anchorOffset!==B.offset||K.focusNode!==_.node||K.focusOffset!==_.offset)){var Y=F.createRange();Y.setStart(B.node,B.offset),K.removeAllRanges(),be>Me?(K.addRange(Y),K.extend(_.node,_.offset)):(Y.setEnd(_.node,_.offset),K.addRange(Y))}}}}for(F=[],K=N;K=K.parentNode;)K.nodeType===1&&F.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<F.length;N++){var P=F[N];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}Ea=!!Gd,Yd=Gd=null}finally{Ge=f,ve.p=u,fe.T=r}}e.current=t,lt=2}}function Md(){if(lt===2){lt=0;var e=_n,t=jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=fe.T,fe.T=null;var r=ve.p;ve.p=2;var u=Ge;Ge|=4;try{Hg(e,t.alternate,t)}finally{Ge=u,ve.p=r,fe.T=l}}lt=3}}function zd(){if(lt===4||lt===3){lt=0;var e=pa;pa=null,Wk();var t=_n,l=jl,r=Fn,u=ev,f=(r&335544064)===r?10262:10256;if((l.subtreeFlags&f)!==0||(l.flags&f)!==0?lt=5:(lt=0,jl=_n=null,fv(t,t.pendingLanes)),f=t.pendingLanes,f===0&&(Is=null),Bc(r),l=l.stateNode,en&&typeof en.onCommitFiberRoot=="function")try{en.onCommitFiberRoot(Qa,l,void 0,(l.current.flags&128)===128)}catch{}if(u!==null){l=fe.T,f=ve.p,ve.p=2,fe.T=null;try{for(var b=t.onRecoverableError,N=0;N<u.length;N++){var z=u[N];b(z.value,{componentStack:z.stack})}}finally{fe.T=l,ve.p=f}}if(u=ga,b=va,va=null,u!==null&&(ga=null,b===null&&(b=[]),e!==null))for(z=0;z<u.length;z++)l=(0,u[z])(b),l!==void 0&&e.finished.finally(l);(Fn&3)!==0&&Do(),Wn(t),f=t.pendingLanes,(r&261930)!==0&&(f&42)!==0?t===zo?Mi++:(Mi=0,zo=t):(Mi=0,zo=null),zi(0)}}function fv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,di(t)))}function Do(){return pa!==null&&(pa.skipTransition(),pa=null),Ad(),Md(),zd(),Rd()}function Rd(){if(lt!==5)return!1;var e=_n,t=Sd;Sd=0;var l=Bc(Fn),r=fe.T,u=ve.p;try{ve.p=32>l?32:l,fe.T=null,l=Td,Td=null;var f=_n,b=Fn;if(lt=0,jl=_n=null,Fn=0,(Ge&6)!==0)throw Error(o(331));var N=Ge;if(Ge|=4,Pg(f.current),Vg(f,f.current,b,l),Ge=N,zi(0,!1),en&&typeof en.onPostCommitFiberRoot=="function")try{en.onPostCommitFiberRoot(Qa,f)}catch{}return!0}finally{ve.p=u,fe.T=r,fv(e,t)}}function hv(e,t,l){t=gn(l,t),t=Qu(e.stateNode,t,2),e=_s(e,t,2),e!==null&&(Pa(e,2),Wn(e))}function Ze(e,t,l){if(e.tag===3)hv(e,e,l);else for(;t!==null;){if(t.tag===3){hv(t,e,l);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Is===null||!Is.has(r))){e=gn(l,e),l=cg(2),r=_s(t,l,2),r!==null&&(ug(l,r,t,e),Pa(r,2),Wn(r));break}}t=t.return}}function Od(e,t,l){var r=e.pingCache;if(r===null){r=e.pingCache=new zj;var u=new Set;r.set(t,u)}else u=r.get(t),u===void 0&&(u=new Set,r.set(t,u));u.has(l)||(wd=!0,u.add(l),e=Hj.bind(null,e,t,l),t.then(e,e))}function Hj(e,t,l){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Pe===e&&(Le&l)===l&&((rt===4||rt===3&&(Le&62914560)===Le&&300>Wt()-Eo)&&(Ge&2)===0?ba(e,0):Co|=l,ma===Le&&(ma=0)),Wn(e)}function mv(e,t){t===0&&(t=Wh()),e=il(e,t),e!==null&&(Pa(e,t),Wn(e))}function Bj(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),mv(e,l)}function qj(e,t){var l=0;switch(e.tag){case 31:case 13:var r=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),mv(e,l)}function Ij(e,t){return $c(e,t)}var ya=null,ja=null,_d=!1,$o=!1,Dd=!1,Ys=0;function Wn(e){e!==ja&&e.next===null&&(ja===null?ya=ja=e:ja=ja.next=e),$o=!0,_d||(_d=!0,Yj())}function zi(e,t){if(!Dd&&$o){Dd=!0;do for(var l=!1,r=ya;r!==null;){if(e!==0){var u=r.pendingLanes;if(u===0)var f=0;else{var b=r.suspendedLanes,N=r.pingedLanes;f=(1<<31-tn(42|e)+1)-1,f&=u&~(b&~N),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(l=!0,xv(r,f))}else f=Le,f=Tr(r,r===Pe?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(f&3)===0||Ja(r,f)||(l=!0,xv(r,f));r=r.next}while(l);Dd=!1}}function Gj(){pv()}function pv(){$o=_d=!1;var e=0;Ys!==0&&t1()&&(e=Ys);for(var t=Wt(),l=null,r=ya;r!==null;){var u=r.next,f=gv(r,t);f===0?(r.next=null,l===null?ya=u:l.next=u,u===null&&(ja=l)):(l=r,(e!==0||(f&3)!==0)&&($o=!0)),r=u}lt!==0&<!==5||zi(e),Ys!==0&&(Ys=0)}function gv(e,t){for(var l=e.suspendedLanes,r=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var b=31-tn(f),N=1<<b,z=u[b];z===-1?((N&l)===0||(N&r)!==0)&&(u[b]=ry(N,t)):z<=t&&(e.expiredLanes|=N),f&=~N}if(t=Pe,l=Le,l=Tr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,l===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Uc(r),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Ja(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(r!==null&&Uc(r),Bc(l)){case 2:case 8:l=Jh;break;case 32:l=jr;break;case 268435456:l=Ph;break;default:l=jr}return r=vv.bind(null,e),l=$c(l,r),e.callbackPriority=t,e.callbackNode=l,t}return r!==null&&r!==null&&Uc(r),e.callbackPriority=2,e.callbackNode=null,2}function vv(e,t){if(lt!==0&<!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Do()&&e.callbackNode!==l)return null;var r=Le;return r=Tr(e,e===Pe?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(nv(e,r,t),gv(e,Wt()),e.callbackNode!=null&&e.callbackNode===l?vv.bind(null,e):null)}function xv(e,t){if(Do())return null;nv(e,t,!0)}function Yj(){s1(function(){(Ge&6)!==0?$c(Qh,Gj):pv()})}function $d(){if(Ys===0){var e=fl;e===0&&(e=wr,wr<<=1,(wr&261888)===0&&(wr=256)),Ys=e}return Ys}function bv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zr(e)}function Kj(e,t,l,r,u){if(t==="submit"&&l&&l.stateNode===u){var f=bv((u[Yt]||null).action),b=r.submitter;b&&(t=(t=b[Yt]||null)?bv(t.formAction):b.getAttribute("formAction"),t!==null&&(f=t,b=null));var N=new Dr("action","action",null,r,u);e.push({event:N,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ys!==0){var z=new FormData(u,b);Yu(l,{pending:!0,data:z,method:u.method,action:f},null,z)}}else typeof f=="function"&&(N.preventDefault(),z=new FormData(u,b),Yu(l,{pending:!0,data:z,method:u.method,action:f},f,z))},currentTarget:u}]})}}for(var Ud=0;Ud<ou.length;Ud++){var Ld=ou[Ud],Zj=Ld.toLowerCase(),Xj=Ld[0].toUpperCase()+Ld.slice(1);Mn(Zj,"on"+Xj)}Mn(Km,"onAnimationEnd"),Mn(Zm,"onAnimationIteration"),Mn(Xm,"onAnimationStart"),Mn("dblclick","onDoubleClick"),Mn("focusin","onFocus"),Mn("focusout","onBlur"),Mn(nj,"onTransitionRun"),Mn(sj,"onTransitionStart"),Mn(lj,"onTransitionCancel"),Mn(Vm,"onTransitionEnd"),Yl("onMouseEnter",["mouseout","mouseover"]),Yl("onMouseLeave",["mouseout","mouseover"]),Yl("onPointerEnter",["pointerout","pointerover"]),Yl("onPointerLeave",["pointerout","pointerover"]),sl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sl("onBeforeInput",["compositionend","keypress","textInput","paste"]),sl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ri="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(" "),Vj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ri));function kv(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var r=e[l],u=r.event;r=r.listeners;e:{var f=void 0;if(t)for(var b=r.length-1;0<=b;b--){var N=r[b],z=N.instance,q=N.currentTarget;if(N=N.listener,z!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=q;try{f(u)}catch(V){Lr(V)}u.currentTarget=null,f=z}else for(b=0;b<r.length;b++){if(N=r[b],z=N.instance,q=N.currentTarget,N=N.listener,z!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=q;try{f(u)}catch(V){Lr(V)}u.currentTarget=null,f=z}}}}function De(e,t){var l=t[am];l===void 0&&(l=t[am]=new Set);var r=e+"__bubble";l.has(r)||(yv(t,e,2,!1),l.add(r))}function Hd(e,t,l){var r=0;t&&(r|=4),yv(l,e,r,t)}var Uo="_reactListening"+Math.random().toString(36).slice(2);function Bd(e){if(!e[Uo]){e[Uo]=!0,om.forEach(function(l){l!=="selectionchange"&&(Vj.has(l)||Hd(l,!1,e),Hd(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uo]||(t[Uo]=!0,Hd("selectionchange",!1,t))}}function yv(e,t,l,r){switch(ux(t)){case 2:var u=B1;break;case 8:u=q1;break;default:u=rf}l=u.bind(null,t,l,e),u=void 0,!Vc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),r?u!==void 0?e.addEventListener(t,l,{capture:!0,passive:u}):e.addEventListener(t,l,!0):u!==void 0?e.addEventListener(t,l,{passive:u}):e.addEventListener(t,l,!1)}function qd(e,t,l,r,u){var f=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var b=r.tag;if(b===3||b===4){var N=r.stateNode.containerInfo;if(N===u)break;if(b===4)for(b=r.return;b!==null;){var z=b.tag;if((z===3||z===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;N!==null;){if(b=nl(N),b===null)return;if(z=b.tag,z===5||z===6||z===26||z===27){r=f=b;continue e}N=N.parentNode}}r=r.return}ym(function(){var q=f,V=Zc(l),F=[];e:{var H=Qm.get(e);if(H!==void 0){var K=Dr,de=e;switch(e){case"keypress":if(Or(l)===0)break e;case"keydown":case"keyup":K=Ry;break;case"focusin":de="focus",K=Fc;break;case"focusout":de="blur",K=Fc;break;case"beforeblur":case"afterblur":K=Fc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Nm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=ky;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Uy;break;case Km:case Zm:case Xm:K=wy;break;case Vm:K=Hy;break;case"scroll":case"scrollend":K=xy;break;case"wheel":K=qy;break;case"copy":case"cut":case"paste":K=Sy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Tm;break;case"submit":K=Dy;break;case"toggle":case"beforetoggle":K=Gy}var be=(t&4)!==0,Me=!be&&(e==="scroll"||e==="scrollend"),B=be?H!==null?H+"Capture":null:H;be=[];for(var _=q,Y;_!==null;){var P=_;if(Y=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||Y===null||B===null||(P=ei(_,B),P!=null&&be.push(Oi(_,P,Y))),Me)break;_=_.return}0<be.length&&(H=new K(H,de,null,l,V),F.push({event:H,listeners:be}))}}if((t&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",K&&l!==Kc&&(de=l.relatedTarget||l.fromElement)&&(nl(de)||de[ql]))break e;(H||K)&&(de=V.window===V?V:(K=V.ownerDocument)?K.defaultView||K.parentWindow:window,H?(K=l.relatedTarget||l.toElement,H=q,K=K?nl(K):null,K!==null&&(Me=d(K),be=K.tag,K!==Me||be!==5&&be!==27&&be!==6)&&(K=null)):(H=null,K=q),H!==K&&(be=Nm,P="onMouseLeave",B="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(be=Tm,P="onPointerLeave",B="onPointerEnter",_="pointer"),Me=H==null?de:Wa(H),Y=K==null?de:Wa(K),de=new be(P,_+"leave",H,l,V),de.target=Me,de.relatedTarget=Y,P=null,nl(V)===q&&(be=new be(B,_+"enter",K,l,V),be.target=Y,be.relatedTarget=Me,P=be),Me=P,be=H&&K?I(H,K,Qj):null,H!==null&&jv(F,de,H,be,!1),K!==null&&Me!==null&&jv(F,Me,K,be,!0)))}e:{if(H=q?Wa(q):window,K=H.nodeName&&H.nodeName.toLowerCase(),K==="select"||K==="input"&&H.type==="file")var pe=_m;else if(Rm(H))if(Dm)pe=Wy;else{pe=Py;var He=Jy}else K=H.nodeName,!K||K.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?q&&Yc(q.elementType)&&(pe=_m):pe=Fy;if(pe&&(pe=pe(e,q))){Om(F,pe,l,V);break e}He&&He(e,H,q)}switch(He=q?Wa(q):window,e){case"focusin":(Rm(He)||He.contentEditable==="true")&&(Jl=He,au=q,oi=null);break;case"focusout":oi=au=Jl=null;break;case"mousedown":iu=!0;break;case"contextmenu":case"mouseup":case"dragend":iu=!1,Gm(F,l,V);break;case"selectionchange":if(tj)break;case"keydown":case"keyup":Gm(F,l,V)}var je;if(eu)e:{switch(e){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Ql?Mm(e,l)&&(Ne="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(Cm&&l.locale!=="ko"&&(Ql||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Ql&&(je=jm()):(Ss=V,Qc="value"in Ss?Ss.value:Ss.textContent,Ql=!0)),He=Lo(q,Ne),0<He.length&&(Ne=new Sm(Ne,e,null,l,V),F.push({event:Ne,listeners:He}),je?Ne.data=je:(je=zm(l),je!==null&&(Ne.data=je)))),(je=Ky?Zy(e,l):Xy(e,l))&&(Ne=Lo(q,"onBeforeInput"),0<Ne.length&&(He=new Sm("onBeforeInput","beforeinput",null,l,V),F.push({event:He,listeners:Ne}),He.data=je)),Kj(F,e,q,l,V)}kv(F,t)})}function Oi(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Lo(e,t){for(var l=t+"Capture",r=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=ei(e,l),u!=null&&r.unshift(Oi(e,u,f)),u=ei(e,t),u!=null&&r.push(Oi(e,u,f))),e.tag===3)return r;e=e.return}return[]}function Qj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jv(e,t,l,r,u){for(var f=t._reactName,b=[];l!==null&&l!==r;){var N=l,z=N.alternate,q=N.stateNode;if(N=N.tag,z!==null&&z===r)break;N!==5&&N!==26&&N!==27||q===null||(z=q,u?(q=ei(l,f),q!=null&&b.unshift(Oi(l,q,z))):u||(q=ei(l,f),q!=null&&b.push(Oi(l,q,z)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var Jj=/\r\n?/g,Pj=/\u0000|\uFFFD/g;function wv(e){return(typeof e=="string"?e:""+e).replace(Jj,`
|
|
50
|
+
`).replace(Pj,"")}function Nv(e,t){return t=wv(t),wv(e)===t}function Xe(e,t,l,r,u,f){switch(l){case"children":if(typeof r=="string")t==="body"||t==="textarea"&&r===""||Zl(e,r);else if(typeof r=="number"||typeof r=="bigint")t!=="body"&&Zl(e,""+r);else return;break;case"className":Mr(e,"class",r);break;case"tabIndex":Mr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Mr(e,l,r);break;case"style":bm(e,r,f);return;case"data":if(t!=="object"){Mr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(l);break}r=zr(r),e.setAttribute(l,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(l,"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 f=="function"&&(l==="formAction"?(t!=="input"&&Xe(e,t,"name",u.name,u,null),Xe(e,t,"formEncType",u.formEncType,u,null),Xe(e,t,"formMethod",u.formMethod,u,null),Xe(e,t,"formTarget",u.formTarget,u,null)):(Xe(e,t,"encType",u.encType,u,null),Xe(e,t,"method",u.method,u,null),Xe(e,t,"target",u.target,u,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(l);break}r=zr(r),e.setAttribute(l,r);break;case"onClick":r!=null&&(e.onclick=Gn);return;case"onScroll":r!=null&&De("scroll",e);return;case"onScrollEnd":r!=null&&De("scrollend",e);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(l=r.__html,l!=null){if(u.children!=null)throw Error(o(60));f?.__html!==l&&(e.innerHTML=l)}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}l=zr(r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,r):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":r===!0?e.setAttribute(l,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,r):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(l,r):e.removeAttribute(l);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(l):e.setAttribute(l,r);break;case"popover":De("beforetoggle",e),De("toggle",e),Ar(e,"popover",r);break;case"xlinkActuate":ls(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ls(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ls(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ls(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ls(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ls(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ls(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ls(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ls(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ar(e,"is",r);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=gy.get(l)||l,Ar(e,l,r);else return}Ie=!0}function Id(e,t,l,r,u,f){switch(l){case"style":bm(e,r,f);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(l=r.__html,l!=null){if(u.children!=null)throw Error(o(60));f?.__html!==l&&(e.innerHTML=l)}}break;case"children":if(typeof r=="string")Zl(e,r);else if(typeof r=="number"||typeof r=="bigint")Zl(e,""+r);else return;break;case"onScroll":r!=null&&De("scroll",e);return;case"onScrollEnd":r!=null&&De("scrollend",e);return;case"onClick":r!=null&&(e.onclick=Gn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!cm.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(u=l.endsWith("Capture"),f=l.slice(2,u?l.length-7:void 0),t=e[Yt]||null,t=t!=null?t[l]:null,typeof t=="function"&&e.removeEventListener(f,t,u),typeof r=="function")){typeof t!="function"&&t!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(f,r,u);break e}Ie=!0,l in e?e[l]=r:r===!0?e.setAttribute(l,""):Ar(e,l,r)}return}Ie=!0}function At(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var r=!1,u=!1,f;for(f in l)if(l.hasOwnProperty(f)){var b=l[f];if(b!=null)switch(f){case"src":r=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,f,b,l,null)}}u&&Xe(e,t,"srcSet",l.srcSet,l,null),r&&Xe(e,t,"src",l.src,l,null);return;case"input":De("invalid",e);var N=f=b=u=null,z=null,q=null;for(r in l)if(l.hasOwnProperty(r)){var V=l[r];if(V!=null)switch(r){case"name":u=V;break;case"type":b=V;break;case"checked":z=V;break;case"defaultChecked":q=V;break;case"value":f=V;break;case"defaultValue":N=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(137,t));break;default:Xe(e,t,r,V,l,null)}}pm(e,f,N,z,q,b,u,!1);return;case"select":De("invalid",e),r=b=f=null;for(u in l)if(l.hasOwnProperty(u)&&(N=l[u],N!=null))switch(u){case"value":f=N;break;case"defaultValue":b=N;break;case"multiple":r=N;default:Xe(e,t,u,N,l,null)}t=f,l=b,e.multiple=!!r,t!=null?Kl(e,!!r,t,!1):l!=null&&Kl(e,!!r,l,!0);return;case"textarea":De("invalid",e),f=u=r=null;for(b in l)if(l.hasOwnProperty(b)&&(N=l[b],N!=null))switch(b){case"value":r=N;break;case"defaultValue":u=N;break;case"children":f=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(o(91));break;default:Xe(e,t,b,N,l,null)}vm(e,r,u,f);return;case"option":for(z in l)if(l.hasOwnProperty(z)&&(r=l[z],r!=null))switch(z){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Xe(e,t,z,r,l,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(r=0;r<Ri.length;r++)De(Ri[r],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(q in l)if(l.hasOwnProperty(q)&&(r=l[q],r!=null))switch(q){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,q,r,l,null)}return;default:if(Yc(t)){for(V in l)l.hasOwnProperty(V)&&(r=l[V],r!==void 0&&Id(e,t,V,r,l,void 0));return}}for(N in l)l.hasOwnProperty(N)&&(r=l[N],r!=null&&Xe(e,t,N,r,l,null))}var Fj={};function Wj(e,t,l,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,b=null,N=null,z=null,q=null,V=null;for(K in l){var F=l[K];if(l.hasOwnProperty(K)&&F!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":z=F;default:r.hasOwnProperty(K)||Xe(e,t,K,null,r,F)}}for(var H in r){var K=r[H];if(F=l[H],r.hasOwnProperty(H)&&(K!=null||F!=null))switch(H){case"type":K!==F&&(Ie=!0),f=K;break;case"name":K!==F&&(Ie=!0),u=K;break;case"checked":K!==F&&(Ie=!0),q=K;break;case"defaultChecked":K!==F&&(Ie=!0),V=K;break;case"value":K!==F&&(Ie=!0),b=K;break;case"defaultValue":K!==F&&(Ie=!0),N=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,t));break;default:K!==F&&Xe(e,t,H,K,r,F)}}Ic(e,b,N,z,q,V,f,u);return;case"select":K=b=N=H=null;for(f in l)if(z=l[f],l.hasOwnProperty(f)&&z!=null)switch(f){case"value":break;case"multiple":K=z;default:r.hasOwnProperty(f)||Xe(e,t,f,null,r,z)}for(u in r)if(f=r[u],z=l[u],r.hasOwnProperty(u)&&(f!=null||z!=null))switch(u){case"value":f!==z&&(Ie=!0),H=f;break;case"defaultValue":f!==z&&(Ie=!0),N=f;break;case"multiple":f!==z&&(Ie=!0),b=f;default:f!==z&&Xe(e,t,u,f,r,z)}t=N,l=b,r=K,H!=null?Kl(e,!!l,H,!1):!!r!=!!l&&(t!=null?Kl(e,!!l,t,!0):Kl(e,!!l,l?[]:"",!1));return;case"textarea":K=H=null;for(N in l)if(u=l[N],l.hasOwnProperty(N)&&u!=null&&!r.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Xe(e,t,N,null,r,u)}for(b in r)if(u=r[b],f=l[b],r.hasOwnProperty(b)&&(u!=null||f!=null))switch(b){case"value":u!==f&&(Ie=!0),H=u;break;case"defaultValue":u!==f&&(Ie=!0),K=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==f&&Xe(e,t,b,u,r,f)}gm(e,H,K);return;case"option":for(var de in l)if(H=l[de],l.hasOwnProperty(de)&&H!=null&&!r.hasOwnProperty(de))switch(de){case"selected":e.selected=!1;break;default:Xe(e,t,de,null,r,H)}for(z in r)if(H=r[z],K=l[z],r.hasOwnProperty(z)&&H!==K&&(H!=null||K!=null))switch(z){case"selected":H!==K&&(Ie=!0),e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:Xe(e,t,z,H,r,K)}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 be in l)H=l[be],l.hasOwnProperty(be)&&H!=null&&!r.hasOwnProperty(be)&&Xe(e,t,be,null,r,H);for(q in r)if(H=r[q],K=l[q],r.hasOwnProperty(q)&&H!==K&&(H!=null||K!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:Xe(e,t,q,H,r,K)}return;default:if(Yc(t)){for(var Me in l)H=l[Me],l.hasOwnProperty(Me)&&H!==void 0&&!r.hasOwnProperty(Me)&&Id(e,t,Me,void 0,r,H);for(V in r)H=r[V],K=l[V],!r.hasOwnProperty(V)||H===K||H===void 0&&K===void 0||Id(e,t,V,H,r,K);return}}for(var B in l)H=l[B],l.hasOwnProperty(B)&&H!=null&&!r.hasOwnProperty(B)&&Xe(e,t,B,null,r,H);for(F in r)H=r[F],K=l[F],!r.hasOwnProperty(F)||H===K||H==null&&K==null||Xe(e,t,F,H,r,K)}function Sv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function e1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),r=0;r<l.length;r++){var u=l[r],f=u.transferSize,b=u.initiatorType,N=u.duration;if(f&&N&&Sv(b)){for(b=0,N=u.responseEnd,r+=1;r<l.length;r++){var z=l[r],q=z.startTime;if(q>N)break;var V=z.transferSize,F=z.initiatorType;V&&Sv(F)&&(z=z.responseEnd,b+=V*(z<N?1:(N-q)/(z-q)))}if(--r,t+=8*(f+b)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Gd=null,Yd=null;function _i(e){return e.nodeType===9?e:e.ownerDocument}function Tv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Cv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ev(e,t,l,r){return l=_i(l).createElement(e),l[Nt]=r,l[Yt]=t,At(l,e,t),bt(l),l}function Kd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Zd=null;function t1(){var e=window.event;return e&&e.type==="popstate"?e===Zd?!1:(Zd=e,!0):(Zd=null,!1)}var Xd=typeof setTimeout=="function"?setTimeout:void 0,n1=typeof clearTimeout=="function"?clearTimeout:void 0,Av=typeof Promise=="function"?Promise:void 0,Mv=typeof requestAnimationFrame=="function"?requestAnimationFrame:Xd,s1=typeof queueMicrotask=="function"?queueMicrotask:typeof Av<"u"?function(e){return Av.resolve(null).then(e).catch(l1)}:Xd;function l1(e){setTimeout(function(){throw e})}function Ks(e){return e==="head"}function zv(e,t){var l=t,r=0;do{var u=l.nextSibling;if(e.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"||l==="/&"){if(r===0){e.removeChild(u),Aa(t);return}r--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")r++;else if(l==="html")tf(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,tf(l);for(var f=l.firstChild;f;){var b=f.nextSibling,N=f.nodeName;f[Fa]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&f.rel.toLowerCase()==="stylesheet"||l.removeChild(f),f=b}}else l==="body"&&tf(e.ownerDocument.body);l=u}while(l);Aa(t)}function Rv(e,t){var l=e;e=0;do{var r=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),r&&r.nodeType===8)if(l=r.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=r}while(l)}function Ov(e,t,l){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,l!=null&&(e.style.viewTransitionClass=l),l=getComputedStyle(e),l.display==="inline"){if(t=e.getClientRects(),t.length===1)var r=1;else for(var u=r=0;u<t.length;u++){var f=t[u];0<f.width&&0<f.height&&r++}r===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+l.paddingTop,e.marginBottom="-"+l.paddingBottom)}}function _v(e,t){e=e.style,t=t.style;var l=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(l=t.display,e.display=l==null||typeof l=="boolean"?"":l,l=t.margin,l!=null?e.margin=l:(l=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=l==null||typeof l=="boolean"?"":l,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function a1(e,t,l){return l=l.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=l.innerHeight&&e.left<=l.innerWidth}}function Vd(e){var t=e.getBoundingClientRect(),l=getComputedStyle(e);return a1(t,l,e)}function i1(e){return e.documentElement.clientHeight}function r1(e){this.addEventListener("load",e),this.addEventListener("error",e)}function o1(e,t,l,r,u,f,b,N,z){var q=t.nodeType===9?t:t.ownerDocument;try{var V=q.startViewTransition({update:function(){var H=q.defaultView,K=H.navigation&&H.navigation.transition,de=q.fonts.status;r();var be=[];if(de==="loaded"&&(i1(q),q.fonts.status==="loading"&&be.push(q.fonts.ready)),de=be.length,e!==null)for(var Me=e.suspenseyImages,B=0,_=0;_<Me.length;_++){var Y=Me[_];if(!Y.complete){var P=Y.getBoundingClientRect();if(0<P.bottom&&0<P.right&&P.top<H.innerHeight&&P.left<H.innerWidth){if(B+=tx(Y),B>qo){be.length=de;break}Y=new Promise(r1.bind(Y)),be.push(Y)}}}if(0<be.length)return H=Promise.race([Promise.all(be),new Promise(function(pe){return setTimeout(pe,500)})]).then(u,u),(K?Promise.allSettled([K.finished,H]):H).then(f,f);if(u(),K)return K.finished.then(f,f);f()},types:l});q.__reactViewTransition=V;var F=[];return V.ready.then(function(){for(var H=q.documentElement.getAnimations({subtree:!0}),K=0;K<H.length;K++){var de=H[K],be=de.effect,Me=be.pseudoElement;if(Me!=null&&Me.startsWith("::view-transition")){F.push(de),de=be.getKeyframes();for(var B=Me=void 0,_=!0,Y=0;Y<de.length;Y++){var P=de[Y],pe=P.width;if(Me===void 0)Me=pe;else if(Me!==pe){_=!1;break}if(pe=P.height,B===void 0)B=pe;else if(B!==pe){_=!1;break}delete P.width,delete P.height,P.transform==="none"&&delete P.transform}_&&Me!==void 0&&B!==void 0&&(be.setKeyframes(de),_=getComputedStyle(be.target,be.pseudoElement),_.width!==Me||_.height!==B)&&(_=de[0],_.width=Me,_.height=B,_=de[de.length-1],_.width=Me,_.height=B,be.setKeyframes(de))}}b()},function(H){q.__reactViewTransition===V&&(q.__reactViewTransition=null);try{if(typeof H=="object"&&H!==null)switch(H.name){case"InvalidStateError":(H.message==="View transition was skipped because document visibility state is hidden."||H.message==="Skipping view transition because document visibility state has become hidden."||H.message==="Skipping view transition because viewport size changed."||H.message==="Transition was aborted because of invalid state")&&(H=null)}H!==null&&z(H)}finally{r(),u(),b()}}),V.finished.finally(function(){for(var H=0;H<F.length;H++)F[H].cancel();q.__reactViewTransition===V&&(q.__reactViewTransition=null),N()}),V}catch{return r(),u(),b(),null}}function wl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}wl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:j({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},wl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,l=e.getAnimations({subtree:!0}),r=[],u=0;u<l.length;u++){var f=l[u].effect;f!==null&&f.target===e&&f.pseudoElement===t&&r.push(l[u])}return r},wl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Dv(e){return{name:e,group:new wl("group",e),imagePair:new wl("image-pair",e),old:new wl("old",e),new:new wl("new",e)}}function un(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}un.prototype.addEventListener=function(e,t,l){var r=null,u=null;if(!(l!=null&&typeof l!="boolean"&&(r=l.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(Uv(f,e,t,l)===-1){var b=this,N=t;l!=null&&typeof l!="boolean"&&l.once===!0&&(N=function(z){b.removeEventListener(e,t,l),typeof t=="function"?t.call(this,z):t.handleEvent(z)}),r!==null&&(u=b.removeEventListener.bind(b,e,t,l),r.addEventListener("abort",u,{once:!0}),u=r.removeEventListener.bind(r,"abort",u)),r=wa(l),f.push({type:e,listener:t,optionsOrUseCapture:l,attachedListener:N,cleanup:u}),x(this._fragmentFiber.child,!1,c1,e,N,r)}this._eventListeners=f}};function c1(e,t,l,r){return M(e).addEventListener(t,l,r),!1}un.prototype.removeEventListener=function(e,t,l){var r=this._eventListeners;if(r!==null&&(t=Uv(r,e,t,l),t!==-1)){var u=r[t];l=u.attachedListener;var f=u.cleanup;u=wa(u.optionsOrUseCapture),x(this._fragmentFiber.child,!1,u1,e,l,u),r.splice(t,1),f!==null&&f()}};function u1(e,t,l,r){return M(e).removeEventListener(t,l,r),!1}function wa(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function $v(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Uv(e,t,l,r){if(e.length===0)return-1;r=$v(r);for(var u=0;u<e.length;u++){var f=e[u];if(f.type===t&&f.listener===l&&$v(f.optionsOrUseCapture)===r)return u}return-1}un.prototype.dispatchEvent=function(e){var t=w(this._fragmentFiber);if(t===null)return!0;t=M(t);var l=this._eventListeners;if(l!==null&&0<l.length||!e.bubbles){var r=t.nodeType===9?t.createComment(""):document.createTextNode("");if(l)for(var u=0;u<l.length;u++){var f=l[u];r.addEventListener(f.type,f.attachedListener,wa(f.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),l)for(u=0;u<l.length;u++)f=l[u],r.removeEventListener(f.type,f.attachedListener,wa(f.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},un.prototype.focus=function(e){x(this._fragmentFiber.child,!0,Lv,e,void 0,void 0)};function Lv(e,t){return e.tag===6?!1:(e=M(e),j1(e,t))}un.prototype.focusLast=function(e){var t=[];x(this._fragmentFiber.child,!0,Qd,t,void 0,void 0);for(var l=t.length-1;0<=l&&!Lv(t[l],e);l--);};function Qd(e,t){return t.push(e),!1}un.prototype.blur=function(){var e=w(this._fragmentFiber);e!==null&&(e=M(e),e=_i(e).activeElement,e!==null&&x(this._fragmentFiber.child,!1,d1,e,void 0,void 0))};function d1(e,t){return e.tag===6?!1:(e=M(e),e===t||e.contains(t)?(t.blur(),!0):!1)}un.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),x(this._fragmentFiber.child,!1,f1,e,void 0,void 0)};function f1(e,t){return e.tag===6||(e=M(e),t.observe(e)),!1}un.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),x(this._fragmentFiber.child,!1,h1,e,void 0,void 0);for(var l=t=0;l<Dn.length;l++){var r=Dn[l];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Dn[t++]=r}Dn.length=t}};function h1(e,t){return e.tag===6||(e=M(e),t.unobserve(e)),!1}var Dn=[],Jd=!1;function m1(e,t,l){Dn.push({fragmentInstance:e,observer:t,instance:l}),Jd||(Jd=!0,w1(function(){Jd=!1;var r=Dn;Dn=[];for(var u=0;u<r.length;u++){var f=r[u];f.observer.unobserve(f.instance)}}))}un.prototype.getClientRects=function(){var e=[];return x(this._fragmentFiber.child,!1,p1,e,void 0,void 0),e};function p1(e,t){if(e.tag===6){e=e.stateNode;var l=e.ownerDocument.createRange();l.selectNodeContents(e),t.push.apply(t,l.getClientRects())}else e=M(e),t.push.apply(t,e.getClientRects());return!1}un.prototype.getRootNode=function(e){var t=w(this._fragmentFiber);return t===null?this:M(t).getRootNode(e)},un.prototype.compareDocumentPosition=function(e){var t=w(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];x(this._fragmentFiber.child,!1,Qd,l,void 0,void 0);var r=M(t);if(l.length===0){if(l=r,E(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(l=t)}t=this._fragmentFiber;var u=r=l.compareDocumentPosition(e);return l===e?u=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=T(t)[1],l===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=M(l).compareDocumentPosition(e),u=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=M(l[0]),u=M(l[l.length-1]);var f=E(this._fragmentFiber)?t.parentElement:r;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=f.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var b=t.compareDocumentPosition(e),N=u.compareDocumentPosition(e),z=b&Node.DOCUMENT_POSITION_CONTAINED_BY||N&Node.DOCUMENT_POSITION_CONTAINED_BY;return N=r&&f&&b&Node.DOCUMENT_POSITION_FOLLOWING&&N&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||f&&u===e||z||N?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!f&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:b,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||g1(t,this._fragmentFiber,l[0],l[l.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function g1(e,t,l,r,u){var f=nl(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===t||f.alternate===t)){l=!0;break e}f=f.return}l=!1}return l}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=u.ownerDocument,u===f||u===f.documentElement||u===f.body;e:{for(f=t,t=w(t);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==t&&f.alternate!==t)){f=!0;break e}f=f.return}f=!1}return f}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!f)&&!(t=f===l)&&(t=I(l,f,ee),t===null?t=!1:(x(t,!0,O,f,l),f=A,A=null,t=f!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!f)&&!(t=f===r)&&(t=I(r,f,ee),t===null?t=!1:(x(t,!0,W,f,r),f=A,$=A=null,t=f!==null)),t):!1}function Hv(e,t){var l=e.ownerDocument.createRange();l.selectNodeContents(e),e=l.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}un.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];x(this._fragmentFiber.child,!1,Qd,t,void 0,void 0);var l=e!==!1;if(t.length===0){var r=T(this._fragmentFiber);if(r=l?r[1]||r[0]||w(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=M(r),Hv(e,l);return}if(r=M(r),r.nodeType!==9){if(r.nodeType===11){l="host"in r?r.host:null,l!==null&&l.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=l?t.length-1:0;r!==(l?-1:t.length);){var u=t[r];u.tag===6?(u=M(u),Hv(u,l)):M(u).scrollIntoView(e),r+=l?-1:1}};function v1(e,t){return e=M(e),Bv(e,t),!1}function Bv(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function qv(e,t){var l=t._eventListeners;if(l!==null)for(var r=0;r<l.length;r++){var u=l[r];e.addEventListener(u.type,u.attachedListener,wa(u.optionsOrUseCapture))}e.nodeType!==3&&(l=t._observers,l!==null&&l.forEach(function(f){for(var b=0,N=0;N<Dn.length;N++){var z=Dn[N];(z.fragmentInstance!==t||z.observer!==f||z.instance!==e)&&(Dn[b++]=z)}Dn.length=b,f.observe(e)}),Bv(e,t))}function x1(e,t){var l=t._eventListeners;if(l!==null)for(var r=0;r<l.length;r++){var u=l[r];e.removeEventListener(u.type,u.attachedListener,wa(u.optionsOrUseCapture))}e.nodeType!==3&&(l=t._observers,l!==null&&l.forEach(function(f){typeof f.rootMargin=="string"?m1(t,f,e):f.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Pd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Pd(l),Er(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function b1(e,t,l,r){for(;e.nodeType===1;){var u=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Fa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=yn(e.nextSibling),e===null)break}return null}function k1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=yn(e.nextSibling),e===null))return null;return e}function Iv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=yn(e.nextSibling),e===null))return null;return e}function Fd(e){return e.data==="$?"||e.data==="$~"}function Wd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function y1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var r=function(){t(),l.removeEventListener("DOMContentLoaded",r)};l.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function yn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ef=null;function Gv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return yn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Yv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function j1(e,t){function l(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener("focus",l,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",l,!0)}return r}function w1(e){Mv(function(){Mv(function(t){return e(t)})})}function Kv(e,t,l){switch(t=_i(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Zv(e,t,l){for(var r in l){var u=l[r];l.hasOwnProperty(r)&&u!=null&&Xe(e,t,r,null,Fj,u)}l.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Gn&&(e.onclick=null),Er(e)}function tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Er(e)}var jn=new Map,Xv=new Set;function Di(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var vs=ve.d;ve.d={f:N1,r:S1,D:T1,C:C1,L:E1,m:A1,X:z1,S:M1,M:R1};function N1(){var e=vs.f(),t=Ro();return e||t}function S1(e){var t=Il(e);t!==null&&t.tag===5&&t.type==="form"?Qp(t):vs.r(e)}var Na=typeof document>"u"?null:document;function Vv(e,t,l){var r=Na;if(r&&typeof t=="string"&&t){var u=mn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),Xv.has(u)||(Xv.add(u),e={rel:e,crossOrigin:l,href:t},r.querySelector(u)===null&&(t=r.createElement("link"),At(t,"link",e),bt(t),r.head.appendChild(t)))}}function T1(e){vs.D(e),Vv("dns-prefetch",e,null)}function C1(e,t){vs.C(e,t),Vv("preconnect",e,t)}function E1(e,t,l){vs.L(e,t,l);var r=Na;if(r&&e&&t){var u='link[rel="preload"][as="'+mn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+mn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+mn(l.imageSizes)+'"]')):u+='[href="'+mn(e)+'"]';var f=u;switch(t){case"style":f=Sa(e);break;case"script":f=Ta(e)}if(!(jn.has(f)||(e=j({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),jn.set(f,e),r.querySelector(u)!==null||t==="style"&&r.querySelector($i(f))||t==="script"&&r.querySelector(Ui(f))))){var b=r.createElement("link");At(b,"link",e),t==="style"&&(b[Cr]=!0,b.onload=b.onerror=function(){rm(b)}),bt(b),r.head.appendChild(b)}}}function A1(e,t){vs.m(e,t);var l=Na;if(l&&e){var r=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+mn(r)+'"][href="'+mn(e)+'"]',f=u;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ta(e)}if(!jn.has(f)&&(e=j({rel:"modulepreload",href:e},t),jn.set(f,e),l.querySelector(u)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Ui(f)))return}r=l.createElement("link"),At(r,"link",e),bt(r),l.head.appendChild(r)}}}function M1(e,t,l){vs.S(e,t,l);var r=Na;if(r&&e){var u=Gl(r).hoistableStyles,f=Sa(e);t=t||"default";var b=u.get(f);if(!b){var N={loading:0,preload:null};if(b=r.querySelector($i(f)))N.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},l),(l=jn.get(f))&&nf(e,l);var z=b=r.createElement("link");bt(z),At(z,"link",e),z._p=new Promise(function(q,V){z.onload=q,z.onerror=V}),z.addEventListener("load",function(){N.loading|=1}),z.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Ho(b,t,r)}b={type:"stylesheet",instance:b,count:1,state:N},u.set(f,b)}}}function z1(e,t){vs.X(e,t);var l=Na;if(l&&e){var r=Gl(l).hoistableScripts,u=Ta(e),f=r.get(u);f||(f=l.querySelector(Ui(u)),f||(e=j({src:e,async:!0},t),(t=jn.get(u))&&sf(e,t),f=l.createElement("script"),bt(f),At(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function R1(e,t){vs.M(e,t);var l=Na;if(l&&e){var r=Gl(l).hoistableScripts,u=Ta(e),f=r.get(u);f||(f=l.querySelector(Ui(u)),f||(e=j({src:e,async:!0,type:"module"},t),(t=jn.get(u))&&sf(e,t),f=l.createElement("script"),bt(f),At(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function Qv(e,t,l,r){var u=(u=An.current)?Di(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=Sa(l.href),t=Gl(u).hoistableStyles,r=t.get(l),r||(r={type:"style",instance:null,count:0,state:null},t.set(l,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Sa(l.href);var f=Gl(u).hoistableStyles,b=f.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,b),(f=u.querySelector($i(e)))?f._p||(b.instance=f,b.state.loading=5):(f=jn.get(e),f||(f={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},jn.set(e,f)),O1(u,e,f,b.state))),t&&r===null)throw Error(o(528,""));return b}if(t&&r!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(l=Ta(l),t=Gl(u).hoistableScripts,r=t.get(l),r||(r={type:"script",instance:null,count:0,state:null},t.set(l,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Sa(e){return'href="'+mn(e)+'"'}function $i(e){return'link[rel="stylesheet"]['+e+"]"}function Jv(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function O1(e,t,l,r){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Cr]!==!0){r.loading=1;return}}else t=e.createElement("link"),t[Cr]=!0,t.onload=t.onerror=rm.bind(null,t),At(t,"link",l),bt(t),e.head.appendChild(t);r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2})}function Ta(e){return'[src="'+mn(e)+'"]'}function Ui(e){return"script[async]"+e}function Pv(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+mn(l.href)+'"]');if(r)return t.instance=r,bt(r),r;var u=j({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),bt(r),At(r,"style",u),Ho(r,l.precedence,e),t.instance=r;case"stylesheet":u=Sa(l.href);var f=e.querySelector($i(u));if(f)return t.state.loading|=4,t.instance=f,bt(f),f;r=Jv(l),(u=jn.get(u))&&nf(r,u),f=(e.ownerDocument||e).createElement("link"),bt(f);var b=f;return b._p=new Promise(function(N,z){b.onload=N,b.onerror=z}),At(f,"link",r),t.state.loading|=4,Ho(f,l.precedence,e),t.instance=f;case"script":return f=Ta(l.src),(u=e.querySelector(Ui(f)))?(t.instance=u,bt(u),u):(r=l,(u=jn.get(f))&&(r=j({},l),sf(r,u)),e=e.ownerDocument||e,u=e.createElement("script"),bt(u),At(u,"link",r),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ho(r,l.precedence,e));return t.instance}function Ho(e,t,l){for(var r=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=r.length?r[r.length-1]:null,f=u,b=0;b<r.length;b++){var N=r[b];if(N.dataset.precedence===t)f=N;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function nf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function sf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Bo=null;function Fv(e,t,l){if(Bo===null){var r=new Map,u=Bo=new Map;u.set(l,r)}else u=Bo,r=u.get(l),r||(r=new Map,u.set(l,r));if(r.has(e))return r;for(r.set(e,null),l=l.getElementsByTagName(e),u=0;u<l.length;u++){var f=l[u];if(!(f[Fa]||f[Nt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(t)||"";b=e+b;var N=r.get(b);N?N.push(f):r.set(b,[f])}}return r}function lf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function _1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Wv(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function ex(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function tx(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function nx(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=tx(t),e.suspenseyImages.push(t)),e=U1.bind(e),t.decode().then(e,e))}function D1(e,t,l,r){if(l.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=Sa(r.href),f=t.querySelector($i(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Li.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=f,bt(f);return}f=t.ownerDocument||t,r=Jv(r),(u=jn.get(u))&&nf(r,u),f=f.createElement("link"),bt(f);var b=f;b._p=new Promise(function(N,z){b.onload=N,b.onerror=z}),At(f,"link",r),l.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Li.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var qo=0;function $1(e,t){return e.stylesheets&&e.count===0&&Go(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var r=setTimeout(function(){if(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&qo===0&&(qo=62500*e1());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>qo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(u)}}:null}function sx(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Go(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Li(){this.count--,sx(this)}function U1(){this.imgCount--,sx(this)}var Io=null;function Go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Io=new Map,t.forEach(L1,e),Io=null,Li.call(e))}function L1(e,t){if(!(t.state.loading&4)){var l=Io.get(e);if(l)var r=l.get(null);else{l=new Map,Io.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var b=u[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),r=b)}r&&l.set(null,r)}u=t.instance,b=u.getAttribute("data-precedence"),f=l.get(b)||r,f===r&&l.set(null,u),l.set(b,u),this.count++,r=Li.bind(this),u.addEventListener("load",r),u.addEventListener("error",r),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Ca={$$typeof:Ce,Provider:null,Consumer:null,_currentValue:tt,_currentValue2:tt,_threadCount:0};function H1(e,t,l,r,u,f,b,N,z){this.tag=1,this.containerInfo=e,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=Lc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lc(0),this.hiddenUpdates=Lc(null),this.identifierPrefix=r,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.transitionTypes=null,this.incompleteTransitions=new Map}function lx(e,t,l,r,u,f,b,N,z,q,V,F){return e=new H1(e,t,l,b,z,q,V,F,N),t=1,f===!0&&(t|=24),f=Kt(3,null,null,t),e.current=f,f.stateNode=e,t=bu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:r,isDehydrated:l,cache:t},wu(f),e}function ax(e){return e?(e=Wl,e):Wl}function ix(e,t,l,r,u,f){u=ax(u),r.context===null?r.context=u:r.pendingContext=u,r=Os(t),r.payload={element:l},f=f===void 0?null:f,f!==null&&(r.callback=f),l=_s(e,r,t),l!==null&&(Qt(l,e,t),pi(l,e,t))}function rx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function af(e,t){rx(e,t),(e=e.alternate)&&rx(e,t)}function ox(e){if(e.tag===13||e.tag===31){var t=il(e,67108864);t!==null&&Qt(t,e,67108864),af(e,67108864)}}function cx(e){if(e.tag===13||e.tag===31){var t=cn();t=Hc(t);var l=il(e,t);l!==null&&Qt(l,e,t),af(e,t)}}var Ea=!0;function B1(e,t,l,r){var u=fe.T;fe.T=null;var f=ve.p;try{ve.p=2,rf(e,t,l,r)}finally{ve.p=f,fe.T=u}}function q1(e,t,l,r){var u=fe.T;fe.T=null;var f=ve.p;try{ve.p=8,rf(e,t,l,r)}finally{ve.p=f,fe.T=u}}function rf(e,t,l,r){if(Ea){var u=of(r);if(u===null)qd(e,t,r,Yo,l),dx(e,r);else if(G1(u,e,t,l,r))r.stopPropagation();else if(dx(e,r),t&4&&-1<I1.indexOf(e)){for(;u!==null;){var f=Il(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=tl(f.pendingLanes);if(b!==0){var N=f;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var z=1<<31-tn(b);N.entanglements[1]|=z,b&=~z}Wn(f),(Ge&6)===0&&(Ao=Wt()+500,zi(0))}}break;case 31:case 13:N=il(f,2),N!==null&&Qt(N,f,2),Ro(),af(f,2)}if(f=of(r),f===null&&qd(e,t,r,Yo,l),f===u)break;u=f}u!==null&&r.stopPropagation()}else qd(e,t,r,null,l)}}function of(e){return e=Zc(e),cf(e)}var Yo=null;function cf(e){if(Yo=null,e=nl(e),e!==null){var t=d(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=h(t),e!==null)return e;e=null}else if(l===31){if(e=m(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Yo=e,null}function ux(e){switch(e){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ey()){case Qh:return 2;case Jh:return 8;case jr:case ty:return 32;case Ph:return 268435456;default:return 32}default:return 32}}var uf=!1,Zs=null,Xs=null,Vs=null,Hi=new Map,Bi=new Map,Qs=[],I1="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 dx(e,t){switch(e){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":Xs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Hi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bi.delete(t.pointerId)}}function qi(e,t,l,r,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:l,eventSystemFlags:r,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Il(t),t!==null&&ox(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function G1(e,t,l,r,u){switch(t){case"focusin":return Zs=qi(Zs,e,t,l,r,u),!0;case"dragenter":return Xs=qi(Xs,e,t,l,r,u),!0;case"mouseover":return Vs=qi(Vs,e,t,l,r,u),!0;case"pointerover":var f=u.pointerId;return Hi.set(f,qi(Hi.get(f)||null,e,t,l,r,u)),!0;case"gotpointercapture":return f=u.pointerId,Bi.set(f,qi(Bi.get(f)||null,e,t,l,r,u)),!0}return!1}function fx(e){var t=nl(e.target);if(t!==null){var l=d(t);if(l!==null){if(t=l.tag,t===13){if(t=h(l),t!==null){e.blockedOn=t,lm(e.priority,function(){cx(l)});return}}else if(t===31){if(t=m(l),t!==null){e.blockedOn=t,lm(e.priority,function(){cx(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ko(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=of(e.nativeEvent);if(l===null){l=e.nativeEvent;var r=new l.constructor(l.type,l);Kc=r,l.target.dispatchEvent(r),Kc=null}else return t=Il(l),t!==null&&ox(t),e.blockedOn=l,!1;t.shift()}return!0}function hx(e,t,l){Ko(e)&&l.delete(t)}function Y1(){uf=!1,Zs!==null&&Ko(Zs)&&(Zs=null),Xs!==null&&Ko(Xs)&&(Xs=null),Vs!==null&&Ko(Vs)&&(Vs=null),Hi.forEach(hx),Bi.forEach(hx)}function Zo(e,t){e.blockedOn===t&&(e.blockedOn=null,uf||(uf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Y1)))}var Xo=null;function mx(e){Xo!==e&&(Xo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Xo===e&&(Xo=null);for(var t=0;t<e.length;t+=3){var l=e[t],r=e[t+1],u=e[t+2];if(typeof r!="function"){if(cf(r||l)===null)continue;break}var f=Il(l);f!==null&&(e.splice(t,3),t-=3,Yu(f,{pending:!0,data:u,method:l.method,action:r},r,u))}}))}function Aa(e){function t(z){return Zo(z,e)}Zs!==null&&Zo(Zs,e),Xs!==null&&Zo(Xs,e),Vs!==null&&Zo(Vs,e),Hi.forEach(t),Bi.forEach(t);for(var l=0;l<Qs.length;l++){var r=Qs[l];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Qs.length&&(l=Qs[0],l.blockedOn===null);)fx(l),l.blockedOn===null&&Qs.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(r=0;r<l.length;r+=3){var u=l[r],f=l[r+1],b=u[Yt]||null;if(typeof f=="function")b||mx(l);else if(b){var N=null;if(f&&f.hasAttribute("formAction")){if(u=f,b=f[Yt]||null)N=b.formAction;else if(cf(u)!==null)continue}else N=b.action;typeof N=="function"?l[r+1]=N:(l.splice(r,3),r-=3),mx(l)}}}function px(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),r||setTimeout(l,20)}function l(){if(!r&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function df(e){this._internalRoot=e}Vo.prototype.render=df.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,r=cn();ix(l,r,e,t,null,null)},Vo.prototype.unmount=df.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ix(e.current,2,null,e,null,null),Ro(),t[ql]=null}};function Vo(e){this._internalRoot=e}Vo.prototype.unstable_scheduleHydration=function(e){if(e){var t=sm();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Qs.length&&t!==0&&t<Qs[l].priority;l++);Qs.splice(l,0,e),l===0&&fx(e)}};var gx=a.version;if(gx!=="19.3.1")throw Error(o(527,gx,"19.3.1"));ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var K1={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:fe,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qo.isDisabled&&Qo.supportsFiber)try{Qa=Qo.inject(K1),en=Qo}catch{}}return Gi.createRoot=function(e,t){if(!c(e))throw Error(o(299));var l=!1,r="",u=ag,f=ig,b=rg;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=lx(e,1,!1,null,null,l,r,null,u,f,b,px),e[ql]=t.current,Bd(e),new df(t)},Gi.hydrateRoot=function(e,t,l){if(!c(e))throw Error(o(299));var r=!1,u="",f=ag,b=ig,N=rg,z=null;return l!=null&&(l.unstable_strictMode===!0&&(r=!0),l.identifierPrefix!==void 0&&(u=l.identifierPrefix),l.onUncaughtError!==void 0&&(f=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError),l.formState!==void 0&&(z=l.formState)),t=lx(e,1,!0,t,l??null,r,u,z,f,b,N,px),t.context=ax(null),l=t.current,r=cn(),r=Hc(r),u=Os(r),u.callback=null,_s(l,u,r),l=r,t.current.lanes=l,Pa(t,l),Wn(t),e[ql]=t.current,Bd(e),new Vo(t)},Gi.version="19.3.1",Gi}var Tx;function ew(){if(Tx)return hf.exports;Tx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),hf.exports=W1(),hf.exports}var tw=ew(),k=uh();const nw=["general","rules","providers","models","memory","image","knowledge","search","skills","mcp","desktop","work","usage","push","about"];function Cx(n){try{return n?decodeURIComponent(n):null}catch{return null}}function sw(n,a){if(n==="job"||n==="routine")return a?{kind:n,id:a}:void 0;if(n==="file")return a?{kind:n,path:a,full:!1}:void 0;if(n==="routines"||n==="skills"||n==="knowledge"||n==="rules"||n==="assistant"||n==="jobs"||n==="newRoutine")return{kind:n}}function lw(n){return n.kind==="job"||n.kind==="routine"?`/${n.kind}/${encodeURIComponent(n.id)}`:n.kind==="file"?n.liveId||!n.path?"":`/file/${encodeURIComponent(n.path)}`:`/${n.kind}`}function aw(n){const[a,i,o,c]=n.replace(/^#\/?/,"").split("/"),d=Cx(i);return a==="knowledge"?{sel:null,settings:!1,section:null,knowledge:!0}:a==="chat"&&d?{sel:d,settings:!1,section:null,panel:sw(o,Cx(c))}:a==="settings"?{sel:null,settings:!0,section:nw.find(m=>m===d)??null}:{sel:null,settings:!1,section:null}}function iw(n,a){if(n.page==="knowledge")return"#/knowledge";if(n.page==="settings")return n.section?`#/settings/${n.section}`:"#/settings";if(!n.sel||a&&n.mobile!=="chat")return"";const i=n.panelStack?.at(-1);return`#/chat/${encodeURIComponent(n.sel)}${i?lw(i):""}`}const rw=["searxng","exa","tavily","brave","serper","jina","firecrawl","perplexity","youcom","ollama"];function o0(){return rw.map(n=>({name:n,enabled:!1}))}class Ue extends Error{status;constructor(a,i){super(i),this.status=a}}async function ie(n,a){let i;try{i=await fetch(n,{credentials:"same-origin",...a})}catch(c){throw new Ue(0,`无法连接 Hob:${c instanceof Error?c.message:String(c)}`)}if(!i.ok){let c=`${i.status} ${i.statusText}`;try{const d=await i.json();d?.error&&(c=d.error)}catch{}throw new Ue(i.status,c)}if(i.status===204)return;const o=await i.text();return o?JSON.parse(o):void 0}function $e(n,a="POST"){return{method:a,headers:{"content-type":"application/json"},body:JSON.stringify(n)}}const ow=["rules","assistant","assistant_removed","item","delta","job","delegation","job_step","activity","approval","draft","routine","routine_removed","profile","knowledge","skills"],cw={knowledge:(n={})=>{const a=new URLSearchParams;for(const[i,o]of Object.entries(n))o!==void 0&&o!==""&&a.set(i,String(o));return ie(`/api/knowledge?${a}`)},knowledgeEntry:(n,a)=>ie(`/api/knowledge/entries/${encodeURIComponent(n)}${a!==void 0?`?chunk=${a}`:""}`),reindexKnowledge:n=>ie(`/api/knowledge/collections/${encodeURIComponent(n)}/reindex`,{method:"POST"}),embeddingKey:()=>ie("/api/knowledge/embedding"),putEmbedding:(n,a,i)=>ie("/api/knowledge/embedding",$e({revision:n,embedding:a,...i?{apiKey:i}:{}},"PUT")),embeddingTest:n=>ie("/api/knowledge/embedding/test",$e(n)),createKnowledgeCollection:n=>ie("/api/knowledge/collections",$e({name:n})).then(a=>a.collection),renameKnowledgeCollection:(n,a)=>ie(`/api/knowledge/collections/${encodeURIComponent(n)}`,$e({name:a},"PATCH")).then(i=>i.collection),deleteKnowledgeCollection:n=>ie(`/api/knowledge/collections/${encodeURIComponent(n)}`,{method:"DELETE"}),patchKnowledgeEntry:(n,a)=>ie(`/api/knowledge/entries/${encodeURIComponent(n)}`,$e(a,"PATCH")).then(i=>i.entry),deleteKnowledgeEntry:n=>ie(`/api/knowledge/entries/${encodeURIComponent(n)}`,{method:"DELETE"}),uploadKnowledge:(n,a)=>{const i=new FormData;for(const o of a)i.append("files",o);return ie(`/api/knowledge/upload?collection=${encodeURIComponent(n)}`,{method:"POST",body:i})},me:()=>ie("/api/me"),login:n=>ie("/api/login",$e({password:n})),logout:()=>ie("/api/logout",{method:"POST"}),bootstrap:()=>ie("/api/bootstrap"),settings:()=>ie("/api/settings"),rules:()=>ie("/api/rules"),saveRules:n=>ie("/api/rules",$e({rules:n},"PUT")),models:()=>ie("/api/models"),putSettings:(n,a)=>ie("/api/settings",$e({revision:n,patch:a},"PUT")),providers:()=>ie("/api/providers"),claude:()=>ie("/api/claude"),saveClaude:(n,a)=>ie("/api/claude",$e({revision:n,claude:a},"PUT")),putProvider:(n,a)=>ie(`/api/providers/${encodeURIComponent(n)}`,$e(a,"PUT")),putThinking:n=>ie("/api/models/thinking",$e(n,"PUT")),deleteProvider:n=>ie(`/api/providers/${encodeURIComponent(n)}`,{method:"DELETE"}),testProvider:n=>ie("/api/providers/test",$e(n)),discoverProvider:n=>ie("/api/providers/discover",$e(n)),providersImport:()=>ie("/api/providers/import"),importProviders:n=>ie("/api/providers/import",$e({ids:n})),assistantSkills:n=>ie(`/api/assistants/${encodeURIComponent(n)}/skills`),patchAssistantSkill:(n,a,i)=>ie(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:i})}),rollbackAssistantSkill:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}/rollback`,{method:"POST"}),deleteAssistantSkill:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),sedimentJob:n=>ie(`/api/jobs/${encodeURIComponent(n)}/sediment`,{method:"POST"}),skills:()=>ie("/api/skills"),skillsImport:n=>ie(`/api/skills/import/${n}`),importSkills:(n,a,i)=>ie(`/api/skills/import/${n}`,$e({ids:a,overwrite:i})),deleteSkill:n=>ie(`/api/skills/${encodeURIComponent(n)}`,{method:"DELETE"}),desktop:()=>ie("/api/desktop"),saveDesktop:n=>ie("/api/desktop",$e(n,"PUT")),saveDesktopPublic:(n,a)=>ie("/api/desktop/public",$e({revision:n,assistants:a},"PUT")),testDesktop:()=>ie("/api/desktop/test",$e({})),mcp:()=>ie("/api/mcp"),putMcp:(n,a)=>ie(`/api/mcp/${encodeURIComponent(n)}`,$e(a,"PUT")),patchMcp:(n,a)=>ie(`/api/mcp/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteMcp:n=>ie(`/api/mcp/${encodeURIComponent(n)}`,{method:"DELETE"}),testMcp:(n,a)=>ie(`/api/mcp/${encodeURIComponent(n)}/test`,$e({refresh:a})),mcpImports:()=>ie("/api/mcp/import"),importMcp:n=>ie("/api/mcp/import",$e({ids:n})),search:()=>ie("/api/search"),putSearch:(n,a,i)=>ie("/api/search",$e({revision:n,providers:a,keys:i},"PUT")),testSearch:(n,a,i)=>ie("/api/search/test",$e({name:n,baseUrl:a,apiKey:i})),imageKey:()=>ie("/api/image"),putImage:(n,a,i)=>ie("/api/image",$e({revision:n,image:a,...i?{apiKey:i}:{}},"PUT")),imageTest:n=>ie("/api/image/test",$e(n)),changePassword:(n,a)=>ie("/api/password",$e({old:n,new:a})),about:()=>ie("/api/about"),usage:()=>ie("/api/usage"),putUsagePrice:n=>ie("/api/usage/price",$e(n,"PUT")),memory:()=>ie("/api/memory"),putMemory:(n,a)=>ie("/api/memory",$e({revision:n,provider:a},"PUT")),putLore:n=>ie("/api/memory/lore",$e(n,"PUT")),loreTest:n=>ie("/api/memory/lore-test",$e(n)),loreImport:()=>ie("/api/memory/lore/import"),importLore:()=>ie("/api/memory/lore/import",{method:"POST"}),items:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}/items?limit=60${a?`&before=${encodeURIComponent(a)}`:""}`),profile:n=>ie(`/api/assistants/${encodeURIComponent(n)}/profile`),sendMessage:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}/messages`,$e(a)),stopAssistant:n=>ie(`/api/assistants/${encodeURIComponent(n)}/stop`,{method:"POST"}),markRead:n=>ie(`/api/assistants/${encodeURIComponent(n)}/read`,{method:"POST"}),patchAssistant:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),archiveAssistant:n=>ie(`/api/assistants/${encodeURIComponent(n)}/archive`,{method:"POST"}),deleteRule:(n,a)=>ie(`/api/assistants/${encodeURIComponent(n)}/rules/${encodeURIComponent(a)}`,{method:"DELETE"}),retryDelegation:n=>ie(`/api/delegations/${encodeURIComponent(n)}/retry`,{method:"POST"}),answerApproval:(n,a)=>ie(`/api/approvals/${encodeURIComponent(n)}`,$e(a)),createDraft:n=>ie(`/api/drafts/${encodeURIComponent(n)}/create`,{method:"POST"}),dismissDraft:n=>ie(`/api/drafts/${encodeURIComponent(n)}/dismiss`,{method:"POST"}),createRoutine:n=>ie("/api/routines",$e(n)),patchRoutine:(n,a)=>ie(`/api/routines/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteRoutine:n=>ie(`/api/routines/${encodeURIComponent(n)}`,{method:"DELETE"}),runRoutine:n=>ie(`/api/routines/${encodeURIComponent(n)}/run`,{method:"POST"}),replyJob:(n,a)=>ie(`/api/jobs/${encodeURIComponent(n)}/reply`,$e({text:a})),stopJob:n=>ie(`/api/jobs/${encodeURIComponent(n)}/stop`,{method:"POST"}),transcript:n=>ie(`/api/jobs/${encodeURIComponent(n)}/transcript`),jobs:(n={})=>{const a=new URLSearchParams;n.assistantId&&a.set("assistantId",n.assistantId),n.status&&a.set("status",n.status),n.before&&a.set("before",n.before),n.limit&&a.set("limit",String(n.limit));const i=a.toString();return ie(`/api/jobs${i?`?${i}`:""}`)},upload:async n=>{const a=new FormData;a.append("file",n);const i=await ie("/api/uploads",{method:"POST",body:a});if(!i.file?.path)throw new Error("上传响应缺少文件路径");return i.file.path},fileUrl:(n,a)=>`/api/files?path=${encodeURIComponent(n)}${a?.inline?"&inline=1":""}${a?.truncate?"&truncate=1":""}${a?.thumb?"&thumb=1":""}`,fileMeta:n=>ie(`/api/files/meta?path=${encodeURIComponent(n)}`),jobFiles:(n,a)=>ie(`/api/jobs/${encodeURIComponent(n)}/files${a?`?path=${encodeURIComponent(a)}`:""}`),push:()=>ie("/api/push"),subscribePush:(n,a)=>ie("/api/push/subscribe",$e({subscription:n,label:a})).then(i=>i.push),unsubscribePush:n=>ie("/api/push/subscribe",{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})}),testPush:n=>ie("/api/push/test",$e(n?{endpoint:n}:{})),visibility:(n,a)=>ie("/api/visibility",$e({clientId:n,visible:a})),events:({onEvent:n,onReconnect:a,onDown:i},o)=>{const c=new EventSource(`/api/events${o?`?clientId=${encodeURIComponent(o)}`:""}`);let d=!1;const h=m=>{try{n(JSON.parse(m.data))}catch{}};c.onmessage=h;for(const m of ow)c.addEventListener(m,h);return c.onerror=()=>{d=!0,i(c.readyState===EventSource.CLOSED?"实时连接已断开":"实时连接中断,正在重连")},c.onopen=()=>{d&&(d=!1,a())},()=>c.close()}},uw=60;function dw(n,a){return n.at===a.at?0:n.at<a.at?-1:1}function c0(n,a,i=uw){const o=Array.isArray(a)?a:[a];if(!o.length)return n;const c=n.slice(),d=new Map;c.forEach((h,m)=>d.set(h.id,m));for(const h of o){const m=d.get(h.id);m===void 0?(d.set(h.id,c.length),c.push(h)):c[m]=h}return c.sort(dw),c.length>i?c.slice(-i):c}function fw(n,a,i){const o=n.findIndex(h=>h.id===a);if(o<0)return n;const c=n[o];if(c.kind!=="assistant")return n;const d=n.slice();return d[o]={...c,text:c.text+i},d}function u0(n){const a=n[n.length-1];return a?.kind==="assistant"&&!!a.streaming}function hw(n,a){return n.state==="writing"&&!a.seen&&!a.closed&&a.inChat&&n.assistantId===a.assistantId}function mw(n,a){return n.filter(i=>i.assistantId===a&&i.state==="writing")}const pw=900,$a=new Map;function d0(n){for(const a of n)$a.has(a)||$a.set(a,window.setTimeout(()=>$a.delete(a),pw))}function gw(n){return $a.has(n)}function vw(){for(const n of $a.values())window.clearTimeout(n);$a.clear()}function f0(n){const a=n.querySelector(".hov.msg > .u, .hov.msg > .b")??n;a.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",block:"center"}),a.classList.remove("quote-flash"),a.offsetWidth,a.classList.add("quote-flash"),window.setTimeout(()=>a.classList.remove("quote-flash"),1100)}function fn(n,a=180){const[i,o]=k.useState(n);return k.useEffect(()=>{if(n){o(!0);return}const c=window.setTimeout(()=>o(!1),a);return()=>window.clearTimeout(c)},[n,a]),{mounted:i,leaving:i&&!n}}function xw(n,a,i="",o=200){const[c,d]=k.useState([]),[h,m]=k.useState([]),p=k.useRef(null),g=k.useRef(i),v=k.useRef([]),x=k.useRef([]);return k.useEffect(()=>{const E=n.map(a);if(p.current===null||g.current!==i){p.current=new Set(E),g.current=i,v.current=n;return}const T=E.filter(M=>!p.current.has(M)),C=v.current.filter(M=>!E.includes(a(M)));if(p.current=new Set(E),v.current=n,T.length&&(d(M=>[...M,...T]),x.current.push(window.setTimeout(()=>d(M=>M.filter(A=>!T.includes(A))),1e3))),C.length){const M=C.map(A=>({item:A,key:a(A),state:"leave"}));m(A=>[...A,...M]),x.current.push(window.setTimeout(()=>m(A=>A.filter($=>!M.some(O=>O.key===$.key))),o))}},[n,a,i,o]),k.useEffect(()=>{const E=x.current;return()=>{for(const T of E)window.clearTimeout(T)}},[]),[...n.map(E=>{const T=a(E);return{item:E,key:T,state:c.includes(T)?"enter":"still"}}),...h]}function Cc(n){return`pending/${n.id}/${n.name}`}function bw(n){return{kind:"user",id:n.localId,at:n.at,text:n.text,...n.quote?{quote:n.quote}:{},...n.attachments.length?{files:n.attachments.map(a=>a.path??Cc(a))}:{}}}function kw(n,a){if(a.kind!=="user"||n.status!=="sending"||a.text!==n.text)return!1;const i=n.attachments.map(c=>c.path),o=a.files??[];return i.length===o.length&&i.every((c,d)=>c===o[d])}const yw={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"};function Wi(n){const a=n.lastIndexOf(".");return a===-1?!1:n.slice(a).toLowerCase()in yw}function Yi(n){return(n.split("/").pop()??n).replace(/^u-[a-z0-9]{6}-/,"")}function h0(n){const a=/^#k\/(k-[\w-]+)(?:\/(\d+))?$/.exec(n.trim());return a?{entryId:a[1],...a[2]!==void 0?{chunk:Number(a[2])}:{}}:null}function m0(n){return n==="image"||n==="svg"?"image":n==="csv"||n==="json"?"table":n==="html"?"page":n==="markdown"||n==="text"||n==="pdf"||n==="code"||n==="xml"?"document":"other"}const pc=["off","minimal","low","medium","high","xhigh","max"],oc={off:"关闭",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},jw=40;function ww(n,a){return a?/gpt/i.test(n)?pc.slice(0,6):[...pc]:["off"]}function Nw(n,a){return a==="google-generative-ai"||a==="google-vertex"?"high":n}function Sw(n,a,i,o){if(!a)return{levels:["off"],chars:{},map:{}};const c=ww(n,a),d=[],h={},m={};for(const p of pc){const g=i?.[p];if(!(g!==void 0?g!==null:c.includes(p))){m[p]=null;continue}d.push(p);const x=typeof g=="string"?g.trim():"";h[p]=x,x?m[p]=x:(p==="xhigh"||p==="max")&&(m[p]=Nw(p,o))}return{levels:d,chars:h,map:m}}function Tw(n){if(!n||typeof n!="object"||Array.isArray(n))return;const a=n,i={};let o=!1;for(const c of pc){if(!(c in a))continue;o=!0;const d=a[c];if(d===null){i[c]=null;continue}const h=typeof d=="string"?d.trim():"";i[c]=h.length<=jw?h:""}if(o)return i.off===null&&(i.off=""),i}const p0={"readme-chat":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-cards":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"readme-rules":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-desktop":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-page":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-knowledge":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-list":{sel:null,panel:"now",collapsed:!1,dark:!1,mobile:"list"},"readme-question":{sel:"page",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-profile":{sel:"page",panel:"assistant",collapsed:!1,dark:!1,mobile:"chat"},image:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-demo":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-think":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-tool":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"act-home":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},boot:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},bubbles:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"bubbles-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"card-130":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"card-130-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},s1:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},s2:{sel:"bird",panel:"routine:r-daily",collapsed:!1,dark:!1,mobile:"list"},s3:{sel:"page",panel:"assistant",collapsed:!1,dark:!1,mobile:"list"},s4:{sel:"hob",panel:"now",collapsed:!0,dark:!1,mobile:"list"},s6:{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"list"},mlist:{sel:null,panel:"now",collapsed:!1,dark:!1,mobile:"list"},mchat:{sel:"page",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-running":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-waiting":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-done":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"d-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-hob":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"h-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-settings":{sel:"server",panel:"assistant",collapsed:!1,dark:!1,mobile:"chat"},"h-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"}},wn=(()=>{let n=0;return a=>`${a}${++n}`})();function le(n,a,i=0){const o=new Date;return o.setDate(o.getDate()-n),o.setHours(a,i,0,0),o.toISOString()}function J(n){return new Date(Date.now()-n*6e4).toISOString()}function he(n){return JSON.parse(JSON.stringify(n))}const qf=[{id:"claude-sonnet-4-5",provider:"anthropic",input:3200,output:350,cache:.68,weight:1,price:{input:3,output:15,cacheRead:.3,cacheWrite:3.75}},{id:"gpt-5",provider:"openai",input:2900,output:320,cache:.55,weight:.62,price:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{id:"deepseek-chat",provider:"deepseek",input:2100,output:260,cache:.71,weight:.3,price:{input:.28,output:.42,cacheRead:.028,cacheWrite:0}},{id:"glm-4.6",provider:"zhipuai",input:1300,output:150,cache:.4,weight:.12,price:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0}}],Ex=[{id:"hob",name:"Hob",archived:!1,weight:.55,chat:.61},{id:"page",name:"写稿搭子",archived:!1,weight:.3,chat:.22},{id:"ledger",name:"记账管家",archived:!0,weight:.15,chat:.35}];function Cw(n){const a=new Intl.DateTimeFormat("sv-SE",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date),i=Date.parse(`${a}T00:00:00Z`),o=Array.from({length:365},(p,g)=>new Date(i-(364-g)*864e5).toISOString().slice(0,10));let c=7;const d=()=>(c=(c*9301+49297)%233280)/233280,h=qf.reduce((p,g)=>p+g.weight,0),m=[];return o.forEach((p,g)=>{const v=o.length-1-g,x=v>300?0:v>200?.35:v>90?.7:1,w=(new Date(`${p}T00:00:00Z`).getUTCDay()+6)%7>=5;let E=x*(w?.35:1)*(.3+d()*1.1)*520;d()<.12&&(E=0);for(const T of qf)for(const C of Ex)for(const M of["chat","job"]){const A=Math.round(E*T.weight*C.weight*(M==="chat"?C.chat:1-C.chat)/h);if(A<=0)continue;const $=A*T.input,O=Math.round($*T.cache);m.push({day:p,assistantId:C.id,source:M,provider:T.provider,model:T.id,requests:A,input:$-O,output:Math.round(A*T.output),cacheRead:O,cacheWrite:Math.round(($-O)*.15)})}}),{rows:m,assistants:Ex.map(({id:p,name:g,archived:v})=>({id:p,name:g,archived:v}))}}function gc(){const n=new URLSearchParams(globalThis.location?.search??"").get("desktop");return n==="ready"||n==="deployed"||n==="failed"?n:"none"}const Ew={version:"1.7.0",display:{width:1280,height:800},screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}]},Aw={none:{revision:1,url:"",enabled:!1,deployed:!1,tokenConfigured:!1,publicAssistants:[]},ready:{revision:1,url:"http://127.0.0.1:30196",enabled:!0,deployed:!1,tokenConfigured:!0,publicAssistants:[]},deployed:{revision:1,url:"http://desktop:6080",enabled:!0,deployed:!0,tokenConfigured:!0,publicAssistants:[]},failed:{revision:1,url:"http://127.0.0.1:30196",enabled:!0,deployed:!1,tokenConfigured:!0,publicAssistants:[]}},Mw=[{at:J(6),verb:"$",text:"npm run typecheck"},{at:J(5),verb:"读",text:"protocol/src/projection.ts"},{at:J(4),verb:"读",text:"client/src/runtime/store.ts"},{at:J(3),verb:"跑",text:"浏览器 打开 http://localhost:3000/pricing"},{at:J(3),verb:"跑",text:"npm test -w protocol"},{at:J(2),verb:"读",text:"client/src/chat/Transcript.tsx"},{at:J(1),verb:"读",text:"client/src/chat/ToolRow.tsx"}];function zw(n){const a=n==="s1"||n==="s6",i=n==="s4",o=a||n==="mlist",c=!o&&n!=="mchat",d=[{id:"hob",name:"Hob",duty:"主助手",sprite:"hob",primary:!0,pinned:!0,hidden:!1,notify:!0,instructions:"输出用中文短句;编写代码的任务先询问项目目录。",createdAt:le(30,9,0),last:{text:"已交给任务处理,完成后通知你。",at:le(0,10,5)},unread:0,busy:!0},{id:"page",name:"写作",duty:"周报和文章",sprite:"page",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"口语化短句;标题不超过 20 字;配图自行生成;周报每周五提交。",models:{work:{ref:"faux/smart",thinking:"high"},allowed:["faux/smart","faux/vision"]},abilities:{exec:!1,write:!0,image:!0},createdAt:le(30,9,0),last:{text:"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。",at:le(0,10,20)},unread:2,busy:!1},{id:"server",name:"服务器",duty:"线上和机器",sprite:"server",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"清理日志前先查看保留天数的规则。",createdAt:le(28,9,0),last:{text:"凌晨 3 点清理 2.1GB 旧日志",at:le(1,3,5)},unread:0,busy:!1},{id:"bird",name:"行业动态",duty:"每天 6 条行业动态",sprite:"bird",primary:!1,pinned:!1,hidden:!1,notify:!0,instructions:"关注 agent 编排和本地部署,不包含融资新闻。",createdAt:le(7,9,0),splitFrom:{from:"hob",at:le(7,9,0),conversations:8},last:{text:"今天 6 条,挑选了 2 条重点",at:le(0,9,0)},unread:0,busy:!1},{id:"house",name:"家里 NAS",duty:"相册和备份",sprite:"house",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:le(25,9,0),last:{text:"相册备份完成,新增 312 张",at:le(0,7,30)},unread:0,busy:!1},{id:"coin",name:"记账",duty:"账单和预算",sprite:"coin",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:le(24,9,0),last:{text:"10 月账单已整理完成,比上月减少 12%",at:le(1,21,10)},unread:0,busy:!1},{id:"book",name:"读书",duty:"读书笔记",sprite:"book",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:le(20,9,0),last:{text:"本周读书笔记已整理完成",at:le(3,20,0)},unread:0,busy:!1},{id:"leaf",name:"健身",duty:"每周训练",sprite:"leaf",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:le(18,9,0),last:{text:"本周三次训练已记录",at:le(2,19,0)},unread:0,busy:!1}],h=(S,U,Z,oe,ce,ke,Ce,ue,xe)=>({id:S,assistantId:U,title:Z,detail:oe,options:ce,status:ke?"answered":"pending",chosen:ke?Ce:void 0,source:"router",ruleText:xe,createdAt:ue,answeredAt:ke?ue:void 0}),p={"ap-publish":h("ap-publish","page","发到公众号吗?",void 0,he([{key:"A",label:"发布"},{key:"B",label:"暂不发布"},{key:"C",label:"以后同类内容直接发布,无需确认",always:!0}]),c,"C",le(0,7,42),"发公众号"),"ap-split":h("ap-split","hob","是否创建一个专属助手「行业动态」?",a?"这两周你让我查询了 8 次模型和 agent 产品的动态。创建后它会记住你关注的内容,每天早上 9 点提供一份简报。":"这两周你让我查询了 8 次模型和 agent 产品的动态。",[{key:"A",label:"创建专属助手"},{key:"B",label:"暂不创建"}],!o,"A",le(0,10,15))},g={id:"d-bird",assistantId:"hob",status:i?"pending":"created",name:"行业动态",sprite:"bird",duty:"跟踪模型发布、agent 产品和开源项目",dutyLong:"跟踪模型发布、agent 产品和开源项目",routines:[{name:"每日简报",instruction:"挑最值得看的几条,最多 6 条",schedule:"0 9 * * *"}],routinesText:"每天 09:00 简报,最多 6 条;重要发布随时提醒",askFirst:["花钱订阅","替你对外发消息"],instructions:["关心 agent 编排和本地部署","不看融资新闻"],carry:{conversations:8},createdAssistantId:i?void 0:"bird",createdAt:le(0,10,17)},v={id:"t-0931",assistantId:"hob",title:"排查页面卡顿",instruction:"排查页面卡顿的原因,不要修改代码。",status:"running",createdAt:J(6),startedAt:J(6),stats:{reads:14,commands:3,edits:0},cwd:"/srv/example/site",activity:he(Mw)},x={id:"t-rounds",assistantId:"hob",title:"整理项目资料",instruction:"整理项目资料并列出缺失项。",status:"running",createdAt:J(40),startedAt:J(5),stats:{reads:5,commands:2,edits:0},rounds:[{status:"done",startedAt:J(40),endedAt:J(30),durationMs:6e5,summary:"已整理资料清单。",files:["/srv/example/list.md"],followUp:"核对缺失的文档。"},{status:"stuck",startedAt:J(25),endedAt:J(15),durationMs:6e5,summary:"缺少接口文档,暂时无法核对。",followUp:"先根据现有资料继续。"}],activity:[{at:J(35),verb:"读",text:"/srv/example/资料"},{at:J(20),verb:"搜",text:"接口文档"},{at:J(3),verb:"读",text:"/srv/example/项目说明"}]},w={id:"t-0927",assistantId:"server",title:"清理旧日志",instruction:"清理三天前的旧日志,不要影响正在运行的服务。",status:"done",createdAt:le(1,3,0),startedAt:le(1,3,0),endedAt:le(1,3,5),stats:{reads:4,commands:2,edits:0},summary:"已清理 2.1GB 旧日志,服务均正常运行。",cwd:"/srv/example/reports",files:["/srv/example/reports/log-cleanup-1031.md","/srv/example/reports/stats.csv"],activity:[{at:le(1,3,0),verb:"$",text:"du -sh /var/log/*"},{at:le(1,3,1),verb:"读",text:"/var/log/nginx"},{at:le(1,3,3),verb:"跑",text:"find /var/log -mtime +3 -delete"},...Array.from({length:9},(S,U)=>({at:le(1,3,4),verb:"读",text:`/srv/example/reports/src/check-${U}.ts`})),{at:le(1,3,5),verb:"说",text:"已清理 2.1GB,服务均正常运行。"}]},E={id:"t-0929",assistantId:"house",title:"整理相册备份",instruction:"把手机里这个月的照片备份到 NAS,重复的跳过。",status:"done",createdAt:J(58),startedAt:J(58),endedAt:J(51),stats:{reads:6,commands:2,edits:0},summary:"新增 312 张,重复跳过 87 张,占用 4.2GB。",activity:[{at:J(57),verb:"读",text:"/mnt/nas/photos"},{at:J(55),verb:"跑",text:"rsync -a --ignore-existing /sdcard/DCIM /mnt/nas/photos/"},{at:J(51),verb:"说",text:"新增 312 张,占用 4.2GB。"}]},T=[{id:"r-morning",assistantId:"hob",name:"早报",instruction:"汇总昨天交代的事项和今天的重要事项,早上汇报一次。",schedules:["0 8 * * *"],active:!0,createdAt:le(20,21,0),runs:[{jobId:"t-0901",at:le(0,8,0),status:"done"}]},{id:"r-weekly-reminder",assistantId:"hob",name:"周报提醒",instruction:"周五下午提醒查看本周周报。",schedules:["0 17 * * 5"],active:!0,createdAt:le(20,21,2),runs:[]},{id:"r-reconcile",assistantId:"hob",name:"月底对账",instruction:"月末核对账单,列出不一致的项目。",schedules:["0 9 28 * *"],active:!1,createdAt:le(19,10,0),runs:[{jobId:"t-0820",at:le(4,9,0),status:"done"}]},{id:"r-daily",skill:"daily-brief",assistantId:"bird",name:"每日简报",instruction:"挑模型发布、agent 产品和开源项目里最值得看的几条,每条一句话说清为什么重要。最多 6 条,不看融资新闻。",schedules:["0 9 * * *"],active:!0,createdAt:le(7,9,0),runs:[{jobId:"t-0926",at:le(0,9,0),status:"done",durationMs:372e3,tools:95,tokens:198e3},{jobId:"t-0925",at:le(1,9,0),status:"done"},{jobId:"t-0924",at:le(2,9,1),status:"done"},{jobId:"t-0923",at:le(3,9,0),status:"done"}]},{id:"r-weekly-draft",assistantId:"page",name:"周报初稿",instruction:"每周五 17:00 撰写周报初稿,存入草稿箱,完成后通知我。",schedules:["0 17 * * 5"],active:!0,createdAt:le(0,10,21),runs:[]}],C=(S,U,Z,oe)=>({kind:"assistant",id:S,at:U,text:Z,routine:oe}),A=[C("i-h1",le(0,8,0),`早上好。昨晚交代的两件事均已完成:
|
|
51
|
+
|
|
52
|
+
- 写作已将周报初稿存入草稿箱
|
|
53
|
+
- 服务器凌晨 3 点清理了 2.1GB 旧日志`),{kind:"user",id:"i-h3",at:le(0,10,5),text:"页面为什么这么卡?排查一下原因,不要修改代码。"},C("i-h4",le(0,10,5),"已交给任务处理,完成后通知你。"),{kind:"job",id:"i-h5",at:le(0,10,5),jobId:"t-0931"},{kind:"question",id:"i-h6",at:le(0,10,a?9:15),approvalId:"ap-split"},{kind:"job",id:"i-round-1",at:J(40),jobId:"t-rounds",round:0},{kind:"job",id:"i-round-2",at:J(25),jobId:"t-rounds",round:1},{kind:"job",id:"i-round-3",at:J(5),jobId:"t-rounds",round:2}];a||A.push({kind:"user",id:"i-h7",at:le(0,10,16),text:"创建专属助手吧。最多 6 条即可,不要包含融资新闻。"},C("i-h8",le(0,10,17),"草稿如下,需要修改请直接说明:"),{kind:"draft",id:"i-h9",at:le(0,10,17),draftId:"d-bird"});const $=i?A.filter(S=>!["i-h2","i-h3","i-h4","i-h5"].includes(S.id)):A,O=[C("i-p1",le(1,17,5),"周报初稿已完成,存放在草稿箱。"),{kind:"user",id:"i-p2",at:le(1,17,6),text:n==="mchat"?"好,周一发布。":"标题再短一些。"},C("i-p3",le(1,17,8),n==="mchat"?"好的,周一发布时我会再提醒你。":"已改为《这周:Hob 立项》。"),C("i-p4",le(0,7,40),"《Grok Bot 能借鉴什么》已完成,3200 字,包含 4 张配图。"),{kind:"file",id:"i-p5",at:le(0,7,41),path:"/srv/example/notes/Grok Bot 能借鉴什么.md",name:"Grok Bot 能借鉴什么.md",meta:"3200 字 · 4 张图"},{kind:"question",id:"i-p6",at:le(0,7,42),approvalId:"ap-publish"}];n!=="mchat"&&O.push({kind:"note",id:"i-p7",at:le(0,7,43),icon:"rule",text:"已记入写作的规则 · 发布公众号无需确认"},C("i-p8",le(0,7,44),"已发布。[查看文章](https://mp.weixin.qq.com/)"),{kind:"user",id:"i-p9",at:le(0,10,20),text:"以后周报也由你负责,周五下午提供初稿。"},C("i-p10",le(0,10,20),"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。"),{kind:"note",id:"i-p11",at:le(0,10,21),icon:"routine",text:"新增定时任务 · 周报初稿 · 每周五 17:00"});const W=[{kind:"note",id:"i-b0",at:le(7,9,0),icon:"split",text:`${new Date(le(7,9,0)).getMonth()+1}月${new Date(le(7,9,0)).getDate()}日 由 Hob 创建 · 迁移 8 段对话、14 条记忆`},C("i-b1",le(1,9,0),"昨天 5 条,没有特别要紧的。[看全部 5 条](https://example.com/)",{id:"r-daily",name:"每日简报"}),{kind:"job",id:"i-b-job",at:le(0,9,0),jobId:"t-0926"},C("i-b2",le(0,9,0),"今天 6 条,挑选 2 条重点:",{id:"r-daily",name:"每日简报",jobId:"t-0926"}),C("i-b3",le(0,9,0),`1. DeepSeek 公开 Super-agent 设计:路由只分派,任务隔离执行。
|
|
54
|
+
2. xAI 的 Grok Bot:常驻 Bot 加定时任务,结果直接回到对话。
|
|
55
|
+
|
|
56
|
+
[看全部 6 条](https://example.com/)`),{kind:"user",id:"i-b4",at:le(0,9,12),text:"这个和 Hob 相比,差异在哪里?",quote:{itemId:"i-b3",text:"xAI 的 Grok Bot:常驻 Bot 加定时任务…"}},C("i-b5",le(0,9,12),"它的 Bot 有一台云电脑,能直接操作网页;Bot 之间也能互相发消息。定时任务、审批、助手创建,我们均已具备。"),{kind:"user",id:"i-b6",at:le(0,9,14),text:"以后不需要包含融资新闻。"},C("i-b7",le(0,9,14),"好的,已记录。"),{kind:"note",id:"i-b8",at:le(0,9,14),icon:"memory",text:"记忆已更新 · 不包含融资新闻,优先关注人工智能产品和模型的重要更新与实际应用"},{kind:"note",id:"i-b8-en",at:le(0,9,14),icon:"memory",text:"记忆已更新 · Follow important AI product and model updates, focusing on practical applications."},{kind:"note",id:"i-b9",at:le(0,9,15),icon:"skill",text:"已沉淀技能「每日行业简报」,以后定时执行按它做",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md"}],ee=(S,U,Z,oe)=>[C(`${S}-1`,le(1,20,0),U),{kind:"user",id:`${S}-2`,at:le(1,20,2),text:Z},C(`${S}-3`,le(1,20,3),oe)],I={hob:$,page:O,bird:W,server:[...ee("i-s","凌晨清理日志的任务已完成,清理 2.1GB,服务均正常运行。","好的,以后每月清理一次。","已记录:每月 1 号凌晨 3 点清理一次。"),{kind:"job",id:"i-s4",at:le(1,3,5),jobId:"t-0927"}],house:ee("i-ho","相册备份已完成,新增 312 张,占用 4.2GB。","硬盘还剩多少?","剩余 1.8TB,可用约半年。"),coin:ee("i-c","10 月账单已整理完成,比上月减少 12%。","哪一类支出较多?","餐饮和打车,比上月增加 800。"),book:ee("i-bk","本周读书笔记已整理完成,共三条。","发给我看看。","已放入文件中。"),leaf:ee("i-lf","本周三次训练已记录。","下周增加到四次。","好的,下周安排四次。")};n==="image"&&(I.hob=[{kind:"user",id:"image-user",at:J(3),text:"画几张图片给我看看。"},{kind:"image",id:"image-done",at:J(3),startedAt:J(3),prompt:"海边的日落",size:"1536x1024",status:"done",path:"/mock/photo.jpg"},{kind:"image",id:"image-failed",at:J(2),startedAt:J(2),prompt:"山间的早晨",status:"failed",error:"图像服务暂时不可用,请稍后重试。"},{kind:"image",id:"image-pending",at:J(1),startedAt:J(1),prompt:"安静的街道",status:"pending"}]),(n==="bubbles"||n==="bubbles-dark")&&(I.hob=[{kind:"user",id:"bubble-user",at:J(3),text:"给我看看公式、代码和媒体。"},C("bubble-text",J(2),"行内公式 $E=mc^2$,整行公式:\n\n$$\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}$$\n\n```js\nconst answer = 42;\n```\n\n```sh\necho hello\n```\n\n价格是 $5 和 $10。"),C("bubble-md",J(2),"我把刚才的示意图整理成 `.md` 文件,图用 Mermaid 写,方便你看源码或直接预览。"),{kind:"job",id:"bubble-job",at:J(2),jobId:"t-0927"},{kind:"file",id:"bubble-file",at:J(2),path:"/mock/火星日落示意图.md",name:"火星日落示意图.md",meta:"349 字"},C("bubble-after-file",J(2),"《火星日落示意图.md》已发给你。直接打开能看 Markdown 源码,用支持 Mermaid 的预览器可以看到光路图。"),{kind:"file",id:"bubble-page",at:J(2),path:"/mock/sunset.html",name:"如果在地球和火星同时看日落",meta:"两幅同视角示意图:看太阳周围,再看远离太阳的天空。"},C("bubble-list",J(2),`五个模块:
|
|
57
|
+
|
|
58
|
+
1. **两层架构。** Router 长期在线,只负责人机交互、全局协调和派发,**故意不执行任务,甚至可以没有 Bash 工具**;Worker 上下文隔离,**但从不直接对人说话**,只向 Router 报告。
|
|
59
|
+
2. **全双工。** 把同步 \`run()\` 换成异步 \`start()\` / \`stop()\`,立刻回一句"已开始"。
|
|
60
|
+
- 工具跑完再作为新事件送回来
|
|
61
|
+
- **这个机制默认没开。**
|
|
62
|
+
3. 普通的一行
|
|
63
|
+
4. 第四
|
|
64
|
+
5. 第五
|
|
65
|
+
6. 第六
|
|
66
|
+
7. 第七
|
|
67
|
+
8. 第八
|
|
68
|
+
9. 第九
|
|
69
|
+
10. 第十项,两位数的序号也要对齐`),{kind:"file",id:"bubble-audio",at:J(1),path:"/mock/audio.mp3",name:"语音样本.mp3"},{kind:"file",id:"bubble-video",at:J(1),path:"/mock/video.mp4",name:"视频样本.mp4"},{kind:"user",id:"bubble-photo",at:J(1),text:"这个是什么",files:["/mock/photo.jpg"]},{kind:"user",id:"bubble-photo-only",at:J(1),text:"",files:["/mock/photo2.jpg"]},{kind:"user",id:"bubble-photos",at:J(1),text:"两张对比一下",files:["/mock/photo.jpg","/mock/photo2.jpg"]},{kind:"user",id:"bubble-user-file",at:J(1),text:"帮我看看这份报告",files:["/mock/u-k2m9xq-季度报告.pdf"]},{kind:"user",id:"bubble-user-2",at:J(1),text:"画个简单的表格给我,有几种方式?"},C("bubble-table",J(0),`主要有四种:
|
|
70
|
+
|
|
71
|
+
| 方式 | 适合什么情况 | 能不能改 |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| 聊天里直接画 | 简单的表,看一眼就行 | 让我重画 |
|
|
74
|
+
| 发 Excel 或 CSV 文件 | 要下载、自己改或者算 | 能 |
|
|
75
|
+
| 做成页面 | 能排序、筛选,以后还要更新 | 能 |
|
|
76
|
+
| 做成图片 | 要转发给别人或者发朋友圈 | 不能 |
|
|
77
|
+
|
|
78
|
+
想要哪种?告诉我放什么内容。`)]);const j={},y={"t-0931":v,"t-rounds":x,"t-0927":w,"t-0929":E,"t-0926":{id:"t-0926",assistantId:"bird",title:"每日简报",instruction:"整理每日简报",status:"done",createdAt:le(0,8,54),startedAt:le(0,8,54),endedAt:le(0,9,0),durationMs:372e3,stats:{reads:30,commands:60,edits:5},usage:{input:18e4,output:18e3,cost:0},routineId:"r-daily",summary:"今天 6 条,挑选 2 条重点。",activity:[]}};if((n==="s1"||n==="s6")&&(j["dg-sidebar-running"]={id:"dg-sidebar-running",from:"hob",to:"page",text:"整理文章。",createdAt:J(6),status:"running",jobIds:[]},j["dg-sidebar-waiting"]={id:"dg-sidebar-waiting",from:"hob",to:"server",text:"检查服务器。",createdAt:J(5),status:"waiting",jobIds:[]},I.hob.push({kind:"delegation",id:"sidebar-running",at:J(6),delegationId:"dg-sidebar-running"},{kind:"delegation",id:"sidebar-waiting",at:J(5),delegationId:"dg-sidebar-waiting"})),n.startsWith("d-")){const S=n==="d-waiting"||n==="d-mobile"?"waiting":n==="d-done"?"done":"running",U={id:"dg-demo",from:"hob",to:"server",text:"检查服务器磁盘和服务状态,清理前先确认,不要影响正在运行的服务。",createdAt:J(6),status:S,jobIds:["t-delegated"],approvalIds:[]};j[U.id]=U,y["t-delegated"]={...v,id:"t-delegated",assistantId:"server",delegationId:U.id,title:"检查服务器状态",status:S==="waiting"?"waiting":S},S==="waiting"&&(p["ap-delegation"]={id:"ap-delegation",assistantId:"server",title:"清理旧日志吗?",detail:"将清理七天前的日志。",options:[{key:"A",label:"清理旧日志"},{key:"B",label:"暂不清理"}],status:"pending",source:"job",jobId:"t-delegated",createdAt:J(2)}),I.hob=[{kind:"user",id:"d-user",at:J(7),text:"检查一下服务器的磁盘和服务状态。"},{kind:"delegation",id:"d-card",at:J(6),delegationId:U.id}],I.server=[{kind:"user",id:"d-forward",at:J(6),text:U.text,from:{assistantId:"hob",name:"Hob",delegationId:U.id}},{kind:"job",id:"d-job",at:J(5),jobId:"t-delegated"},...S==="waiting"?[{kind:"question",id:"d-question",at:J(2),approvalId:"ap-delegation"}]:[]]}if(n.startsWith("h-")){const S=d.find(U=>U.id==="server");S&&(S.dutyLong="维护服务器、监控服务状态和磁盘空间;代理配置由其他助手负责。"),j["dg-returned"]={id:"dg-returned",from:"hob",to:"server",text:"检查代理节点为什么无法连接。",createdAt:J(4),status:"returned",reply:"退回:代理配置不属于服务器维护职责。",jobIds:[]},I.hob=[{kind:"user",id:"h-forward",at:J(8),text:"检查代理节点为什么无法连接。",from:{assistantId:"server",name:"服务器",delegationId:"hb-demo"}},{kind:"delegation",id:"h-card",at:J(4),delegationId:"dg-returned"}],I.server=[{kind:"user",id:"h-user",at:J(9),text:"检查代理节点为什么无法连接。"},{kind:"note",id:"h-note",at:J(8),icon:"info",text:"已交回 Hob:代理配置不属于我的职责。",handbackId:"hb-demo"},{kind:"user",id:"h-delegation-forward",at:J(4),text:"检查代理节点为什么无法连接。",from:{assistantId:"hob",name:"Hob",delegationId:"dg-returned"}}]}if(n.startsWith("act-")){const S=d.find(U=>U.id==="hob");S.busy=!0,S.activity=n==="act-think"||n==="act-demo"?{state:"thinking",label:"正在想…"}:{state:"tool",label:"搜索:最新 AI 动态"},I.hob=[{kind:"user",id:"act-user",at:J(1),text:"帮我搜索最新 AI 动态。"}],n==="act-home"&&(d.find(U=>U.id==="page").busy=!0)}if(n.startsWith("readme-")){const S=d.find(ce=>ce.id==="page");S.instructions="周报发到团队群;素材在共享盘的周报文件夹。",S.models={work:{ref:"anthropic/claude-sonnet",thinking:"high"},allowed:["anthropic/claude-sonnet","openai/gpt-5"]},S.last={text:"周报已整理好,发送前请确认。",at:J(2)};const U=d.find(ce=>ce.id==="hob");U.busy=!1,U.instructions="",U.last={text:"整理好了,适合用共享文档协作。",at:J(1)},d.splice(0,d.length,...d.filter(ce=>["hob","page","bird","coin"].includes(ce.id)));const Z={id:"readme-job",assistantId:"hob",title:"比较团队知识整理方案",instruction:"比较团队资料的整理方式。",status:"done",createdAt:J(8),startedAt:J(8),endedAt:J(2),durationMs:36e4,stats:{reads:3,commands:1,edits:0},summary:"已比较三种方案并整理建议。",activity:[{at:J(7),verb:"读",text:"团队资料/需求.md"},{at:J(6),verb:"搜",text:"团队知识整理方案"},{at:J(4),verb:"读",text:"团队资料/现有流程.md"},{at:J(2),verb:"说",text:"已完成三种方案的比较。"}]},oe={...Z,id:"readme-active",assistantId:"bird",title:"整理行业动态",status:"running",endedAt:void 0,durationMs:void 0,createdAt:J(4),startedAt:J(4),activity:[{at:J(1),verb:"搜",text:"本周行业动态"}]};for(const ce of Object.keys(y))delete y[ce];y[Z.id]=Z,y["readme-weekly"]={id:"readme-weekly",assistantId:"page",title:"整理本周周报",instruction:"整理本周周报初稿。",status:"done",createdAt:J(5),startedAt:J(5),endedAt:J(3),durationMs:12e4,stats:{reads:3,commands:0,edits:1},summary:"已整理周报初稿,等待确认后发送。",activity:[{at:J(4),verb:"读",text:"周报/本周素材.md"},{at:J(3),verb:"说",text:"周报初稿已整理。"}]},n==="readme-list"&&(y[oe.id]=oe),n==="readme-chat"&&(y["readme-active"]={...oe,assistantId:"hob",title:"整理实施清单",instruction:"整理团队资料的实施清单。",activity:[{at:J(1),verb:"读",text:"团队资料/需求.md"}]});for(const ce of Object.keys(p))delete p[ce];p["readme-approval"]={id:"readme-approval",assistantId:"page",title:"将周报发到团队群吗?",detail:"周报初稿已整理好,发送前请确认。",options:[{key:"A",label:"发送"},{key:"B",label:"暂不发送"}],status:"pending",source:"router",createdAt:J(1)},I.hob=[{kind:"user",id:"readme-user",at:J(9),text:"我们团队的资料有点散,比较几种整理方案,给我一个建议。"},C("readme-reply",J(8),"我会比较几种方式,整理成一页给你。"),{kind:"job",id:"readme-job-card",at:J(8),jobId:Z.id},C("readme-result",J(1),"建议先用共享文档统一入口,现有资料不用搬家;下面是三种方案的比较。"),{kind:"file",id:"readme-page-card",at:J(1),path:"/mock/readme-page.html",name:"团队资料整理方案",meta:"三种方式的对比与实施建议"}],n==="readme-desktop"&&(I.hob=[{kind:"user",id:"readme-browser-user",at:J(3),text:"打开示例网站,发一张截图给我看看。"},C("readme-browser-reply",J(2),"已在浏览器中打开示例网站,这是当前页面的截图。"),{kind:"file",id:"readme-browser-shot",at:J(1),path:"/mock/desktop.jpg",name:"网页截图.jpg"}]),n==="readme-chat"&&(p["readme-chat-approval"]={id:"readme-chat-approval",assistantId:"hob",title:"将方案发给团队吗?",options:[{key:"A",label:"发送"},{key:"B",label:"暂不发送"}],status:"pending",source:"router",createdAt:J(1)},I.hob=[{kind:"user",id:"readme-user",at:J(9),text:"比较团队资料的整理方式,给我一个建议和实施清单。"},{kind:"job",id:"readme-job-card",at:J(8),jobId:Z.id},C("readme-result",J(3),`建议先用**共享文档**统一入口,现有资料不用搬家。
|
|
79
|
+
|
|
80
|
+
- 先建立目录,明确负责人
|
|
81
|
+
- 再逐步整理高频使用的资料`),{kind:"file",id:"readme-page-card",at:J(3),path:"/mock/readme-page.html",name:"团队资料整理方案",meta:"三种方式的对比与实施建议"},{kind:"file",id:"readme-file-card",at:J(2),path:"/mock/knowledge/资料目录.md",name:"资料目录.md",meta:"团队常用资料入口"},{kind:"job",id:"readme-active-card",at:J(2),jobId:"readme-active"},{kind:"question",id:"readme-chat-question",at:J(1),approvalId:"readme-chat-approval"}]),n==="readme-cards"&&(Object.assign(g,{status:"pending",createdAssistantId:void 0,name:"资料助手",dutyLong:"整理团队资料,维护共享目录",routinesText:"每周整理资料",askFirst:["对外发送"],instructions:["优先整理常用资料"],carry:{conversations:3}}),j["readme-delegation"]={id:"readme-delegation",from:"hob",to:"page",text:"整理团队资料的使用说明。",createdAt:J(3),status:"running",jobIds:[]},I.hob=[{kind:"image",id:"readme-image",at:J(4),startedAt:J(4),status:"done",prompt:"团队资料封面",size:"1536x1024",path:"/mock/readme-cover.svg"},{kind:"delegation",id:"readme-delegation-card",at:J(3),delegationId:"readme-delegation"},{kind:"draft",id:"readme-draft-card",at:J(2),draftId:g.id},{kind:"note",id:"readme-note",at:J(1),icon:"memory",text:"记忆已更新 · 优先整理常用资料"}]),I.page=[{kind:"user",id:"readme-weekly-user",at:J(5),text:"整理本周周报,完成后发到团队群。"},{kind:"job",id:"readme-weekly-card",at:J(5),jobId:"readme-weekly"},C("readme-weekly-reply",J(3),"周报初稿已整理好。对外发送前,请先确认。"),{kind:"question",id:"readme-question-card",at:J(1),approvalId:"readme-approval"}]}if(n==="card-130"||n==="card-130-dark"){const S=(Z,oe,ce)=>({id:Z,assistantId:"hob",title:oe,instruction:oe,status:"done",createdAt:J(50),startedAt:J(50),endedAt:J(40),durationMs:6e5,stats:{reads:4,commands:2,edits:0},activity:[],...ce}),U=[S("t-130-stop","整理项目资料",{status:"stopped",statusReason:"你叫停了",summary:"整理到一半停下了。"}),S("t-130-stuck","核对接口文档",{status:"stuck",statusReason:"沙箱里没有网络,装不上依赖,换镜像也一样;接口文档在共享盘里也没找到,问了两个同事都说不知道放在哪里,先把已经核对过的部分记下来,等你处理网络和文档之后再继续。"}),S("t-130-running","写周报初稿",{sediment:{status:"running"}}),S("t-130-saved","整理行业动态",{sediment:{status:"saved",name:"daily-brief",title:"每日行业简报",version:1,updated:!1}}),S("t-130-updated","对比团队资料方案",{sediment:{status:"saved",name:"daily-brief",title:"每日行业简报",version:3,updated:!0}}),S("t-130-failed","清理旧日志",{sediment:{status:"failed",reason:"技能目录不可写"}}),S("t-130-empty","备份相册",{sediment:{status:"empty",reason:"一次性的事情"}})];for(const Z of U)y[Z.id]=Z;I.hob=[{kind:"user",id:"c-130-user",at:J(60),text:"看看任务卡现在的样子。"},...U.map((Z,oe)=>({kind:"job",id:`c-130-${oe}`,at:Z.endedAt??Z.createdAt,jobId:Z.id}))]}return{assistants:d,items:I,jobs:y,delegations:j,approvals:p,drafts:{"d-bird":g},routines:n.startsWith("readme-")?T.filter(S=>S.id==="r-weekly-draft"||S.id==="r-daily"):T,assistantSkills:{bird:[{name:"daily-brief",title:"每日行业简报",description:"整理值得关注的行业动态。",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md",version:2,createdAt:le(7,9),updatedAt:le(1,9),uses:3,lastUsedAt:le(0,9),enabled:!0},{name:"release-watch",title:"重要发布追踪",description:"追踪模型和产品的重要发布。",path:"/mock/assistants/bird/skills/release-watch/SKILL.md",version:1,createdAt:le(2,9),updatedAt:le(2,9),uses:0,enabled:!0}]},rules:{hob:[{id:"rule-1",text:"花钱",mode:"ask",changedAt:le(10,9,0)},{id:"rule-2",text:"改线上服务",mode:"ask",changedAt:le(10,9,0)},{id:"rule-3",text:"清理我的文件",mode:"ask",changedAt:le(3,9,0)}],page:n.startsWith("readme-")?[{id:"readme-rule",text:"向团队群发送周报",mode:"ask",changedAt:le(9,9)}]:[{id:"rule-4",text:"删除草稿",mode:"ask",changedAt:le(9,9,0)},{id:"rule-5",text:"花钱",mode:"ask",changedAt:le(9,9,0)},{id:"rule-6",text:"发公众号",mode:"allow",changedAt:J(120)}],bird:[{id:"rule-7",text:"花钱订阅",mode:"ask",changedAt:le(7,9,0)}]},worklog:{hob:[{at:le(0,10,5),text:"任务已完成:排查页面卡顿",jobId:"t-0931"},{at:le(0,8,2),text:"转述写作的审批:发布公众号"},{at:le(0,8,0),text:"早报:两件事均已完成"}],page:[{at:le(0,10,21),text:"新增定时任务:周报初稿",jobId:"r-weekly-draft"},{at:le(0,7,44),text:"发布的文章:Grok Bot 能借鉴什么"},{at:le(0,7,40),text:"完成《Grok Bot 能借鉴什么》,3200 字"},{at:le(1,17,8),text:"周报初稿修改标题"}],bird:[{at:le(0,9,0),text:"每日简报:今天 6 条",jobId:"t-0926"},{at:le(1,9,0),text:"每日简报:昨天 5 条",jobId:"t-0925"}],server:[{at:le(1,3,5),text:"任务已完成:清理旧日志",jobId:"t-0927"}],house:[{at:le(0,7,30),text:"相册备份:新增 312 张"}],coin:[{at:le(1,21,10),text:"10 月账单已整理"}],book:[],leaf:[]},settings:{revision:1,settings:{general:{theme:n==="d-dark"||n==="h-dark"||n==="act-dark"||n==="readme-dark"||n==="card-130-dark"?"dark":"system",timezone:"Asia/Tokyo",aboutYou:{name:"小林",language:"中文",notes:""}},providers:[{kind:"builtin",id:"anthropic"},{kind:"custom",id:"my-proxy",name:"我的代理",api:"openai-completions",baseUrl:"http://127.0.0.1:8080/v1",models:[{id:"gpt-x",name:"GPT X",input:["text","image"],reasoning:!0,contextWindow:2e5}]}],models:n.startsWith("readme-")?{roster:[{ref:"openai/gpt-5",note:"日常对话",thinking:"low"},{ref:"anthropic/claude-sonnet",note:"整理资料",thinking:"high"}],conversation:{ref:"openai/gpt-5",thinking:"low"},work:{ref:"anthropic/claude-sonnet",thinking:"high"}}:{roster:[{ref:"faux/fast",note:"响应快、成本低,适合日常对话",thinking:"low"},{ref:"faux/smart",note:"能力最强但速度较慢,适合复杂问题",thinking:"high"},{ref:"faux/vision",note:"支持图像输入,适合截图和图片",thinking:"medium"}],conversation:{ref:"faux/fast",thinking:"low"},work:{ref:"faux/smart",thinking:"high"}},image:{source:"off"},search:[{name:"searxng",enabled:!0,baseUrl:"http://127.0.0.1:8888"},{name:"exa",enabled:!0},...o0().filter(S=>S.name!=="searxng"&&S.name!=="exa")],work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}}}}}const xf={models:[{ref:"faux/fast",provider:"faux",id:"fast",name:"Faux Fast",reasoning:!1,thinkingLevels:["off"],input:["text"],contextWindow:128e3,maxTokens:8192,cost:{input:.1,output:.4}},{ref:"faux/smart",provider:"faux",id:"smart",name:"Faux Smart",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh","max"],input:["text"],contextWindow:4e5,maxTokens:32e3,cost:{input:3,output:15}},{ref:"faux/vision",provider:"faux",id:"vision",name:"Faux Vision",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh"],input:["text","image"],contextWindow:2e5,maxTokens:16e3,cost:{input:2,output:8}},{ref:"faux/tiny",provider:"faux",id:"tiny",name:"Faux Tiny",reasoning:!1,thinkingLevels:["off"],input:["text"],contextWindow:64e3,maxTokens:4096,cost:{input:.05,output:.2}},{ref:"sample/deep",provider:"sample",id:"deep",name:"Sample Deep",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh","max"],input:["text","image"],contextWindow:1e6,maxTokens:64e3,cost:{input:8,output:40}}],roster:[]},Ax={keyConfigured:!0},Rw=[{id:"anthropic",name:"Anthropic"},{id:"openai",name:"OpenAI"},{id:"google",name:"Google"},{id:"deepseek",name:"DeepSeek"},{id:"openrouter",name:"OpenRouter"}],Ow={anthropic:[{id:"claude-x",name:"Claude X",reasoning:!0},{id:"claude-x-haiku",name:"Claude X Haiku",reasoning:!1}],openai:[{id:"gpt-6-astra",name:"GPT-6 Astra",reasoning:!0}]};function bf(n,a){return(n.kind==="custom"?n.models.map(o=>({id:o.id,name:o.name?.trim()||o.id,reasoning:o.reasoning===!0})):Ow[n.id]??[]).map(o=>{const c=`${n.id}/${o.id}`,d=a?.[c],h=Sw(o.id,o.reasoning,d,n.kind==="custom"?n.api:void 0);return{ref:c,id:o.id,name:o.name,reasoning:o.reasoning,levels:h.levels.map(m=>({level:m,text:h.chars[m]??""})),custom:d!==void 0}})}const _w="/Users/me/.pi/agent",Dw="/Users/me/.lore",$w=[{id:"anthropic",kind:"builtin",models:12,key:"literal",exists:!0,selectable:!0},{id:"my-proxy",kind:"custom",api:"openai-completions",baseUrl:"https://proxy.example/v1",models:4,key:"literal",exists:!1,selectable:!0},{id:"cmd-proxy",kind:"custom",api:"anthropic-messages",baseUrl:"http://127.0.0.1:8080",models:2,key:"command",exists:!1,selectable:!0,note:"Key 需通过命令获取,请导入后手动填写。"},{id:"work-laptop",kind:"builtin",models:6,key:"none",exists:!1,selectable:!1,note:"登录授权类凭据无法导入。"}],Uw={anthropic:{kind:"builtin",id:"anthropic"},"my-proxy":{kind:"custom",id:"my-proxy",name:"my-proxy",api:"openai-completions",baseUrl:"https://proxy.example/v1",models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini"}]},"cmd-proxy":{kind:"custom",id:"cmd-proxy",name:"cmd-proxy",api:"anthropic-messages",baseUrl:"http://127.0.0.1:8080",models:[{id:"claude-x"}]}},Mx=new Map,kf={servers:[{name:"filesystem",valid:!0,kind:"stdio",enabled:!0,exposure:"direct",command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","."],description:"读写指定目录的文件"},{name:"docs",valid:!0,kind:"http",enabled:!1,exposure:"deferred",url:"https://example.com/mcp",headers:{Authorization:{redacted:!0}}}]};function Lw(n="s1"){const a=zw(n);let i=n.startsWith("readme-")?[...["删除或覆盖文件、数据和备份","对外发送(消息、邮件、发布)、付费、充值、改计费","停止或重启别人正在使用的服务和设备","修改可能让你失去远程访问的设置(网络、防火墙、登录方式)"].map((j,y)=>({id:`ask-${y}`,text:j,mode:"ask",changedAt:le(10,9)})),...["过去的记录是线索不是现状:动手前先核实实际状态。","改配置、改数据前先留好退路(备份或记下原值);改完用实际效果验证,不只看命令返回。","凭据(密码、密钥、令牌、Cookie)只在用的时候读取,不回显,不写进文件和报告,也不存起来。"].map((j,y)=>({id:`allow-${y}`,text:j,mode:"allow",changedAt:le(10,9)}))]:[];new URLSearchParams(globalThis.location?.search??"").has("citation")&&(a.items.hob??=[]).push({kind:"assistant",id:"mock-citation",at:new Date().toISOString(),text:"这里是资料里的结论:[工作记录.md](#k/k-2/0)。"});let o=[{id:"kc-1",name:"工作资料",createdAt:J(1e3),count:0},{id:"kc-2",name:"灵感收藏",createdAt:J(900),count:0}],c=["项目封面.png","产品设计页面.html","工作记录.md","数据汇总.csv","参考文档.pdf","插画.png","会议纪要.md","网站方案.html","预算表.csv","资料.txt","附件.json","录音.mp3"].map((j,y)=>({id:`k-${y}`,origin:y%3===0?"chat":y%3===1?"output":"upload",name:j,description:`项目资料 · ${j},记录设计与工作进展。`,kind:j.endsWith(".png")?"image":j.endsWith(".html")?"html":j.endsWith(".csv")?"csv":j.endsWith(".pdf")?"pdf":j.endsWith(".json")?"json":j.endsWith(".mp3")?"audio":"markdown",path:`/mock/knowledge/${j}`,hash:`hash-${y}`,size:2048+y*1e3,createdAt:J(y<6?y*60:336*60+y),updatedAt:J(y<6?y*60:336*60+y),source:{assistantId:"hob",itemId:n==="bubbles"||n==="bubbles-dark"?["bubble-file","bubble-page","bubble-audio","bubble-video","bubble-job"][y%5]:n==="image"?"image-done":a.items.hob?.[0]?.id},collections:y%2?["kc-1"]:["kc-2"]}));const d=["queued","indexing","ready","failed","unsupported"];c.forEach((j,y)=>{j.index={state:d[y%d.length],...y%d.length===3?{error:"无法读取文件"}:{}}}),n==="readme-knowledge"&&(o=[{id:"kc-1",name:"工作资料",createdAt:J(1e3),count:0}],c=[{name:"团队资料整理方案.html",description:"比较共享文档、知识库和文件夹的适用场景。",kind:"html"},{name:"周报进度表.csv",description:"汇总本周各项工作、负责人和进度。",kind:"csv"},{name:"团队活动封面.png",description:"团队活动通知使用的封面图片。",kind:"image"},{name:"项目会议纪要.md",description:"记录项目讨论的决定与后续安排。",kind:"markdown"},{name:"资料目录.md",description:"收录团队常用资料及其访问入口。",kind:"markdown"}].map((y,S)=>({...y,id:`readme-k-${S}`,origin:S===2?"upload":"output",path:`/mock/knowledge/${y.name}`,hash:`readme-hash-${S}`,size:2048+S*1e3,createdAt:J(S*60),updatedAt:J(S*60),source:{assistantId:"hob"},collections:["kc-1"],index:{state:"ready",chunks:1}})));const h=a.assistants.find(j=>j.id==="hob");h&&(h.knowledge=["kc-1"]);let m=!1;const p=new Set,g=j=>p.forEach(y=>y(j)),v=j=>a.assistants.find(y=>y.id===j),x=new Set(["anthropic","my-proxy"]);let w=he(Aw[gc()]);const E=()=>({providers:a.settings.settings.providers.map(j=>({...j,keyConfigured:x.has(j.id)})),builtin:he(Rw),settings:he(a.settings),models:Object.fromEntries(a.settings.settings.providers.map(j=>[j.id,bf(j,a.settings.settings.models.thinking)]))}),T={revision:a.settings.revision,provider:"local",providerExplicit:!1,lorePlugin:"1.12.5",lore:{configured:!1,baseUrl:null,source:"none",tokenConfigured:!1}},C=[{endpoint:"https://push.example/mock-iphone",label:"iPhone",createdAt:new Date(Date.now()-3*864e5).toISOString()}],M=()=>({publicKey:"BOmockVapidPublicKeyForPreviewOnly",email:a.settings.settings.push.email,devices:he(C)}),A=j=>{const y=[];return j.activity.forEach((S,U)=>{if(S.verb==="$")return;const Z=S.text.match(/^浏览器 打开 (\S+)$/),oe=Z?"browser_open":S.verb==="读"?"read":S.verb==="跑"?"bash":S.verb==="改"?"edit":S.verb==="说"?"report":"ls";y.push({id:`mock-${j.id}-${U}`,kind:"tool",at:S.at,name:oe,title:oe==="report"?"提交结果":`${S.verb} ${S.text}`,args:Z?{url:Z[1]}:oe==="bash"?{command:S.text}:oe==="report"?{outcome:"done",summary:S.text}:{path:S.text},output:oe==="report"?"结果已记录。":Z?"已打开页面。":`${S.text}
|
|
82
|
+
`,durationMs:120})}),j.id==="t-0931"&&y.push({id:"mock-search",kind:"tool",at:j.createdAt,name:"web_search",title:"联网搜索:浏览器页面性能优化",args:{query:"浏览器页面性能优化"},output:"演示结果:网页性能优化指南。",durationMs:120}),y};function $(j,y){const S=v(j);S&&(Object.assign(S,y),g({type:"assistant",assistant:he(S)}))}function O(j,y){const S=a.items[j]??=[],U=S.findIndex(Z=>Z.id===y.id);U>=0?S[U]=y:S.push(y),g({type:"item",assistantId:j,item:y})}function W(j,y){$(j,{last:{text:y,at:new Date().toISOString()}})}const ee=()=>{const j=a.settings.settings.usage?.prices??{},y={};for(const S of qf){const U=j[S.id];y[S.id]=U?{price:U,custom:!0,default:S.price}:{price:S.price,custom:!1}}return{updatedAt:J(90),error:null,models:y}};let I;return{usage:async()=>{const j=a.settings.settings.general.timezone;return I?.timezone!==j&&(I={timezone:j,...Cw(j)}),{timezone:j,rows:I.rows,assistants:I.assistants,prices:ee()}},putUsagePrice:async j=>{if(j.revision!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");const y={...a.settings.settings.usage?.prices??{}};return j.price?y[j.model]=j.price:delete y[j.model],a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,...Object.keys(y).length?{usage:{prices:y}}:{usage:void 0}}},{settings:he(a.settings),price:ee().models[j.model]??null}},knowledge:async(j={})=>{const y=j.q?.toLowerCase(),S=c.filter(Z=>(!j.origin||Z.origin===j.origin)&&(!j.collection||Z.collections.includes(j.collection))&&(!j.kind||m0(Z.kind)===j.kind)&&(!j.assistantId||Z.source?.assistantId===j.assistantId)&&(!j.before||Z.updatedAt<j.before)&&(!y||`${Z.name} ${Z.description}`.toLowerCase().includes(y))),U=j.limit??50;return{entries:he(S.slice(0,U).map(Z=>y?{...Z,snippet:Z.description??Z.name}:Z)),hasMore:S.length>U,collections:he(o.map(Z=>({...Z,count:c.filter(oe=>oe.collections.includes(Z.id)).length,indexed:c.filter(oe=>oe.collections.includes(Z.id)&&oe.index?.state==="ready").length,failed:c.filter(oe=>oe.collections.includes(Z.id)&&oe.index?.state==="failed").length,unsupported:c.filter(oe=>oe.collections.includes(Z.id)&&oe.index?.state==="unsupported").length})))}},knowledgeEntry:async(j,y)=>{const S=c.find(U=>U.id===j);if(!S)throw new Ue(404,"文件不存在");return{entry:he(S),...y!==void 0?{chunk:{index:y,heading:S.name,text:"模拟模式中的项目资料。"}}:{}}},reindexKnowledge:async j=>{if(!o.some(y=>y.id===j))throw new Ue(404,"知识库不存在");return c.filter(y=>y.collections.includes(j)&&y.index?.state==="failed").forEach(y=>{y.index={state:"queued"}}),g({type:"knowledge"}),{ok:!0}},embeddingKey:async()=>({keyConfigured:m}),putEmbedding:async(j,y,S)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改");return a.settings={revision:j+1,settings:{...a.settings.settings,knowledge:{embedding:y}}},S&&(m=!0),{settings:he(a.settings),keyConfigured:m}},embeddingTest:async()=>({ok:!0,dims:1024}),createKnowledgeCollection:async j=>{const y={id:`kc-${Date.now()}`,name:j,createdAt:new Date().toISOString(),count:0};return o.push(y),g({type:"knowledge"}),he(y)},renameKnowledgeCollection:async(j,y)=>{const S=o.find(U=>U.id===j);if(!S)throw new Ue(404,"知识库不存在");return S.name=y,g({type:"knowledge"}),he(S)},deleteKnowledgeCollection:async j=>{o=o.filter(S=>S.id!==j);const y=c.length;return c=c.filter(S=>!(S.origin==="upload"&&S.collections.length===1&&S.collections[0]===j)).map(S=>({...S,collections:S.collections.filter(U=>U!==j)})),g({type:"knowledge"}),{deleted:y-c.length}},patchKnowledgeEntry:async(j,y)=>{const S=c.find(U=>U.id===j);if(!S)throw new Ue(404,"文件不存在");return Object.assign(S,y),g({type:"knowledge"}),he(S)},deleteKnowledgeEntry:async j=>(c=c.filter(y=>y.id!==j),g({type:"knowledge"}),{ok:!0}),uploadKnowledge:async(j,y)=>{const S=y.map((U,Z)=>({id:`k-${Date.now()}-${Z}`,origin:"upload",name:U.name,kind:"other",path:URL.createObjectURL(U),hash:`mock-${Date.now()}-${Z}`,size:U.size,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),collections:[j]}));return c.unshift(...S),g({type:"knowledge"}),{entries:he(S)}},me:async()=>{},login:async()=>{},logout:async()=>{},bootstrap:async()=>({assistants:he(a.assistants),jobs:he(Object.values(a.jobs)),delegations:he(Object.values(a.delegations)),routines:he(a.routines),approvals:he(Object.values(a.approvals).filter(j=>j.status==="pending")),settings:he(a.settings)}),settings:async()=>he(a.settings),rules:async()=>({rules:he(i)}),saveRules:async j=>(i=j.map(y=>({...y,id:y.id??`rule-${crypto.randomUUID()}`,changedAt:i.find(S=>S.id===y.id&&S.text===y.text&&S.mode===y.mode)?.changedAt??new Date().toISOString()})),g({type:"rules"}),{rules:he(i)}),models:async()=>({...he(xf),models:n.startsWith("readme-")?he(xf.models.slice(0,2)).map((j,y)=>({...j,ref:y?"anthropic/claude-sonnet":"openai/gpt-5",name:y?"Claude Sonnet":"GPT-5"})):he(xf.models),roster:he(a.settings.settings.models.roster)}),providers:async()=>E(),claude:async()=>({settings:he(a.settings),status:{found:!1,loggedIn:!1}}),saveClaude:async(j,y)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已更改,请刷新后重试。");return a.settings={revision:j+1,settings:{...a.settings.settings,claude:y}},{settings:he(a.settings),status:{found:!1,loggedIn:!1}}},putThinking:async j=>{const y=a.settings.settings.providers.find(ce=>j.ref.startsWith(`${ce.id}/`)),S=y?bf(y,a.settings.settings.models.thinking).find(ce=>ce.ref===j.ref):void 0;if(!y||!S)throw new Ue(400,`模型 ${j.ref} 不在已配置的服务商里。`);const U={...a.settings.settings.models.thinking??{}},Z=j.levels===null?void 0:Tw(j.levels);Z?U[j.ref]=Z:delete U[j.ref],a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,models:{roster:a.settings.settings.models.roster,conversation:a.settings.settings.models.conversation,work:a.settings.settings.models.work,...Object.keys(U).length?{thinking:U}:{}}}};const oe=bf(y,a.settings.settings.models.thinking).find(ce=>ce.ref===j.ref);return{settings:he(a.settings),thinking:oe}},putProvider:async(j,y)=>{const S=y,U={...S,id:j};delete U.key;const Z=a.settings.settings.providers.filter(oe=>oe.id!==j);return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...Z,U]}},S.key&&x.add(j),E()},deleteProvider:async j=>(a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:a.settings.settings.providers.filter(y=>y.id!==j)}},x.delete(j),E()),discoverProvider:async()=>({models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini",name:"GPT X mini"},{id:"gpt-x-vision"}]}),providersImport:async()=>({source:_w,items:$w.map(j=>({...j,exists:j.exists||a.settings.settings.providers.some(y=>y.id===j.id)}))}),importProviders:async j=>{const y=j.map(U=>Uw[U]).filter(U=>U!==void 0);if(!y.length)throw new Ue(400,"没有可导入的服务商:请选择状态为可导入的项目。");const S=a.settings.settings.providers.filter(U=>!y.some(Z=>Z.id===U.id));a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...S,...y]}};for(const U of y)x.add(U.id);return E()},testProvider:async()=>{},imageKey:async()=>he(Ax),putImage:async(j,y,S)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,image:y}},{settings:he(a.settings),keyConfigured:!!S||Ax.keyConfigured}},assistantSkills:async j=>he(a.assistantSkills[j]??[]),patchAssistantSkill:async(j,y,S)=>{const U=a.assistantSkills[j]?.find(Z=>Z.name===y);if(!U)throw new Error("技能不存在");return U.enabled=S,g({type:"skills",assistantId:j}),he(U)},rollbackAssistantSkill:async(j,y)=>{const S=a.assistantSkills[j]?.find(U=>U.name===y);if(!S||S.version<=1)throw new Error("没有上一版");return S.version--,g({type:"skills",assistantId:j}),he(S)},deleteAssistantSkill:async(j,y)=>(a.assistantSkills[j]=(a.assistantSkills[j]??[]).filter(S=>S.name!==y),g({type:"skills",assistantId:j}),{ok:!0}),sedimentJob:async j=>{if(!a.jobs[j])throw new Error("任务不存在");if(a.jobs[j].status!=="done")throw new Error("任务尚未完成");return a.jobs[j].sediment={status:"running"},g({type:"job",job:he(a.jobs[j])}),setTimeout(()=>{a.jobs[j].sediment={status:"empty",reason:"没有需要沉淀的"},g({type:"job",job:he(a.jobs[j])})},0),{ok:!0}},skills:async()=>{const j=a.settings.settings.skills?.disabled??[],y=(S,U,Z,oe,ce=!1)=>({id:S,name:S,description:Z,source:U,content:oe,enabled:!j.includes(`${U}:${S}`),overridden:ce});return{skills:[y("weekly-report","hob","按固定结构整理本周进展、风险和下周计划,生成可直接发出的周报。",`# 周报
|
|
83
|
+
|
|
84
|
+
1. 汇总本周完成的事项
|
|
85
|
+
2. 列出风险和需要的支持
|
|
86
|
+
3. 写下周计划`),y("research","hob","查阅可靠来源,交叉核对后整理结论,并为每条结论注明出处。",`# 研究
|
|
87
|
+
|
|
88
|
+
查阅可靠来源,整理结论并注明出处。`),y("server-checkup","hob","检查主机的磁盘、内存、服务状态和最近的错误日志,给出处理建议。",`# 主机巡检
|
|
89
|
+
|
|
90
|
+
逐台检查磁盘、内存、服务与日志。`),y("browser","common","在浏览器中打开页面、操作并截图,验证改动是否生效。",`# 浏览器
|
|
91
|
+
|
|
92
|
+
通过浏览器检查和验证页面。`),y("pdf","common","读取、拆分、合并 PDF,提取其中的表格和文字。",`# PDF
|
|
93
|
+
|
|
94
|
+
处理 PDF 文件。`),y("research","common","通用的资料检索流程。","# research",!0)],loreActive:!1,loreUrl:null}},skillsImport:async()=>({found:!0,skipped:[],skills:[{id:"review",name:"review",description:"检查代码与需求。",exists:!1},{id:"research",name:"research",description:"整理研究结果。",exists:!0}]}),importSkills:async(j,y)=>({imported:y,skipped:[],errors:[]}),deleteSkill:async()=>{},desktop:async()=>he(w),saveDesktop:async j=>(w={...w,revision:w.revision+1,url:j.url,enabled:j.enabled,tokenConfigured:w.tokenConfigured||!!j.token},he(w)),saveDesktopPublic:async(j,y)=>{if(j!==w.revision)throw new Ue(409,"设置已在别处修改,已刷新");return w={...w,revision:w.revision+1,publicAssistants:[...y]},he(w)},testDesktop:async()=>gc()==="failed"?{ok:!1,error:`无法连接 ${w.url},请确认云桌面已部署并启动。`}:w.url?{ok:!0,health:he(Ew)}:{ok:!1,error:"请先填写云桌面地址。"},mcp:async()=>({servers:kf.servers.map(j=>({...j}))}),putMcp:async()=>({servers:kf.servers.map(j=>({...j}))}),patchMcp:async()=>({servers:kf.servers.map(j=>({...j}))}),deleteMcp:async()=>({servers:[]}),testMcp:async()=>({ok:!0,tools:[{name:"read_file",description:"读取一个文件"},{name:"list_directory",description:"列出目录内容"}]}),mcpImports:async()=>({sources:["pi(~/.pi/agent/mcp.json)"],items:[{id:"pi:github",name:"github",source:"pi",kind:"http",exists:!1,selectable:!0}]}),importMcp:async j=>({imported:j,skipped:[]}),search:async()=>({providers:a.settings.settings.search.map(j=>({...j,keyConfigured:j.name==="exa"||j.name==="tavily"}))}),putSearch:async(j,y)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return a.settings={revision:j+1,settings:{...a.settings.settings,search:y}},he(a.settings)},testSearch:async()=>({ok:!1,error:"演示模式不连接搜索服务商。"}),imageTest:async()=>({ok:!1,error:"演示模式不连接图像生成接口;正式运行时会实际生成图片。"}),putSettings:async(j,y)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");const S=y.models??{};return a.settings={revision:a.settings.revision+1,settings:{general:{...a.settings.settings.general,...y.general??{},aboutYou:{...a.settings.settings.general.aboutYou,...y.general?.aboutYou??{}}},models:{roster:S.roster??a.settings.settings.models.roster,conversation:S.conversation??a.settings.settings.models.conversation,work:S.work??a.settings.settings.models.work,thinkingChoice:S.thinkingChoice??a.settings.settings.models.thinkingChoice,...S.thinking??a.settings.settings.models.thinking?{thinking:S.thinking??a.settings.settings.models.thinking}:{}},providers:a.settings.settings.providers,image:a.settings.settings.image,search:a.settings.settings.search,skills:y.skills??a.settings.settings.skills,usage:a.settings.settings.usage,work:{...a.settings.settings.work,...y.work??{}},push:{...a.settings.settings.push,...y.push??{}}}},he(a.settings)},changePassword:async j=>{if(j!=="test")throw new Ue(403,"旧密码不正确")},about:async()=>({version:"0.1.0",home:"/var/lib/hob"}),memory:async()=>he({...T,revision:a.settings.revision}),putMemory:async(j,y)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");if(y==="lore"&&!T.lore.configured)throw new Ue(400,"Lore 尚未配置:请先填写服务地址和 Token 并测试连接");return T.provider=y,T.providerExplicit=!0,a.settings.revision+=1,T.revision=a.settings.revision,he(T)},putLore:async j=>{const y=j.baseUrl.trim().replace(/\/+$/,"");if(!y)throw new Ue(400,"Lore 服务地址不能为空");const S=T.lore.baseUrl===y;return T.lore={configured:S?T.lore.tokenConfigured:!!j.token,baseUrl:y,source:"config",tokenConfigured:S?T.lore.tokenConfigured:!!j.token},he({...T,revision:a.settings.revision})},loreTest:async j=>{const y=(j.baseUrl??T.lore.baseUrl??"").trim().replace(/\/+$/,"");return y?y.startsWith("http://")&&!/^http:\/\/(localhost|127\.0\.0\.1|192\.168\.|10\.)/.test(y)?{ok:!1,reason:"insecure_http"}:!j.token&&!T.lore.tokenConfigured?{ok:!1,reason:"missing_token"}:{ok:!0,baseUrl:y}:{ok:!1,reason:"invalid_url"}},loreImport:async()=>({source:Dw,found:!0,baseUrl:"https://api.loremem.com",tokenPresent:!0}),importLore:async()=>(T.lore={configured:!0,baseUrl:"https://api.loremem.com",source:"config",tokenConfigured:!0},he({...T,revision:a.settings.revision})),items:async j=>({items:he(a.items[j]??[]),approvals:he(Object.values(a.approvals)),jobs:he(Object.values(a.jobs)),drafts:he(Object.values(a.drafts)),delegations:he(Object.values(a.delegations)),hasMore:!1}),profile:async j=>{const y=v(j);if(!y)throw new Error(`没有这个助手:${j}`);return{assistant:he(y),rules:he(a.rules[j]??[]),routines:he(a.routines.filter(U=>U.assistantId===j)),worklog:he(a.worklog[j]??[])}},sendMessage:async(j,y)=>{if(y.text==="模拟发送失败")throw new Error("网络连接已断开");const S=new Date().toISOString();for(const Z of Object.values(a.delegations))Z.to!==j||Z.reportedAt||Z.status==="interrupted"||(Object.assign(Z,{status:"takenOver",endedAt:S,reportedAt:S}),g({type:"delegation",delegation:he(Z)}));for(const Z of Object.values(a.approvals))Z.assistantId!==j||Z.source!=="router"||Z.status!=="pending"||(Z.status="expired",g({type:"approval",approval:he(Z)}));const U={kind:"user",id:wn("mock-u"),at:S,text:y.text,quote:y.quote,files:y.files&&y.files.length?y.files:void 0};return O(j,U),W(j,y.text),$(j,{busy:!0}),setTimeout(()=>{O(j,{kind:"assistant",id:wn("mock-a"),at:new Date().toISOString(),text:"收到。"}),W(j,"收到。"),$(j,{busy:!1})},320),{item:U}},stopAssistant:async j=>$(j,{busy:!1}),markRead:async j=>$(j,{unread:0}),patchAssistant:async(j,y)=>{if(!v(j))throw new Ue(404,"助手不存在。");if(y.rule){const S=a.rules[j]??=[],U=y.rule.id===void 0?void 0:S.find(ke=>ke.id===y.rule.id);if(y.rule.id!==void 0&&!U)throw new Ue(404,"规则不存在。");const Z=y.rule.text===void 0?U?.text??"":y.rule.text.trim();if(!Z||Z.length>1e3)throw new Ue(400,"规则内容不能为空或超过 1000 字。");if(S.some(ke=>ke.id!==y.rule.id&&ke.text===Z))throw new Ue(400,"规则内容已存在。");const oe=y.rule.mode??U?.mode;if(oe!=="ask"&&oe!=="allow")throw new Ue(400,"规则模式无效。");const ce={id:U?.id??wn("r-"),text:Z,mode:oe,changedAt:new Date().toISOString()};return U?Object.assign(U,ce):S.push(ce),g({type:"profile",assistantId:j}),{rule:he(ce)}}$(j,y)},archiveAssistant:async j=>{const y=v(j);if(!y)throw new Ue(404,"助手不存在");if(y.primary)throw new Ue(400,"主助手不能归档");if(Object.values(a.jobs).filter(U=>U.assistantId===j&&(U.status==="running"||U.status==="queued"||U.status==="waiting")).length)throw new Ue(409,"请等任务结束后再归档");for(const U of a.routines.filter(Z=>Z.assistantId===j))g({type:"routine_removed",id:U.id});a.routines=a.routines.filter(U=>U.assistantId!==j),a.assistants=a.assistants.filter(U=>U.id!==j),g({type:"assistant_removed",id:j})},deleteRule:async(j,y)=>{a.rules[j]=(a.rules[j]??[]).filter(S=>S.id!==y),g({type:"profile",assistantId:j})},answerApproval:async(j,y)=>{const S=a.approvals[j];if(!S||S.status!=="pending")return;S.status="answered",y.key?S.chosen=y.key:S.answerText=(y.text??"").trim(),S.answeredAt=new Date().toISOString(),S.options.find(Z=>Z.key===y.key)?.always&&S.ruleText&&((a.rules[S.assistantId]??=[]).push({id:wn("rule"),text:S.ruleText,mode:"allow",changedAt:S.answeredAt}),O(S.assistantId,{kind:"note",id:wn("mock-n"),at:S.answeredAt,icon:"rule",text:`已记入${v(S.assistantId)?.name??""}的规则 · ${S.ruleText}无需确认`}),g({type:"profile",assistantId:S.assistantId})),g({type:"approval",approval:he(S)});for(const Z of Object.values(a.delegations))!Z.reportedAt&&((Z.approvalIds??[]).includes(S.id)||S.jobId&&Z.jobIds.includes(S.jobId))&&(Z.status="running",S.jobId&&a.jobs[S.jobId]?.status==="waiting"&&(a.jobs[S.jobId].status="running",g({type:"job",job:he(a.jobs[S.jobId])})),g({type:"delegation",delegation:he(Z)}))},retryDelegation:async j=>{const y=a.delegations[j];if(!y||y.status!=="interrupted")throw new Ue(400,"只有已中断的委派可以重新转交");const S={...y,id:wn("dg-"),status:"running",createdAt:new Date().toISOString(),jobIds:[],approvalIds:[],reportedAt:void 0,endedAt:void 0};a.delegations[S.id]=S,g({type:"delegation",delegation:he(S)}),O("hob",{kind:"delegation",id:wn("item-"),at:S.createdAt,delegationId:S.id}),O(S.to,{kind:"user",id:wn("item-"),at:S.createdAt,text:S.text,from:{assistantId:"hob",name:"Hob",delegationId:S.id}})},createDraft:async j=>{const y=a.drafts[j];y&&(y.status="created",y.createdAssistantId="bird",g({type:"draft",draft:he(y)}),O(y.assistantId,{kind:"note",id:wn("mock-n"),at:new Date().toISOString(),icon:"split",text:`专属助手已创建 · ${y.name}`}))},dismissDraft:async j=>{const y=a.drafts[j];y&&(y.status="dismissed",g({type:"draft",draft:he(y)}))},createRoutine:async j=>{const y={...j,id:wn("r"),createdAt:new Date().toISOString(),runs:[]};return a.routines.push(y),g({type:"routine",routine:he(y)}),he(y)},patchRoutine:async(j,y)=>{const S=a.routines.find(oe=>oe.id===j);if(!S)return;const{skill:U,...Z}=y;Object.assign(S,Z),U===null?delete S.skill:U!==void 0&&(S.skill=U),g({type:"routine",routine:he(S)})},deleteRoutine:async j=>{a.routines=a.routines.filter(y=>y.id!==j),g({type:"routine_removed",id:j})},runRoutine:async j=>{const y=a.routines.find(oe=>oe.id===j);if(!y)return;const S=new Date().toISOString(),U={id:wn("t-"),assistantId:y.assistantId,title:`${y.name}(立即运行)`,instruction:y.instruction,status:"running",createdAt:S,startedAt:S,stats:{reads:0,commands:0,edits:0},routineId:y.id,activity:[{at:S,verb:"$",text:`立即运行 ${y.name}`}]};a.jobs[U.id]=U;const Z={jobId:U.id,at:S,status:"running"};y.runs=[Z,...y.runs].slice(0,20),O(y.assistantId,{kind:"job",id:wn("mock-j"),at:S,jobId:U.id}),g({type:"job",job:he(U)}),g({type:"routine",routine:he(y)}),W(y.assistantId,`运行定时任务:${y.name}`)},replyJob:async(j,y)=>{const S=a.jobs[j];if(!S)return;S.activity=[...S.activity,{at:new Date().toISOString(),verb:"说",text:y}],g({type:"activity",jobId:j,line:S.activity[S.activity.length-1],stats:he(S.stats)});const U=new Date().toISOString();g({type:"job_step",jobId:j,step:{id:`q${Date.now()}`,kind:"text",at:U,from:"user",text:y,queued:!0}}),setTimeout(()=>g({type:"job_step",jobId:j,step:{id:`u${Date.now()}`,kind:"text",at:new Date().toISOString(),from:"user",text:y}}),4e3)},transcript:async j=>{const y=a.jobs[j];if(!y)throw new Error(`没有这个任务:${j}`);return{job:he(y),steps:A(y)}},jobs:async(j={})=>{let y=Object.values(a.jobs).sort((Z,oe)=>oe.createdAt.localeCompare(Z.createdAt));if(j.assistantId&&(y=y.filter(Z=>Z.assistantId===j.assistantId)),j.status&&(y=y.filter(Z=>Z.status===j.status)),j.before){const Z=y.findIndex(oe=>oe.id===j.before);Z!==-1&&(y=y.slice(Z+1))}const S=j.limit??30;return{jobs:he(y.slice(0,S)),hasMore:y.length>S}},stopJob:async j=>{const y=a.jobs[j];y&&(y.status="stopped",y.endedAt=new Date().toISOString(),g({type:"job",job:he(y)}))},upload:async j=>{await new Promise(S=>setTimeout(S,1200));const y=`/mock/uploads/u-${Math.random().toString(36).slice(2,8).padEnd(6,"0")}-${j.name}`;return Mx.set(y,URL.createObjectURL(j)),y},fileUrl:(j,y)=>j==="/mock/readme-page.html"||n==="readme-knowledge"&&j==="/mock/knowledge/团队资料整理方案.html"?"/mock/readme-page.html":Mx.get(j)??(j==="/srv/example/reports/stats.csv"?`data:text/plain;charset=utf-8,${encodeURIComponent(`项目,大小
|
|
95
|
+
旧日志,2.1GB
|
|
96
|
+
服务,正常`)}`:j==="/srv/example/reports/log-cleanup-1031.md"?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 清理报告
|
|
97
|
+
|
|
98
|
+
已清理旧日志,服务运行正常。`)}`:j.startsWith("/mock/assistants/")?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 每日行业简报
|
|
99
|
+
|
|
100
|
+
整理值得关注的行业动态。`)}`:j.startsWith("blob:")?j:j.startsWith("/mock/knowledge/")?j.endsWith(".png")?`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400"><rect width="600" height="400" fill="#d5e3d4"/><circle cx="430" cy="110" r="55" fill="#f5d599"/><path d="M0 380L190 150 340 330 430 220 600 400" fill="#83a392"/></svg>')}`:j.endsWith(".html")?`data:text/html;charset=utf-8,${encodeURIComponent("<h1>产品设计页面</h1><p>这是模拟模式中的项目资料。</p>")}`:`data:text/plain;charset=utf-8,${encodeURIComponent("模拟模式中的项目资料。")}`:j.startsWith("/mock/")?j:`data:text/plain;charset=utf-8,${encodeURIComponent(`mock 模式没有真实文件。
|
|
101
|
+
|
|
102
|
+
${j}`)}`),fileMeta:async j=>{const y=j.split("/").pop()??j,S=y.lastIndexOf("."),U=S>0?y.slice(S).toLowerCase():"",Z=[".png",".jpg",".jpeg",".webp",".gif"].includes(U)?"image":U===".md"?"markdown":U===".csv"?"csv":U===".html"?"html":U===".json"?"json":"text";return{path:j,name:y,size:2048,modifiedAt:new Date().toISOString(),mime:Z==="image"?`image/${U===".jpg"?"jpeg":U.slice(1)}`:"text/plain; charset=utf-8",kind:Z,...j==="/mock/readme-page.html"?{page:!0}:{},text:Z!=="image"}},jobFiles:async(j,y)=>{const S=a.jobs[j];if(!S)throw new Ue(404,"任务不存在");const U="/srv/example/reports",Z=ke=>({type:"file",path:`${U}/${ke}`,rel:ke,name:ke.split("/").pop(),size:2048,modifiedAt:S.createdAt,kind:ke.endsWith(".md")?"markdown":ke.endsWith(".csv")?"csv":"code"}),oe=j!=="t-0927"?[]:y?y==="src"?[{type:"directory",path:`${U}/src/checks`,rel:"src/checks",name:"checks",count:1},Z("src/main.ts")]:y==="src/checks"?[Z("src/checks/logs.ts")]:[]:[{type:"directory",path:`${U}/src`,rel:"src",name:"src",count:2},Z("log-cleanup-1031.md"),Z("stats.csv"),Z("notes.txt")],ce=oe.filter(ke=>ke.type==="directory").length;return{files:oe,total:oe.length,directoryCount:ce,fileCount:oe.length-ce}},push:async()=>M(),subscribePush:async(j,y)=>{const S=C.filter(U=>U.endpoint!==j.endpoint);return C.splice(0,C.length,...S,{endpoint:j.endpoint,label:y.trim()||"本机",createdAt:new Date().toISOString()}),M()},unsubscribePush:async j=>{const y=C.findIndex(S=>S.endpoint===j);return y>=0&&C.splice(y,1),M()},testPush:async()=>({sent:1,removed:0}),visibility:async()=>{},events:j=>{p.add(j.onEvent);const y=[];return n==="act-demo"&&(y.push(setTimeout(()=>g({type:"router-activity",assistantId:"hob",activity:{state:"tool",label:"搜索:最新 AI 动态"}}),2500)),y.push(setTimeout(()=>{g({type:"router-activity",assistantId:"hob",activity:null}),g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"正在整理搜索结果…",streaming:!0}})},5500)),y.push(setTimeout(()=>{g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"已整理好最新动态。"}}),g({type:"assistant",assistant:{...a.assistants.find(S=>S.id==="hob"),busy:!1,activity:null}})},7500))),()=>{y.forEach(clearTimeout),p.delete(j.onEvent)}}}}function Hw(n){return/iPhone/i.test(n)?"iPhone":/iPad/i.test(n)?"iPad":/Android/i.test(n)?"Android":/Macintosh|Mac OS X/i.test(n)?"Mac":/Windows/i.test(n)?"Windows":/Linux/i.test(n)?"Linux":"浏览器"}function Bw(n){const a=n.replace(/-/g,"+").replace(/_/g,"/"),i=a.padEnd(Math.ceil(a.length/4)*4,"="),o=atob(i),c=new Uint8Array(o.length);for(let d=0;d<o.length;d+=1)c[d]=o.charCodeAt(d);return c}function dh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function qw(n,a){return!n||n.byteLength!==a.length?!1:new Uint8Array(n).every((o,c)=>o===a[c])}function Iw(n){const a=n.toJSON(),i=a.keys?.p256dh??"",o=a.keys?.auth??"";return!a.endpoint||!i||!o?null:{endpoint:a.endpoint,keys:{p256dh:i,auth:o}}}async function fh(){return dh()?await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription()??null:null}async function Gw(n){if(!dh())return{error:"这个浏览器不支持推送"};let a=Notification.permission;if(a==="default")try{a=await Notification.requestPermission()}catch{return{error:"浏览器拒绝授予通知权限"}}if(a!=="granted")return{error:"浏览器未授予通知权限"};const i=await navigator.serviceWorker.getRegistration();if(!i)return{error:"离线页面尚未就绪,请刷新后重试"};const o=Bw(n);let c=await i.pushManager.getSubscription();if(c&&!qw(c.options.applicationServerKey,o)){try{await c.unsubscribe()}catch{}c=null}if(!c)try{c=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:o.buffer})}catch(h){return{error:`浏览器订阅推送失败:${h instanceof Error?h.message:String(h)}`}}const d=Iw(c);return d?{subscription:d}:{error:"浏览器返回的订阅信息不完整"}}function Ba(n){return n.replace(/```[^\n]*\n?([\s\S]*?)```/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^[ \t]*#{1,6}[ \t]+/gm,"").replace(/^[ \t]*>[ \t]?/gm,"").replace(/^[ \t]*(?:[-*+]|\d+[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/gm,"").replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)*\|?[ \t]*$/gm,"").replace(/[ \t]*\|[ \t]*/g," ").replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gm,"").replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,"$2").replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1").replace(/(^|[^\w*])\*(?=\S)([^*\n]*?\S)\*(?![\w*])/g,"$1$2").replace(/(^|[^\w])_(?=\S)([^_\n]*?\S)_(?!\w)/g,"$1$2").replace(/`([^`\n]+)`/g,"$1").replace(/\s+/g," ").trim()}function Yw(n,a){if(a.from==="user"&&!a.queued){const c=n.findIndex(d=>d.queued&&d.text===a.text);c>=0&&(n=n.filter((d,h)=>h!==c))}const i=n.findIndex(c=>c.id===a.id);if(i<0)return[...n,a];const o=n.slice();return o[i]=a,o}function Kw(n,a){const i=new Set(a.map(c=>c.id)),o=a.slice();for(const c of n)!i.has(c.id)&&!c.queued&&o.push(c);return o}function zx(n){const a=[];let i=[];const o=()=>{if(!i.length)return;const c=i.join(`
|
|
103
|
+
|
|
104
|
+
`);return i=[],c};for(const c of n){if(c.kind==="thinking"){const h=c.text?.trim();h&&i.push(h);continue}if(c.kind==="text"&&c.from==="user"){a.push(c);continue}const d=o();a.push(d?{...c,thinking:d}:c)}return{rows:a,thinking:o()??null}}function Jo(n,a,i){const o=a&&!i?n.slice(0,8):n;return{rows:o,remaining:n.length-o.length}}const Rx=400,Zw=2e5,Ox=3;function Xw(n,a){const i=n===""?[]:n.split(`
|
|
105
|
+
`),o=a===""?[]:a.split(`
|
|
106
|
+
`);let c=0;for(;c<i.length&&c<o.length&&i[c]===o[c];)c+=1;let d=i.length,h=o.length;for(;d>c&&h>c&&i[d-1]===o[h-1];)d-=1,h-=1;const m=Math.min(c,Ox),p=Math.min(i.length-d,Ox),g=i.slice(c-m,c).map(v=>({sign:" ",text:v}));return g.push(...Vw(i.slice(c,d),o.slice(c,h))),g.push(...i.slice(d,d+p).map(v=>({sign:" ",text:v}))),g.length<=Rx?g:[...g.slice(0,Rx),{sign:" ",text:"…"}]}function Vw(n,a){if(!n.length)return a.map(h=>({sign:"+",text:h}));if(!a.length)return n.map(h=>({sign:"-",text:h}));if(n.length*a.length>Zw)return[...n.slice(0,190).map(m=>({sign:"-",text:m})),...n.length>190||a.length>190?[{sign:" ",text:"…"}]:[],...a.slice(0,190).map(m=>({sign:"+",text:m}))];const i=Array.from({length:n.length+1},()=>new Int32Array(a.length+1));for(let h=n.length-1;h>=0;h-=1)for(let m=a.length-1;m>=0;m-=1)i[h][m]=n[h]===a[m]?i[h+1][m+1]+1:Math.max(i[h+1][m],i[h][m+1]);const o=[];let c=0,d=0;for(;c<n.length&&d<a.length;)n[c]===a[d]?(o.push({sign:" ",text:n[c]}),c+=1,d+=1):i[c+1][d]>=i[c][d+1]?(o.push({sign:"-",text:n[c]}),c+=1):(o.push({sign:"+",text:a[d]}),d+=1);for(;c<n.length;)o.push({sign:"-",text:n[c++]});for(;d<a.length;)o.push({sign:"+",text:a[d++]});return o}function Qw(n,a){const i=n.rounds??[];return[...i,n].map((o,c)=>{const d=c===i.length,h=o.startedAt??(c===0?n.createdAt:i[c-1].endedAt),m=d?void 0:o.endedAt,p=d?void 0:i[c+1]?.startedAt??(c+1===i.length?n.startedAt:void 0);return{job:{...n,...o,statusReason:o.statusReason,summary:d&&["running","queued","waiting"].includes(n.status)?void 0:o.summary,files:d&&["running","queued","waiting"].includes(n.status)?void 0:o.files},instruction:c===0?n.instruction:i[c-1].followUp,steps:a?.filter(g=>(!h||g.at>=h)&&(!m||g.at<=m)&&(!p||g.at<p))}})}const Jw=new Set(["排队中","进行中","待确认","等你确认","已完成","受阻","失败","已停止"]);function Pw(n,a=0){const i=n.rounds?.[a];return i?{...n,status:i.status,statusReason:i.statusReason,startedAt:i.startedAt,endedAt:i.endedAt,durationMs:i.durationMs}:n}function hh(n){const a=n.statusReason?Ba(n.statusReason):"";if(!(!a||Jw.has(a)))return a}function Fw(n){return n.split(/`/).map((a,i)=>({text:a,mono:i%2===1})).filter(a=>a.text.length>0)}function Ww(n,a){const i=n==="dark"||n==="system"&&a;return{dark:i,color:i?"#1b1b1d":"#f6f6f4"}}function eN(n,a){if(n.phase!=="ready")return a?"bg":"side";const i=n.panelStack.at(-1);return i?.kind==="file"&&(a||i.full)?"bg":a?i?.kind==="job"||i?.kind==="jobs"||n.page==="settings"||n.page==="knowledge"?"bg":i||n.sheet?"panel":"bg":n.page==="settings"||n.page==="knowledge"?"bg":"side"}function g0(n,a){const i=document.documentElement;i.style.setProperty("--status-background",`var(--${eN(n,a)})`);const o=getComputedStyle(i).backgroundColor;document.querySelector('meta[name="theme-color"]')?.setAttribute("content",o)}function tN(n,a){return n.kind!==a.kind?!1:n.kind==="routine"&&a.kind==="routine"||n.kind==="job"&&a.kind==="job"?n.id===a.id:n.kind==="file"&&a.kind==="file"?n.liveId||a.liveId?n.liveId===a.liveId:n.path===a.path:!0}function ts(n,a){const i=n.findIndex(o=>tN(o,a));return[...i<0?n:n.slice(0,i),a]}function nN(n,a,i,o){return a!==i&&!o?[]:n}function v0(n){return n.slice(0,-1)}function x0(n,a){return ts(v0(n),a)}function qa(n){return`${n.kind}:${"id"in n?n.id:"path"in n?n.liveId??n.path:""}`}function sN(n,a){const i=new Set(a.map(qa)),o=a.length<n.length;return n.flatMap((c,d)=>i.has(qa(c))?[]:[{page:c,index:d,leaving:o}])}function lN(n,a){const i=n.map(o=>({page:o,leaving:!1}));for(const o of a)i.splice(Math.min(o.index,i.length),0,{page:o.page,leaving:o.leaving});return i}function aN(n,a){return n.filter(i=>i.kind!=="file"||!i.liveId||!!a[i.liveId])}const iN={general:{theme:"system",timezone:"UTC",aboutYou:{name:"",language:"",notes:""}},providers:[],models:{roster:[],conversation:{ref:"",thinking:"low"},work:{ref:"",thinking:"high"}},image:{source:"off"},search:o0(),work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}},Ml=new URLSearchParams(location.search),Ol=Ml.get("mock")==="1",rN=["readme-chat","readme-cards","readme-dark","readme-rules","readme-desktop","readme-page","readme-knowledge","readme-list","readme-question","readme-profile","image","act-demo","act-think","act-tool","act-dark","act-home","boot","bubbles","bubbles-dark","card-130","card-130-dark","s1","s2","s3","s4","s6","mlist","mchat","d-running","d-waiting","d-done","d-dark","d-source","d-mobile","h-hob","h-dark","h-source","h-settings","h-mobile"],yf=Ml.get("scene"),Ec=yf&&rN.includes(yf)?yf:"s1",ne=Ol?Lw(Ec):cw,mh="hob.theme",b0=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;let _x=!1;function Dx(n){return n==="assistant"||n==="now"||n==="routines"||n==="skills"||n==="knowledge"||n==="rules"||n==="newRoutine"?{kind:n}:n.startsWith("routine:")?{kind:"routine",id:n.slice(8)}:{kind:"now"}}function k0(){const n=localStorage.getItem(mh);return n==="light"||n==="dark"||n==="system"?n:null}const y0=Ml.get("dark")==="1",Ws=aw(location.hash);function oN(){const n=p0[Ol?Ec:"s1"],a={phase:"loading",error:null,notice:null,offline:null,assistants:[],jobs:{},delegations:{},routines:[],approvals:{},drafts:{},settings:{revision:0,settings:iN},globalRules:{rules:null,error:null,busy:!1},page:"main",knowledge:{category:"all",q:"",kind:"",assistantId:"",entries:[],collections:[],collectionsLoaded:!1,hasMore:!1,loading:!1,error:null},section:null,sub:null,items:{},itemGen:{},itemPages:{},profiles:{},assistantSkills:{},sidebarJobs:{},sidebarFiles:{},sel:"hob",panelStack:[],livePages:{},steps:{},worklog:null,collapsed:!1,nowWide:!1,theme:k0()??"system",query:"",quote:null,text:"",attachments:[],pending:{},nonce:0,mobile:"list",sheet:!1,search:!1,menu:null,tick:0,updateReady:!1,loggingIn:!1};if(Ol){a.sel=n.sel;const c=Dx(n.panel);a.panelStack=c.kind==="now"?[]:[c],a.collapsed=n.collapsed,a.mobile=n.mobile,a.theme=n.dark?"dark":"light"}const i=Ml.get("a");i&&(a.sel=i),Ws.sel&&(a.sel=Ws.sel),Ws.panel&&(a.panelStack=[Ws.panel]),Ws.knowledge&&(a.page="knowledge"),Ws.settings&&(a.page="settings",a.section=Ws.section);const o=Ml.get("panel");if(o){const c=Dx(o);a.panelStack=c.kind==="now"?[]:[c]}return Ml.get("collapsed")==="1"&&(a.collapsed=!0),y0&&(a.theme="dark"),a}let re=oN();function cN(){return Ws.sel?!0:Ol?p0[Ec].mobile==="chat":!!Ml.get("a")||window.innerWidth>=768}Ol||y0||k0();const If=new Set;function X(n){re={...re,...typeof n=="function"?n(re):n},If.forEach(a=>a())}function j0(n){return If.add(n),()=>If.delete(n)}const ks=()=>re;function we(){return k.useSyncExternalStore(j0,ks,ks)}function me(n){return n instanceof Ue||n instanceof Error?n.message:String(n)}function Tn(n){const a={};for(const i of n)a[i.id]=i;return a}function $x(n,a){const i=n.findIndex(c=>c.id===a.id);if(i<0)return[...n,a];const o=n.slice();return o[i]=a,o}function uN(n,a){const i=a.models??{};return{general:{...n.general,...a.general??{},aboutYou:{...n.general.aboutYou,...a.general?.aboutYou??{}}},models:{roster:i.roster??n.models.roster,conversation:i.conversation??n.models.conversation,work:i.work??n.models.work,thinkingChoice:i.thinkingChoice??n.models.thinkingChoice,...i.thinking??n.models.thinking?{thinking:i.thinking??n.models.thinking}:{}},image:n.image,search:n.search,providers:n.providers,work:{...n.work,...a.work??{}},push:{...n.push,...a.push??{}}}}let Ux=Promise.resolve();function ph(n){const a=Ux.then(()=>dN(typeof n=="function"?n(re.settings.settings):n));return Ux=a.then(()=>{},()=>{}),a}async function dN(n){const a=re.settings,i={revision:a.revision,settings:uN(a.settings,n)};X({settings:i,theme:i.settings.general.theme}),n.general?.theme&&El(n.general.theme);try{const o=await ne.putSettings(a.revision,n);return X({settings:o,theme:o.settings.general.theme}),El(o.settings.general.theme),localStorage.setItem(mh,o.settings.general.theme),!0}catch(o){if(o instanceof Ue&&o.status===409){try{const c=await ne.settings();X({settings:c,theme:c.settings.general.theme}),El(c.settings.general.theme)}catch{X({settings:a})}return X({notice:"设置已在别处修改,已刷新"}),!1}return X({settings:a,theme:a.settings.general.theme,notice:`保存失败:${me(o)}`}),El(a.settings.general.theme),!1}}async function fN(n,a){try{return await ne.changePassword(n,a),null}catch(i){return me(i)}}async function hN(){try{return await ne.about()}catch(n){return X({notice:`无法读取版本信息:${me(n)}`}),null}}async function mN(){try{return{ok:!0,view:await ne.usage()}}catch(n){return{ok:!1,error:`无法读取消耗统计:${me(n)}`}}}async function Lx(n,a){try{const i=await ne.putUsagePrice({revision:ks().settings.revision,model:n,price:a});return X({settings:i.settings}),{ok:!0,price:i.price}}catch(i){return{ok:!1,error:me(i)}}}async function gh(){try{return await ne.models()}catch(n){return X({notice:`无法读取模型列表:${me(n)}`}),null}}let cc=0;async function Gf(){const n=++cc;try{const{rules:a}=await ne.rules();n===cc&&X(i=>({globalRules:{...i.globalRules,rules:a,error:null}}))}catch(a){n===cc&&X(i=>({globalRules:{...i.globalRules,error:`无法读取全局规则:${me(a)}`}}))}}async function pN(n){if(re.globalRules.busy)return!1;X(a=>({globalRules:{...a.globalRules,busy:!0,error:null}}));try{const a=await ne.saveRules(n);return++cc,X({globalRules:{rules:a.rules,error:null,busy:!1}}),!0}catch(a){return X(i=>({globalRules:{...i.globalRules,busy:!1,error:`保存失败:${me(a)}`}})),!1}}async function gN(){const n=await ne.claude();return X({settings:n.settings}),n}async function vN(n){const a=await ne.saveClaude(re.settings.revision,n);return X({settings:a.settings}),a}async function vh(n){return X({settings:n.settings}),n}async function xN(){try{return{ok:!0,view:await ne.providers()}}catch(n){return{ok:!1,error:me(n)}}}async function Hx(n,a){try{return{ok:!0,view:await vh(await ne.putProvider(n,a))}}catch(i){return{ok:!1,error:me(i)}}}async function bN(n,a){try{const i=await ne.putThinking({ref:n,levels:a});return X({settings:i.settings}),{ok:!0,settings:i.settings,thinking:i.thinking}}catch(i){return{ok:!1,error:me(i)}}}async function kN(n){try{return{ok:!0,view:await vh(await ne.deleteProvider(n))}}catch(a){return{ok:!1,error:me(a)}}}async function Bx(n){try{return await ne.testProvider(n),null}catch(a){return me(a)}}async function yN(n){try{return{ok:!0,models:(await ne.discoverProvider(n)).models}}catch(a){return{ok:!1,error:me(a)}}}async function jN(){try{return{ok:!0,view:await ne.providersImport()}}catch(n){return{ok:!1,error:me(n)}}}async function wN(n){try{return{ok:!0,view:await vh(await ne.importProviders(n))}}catch(a){return{ok:!1,error:me(a)}}}const NN=()=>ne.skills(),SN=n=>ne.skillsImport(n),TN=(n,a,i)=>ne.importSkills(n,a,i),CN=n=>ne.deleteSkill(n),EN=()=>ne.desktop();async function AN(n){const a=await ne.saveDesktop(n);return X({settings:await ne.settings()}),a}async function MN(n,a){const i=await ne.saveDesktopPublic(n,a);return X({settings:await ne.settings()}),i}const zN=()=>ne.testDesktop(),qx=()=>ne.mcp(),RN=(n,a)=>ne.putMcp(n,a),w0=(n,a)=>ne.patchMcp(n,a),ON=n=>ne.deleteMcp(n),_N=(n,a=!0)=>ne.testMcp(n,a),DN=()=>ne.mcpImports(),$N=n=>ne.importMcp(n),UN=()=>ne.search(),LN=(n,a,i)=>ne.testSearch(n,a,i);async function HN(n,a){try{const i=await ne.putSearch(re.settings.revision,n,a);return X({settings:i}),null}catch(i){return i instanceof Ue&&i.status===409&&X({settings:await ne.settings()}),me(i)}}const BN=()=>ne.embeddingKey(),qN=n=>ne.embeddingTest(n);async function IN(n,a){try{const i=await ne.putEmbedding(re.settings.revision,n,a);return X({settings:i.settings}),i}catch(i){throw i instanceof Ue&&i.status===409&&X({settings:await ne.settings()}),i}}const GN=(n,a)=>ne.knowledgeEntry(n,a),YN=n=>ne.reindexKnowledge(n);async function KN(){try{return await ne.imageKey()}catch(n){return X({notice:`无法读取图像生成设置:${me(n)}`}),null}}async function Ix(n,a){try{const i=await ne.putImage(re.settings.revision,n,a);return X({settings:i.settings}),{ok:!0,keyConfigured:i.keyConfigured}}catch(i){if(i instanceof Ue&&i.status===409){try{X({settings:await ne.settings()})}catch{}return{ok:!1,error:"设置已在别处修改,已刷新,请重新保存",conflict:!0}}return{ok:!1,error:me(i),conflict:!1}}}async function Gx(n){try{return await ne.imageTest(n)}catch(a){return{ok:!1,error:`生成测试图片的请求失败:${me(a)}`}}}async function jf(){try{return{ok:!0,config:await ne.memory()}}catch(n){return{ok:!1,error:`无法读取记忆设置:${me(n)}`}}}async function Yx(n,a){try{const i=await ne.putMemory(n,a);return X(o=>({settings:{...o.settings,revision:Math.max(o.settings.revision,i.revision)}})),{ok:!0,config:i}}catch(i){return{ok:!1,error:me(i)}}}async function ZN(n){try{return{ok:!0,config:await ne.putLore(n)}}catch(a){return{ok:!1,error:me(a)}}}async function Kx(n){try{return{ok:!0,result:await ne.loreTest(n)}}catch(a){return{ok:!1,error:`测试请求失败:${me(a)}`}}}async function XN(){try{return{ok:!0,view:await ne.loreImport()}}catch(n){return{ok:!1,error:me(n)}}}async function VN(){try{return{ok:!0,config:await ne.importLore()}}catch(n){return{ok:!1,error:me(n)}}}async function sr(){try{return{ok:!0,view:await ne.push()}}catch(n){return{ok:!1,error:`无法读取推送设置:${me(n)}`}}}async function QN(){const n=await sr();if(!n.ok)return n;try{const a=await Gw(n.view.publicKey);return"error"in a?{ok:!1,error:a.error}:{ok:!0,view:await ne.subscribePush(a.subscription,Hw(navigator.userAgent))}}catch(a){return{ok:!1,error:`订阅推送失败:${me(a)}`}}}async function JN(){try{const n=await fh();if(n)try{await n.unsubscribe()}catch{}return N0(n?.endpoint??await PN())}catch(n){return{ok:!1,error:`关闭推送失败:${me(n)}`}}}async function PN(){const n=await sr();return n.ok?n.view.devices[0]?.endpoint??"":""}async function N0(n){if(!n)return sr();try{return{ok:!0,view:await ne.unsubscribePush(n)}}catch(a){return{ok:!1,error:`删除设备失败:${me(a)}`}}}async function FN(){const n=await fh();try{const a=await ne.testPush(n?.endpoint);return{ok:!0,sent:a.sent,removed:a.removed}}catch(a){return{ok:!1,error:me(a)}}}const S0=window.matchMedia("(prefers-color-scheme: dark)");function El(n){const{dark:a}=Ww(n,S0.matches);document.documentElement.classList.toggle("dark",a),document.documentElement.style.colorScheme=a?"dark":"light",g0(re,window.innerWidth<768)}S0.addEventListener("change",()=>El(re.theme));let Zx=!1,Xx=null;async function WN(){if(!Zx){if(Zx=!0,El(re.theme),Ol){if(Ec==="boot")return;await vc();return}try{await ne.me()}catch(n){if(n instanceof Ue&&n.status===401){X({phase:"login"});return}X({phase:"error",error:me(n)});return}await vc()}}async function eS(n){if(!re.loggingIn){X({loggingIn:!0,error:null});try{await ne.login(n)}catch(a){X({loggingIn:!1,error:a instanceof Ue&&a.status===401?"密码不正确":`登录失败:${me(a)}`});return}X({loggingIn:!1,phase:"loading"}),await vc()}}async function vc(){try{const n=await ne.bootstrap();X({phase:"ready",error:null,offline:null,assistants:n.assistants,jobs:Tn(n.jobs),delegations:Tn(n.delegations??[]),routines:n.routines,approvals:Tn(n.approvals),settings:n.settings,theme:n.settings.settings.general.theme}),El(n.settings.settings.general.theme),localStorage.setItem(mh,n.settings.settings.general.theme),Xx||(Xx=ne.events({onEvent:Yf,onReconnect:()=>{X({offline:null}),vc()},onDown:o=>X({offline:o})},b0),nS());const a=re.sel&&n.assistants.some(o=>o.id===re.sel)?re.sel:n.assistants.find(o=>o.primary)?.id??n.assistants[0]?.id??null;a&&await Jt(a,cN()),re.page==="knowledge"&&_t();const i=re.panelStack.at(-1);i?.kind==="job"&&jh(i.id),i?.kind==="jobs"&&!re.worklog&&yc()}catch(n){X({phase:"error",error:me(n)})}}const xh=new Set;function Yf(n){switch((n.type==="item"||n.type==="delta")&&Vi.get(n.assistantId)?.push(n),n.type){case"rules":re.page==="settings"&&re.section==="rules"&&Gf();break;case"page-live":{const a=!re.livePages[n.callId];X(i=>({livePages:{...i.livePages,[n.callId]:n},...hw(n,{seen:!a,closed:xh.has(n.callId),assistantId:i.sel,inChat:i.page==="main"&&(i.mobile==="chat"||!window.matchMedia("(max-width: 767px)").matches)})?{panelStack:ts(i.panelStack,{kind:"file",path:"",full:!1,liveId:n.callId})}:{}}));break}case"assistant":{const a=n.assistant.unread>0&&T0(n.assistant.id);a&&ne.markRead(n.assistant.id).catch(()=>{});const i=a?{...n.assistant,unread:0}:n.assistant;X(o=>({assistants:$x(o.assistants,i),profiles:o.profiles[i.id]?{...o.profiles,[i.id]:{...o.profiles[i.id],assistant:i}}:o.profiles}));break}case"router-activity":X(a=>({assistants:a.assistants.map(i=>i.id===n.assistantId?{...i,activity:n.activity}:i)}));break;case"assistant_removed":X(a=>({assistants:a.assistants.filter(i=>i.id!==n.id),sel:a.sel===n.id?a.assistants.find(i=>i.primary)?.id??null:a.sel}));break;case"item":{const a=re.items[n.assistantId];if(!a)break;const i=re.pending[n.assistantId]??[],o=i.find(c=>kw(c,n.item));!o&&!a.some(c=>c.id===n.item.id)&&d0([n.item.id]),X(c=>({items:{...c.items,[n.assistantId]:c0(a,n.item)},...o?{pending:{...c.pending,[n.assistantId]:i.filter(d=>d!==o)}}:{}}));break}case"delta":{const a=re.items[n.assistantId];if(!a)break;const i=fw(a,n.itemId,n.text);i!==a&&X(o=>({items:{...o.items,[n.assistantId]:i}}));break}case"job":X(a=>({jobs:{...a.jobs,[n.job.id]:n.job}})),tS(n.job.status)&&re.panelStack.some(a=>a.kind==="job"&&a.id===n.job.id)&&re.steps[n.job.id]&&jh(n.job.id);break;case"delegation":X(a=>({delegations:{...a.delegations,[n.delegation.id]:n.delegation}}));break;case"job_step":{const a=re.steps[n.jobId];if(!a)break;X(i=>({steps:{...i.steps,[n.jobId]:Yw(a,n.step)}}));break}case"activity":{const a=re.jobs[n.jobId];if(!a)break;X(i=>({jobs:{...i.jobs,[n.jobId]:{...a,stats:n.stats,activity:[...a.activity,n.line].slice(-200)}}}));break}case"approval":X(a=>({approvals:{...a.approvals,[n.approval.id]:n.approval}}));break;case"draft":X(a=>({drafts:{...a.drafts,[n.draft.id]:n.draft}}));break;case"routine":X(a=>({routines:$x(a.routines,n.routine)}));break;case"routine_removed":X(a=>({routines:a.routines.filter(i=>i.id!==n.id),panelStack:a.panelStack.filter(i=>i.kind!=="routine"||i.id!==n.id)}));break;case"skills":ys(n.assistantId);break;case"knowledge":re.page==="knowledge"&&_t(!1,!0);break;case"profile":C0(n.assistantId);break}}function tS(n){return n==="done"||n==="stuck"||n==="failed"||n==="stopped"}function Vx(){ne.visibility(b0,document.visibilityState==="visible").catch(()=>{});const n=re.assistants.find(a=>a.id===re.sel);n&&n.unread>0&&T0(n.id)&&(X(a=>({assistants:a.assistants.map(i=>i.id===n.id?{...i,unread:0}:i)})),ne.markRead(n.id).catch(()=>{}))}function T0(n){return re.sel===n&&re.page==="main"&&globalThis.document?.visibilityState==="visible"&&(window.innerWidth>=768||re.mobile==="chat")}function nS(){_x||(_x=!0,document.addEventListener("visibilitychange",Vx),Vx())}async function Jt(n,a=!0,i=!1){X(c=>({sel:n,panelStack:nN(c.panelStack,c.sel,n,i),...c.sel!==n&&!i?{worklog:null}:{},...a?{mobile:"chat",...i?{}:{sheet:!1},search:!1}:{},quote:null}));const o=re.assistants.find(c=>c.id===n);o&&o.unread>0&&(X(c=>({assistants:c.assistants.map(d=>d.id===n?{...d,unread:0}:d)})),ne.markRead(n).catch(()=>{})),await Promise.all([sS(n),C0(n)])}const Al=new Map,Xi=new Map,Vi=new Map;async function sS(n){const a=(Al.get(n)??0)+1;Al.set(n,a),Xi.delete(n),Vi.set(n,[]),X(o=>({itemPages:{...o.itemPages,[n]:{hasMore:!1,loading:!1,error:null}}}));const i=new Set(Object.keys(re.livePages));try{const o=await ne.items(n);if(Al.get(n)!==a)return;const c=Vi.get(n)??[];Vi.delete(n),vw();const d=new Set((o.pageLive??[]).map(h=>h.callId));X(h=>{const m=Object.fromEntries(Object.entries(h.livePages).filter(([p,g])=>g.assistantId!==n||g.state==="done"||!i.has(p)||d.has(p)));return{livePages:m,panelStack:aN(h.panelStack,m)}});for(const h of o.pageLive??[])Yf({type:"page-live",...h});X(h=>({items:{...h.items,[n]:o.items},itemGen:{...h.itemGen,[n]:(h.itemGen[n]??0)+1},itemPages:{...h.itemPages,[n]:{hasMore:o.hasMore,loading:!1,error:null}},jobs:{...h.jobs,...Tn(o.jobs)},approvals:{...h.approvals,...Tn(o.approvals)},drafts:{...h.drafts,...Tn(o.drafts)},delegations:{...h.delegations,...Tn(o.delegations??[])}}));for(const h of c)Yf(h)}catch(o){if(Al.get(n)!==a)return;Vi.delete(n),X({notice:`无法加载对话:${me(o)}`})}}function bh(n,a=!1){const i=Xi.get(n);if(i)return i;const o=re.itemPages[n],c=re.items[n]?.[0]?.id;if(!o?.hasMore||!c||o.error&&!a)return Promise.resolve();const d=Al.get(n);X(m=>({itemPages:{...m.itemPages,[n]:{...o,loading:!0,error:null}}}));const h=(async()=>{try{const m=await ne.items(n,c);if(Al.get(n)!==d||re.sel!==n)return;X(p=>{const g=p.items[n]??[],v=new Set(g.map(x=>x.id));return{items:{...p.items,[n]:[...m.items.filter(x=>!v.has(x.id)),...g]},itemPages:{...p.itemPages,[n]:{hasMore:m.hasMore,loading:!1,error:null}},jobs:{...Tn(m.jobs),...p.jobs},approvals:{...Tn(m.approvals),...p.approvals},drafts:{...Tn(m.drafts),...p.drafts},delegations:{...Tn(m.delegations??[]),...p.delegations}}})}catch(m){Al.get(n)===d&&re.sel===n&&X(p=>({itemPages:{...p.itemPages,[n]:{...p.itemPages[n],loading:!1,error:me(m)}}}))}})();return Xi.set(n,h),h.finally(()=>{Xi.get(n)===h&&Xi.delete(n)}),h}async function C0(n){try{const a=await ne.profile(n);X(i=>({profiles:{...i.profiles,[n]:a}}))}catch(a){X({notice:`无法加载档案:${me(a)}`})}}function kh(n){X({text:n})}function xc(n){X({quote:n,nonce:re.nonce+1})}const E0=new Map,Kf=new Map,bc=new Map;function $l(n){return bc.get(n)??ne.fileUrl(n,{thumb:!0})}function Qx(n,a){const i=o=>o.some(c=>c.id===n)?o.map(c=>c.id===n?{...c,...a}:c):o;X(o=>({attachments:i(o.attachments),pending:Object.fromEntries(Object.entries(o.pending).map(([c,d])=>[c,d.map(h=>({...h,attachments:i(h.attachments)}))]))}))}function A0(n){const a=E0.get(n.id),i=ne.upload(a).then(o=>{const c=bc.get(Cc(n));return c&&bc.set(o,c),Qx(n.id,{status:"done",path:o}),o},o=>{throw Kf.delete(n.id),Qx(n.id,{status:"failed"}),o});return i.catch(()=>{}),Kf.set(n.id,i),i}function Jx(n){const a=Array.from(n).map(i=>{const o={id:`att-${Math.random().toString(36).slice(2,10)}`,name:i.name,status:"uploading"};return E0.set(o.id,i),Wi(i.name)&&bc.set(Cc(o),URL.createObjectURL(i)),o});X(i=>({attachments:[...i.attachments,...a]})),a.forEach(i=>void A0(i))}function Px(n){X(a=>({attachments:a.attachments.filter(i=>i.id!==n)}))}async function lS(n){return Promise.all(n.attachments.map(a=>Kf.get(a.id)??A0(a)))}function Zf(n,a,i){X(o=>{const c=o.pending[n]??[],d=i?c.map(h=>h.localId===a?{...h,...i}:h):c.filter(h=>h.localId!==a);return{pending:{...o.pending,[n]:d}}})}async function M0(n){Zf(n.assistantId,n.localId,{status:"sending",error:void 0});try{const a=await lS(n),i=await ne.sendMessage(n.assistantId,{text:n.text,quote:n.quote,files:a.length?a:void 0});X(o=>({pending:{...o.pending,[n.assistantId]:(o.pending[n.assistantId]??[]).filter(c=>c.localId!==n.localId)},...i?.item?{items:{...o.items,[n.assistantId]:c0(o.items[n.assistantId]??[],i.item)}}:{}}))}catch(a){Zf(n.assistantId,n.localId,{status:"failed",error:me(a)})}}async function Fx(){const n=re.sel,a=re.text.trim();if(!n||!a&&!re.attachments.length)return;const i={localId:`local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,assistantId:n,at:new Date().toISOString(),text:a,...re.quote?{quote:re.quote}:{},attachments:re.attachments,status:"sending"};d0([i.localId]),X(o=>({text:"",quote:null,attachments:[],nonce:o.nonce+1,pending:{...o.pending,[n]:[...o.pending[n]??[],i]}})),await M0(i)}function Wx(n,a){const i=re.pending[n]?.find(o=>o.localId===a);i&&M0(i)}function aS(n,a){Zf(n,a,null)}function z0(n,a){if(!a)return[];const i=n.pending[a]??[],o=n.items[a]??[];return i.length?[...o,...i.map(bw)]:o}function iS(n,a,i){return a?n.pending[a]?.find(o=>o.localId===i):void 0}async function rS(n){try{await ne.stopAssistant(n)}catch(a){X({notice:`停止失败:${me(a)}`})}}async function eb(n,a){const i=re.approvals[n];if(i){X(o=>({approvals:{...o.approvals,[n]:{...i,status:"answered",...a.key?{chosen:a.key}:{answerText:(a.text??"").trim()}}}}));try{await ne.answerApproval(n,a)}catch(o){X({approvals:{...re.approvals,[n]:i},notice:`提交失败:${me(o)}`})}}}async function oS(n){try{await ne.createDraft(n)}catch(a){X({notice:`创建助手失败:${me(a)}`})}}async function cS(n){try{await ne.archiveAssistant(n);const a=re.assistants.find(i=>i.primary);re.sel===n&&a&&await Jt(a.id)}catch(a){X({notice:`归档失败:${me(a)}`})}}async function uS(n){try{await ne.retryDelegation(n)}catch(a){X({notice:`重新转交失败:${me(a)}`})}}async function tb(n,a,i){await O0(n,a,i?"forward":"handback")}async function yh(n,a,i){await O0(n,a,i?"forward":"delegation")}async function R0(n,a){for(;re.sel===n&&!(re.items[n]??[]).some(a)&&re.itemPages[n]?.hasMore;){const i=re.items[n]?.[0]?.id;if(await bh(n),re.itemPages[n]?.error)throw new Error(re.itemPages[n].error);if(!i||re.items[n]?.[0]?.id===i)break}return(re.items[n]??[]).some(a)}async function O0(n,a,i){(re.sel!==n||!re.items[n])&&await Jt(n);const o=c=>i==="forward"?c.kind==="user"&&c.from?.delegationId===a:i==="handback"?c.kind==="note"&&c.handbackId===a:c.kind==="delegation"&&c.delegationId===a;try{if(!await R0(n,o)){X({notice:"未找到对应的转交消息"});return}requestAnimationFrame(()=>requestAnimationFrame(()=>document.getElementById(`${i}-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})))}catch(c){X({notice:`无法定位转交消息:${me(c)}`})}}async function Xf(n,a){try{return await ne.replyJob(n,a),!0}catch(i){return X({notice:`发送失败:${me(i)}`}),!1}}async function _0(n){try{await ne.stopJob(n)}catch(a){X({notice:`停止失败:${me(a)}`})}}const Po={};async function ys(n){const a=Po[n]=(Po[n]??0)+1;X(i=>({assistantSkills:{...i.assistantSkills,[n]:{skills:i.assistantSkills[n]?.skills??[],loaded:i.assistantSkills[n]?.loaded??!1,loading:!0,error:null}}}));try{const i=await ne.assistantSkills(n);Po[n]===a&&X(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:i,loaded:!0,loading:!1,error:null}}}))}catch(i){Po[n]===a&&X(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:o.assistantSkills[n]?.skills??[],loaded:o.assistantSkills[n]?.loaded??!1,loading:!1,error:me(i)}}}))}}async function wf(n,a,i){try{i==="rollback"?await ne.rollbackAssistantSkill(n,a):i==="delete"?await ne.deleteAssistantSkill(n,a):await ne.patchAssistantSkill(n,a,i==="enable"),await ys(n)}catch(o){X({notice:`操作失败:${me(o)}`})}}async function dS(n){try{return await ne.sedimentJob(n),!0}catch(a){return X({notice:`沉淀失败:${me(a)}`}),!1}}async function Nl(n,a){const i=re.routines.find(d=>d.id===n);if(!i)return;const{skill:o,...c}=a;X(d=>({routines:d.routines.map(h=>h.id===n?{...h,...c,...o!==void 0?{skill:o??void 0}:{}}:h)}));try{await ne.patchRoutine(n,a)}catch(d){X({routines:re.routines.map(h=>h.id===n?i:h),notice:`保存失败:${me(d)}`})}}async function fS(n){const a=new Set(re.routines.map(c=>c.id));let i;try{i=await ne.createRoutine(n)}catch(c){X({notice:`创建失败:${me(c)}`});return}const o=i?.id?i:re.routines.find(c=>!a.has(c.id));o&&X(c=>({panelStack:x0(c.panelStack,{kind:"routine",id:o.id})}))}async function hS(n){try{await ne.deleteRoutine(n)}catch(a){X({notice:`删除失败:${me(a)}`})}}async function mS(n){try{await ne.runRoutine(n)}catch(a){X({notice:`运行失败:${me(a)}`})}}async function kc(n,a){const i=re.assistants.find(c=>c.id===n),o=re.profiles[n];if(!i)return"助手不存在。";X(c=>({assistants:c.assistants.map(d=>d.id===n?{...d,...a}:d),profiles:c.profiles[n]?{...c.profiles,[n]:{...c.profiles[n],assistant:{...c.profiles[n].assistant,...a}}}:c.profiles}));try{return await ne.patchAssistant(n,a),null}catch(c){const d=`保存失败:${me(c)}`;return X(h=>({assistants:h.assistants.map(m=>m.id===n?i:m),profiles:o?{...h.profiles,[n]:o}:h.profiles,notice:d})),d}}async function pS(n,a,i){try{const o=await ne.patchAssistant(n,{rule:{text:a,mode:i}});if(!o?.rule)throw new Error("保存响应缺少规则。");const c=o.rule;return X(d=>{const h=d.profiles[n];return!h||h.rules.some(m=>m.id===c.id)?{}:{profiles:{...d.profiles,[n]:{...h,rules:[...h.rules,c]}}}}),null}catch(o){return`保存失败:${me(o)}`}}async function gS(n,a){try{return await ne.patchAssistant(n,{rule:a}),X(i=>{const o=i.profiles[n];return o?{profiles:{...i.profiles,[n]:{...o,rules:o.rules.map(c=>c.id===a.id?{...c,...a,changedAt:new Date().toISOString()}:c)}}}:{}}),null}catch(i){return`保存失败:${me(i)}`}}async function vS(n,a){const i=re.profiles[n];if(i){X(o=>({profiles:{...o.profiles,[n]:{...i,rules:i.rules.filter(c=>c.id!==a)}}}));try{await ne.deleteRule(n,a)}catch(o){X({profiles:{...re.profiles,[n]:i},notice:`删除失败:${me(o)}`})}}}async function jh(n){try{const{job:a,steps:i}=await ne.transcript(n);X(o=>({jobs:{...o.jobs,[a.id]:a},steps:{...o.steps,[a.id]:o.steps[a.id]?Kw(o.steps[a.id],i):i}}))}catch(a){X({notice:`无法加载任务过程:${me(a)}`})}}function Ln(n,a){X(i=>({panelStack:ts(i.panelStack,{kind:"job",id:n,round:a})})),jh(n)}function D0(n=null){X(a=>({panelStack:ts(a.panelStack,{kind:"jobs"})})),yc({assistantId:n,status:null})}function ur(){const n=re.panelStack.at(-1);n?.kind==="file"&&n.liveId&&xh.add(n.liveId),X(a=>({panelStack:v0(a.panelStack)}))}function dr(){for(const n of re.panelStack)n.kind==="file"&&n.liveId&&xh.add(n.liveId);X({panelStack:[]})}async function yc(n={}){const a=n.assistantId??null,i=n.status??null;X({worklog:{jobs:[],assistantId:a,status:i,hasMore:!1,loading:!0}});try{const o=await ne.jobs({...a?{assistantId:a}:{},...i?{status:i}:{},limit:30});$0(o,a,i)}catch(o){X({worklog:null,notice:`无法加载任务记录:${me(o)}`})}}async function nb(){const n=re.worklog;if(!n||!n.hasMore||n.loading)return;const a=n.jobs[n.jobs.length-1];X({worklog:{...n,loading:!0}});try{const i=await ne.jobs({...n.assistantId?{assistantId:n.assistantId}:{},...n.status?{status:n.status}:{},...a?{before:a.id}:{},limit:30});$0(i,n.assistantId,n.status)}catch(i){X(o=>({worklog:o.worklog?{...o.worklog,loading:!1}:null,notice:`无法加载更多:${me(i)}`}))}}function $0(n,a,i){X(o=>{const c=new Set((o.worklog?.jobs??[]).map(h=>h.id));return{worklog:{jobs:o.worklog&&o.worklog.assistantId===a&&o.worklog.status===i?[...o.worklog.jobs,...n.jobs.filter(h=>!c.has(h.id))]:n.jobs,assistantId:a,status:i,hasMore:n.hasMore,loading:!1},jobs:{...o.jobs,...Tn(n.jobs)}}})}function lr(){X({nonce:re.nonce+1,mobile:"chat",sheet:!1})}function U0(){const n=re.assistants.find(a=>a.primary);n&&(Jt(n.id),X({text:"我想创建一个专属助手,负责:",nonce:re.nonce+1,mobile:"chat",sheet:!1}))}async function xS(n,a){(re.sel!==n||!re.items[n])&&await Jt(n),requestAnimationFrame(()=>{document.getElementById(`job-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})})}function L0(n){X(a=>({panelStack:ts(a.panelStack,{kind:"routine",id:n})}))}function bS(){X(n=>({panelStack:ts(n.panelStack,{kind:"newRoutine"})}))}function wh(){X(n=>({panelStack:ts(n.panelStack,{kind:"assistant"})}))}function Fo(n){X(a=>({panelStack:ts(a.panelStack,{kind:n})}))}async function H0(n,a,i){const o={items:[],loaded:!1,loading:!1,loadingMore:!1,hasMore:!1,error:null},c=re[n][a]??o;if(!(c.loading||i&&(!c.loaded||!c.hasMore))){X(d=>({[n]:{...d[n],[a]:{...c,loading:!0,loadingMore:i,error:null}}}));try{const d=i?c.cursor:void 0,h=n==="sidebarJobs"?await ne.jobs({assistantId:a,before:d,limit:20}).then(E=>({items:E.jobs,hasMore:E.hasMore})):await ne.knowledge({origin:"output",assistantId:a,before:d,limit:30}).then(E=>({items:E.entries,hasMore:E.hasMore})),m=i?[...c.items,...h.items]:[...h.items,...c.items],p=new Set,g=m.filter(E=>!p.has(E.id)&&!!p.add(E.id)),v=h.items.at(-1),x=i||!c.loaded?v&&("createdAt"in v&&n==="sidebarJobs"?v.id:v.updatedAt):c.cursor,w=i||!c.loaded?h.hasMore:c.hasMore||h.hasMore;X(E=>({[n]:{...E[n],[a]:{items:g,loaded:!0,loading:!1,loadingMore:!1,hasMore:w,error:null,cursor:x}}}))}catch(d){X(h=>({[n]:{...h[n],[a]:{...c,loading:!1,loadingMore:!1,failedMore:i,error:me(d)}}}))}}}function Nf(n,a=!1){return H0("sidebarJobs",n,a)}function Sf(n,a=!1){return H0("sidebarFiles",n,a)}let sb=!1;async function kS(){if(sb)return;const n=await ne.knowledge({limit:1});sb=!0,X(a=>({knowledge:{...a.knowledge,collections:n.collections,collectionsLoaded:!0}}))}function lb(n,a,i){X({menu:{id:n,x:a,y:i}})}function Tf(){re.menu&&X({menu:null})}let Cf=0;async function _t(n=!1,a=!1){if(n&&(re.knowledge.loading||!re.knowledge.hasMore))return;const i=re.knowledge,o=++Cf;X({knowledge:{...i,loading:n||i.entries.length===0,error:null}});try{const c=await ne.knowledge({...i.category==="output"||i.category==="chat"?{origin:i.category}:i.category!=="all"?{collection:i.category}:{},q:i.q,kind:i.kind||void 0,assistantId:i.assistantId,before:n?i.entries.at(-1)?.updatedAt:void 0,limit:a?Math.min(200,Math.max(50,i.entries.length)):50});if(o!==Cf)return;X({knowledge:{...re.knowledge,entries:n?[...i.entries,...c.entries]:c.entries,collections:c.collections,collectionsLoaded:!0,hasMore:c.hasMore,loading:!1}})}catch(c){o===Cf&&X({knowledge:{...re.knowledge,loading:!1,error:me(c)}})}}function zl(n){X({knowledge:{...re.knowledge,...n,hasMore:!1}}),_t()}async function B0(n,a=!0){try{const i=await ne.createKnowledgeCollection(n.trim());return a?zl({category:i.id}):await _t(!1,!0),i}catch(i){return X({notice:`新建失败:${me(i)}`}),null}}async function yS(n,a){try{return await ne.renameKnowledgeCollection(n,a.trim()),await _t(!1,!0),!0}catch(i){return X({notice:`改名失败:${me(i)}`}),!1}}async function jS(n){try{const{deleted:a}=await ne.deleteKnowledgeCollection(n);re.knowledge.category===n?zl({category:"all"}):await _t(!1,!0),X({notice:a?`已删除知识库,一起删掉 ${a} 个文件`:"已删除知识库"})}catch(a){X({notice:`删除失败:${me(a)}`})}}async function uc(n,a){try{return await ne.patchKnowledgeEntry(n,a),await _t(!1,!0),!0}catch(i){return X({notice:`保存失败:${me(i)}`}),!1}}async function wS(n){try{await ne.deleteKnowledgeEntry(n),await _t(!1,!0)}catch(a){X({notice:`删除失败:${me(a)}`})}}async function NS(n,a){try{await ne.uploadKnowledge(n,a),await _t(!1,!0)}catch(i){X({notice:`上传失败:${me(i)}`})}}function Nh(){X({page:"knowledge",panelStack:[],sheet:!1}),_t()}function ar(){X({page:"main",panelStack:[]})}async function SS(n,a){X({page:"main",panelStack:[]}),await Jt(n);try{if(!await R0(n,c=>c.id===a)){X({notice:"未找到对应的对话消息"});return}const i=performance.now()+1500,o=()=>{if(re.page!=="main"||re.sel!==n)return;const c=Array.from(document.querySelectorAll("[data-item-id]")).find(d=>d.dataset.itemId===a);if(!c){performance.now()<i?requestAnimationFrame(o):X({notice:"没能定位到这条消息"});return}f0(c)};requestAnimationFrame(o)}catch(i){X({notice:`无法定位对话消息:${me(i)}`})}}function Ac(){X({page:"settings",section:null,sub:null,sheet:!1,search:!1,panelStack:[]})}function Vf(){X({page:"main",panelStack:[]})}function Rl(n){X({section:n,sub:null})}function En(n){X({sub:n})}function Gt(){X({sub:null})}function Ef(){X(n=>({nowWide:!n.nowWide}))}function TS(){X({collapsed:!0,sheet:!1})}function CS(){X({collapsed:!1,panelStack:[]})}function q0(n){X({query:n})}function Qf(n){X({mobile:n,sheet:!1,search:!1})}function ES(){X({sheet:!0})}function I0(){X({sheet:!1})}function ab(n){X({search:n,query:n?re.query:""})}function AS(){X({notice:null})}function Za(n){X({notice:n})}function MS(){X({updateReady:!0})}function zS(){X({tick:re.tick+1})}function It(n,a){return ne.fileUrl(n,a)}function Sh(n){return ne.fileMeta(n)}function G0(n,a){return ne.jobFiles(n,a)}function zt(n,a,i){X(o=>({panelStack:ts(o.panelStack,{kind:"file",path:n,full:!1,...a?{title:a}:{},...i})}))}function RS(n){X(a=>({panelStack:ts(a.panelStack,{kind:"file",path:"",full:!1,liveId:n})}))}function OS(){X(n=>{const a=n.panelStack.at(-1);return a?.kind==="file"?{panelStack:x0(n.panelStack,{...a,full:!a.full})}:{}})}const _S=500,ib=10;function Y0(n){const a=k.useRef(null),i=k.useRef(null),o=k.useRef(!1),c=()=>{a.current!==null&&window.clearTimeout(a.current),a.current=null,i.current=null};return k.useEffect(()=>c,[]),{handlers:{onContextMenu(h){h.preventDefault(),c(),lb(n.id,h.clientX,h.clientY)},onPointerDown(h){h.pointerType==="touch"&&(c(),o.current=!1,i.current={x:h.clientX,y:h.clientY},a.current=window.setTimeout(()=>{a.current=null;const m=i.current;m&&(o.current=!0,window.setTimeout(()=>o.current=!1,1e3),lb(n.id,m.x,m.y))},_S))},onPointerMove(h){const m=i.current;m&&(Math.abs(h.clientX-m.x)>ib||Math.abs(h.clientY-m.y)>ib)&&c()},onPointerUp:c,onPointerCancel:c},takeHeld(){return o.current?(o.current=!1,!0):!1}}}function rb(){const n=we(),a=n.menu,i=k.useRef(null);if(k.useEffect(()=>{if(!a)return;const p=v=>{i.current&&!i.current.contains(v.target)&&Tf()},g=v=>{v.key==="Escape"&&Tf()};return document.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",g),()=>{document.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",g)}},[a]),!a)return null;const o=n.assistants.find(p=>p.id===a.id);if(!o)return null;const c=p=>{Tf(),p()},d=o.primary?1:3,h=Math.max(8,Math.min(a.x,window.innerWidth-172)),m=Math.max(8,Math.min(a.y,window.innerHeight-(d*34+16)));return s.jsxs("div",{className:"amenu",ref:i,style:{left:h,top:m,transformOrigin:`${a.x-h}px ${a.y-m}px`},onContextMenu:p=>p.preventDefault(),children:[o.primary?null:s.jsx("button",{onClick:()=>c(()=>void kc(o.id,{pinned:!o.pinned})),children:o.pinned?"取消置顶":"放在顶部"}),o.primary?null:s.jsx("button",{onClick:()=>c(()=>void kc(o.id,{hidden:!o.hidden})),children:o.hidden?"放回列表":"收起这个助手"}),s.jsx("button",{onClick:()=>c(()=>{Jt(o.id,!1),wh()}),children:"助手设置"})]})}const DS={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp"},$S=/^(?:image|blob|clipboard|pasted|snapshot|untitled|无标题|未命名)(?:[-_ ]?\d+)?(?:\.[a-z0-9]+)?$/i;function Ki(n){return String(n).padStart(2,"0")}function US(n){return`${n.getFullYear()}${Ki(n.getMonth()+1)}${Ki(n.getDate())}-${Ki(n.getHours())}${Ki(n.getMinutes())}${Ki(n.getSeconds())}`}function LS(n){const a=n.name.lastIndexOf(".");return a>0?n.name.slice(a).toLowerCase():DS[n.type]??""}function HS(n){if(!n)return[];const a=[];for(const i of Array.from(n.items??[])){if(i.kind!=="file")continue;const o=i.getAsFile();o&&a.push(o)}if(!a.length)for(const i of Array.from(n.files??[]))i&&a.push(i);return a}function BS(n,a=new Date){const i=HS(n);if(!i.length)return[];if((n?.getData?.("text/plain")??"").trim())return[];const o=US(a),c=i.length>1;return i.map((d,h)=>{if(d.name&&!$S.test(d.name))return d;const m=`截图-${o}${c?`-${h+1}`:""}${LS(d)}`;return new File([d],m,{type:d.type,lastModified:a.getTime()})})}const K0={};for(const[n,a]of Object.entries({image:"png jpg jpeg gif webp bmp ico avif",table:"csv tsv xls xlsx ods",code:"ts tsx js jsx mjs cjs py go sh bash zsh json jsonl yaml yml toml xml css scss java c cpp h rs rb php sql vue svelte",doc:"md markdown txt pdf doc docx odt rtf",globe:"html htm svg",archive:"zip rar 7z tar gz bz2 xz tgz"}))for(const i of a.split(" "))K0[i]=n;function Ul(n){const a=n.split(/[\\/]/).pop()??"",i=a.lastIndexOf(".");return i>0?K0[a.slice(i+1).toLowerCase()]??"file":"file"}const Z0={search:'<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',plus:'<path d="M12 5v14M5 12h14"/>',edit:'<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>',gear:'<path d="M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',dbl:'<path d="m6 17 5-5-5-5M13 17l5-5-5-5"/>',left:'<path d="m15 18-6-6 6-6"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/>',pause:'<circle cx="12" cy="12" r="9"/><path d="M10 9v6M14 9v6"/>',check:'<path d="M5 12.5 10 17l9-10"/>',spin:'<path d="M12 3a9 9 0 1 0 9 9" />',out:'<path d="M7 17 17 7M8.5 7H17v8.5"/>',reply:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v3"/>',smile:'<circle cx="12" cy="12" r="9"/><path d="M8.5 14.5s1.3 1.8 3.5 1.8 3.5-1.8 3.5-1.8M9 9.5h.01M15 9.5h.01"/>',more:'<circle cx="5" cy="12" r="1.2"/><circle cx="12" cy="12" r="1.2"/><circle cx="19" cy="12" r="1.2"/>',doc:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',folder:'<path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',table:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><path d="M3.5 9.5h17M3.5 14.5h17M10 9.5v10"/>',code:'<path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 5l-4 14"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>',archive:'<rect x="4" y="7" width="16" height="13" rx="2"/><rect x="3" y="4" width="18" height="4" rx="1"/><path d="M10 12h4"/>',panel:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M15 4v16"/>',mem:'<path d="M12 3.5 14 9l5.5 2-5.5 2-2 5.5-2-5.5L4.5 11 10 9z"/>',rule:'<path d="M12 3 4 6v6c0 4.5 3.4 8.2 8 9 4.6-.8 8-4.5 8-9V6z"/><path d="m8.5 12 2.5 2.5 4.5-5"/>',chev:'<path d="m9 6 6 6-6 6"/>',down:'<path d="m6 9 6 6 6-6"/>',arrowDown:'<path d="M12 5v14M5.5 12.5 12 19l6.5-6.5"/>',updown:'<path d="m8 9 4-4 4 4M8 15l4 4 4-4"/>',bulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6M10 22h4"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>',send:'<path d="M12 20V5M5.5 11.5 12 5l6.5 6.5"/>',close:'<path d="m6 6 12 12M18 6 6 18"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M15 6.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h1.5"/>',split:'<path d="M4 5h4l8 14h4M4 19h4l8-14h4"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="2"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 7.9h.01"/>',term:'<path d="m5 16 5-4-5-4M12 17h7"/>',dl:'<path d="M12 4v11M7.5 11.5 12 16l4.5-4.5"/><path d="M5 20h14"/>',expand:'<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>',shrink:'<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/>',pointer:'<path d="m5 3 6.5 17 2.3-7.2L21 10.5Z"/>',image:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><circle cx="9" cy="10" r="1.6"/><path d="m20.5 16-4.5-4.5L7 19.5"/>'};function jc(n,a=16){return`<svg class="i" width="${a}" height="${a}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Z0[n]}</svg>`}function Q({name:n,size:a=16,w:i=1.7,className:o,style:c}){return s.jsx("svg",{className:`i${o?` ${o}`:""}`,width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:i,strokeLinecap:"round",strokeLinejoin:"round",style:c,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Z0[n]}})}const _a=["......k.....",".....kok....",".....kook...","..k.koook...",".kokoooook..",".kooooooook.","kooyyyyyyook","koyyeyyeyyok","koyyeyyeyyok","koyyyyyyyyok",".kooyyyyook.","..kkkkkkkk.."],Sn=16,ob="#40261a",Ia={orange:{name:"橙",o:"#ff7a2e",y:"#ffcf4a",bg:"#ffe6d3"},red:{name:"红",o:"#ff5a3c",y:"#ffd2a8",bg:"#ffe3dc"},pink:{name:"粉",o:"#ff6b8a",y:"#ffd6de",bg:"#ffe4ef"},purple:{name:"紫",o:"#8f7bff",y:"#ddd6ff",bg:"#e9e5ff"},blue:{name:"蓝",o:"#4ea3ff",y:"#cfe6ff",bg:"#fff0c4"},slate:{name:"灰蓝",o:"#6f8fb3",y:"#d8e5f2",bg:"#e3eeff"},teal:{name:"青",o:"#20b8b0",y:"#c2f0ea",bg:"#d6f3f1"},green:{name:"绿",o:"#2fbf71",y:"#c9f2da",bg:"#e4f5d9"}},Ve=(n,a)=>[...Array(n).fill(""),...a],_l={hob:{label:"主助手",color:"orange",dx:2,pal:{},art:[]},page:{label:"写作/文档",color:"purple",dx:1,pal:{p:"#ff9db0",g:"#b9c0c8",h:"#ffc21a",b:"#f2c58f"},art:Ve(5,["............kkkk","............kppk","............kppk","............kggk","............khhk","............khhk","............khhk","............khhk","............kbbk",".............kk."])},server:{label:"服务器/运维",color:"slate",dx:2,pal:{h:"#ffc21a",w:"#fff1b8"},art:Ve(2,["......kkkk......",".....khhwwk.....","....khhhhwhk....","....khhhhhhk....","...kkkkkkkkkk..."])},bird:{label:"资讯/动态",color:"blue",dx:0,pal:{l:"#dff3ff",w:"#ffffff"},art:Ve(6,["..........kkkk..",".........kllllk.",".........kwlllk.",".........kllllk.",".........kllllk.","..........kkkk..",".............kk.","..............kk","...............k"])},house:{label:"家/NAS/生活",color:"teal",dx:0,pal:{r:"#ff8b6a",w:"#fff7ea",d:"#9b6b52"},art:Ve(9,["............k...","...........krk..","..........krrrk.",".........krrrrrk","..........kwwwk.","..........kwdwk.","..........kkkkk."])},coin:{label:"钱/记账",color:"green",dx:0,pal:{h:"#ffc21a",w:"#fff1b8",d:"#d18f00"},art:Ve(9,["...........kkk..","..........khhhk.",".........khwdhhk",".........khwdhhk",".........khhdhhk","..........khhhk.","...........kkk.."])},book:{label:"学习/读书",color:"red",dx:2,pal:{d:"#3a3f58",t:"#ffc21a"},art:Ve(1,[".......kk.......",".....kkddkk.....","...kkddddddkk...",".kkddddddddddkk.","...kkddddddkk.t.","....kddddddk..t.","....kkkkkkkk..t.","..............t."])},leaf:{label:"健康/植物",color:"pink",dx:2,pal:{g:"#5ccf6b",s:"#3a9a4f"},art:Ve(0,["....kk.....kk...","...kggk...kggk..","....kggkskggk...",".....kk.s.kk...."])},wifi:{label:"网络/路由器",color:"teal",dx:2,pal:{},art:Ve(0,["......kkkkk.....",".....k.....k....",".......kkk......","......k...k....."])},calendar:{label:"日程/提醒",color:"purple",dx:0,pal:{r:"#ff4d4d",w:"#ffffff"},art:Ve(8,["..........k...k.",".........kkkkkkk",".........krrrrrk",".........kkkkkkk",".........kwwwwwk",".........kwwkwwk",".........kwwwwwk",".........kkkkkkk"])},chef:{label:"做饭/饮食",color:"red",dx:2,pal:{w:"#ffffff",g:"#d9dde2"},art:Ve(1,[".....kk..kk.....","....kwwkkwwk....","...kwwwwwwwwk...","...kwwwwwwwwk...","....kwwwwwwk....","....kggggggk....","....kkkkkkkk...."])},chart:{label:"股票/数据",color:"slate",dx:0,pal:{w:"#ffffff",g:"#f04848"},art:Ve(9,[".........kkkkkkk",".........kwwwwgk",".........kwwgwgk",".........kwwgwgk",".........kgwgwgk",".........kgwgwgk",".........kkkkkkk"])},bag:{label:"旅行/出行",color:"blue",dx:0,pal:{b:"#e8833a",s:"#ffd59a"},art:Ve(9,["...........kkk..","...........k.k..",".........kkkkkkk",".........kbsbsbk",".........kbsbsbk",".........kbsbsbk",".........kkkkkkk"])},paw:{label:"宠物",color:"purple",dx:0,pal:{c:"#ffb36b",p:"#ff8fa6"},art:Ve(9,[".........k.....k",".........kck.kck",".........kccccck",".........kckckck",".........kccpcck","..........kkkkk."])},note:{label:"音乐",color:"pink",dx:1,pal:{},art:Ve(2,["..............k.","..............kk","..............kk","..............k.","..............k.","............kkk.","............kkk."])},code:{label:"代码/开发",color:"green",dx:0,pal:{d:"#2b3240",g:"#6ef0a0"},art:Ve(10,[".........kkkkkkk",".........kgddddk",".........kdgdddk",".........kgdggdk",".........kdddddk",".........kkkkkkk"])},gym:{label:"健身/运动",color:"blue",dx:2,pal:{r:"#ff3b5c"},art:Ve(9,["...krrrrrrrrk...","..krrrrrrrrrrkr.","...............r"])},sticky:{label:"需求/产品负责人",color:"purple",dx:0,pal:{n:"#ffe066",d:"#c9a227"},art:Ve(9,[".........kkkkkkk",".........knnnnnk",".........kdddnnk",".........knnnnnk",".........kddddnk",".........knnnnkk",".........kkkkkk."])},timer:{label:"迭代/敏捷教练",color:"teal",dx:0,pal:{w:"#ffffff",r:"#ff5a3c"},art:Ve(8,["...........kkk..","............k...","..........kkkkk.",".........kwwrwwk",".........kwwrwwk",".........kwwkkwk",".........kwwwwwk","..........kkkkk."])},bug:{label:"测试/质量",color:"green",dx:0,pal:{r:"#ff4d4d"},art:Ve(8,["..........k...k.","...........kkk..","..........krrrk.",".........krkrkrk",".........krrrrrk",".........krkrkrk","..........krrrk.","...........kkk.."])},magnifier:{label:"代码审查/调研",color:"blue",dx:0,pal:{l:"#cfe8ff",w:"#ffffff",h:"#8a5a3c"},art:Ve(8,["..........kkk...",".........kwllk..",".........kllllk.",".........kllllk.","..........kkkk..",".............hh.","..............hh"])},blocks:{label:"架构/系统设计",color:"slate",dx:0,pal:{a:"#ff8b6a",b:"#4ea3ff",c:"#ffc21a"},art:Ve(9,["...........kkkk.","...........kaak.","...........kaak.",".........kkkkkkk",".........kbbkcck",".........kbbkcck",".........kkkkkkk"])},rocket:{label:"发布/部署",color:"purple",dx:0,pal:{w:"#e8edf3",r:"#ff5a3c",b:"#4ea3ff",f:"#ffb020"},art:Ve(6,["............k...","...........krk..","...........krk..","..........kwwwk.","..........kwbwk.","..........kwwwk.","..........kwwwk.",".........krwwwrk",".........kkkkkkk","...........kfk.."])},shield:{label:"安全/权限",color:"blue",dx:0,pal:{s:"#5b8def",w:"#ffffff"},art:Ve(9,[".........kkkkkkk",".........kssswsk",".........kwswssk",".........kswsssk","..........ksssk.","...........ksk..","............k..."])},database:{label:"数据库/数据",color:"teal",dx:0,pal:{d:"#5fa8ff",t:"#cfe6ff"},art:Ve(8,["..........kkkkk.",".........ktttttk",".........kkkkkkk",".........kdddddk",".........kkkkkkk",".........kdddddk","..........kkkkk."])},palette:{label:"界面/视觉设计",color:"pink",dx:0,pal:{p:"#f2c58f",a:"#ff4d4d",b:"#4ea3ff",c:"#5ccf6b"},art:Ve(9,["..........kkkkk.",".........kpppppk",".........kpapbpk",".........kppppk.",".........kpcppk.","..........kkkk.."])},siren:{label:"值班/告警",color:"red",dx:2,pal:{r:"#ff3b3b",w:"#ffd0d0"},art:Ve(1,["..k...kkkk...k..","...k.krwrrk.k...",".....krrrrk.....","....kkkkkkkk...."])},kanban:{label:"项目管理/看板",color:"green",dx:0,pal:{w:"#ffffff",a:"#ff8b6a",b:"#ffc21a",c:"#5ccf6b"},art:Ve(9,[".........kkkkkkk",".........kakbkck",".........kakwkck",".........kwkbkwk",".........kwkwkwk",".........kkkkkkk"])},wrench:{label:"维护/修复",color:"slate",dx:0,pal:{g:"#b9c0c8"},art:Ve(8,["............k.k.","...........kgkgk","...........kgggk","..........kgggk.",".........kggk...","........kggk....","........kgk.....","........kk......"])},bolt:{label:"性能/优化",color:"purple",dx:0,pal:{b:"#ffc21a"},art:Ve(8,["............kkk.","...........kbbk.","..........kbbk..",".........kbbbbk.","..........kkbbk.","...........kbk..","..........kbk...","..........kk...."])}},qS=Object.keys(_l),IS=Object.keys(Ia);function X0(n){if(n==="custom")return{prop:"custom",color:"orange"};if(n.startsWith("custom:")){const d=n.slice(7);return Object.hasOwn(Ia,d)?{prop:"custom",color:d}:void 0}const[a,i,...o]=n.split(":");if(o.length||!Object.hasOwn(_l,a))return;const c=a;return i===void 0?{prop:c,color:_l[c].color}:Object.hasOwn(Ia,i)?{prop:c,color:i}:void 0}function Af(n){return n==="orange"?"custom":`custom:${n}`}const GS=/^#[0-9a-f]{6}$/;function YS(n){if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"prop_art 要是一个对象:art(字符串数组)、pal(字母 → 颜色)、dx(0|1|2)"};const{art:a,pal:i,dx:o}=n;if(!Array.isArray(a)||a.length===0)return{ok:!1,error:"prop_art.art 要是非空的字符串数组"};if(a.length>Sn)return{ok:!1,error:`prop_art.art 最多 ${Sn} 行,收到 ${a.length} 行`};for(const p of a){if(typeof p!="string")return{ok:!1,error:"prop_art.art 的每行都要是字符串"};if([...p].length!==Sn)return{ok:!1,error:`prop_art.art 每行要正好 ${Sn} 个字符,这一行是 ${[...p].length} 个:「${p}」`}}if(!i||typeof i!="object"||Array.isArray(i))return{ok:!1,error:"prop_art.pal 要是对象:单个小写字母 → #rrggbb"};const c=Object.entries(i);if(c.length>6)return{ok:!1,error:`prop_art.pal 最多 6 种颜色,收到 ${c.length} 种`};for(const[p,g]of c){if(!/^[a-z]$/.test(p))return{ok:!1,error:`pal 的键要是单个小写字母,收到「${p}」`};if(p==="k")return{ok:!1,error:"pal 不能有 k:描边色是固定的,art 里直接用 k 就行"};if("oye".includes(p))return{ok:!1,error:`pal 不能用 ${p}:这是火苗自己的颜色`};if(typeof g!="string"||!GS.test(g))return{ok:!1,error:`pal[${p}] 要是 #rrggbb 格式的颜色,收到「${String(g)}」`}}const d=a.join("");for(const p of new Set([...d].filter(g=>g!==".")))if(p!=="k"&&!Object.hasOwn(i,p))return{ok:!1,error:`art 里的「${p}」没有在 pal 里定义颜色`};const h=[...d].filter(p=>p!==".").length;if(h<6)return{ok:!1,error:`至少要画 6 个像素,现在只有 ${h} 个`};if(o!==0&&o!==1&&o!==2)return{ok:!1,error:`prop_art.dx 要是 0、1 或 2,收到 ${String(o)}`};const m=Sn-_a.length;for(let p=0;p<_a.length;p++)for(let g=0;g<_a[p].length;g++){if(_a[p][g]!=="e")continue;const x=a[m+p]?.[o+g];if(x&&x!==".")return{ok:!1,error:`art 第 ${m+p+1} 行第 ${o+g+1} 列会盖住火苗的眼睛,把图案挪开(或调小 dx)`}}return{ok:!0,prop:{art:a,pal:i,dx:o}}}function Mf(n,a){return a===_l[n].color?n:`${n}:${a}`}function KS(n,a){const i=X0(n)??{prop:"hob",color:"slate"},o=i.prop==="custom"&&a?YS(a):void 0,c=i.prop==="custom"?o?.ok?o.prop:_l.hob:_l[i.prop],d=Ia[i.color],h=[...Array(Sn-_a.length).fill(""),..._a].map((x,w)=>{const E=x?`${".".repeat(c.dx)}${x}`.padEnd(Sn,"."):".".repeat(Sn),T=c.art[w]??"";return[...E].map((C,M)=>T[M]&&T[M]!=="."?T[M]:C).join("")});let[m,p,g,v]=[Sn,Sn,0,0];return h.forEach((x,w)=>[...x].forEach((E,T)=>{E!=="."&&([m,p,g,v]=[Math.min(m,T),Math.min(p,w),Math.max(g,T+1),Math.max(v,w+1)])})),{rows:h,pal:{k:ob,e:ob,o:d.o,y:d.y,...c.pal},bg:d.bg,offset:[(m+g-Sn)/2,(p+v-Sn)/2]}}function ZS(n){const a=[];return{body:n.rows.map((o,c)=>[...o].map((d,h)=>d!=="e"?d:(a.push([h,c]),"y")).join("")),eyes:a}}function cb({art:n}){const a=[];return n.rows.forEach((i,o)=>{for(let c=0;c<i.length;){const d=i[c];let h=c+1;for(;h<i.length&&i[h]===d;)h++;d!=="."&&n.pal[d]&&a.push({x:c,y:o,w:h-c,fill:n.pal[d]}),c=h}}),s.jsx(s.Fragment,{children:a.map((i,o)=>s.jsx("rect",{x:i.x,y:i.y,width:i.w+.02,height:1.02,fill:i.fill},o))})}const XS={busy:"正在工作",ask:"等你确认",stuck:"受阻",done:"已完成,未读"},VS=4,QS=7;function ut({sprite:n,prop:a,size:i,title:o,onClick:c,motion:d,mark:h,free:m,slot:p}){const g=k.useRef(h);h&&(g.current=h);const v=h??g.current,x=KS(n,a),w=d?ZS(x):void 0,E=d==="peek"?`${(p??0)%QS*VS}s`:d?`${-([...n].reduce((T,C)=>(T*31+C.charCodeAt(0))%9973,7)%4e3)/1e3}s`:void 0;return s.jsxs("div",{className:`av${m?" av-free":""}${d?` av-motion av-${d}`:""} av-marked`,title:o,onClick:c,style:{"--av-size":`${i}px`,"--av-bg":x.bg},children:[s.jsx("svg",{viewBox:`${x.offset[0]} ${x.offset[1]} 16 16`,shapeRendering:"crispEdges","aria-hidden":"true",style:E?{"--eye-delay":E}:void 0,children:w?s.jsxs(s.Fragment,{children:[s.jsx(cb,{art:{...x,rows:w.body}}),s.jsx("g",{className:"av-eyes",children:s.jsx("g",{className:"av-blink",children:w.eyes.map(([T,C])=>s.jsx("rect",{x:T,y:C,width:1.02,height:1.02,fill:x.pal.e},`${T}-${C}`))})})]}):s.jsx(cb,{art:x})}),s.jsx("span",{className:`av-mark${h?" present":""}${v?` ${v}`:""}`,"aria-label":h?XS[h]:void 0,"aria-hidden":!h,children:s.jsx("span",{className:"av-mark-icon",children:v==="busy"?s.jsxs("svg",{viewBox:"0 0 13 5",children:[s.jsx("circle",{cx:"2.5",cy:"2.5",r:"1.5"}),s.jsx("circle",{cx:"6.5",cy:"2.5",r:"1.5"}),s.jsx("circle",{cx:"10.5",cy:"2.5",r:"1.5"})]}):v==="done"?s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",children:s.jsx("path",{d:"M3 8.5 6.5 12 13 4.5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}):v==="ask"?"?":v==="stuck"?"!":null},v)})]})}const JS=80;function V0(n){return Math.max(0,n.height-n.view)}function PS(n,a,i){const o=V0(i);return n?o:Math.min(a,o)}function FS(n,a,i){return i.height-i.top-i.view<JS?{stuck:!0,expect:i.top}:i.top<Math.min(a,V0(i))-2?{stuck:!1,expect:i.top}:{stuck:n,expect:i.top}}var fr=r0();async function Th(n){try{const a=navigator.clipboard;return a?.writeText?(await a.writeText(n),!0):!1}catch{return!1}}const WS="modulepreload",e2=function(n){return"/"+n},ub={},hr=function(a,i,o){let c=Promise.resolve();if(i&&i.length>0){let h=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=h(i.map(g=>{if(g=e2(g),g in ub)return;ub[g]=!0;const v=g.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":WS,v||(w.as="script"),w.crossOrigin="",w.href=g,p&&w.setAttribute("nonce",p),document.head.appendChild(w),v)return new Promise((E,T)=>{w.addEventListener("load",E),w.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return c.then(h=>{for(const m of h||[])m.status==="rejected"&&d(m.reason);return a().catch(d)})};function Ch(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ll=Ch();function Q0(n){Ll=n}var Cl={exec:()=>null};function Sl(n){let a=[];return i=>{let o=Math.max(0,Math.min(3,i-1)),c=a[o];return c||(c=n(o),a[o]=c),c}}function Ee(n,a=""){let i=typeof n=="string"?n:n.source,o={replace:(c,d)=>{let h=typeof d=="string"?d:d.source;return h=h.replace(xt.caret,"$1"),i=i.replace(c,h),o},getRegex:()=>new RegExp(i,a)};return o}var J0=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),xt={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Sl(n=>new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:</?(?:${pr})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}>`))},t2=/^(?:[ \t]*(?:\n|$))+/,n2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,s2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,mr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,l2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Eh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,P0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,F0=Ee(P0).replace(/bull/g,Eh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),a2=Ee(P0).replace(/bull/g,Eh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ah=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,i2=/^[^\n]+/,Mh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,r2=Ee(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mh).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),o2=Ee(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Eh).getRegex(),pr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,c2=Ee("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",zh).replace("tag",pr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),W0=n=>Ee(Ah).replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",pr).getRegex(),u2=W0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),d2=W0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),f2=Ee(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",d2).getRegex(),Rh={blockquote:f2,code:n2,def:r2,fences:s2,heading:l2,hr:mr,html:c2,lheading:F0,list:o2,newline:t2,paragraph:u2,table:Cl,text:i2},db=Ee("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",pr).getRegex(),h2={...Rh,lheading:a2,table:db,paragraph:Ee(Ah).replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",db).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",pr).getRegex()},m2={...Rh,html:Ee(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",zh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Cl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ee(Ah).replace("hr",mr).replace("heading",` *#{1,6} *[^
|
|
107
|
+
]`).replace("lheading",F0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},p2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,g2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ek=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,v2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ns=/[\p{P}\p{S}]/u,Xa=/[\s\p{P}\p{S}]/u,gr=/[^\s\p{P}\p{S}]/u,x2=Ee(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xa).getRegex(),b2=/[\p{Pi}\p{Ps}"']/u,tk=/(?!~)[\p{P}\p{S}]/u,k2=/(?!~)[\s\p{P}\p{S}]/u,y2=/(?:[^\s\p{P}\p{S}]|~)/u,j2=Ee(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",J0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),nk=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,w2=Ee(nk,"u").replace(/punct/g,ns).getRegex(),N2=Ee(nk,"u").replace(/punct/g,tk).getRegex(),S2=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,T2=Ee(S2,"u").replace(/openQuote/g,b2).replace(/punct/g,ns).getRegex(),sk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",C2=Ee(sk,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Xa).replace(/punct/g,ns).getRegex(),E2=Ee(sk,"gu").replace(/notPunctSpace/g,y2).replace(/punctSpace/g,k2).replace(/punct/g,tk).getRegex(),A2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",M2=Ee(A2,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Xa).replace(/punct/g,ns).getRegex(),z2=Ee("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Xa).replace(/punct/g,ns).getRegex(),R2="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",O2=Ee(R2,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Xa).replace(/punct/g,ns).getRegex(),_2=Ee(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ns).getRegex(),D2="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$2=Ee(D2,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Xa).replace(/punct/g,ns).getRegex(),U2=Ee(/\\(punct)/,"gu").replace(/punct/g,ns).getRegex(),L2=Ee(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ns).getRegex(),H2=Ee(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),B2=Ee(zh).replace("(?:-->|$)","-->").getRegex(),q2=Ee("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",B2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),lk=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,wc=Ee(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",lk).getRegex(),I2=Ee(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",wc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),G2=Ee(/^!?\[(label)\]\[(ref)\]/).replace("label",wc).replace("ref",Mh).getRegex(),Y2=Ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mh).getRegex(),fb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,K2=Ee(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",lk).getRegex(),Z2=Ee("reflink|nolink(?!\\()","g").replace("reflink",Ee(/^!?\[(label)\]\[(ref)\]/).replace("label",K2).replace("ref",fb).getRegex()).replace("nolink",Ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",fb).getRegex()).getRegex(),hb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X2=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,V2=Ee(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,X2).getRegex(),Oh={_backpedal:Cl,anyPunctuation:U2,anyPunctuationOutsideCode:L2,autolink:H2,blockSkip:j2,br:ek,code:g2,del:Cl,delLDelim:Cl,delRDelim:Cl,emStrongLDelim:w2,emStrongRDelimAst:C2,emStrongRDelimUnd:z2,escape:p2,link:I2,nolink:Y2,punctuation:x2,reflink:G2,reflinkSearch:Z2,tag:q2,text:v2,url:Cl},Q2={...Oh,emStrongLDelim:T2,emStrongRDelimAst:M2,emStrongRDelimUnd:O2,link:Ee(/^!?\[(label)\]\((.*?)\)/).replace("label",wc).getRegex(),reflink:Ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wc).getRegex()},Jf={...Oh,emStrongRDelimAst:E2,emStrongLDelim:N2,delLDelim:_2,delRDelim:$2,url:Ee(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",V2).replace("protocol",hb).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ee(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",hb).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",J0?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},J2={...Jf,br:Ee(ek).replace("{2,}","*").getRegex(),text:Ee(Jf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wo={normal:Rh,gfm:h2,pedantic:m2},Zi={normal:Oh,gfm:Jf,breaks:J2,pedantic:Q2},P2={"&":"&","<":"<",">":">",'"':""","'":"'"},mb=n=>P2[n];function dn(n,a){if(a){if(xt.escapeTest.test(n))return n.replace(xt.escapeReplace,mb)}else if(xt.escapeTestNoEncode.test(n))return n.replace(xt.escapeReplaceNoEncode,mb);return n}function F2(n){return xt.numericCharacterReference.test(n)?n.replace(xt.numericCharacterReferenceOrAmpersand,(a,i,o)=>{if(i===void 0&&o===void 0)return"&";let c=i===void 0?Number.parseInt(o,16):Number.parseInt(i,10);return c===0||c>1114111||c>=55296&&c<=57343?"�":c===38?"&":String.fromCodePoint(c)}):n}function pb(n){try{n=encodeURI(n).replace(xt.percentDecode,"%")}catch{return null}return n}function gb(n,a){let i=n.replace(xt.findPipe,(d,h,m)=>{let p=!1,g=h;for(;--g>=0&&m[g]==="\\";)p=!p;return p?"|":" |"}),o=i.split(xt.splitPipe),c=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),a)if(o.length>a)o.splice(a);else for(;o.length<a;)o.push("");for(;c<o.length;c++)o[c]=o[c].trim().replace(xt.slashPipe,"|");return o}function xs(n,a,i){let o=n.length;if(o===0)return"";let c=0;for(;c<o&&n.charAt(o-c-1)===a;)c++;return n.slice(0,o-c)}function vb(n){let a=n.split(`
|
|
108
|
+
`),i=a.length-1;for(;i>=0&&xt.blankLine.test(a[i]);)i--;return a.length-i<=2?n:a.slice(0,i+1).join(`
|
|
109
|
+
`)}function Nc(n){return n.trim().replace(xt.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function xb(n,a){if(n.indexOf(a[0])===-1&&n.indexOf(a[1])===-1)return-1;let i=0;for(let o=0;o<n.length;o++)if(n[o]==="\\")o++;else if(n[o]===a[0])i++;else if(n[o]===a[1]&&(i--,i<0))return o;return i>0?-2:-1}var Ga=new WeakMap;function _h(n){let a={"*":-1,_:-1},i=-1,o=n.length;for(let c=0;c<o;c++){let d=n[c];if(d!=="*"&&d!=="_"&&d!=="~")continue;let h=c===0?`
|
|
110
|
+
`:n[c-1],m=c+1;for(;m<o&&n[m]===d;)m++;h!==" "&&h!==" "&&h!==`
|
|
111
|
+
`&&h!=="\r"&&h!=="\f"&&(d==="~"?i=c:a[d]=c),c=m-1}return{maskedSrc:n,lastPossibleEmStrongCloserIndex:a,lastPossibleDelCloserIndex:i}}function W2(n,a){let i=_h(a),o=Ga.get(n);o?o.push(i):Ga.set(n,[i])}function eT(n){let a=Ga.get(n);a&&(a.pop(),a.length===0&&Ga.delete(n))}function tT(n,a,i){let o=Ga.get(n)?.at(-1);return o&&o.maskedSrc===a?o.lastPossibleEmStrongCloserIndex[i]:_h(a).lastPossibleEmStrongCloserIndex[i]}function nT(n,a){let i=Ga.get(n)?.at(-1);return i&&i.maskedSrc===a?i.lastPossibleDelCloserIndex:_h(a).lastPossibleDelCloserIndex}function ec(n,a=0){let i=a,o="";for(let c of n)if(c===" "){let d=4-i%4;o+=" ".repeat(d),i+=d}else o+=c,i++;return o}function bb(n,a,i,o,c){let d=a.href,h=a.title||null,m=n[1].replace(c.other.outputLinkReplace,"$1"),p=n[0].charAt(0)==="!",g=o.state.inLink,v=o.state.linkEmitted,x=o.state.inRawBlock;o.state.inLink=!0,o.state.linkEmitted=!1;let w=o.inlineTokens(m),E=o.state.linkEmitted;if(o.state.linkEmitted=v,o.state.inLink=g,!p){if(E){o.state.inRawBlock=x;return}o.state.linkEmitted=!0}return{type:p?"image":"link",raw:i,href:d,title:h,text:m,tokens:w}}function sT(n,a,i){let o=n.match(i.other.indentCodeCompensation);if(o===null)return a;let c=o[1];return a.split(`
|
|
112
|
+
`).map(d=>{let h=d.match(i.other.beginningSpace);if(h===null)return d;let[m]=h;return d.slice(Math.min(m.length,c.length))}).join(`
|
|
113
|
+
`)}function kb(n,a,i,o){if(!a.includes("<"))return!1;for(let c=0;c<a.length;c++){if(a[c]==="\\"){c++;continue}if(a[c]==="`"){let m=o.inline.code.exec(a.slice(c));if(m){c+=m[0].length-1;continue}}if(a[c]!=="<")continue;let d=n.slice(i+c),h=o.inline.tag.exec(d)||o.inline.autolink.exec(d);if(h){if(h[0].length>a.length-c)return!0;c+=h[0].length-1}}return!1}var Ua=class{options;rules;lexer;constructor(a){this.options=a||Ll}space(a){let i=this.rules.block.newline.exec(a);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(a){let i=this.rules.block.code.exec(a);if(i){let o=this.options.pedantic?i[0]:vb(i[0]),c=o.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:o,codeBlockStyle:"indented",text:c}}}fences(a){let i=this.rules.block.fences.exec(a);if(i){let o=i[0],c=sT(o,i[3]||"",this.rules);return{type:"code",raw:o,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:c}}}heading(a){let i=this.rules.block.heading.exec(a);if(i){let o=i[2].trim();if(this.rules.other.endingHash.test(o)){let c=xs(o,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceTabChar.test(c))&&(o=c.trim())}return{type:"heading",raw:xs(i[0],`
|
|
114
|
+
`),depth:i[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(a){let i=this.rules.block.hr.exec(a);if(i)return{type:"hr",raw:xs(i[0],`
|
|
115
|
+
`)}}blockquote(a){let i=this.rules.block.blockquote.exec(a);if(i){let o=xs(i[0],`
|
|
116
|
+
`).split(`
|
|
117
|
+
`),c="",d="",h=[];for(;o.length>0;){let m=!1,p=[],g;for(g=0;g<o.length;g++)if(this.rules.other.blockquoteStart.test(o[g]))p.push(o[g]),m=!0;else if(!m)p.push(o[g]);else break;o=o.slice(g);let v=p.join(`
|
|
118
|
+
`),x=v.replace(this.rules.other.blockquoteMarkerWhitespace,(T,C,M)=>C+ec(M,C.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
119
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
|
|
120
|
+
${v}`:v,d=d?`${d}
|
|
121
|
+
${x}`:x;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,h,!0),this.lexer.state.top=w,o.length===0)break;let E=h.at(-1);if(E?.type==="code"||E?.type==="heading"||E?.type==="hr"||E?.type==="html"||E?.type==="table")break;if(E?.type==="blockquote"){let T=E,C=o.join(`
|
|
122
|
+
`),M=T.raw+`
|
|
123
|
+
`+C.replace(this.rules.other.blockquoteSetextReplace2,""),A=this.blockquote(M);h[h.length-1]=A;let $=M.substring(A.raw.length).replace(/^\n/,""),O=$?$.split(`
|
|
124
|
+
`).length:0,W=O?o.slice(0,-O):o;if(W.length>0&&(c=`${c}
|
|
125
|
+
${W.join(`
|
|
126
|
+
`)}`),d=d.substring(0,d.length-T.text.length)+A.text,o=o.slice(W.length),o.length>0&&this.rules.other.blockquoteStart.test(o[0]))continue;break}else if(E?.type==="list"){let T=E,C=T.raw+`
|
|
127
|
+
`+o.join(`
|
|
128
|
+
`),M=this.list(C);h[h.length-1]=M;let A=M.raw.length>T.raw.length?C.slice(T.raw.length+1,M.raw.length).split(`
|
|
129
|
+
`).length:0;if(A>0){let $=o.slice(0,A).join(`
|
|
130
|
+
`);c=`${c}
|
|
131
|
+
${$}`,d=`${d}
|
|
132
|
+
${$}`}o=o.slice(A);continue}}return{type:"blockquote",raw:c,tokens:h,text:d}}}list(a){let i=this.rules.block.list.exec(a);if(i){let o=a,c=()=>o.length-a.length,d=i[1].trim(),h=d.length>1,m={type:"list",raw:"",ordered:h,start:h?+d.slice(0,-1):"",loose:!1,items:[]};d=h?`\\d{1,9}\\${d.slice(-1)}`:`\\${d}`,this.options.pedantic&&(d=h?d:"[*+-]");let p=this.rules.other.listItemRegex(d),g=!1;for(;a;){let x=!1,w="";if(!(i=p.exec(a))||this.rules.block.hr.test(a))break;let E=c();a=a.substring(i[0].length);let T=i[2].split(`
|
|
133
|
+
`,1)[0],C=i[1].length,M=this.options.pedantic?ec(T,C):T.replace(this.rules.other.leadingSpaceTab,ee=>ec(ee,C)),A=a.split(`
|
|
134
|
+
`,1)[0],$=!M.trim(),O=0;if(this.options.pedantic?(O=2,w=M.trimStart()):$?O=C+1:(O=M.search(this.rules.other.nonSpaceChar),O=O>4?1:O,w=M.slice(O),O+=C),$&&this.rules.other.blankLine.test(A)&&(a=a.substring(A.length+1),x=!0),!x){let ee=this.rules.other.nextBulletRegex(O),I=this.rules.other.hrRegex(O),j=this.rules.other.fencesBeginRegex(O),y=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(O):this.rules.other.headingBeginRegex(O),S=this.rules.other.htmlBeginRegex(O),U=this.rules.other.blockquoteBeginRegex(O);for(;a;){let Z=a.split(`
|
|
135
|
+
`,1)[0],oe;if(A=Z,this.options.pedantic?(A=A.replace(this.rules.other.listReplaceNesting," "),oe=A):oe=A.replace(this.rules.other.leadingSpaceTab,ce=>ec(ce)),j.test(A)||y.test(A)||S.test(A)||U.test(A)||ee.test(A)||I.test(A))break;if(oe.search(this.rules.other.nonSpaceChar)>=O||!A.trim())w+=`
|
|
136
|
+
`+oe.slice(O);else{if($||M.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||j.test(M)||y.test(M)||S.test(M)||I.test(M))break;let ce=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(A)&&this.rules.block.lheading.test(`${M}
|
|
137
|
+
${A}`)?` ${oe.replace(/^ {0,3}/,"")}`:A;w+=`
|
|
138
|
+
`+ce}$=!A.trim(),a=a.substring(Z.length+1),M=oe.slice(O)}}let W=o.slice(E,c());m.loose||(g?m.loose=!0:this.rules.other.doubleBlankLine.test(W)&&(g=!0)),m.items.push({type:"list_item",raw:W,task:!!this.options.gfm&&this.rules.other.listIsTask.test(w),loose:!1,text:w,tokens:[]})}let v=m.items.at(-1);if(v)v.raw=v.raw.trimEnd(),v.text=v.text.trimEnd();else return;m.raw=o.slice(0,c()).trimEnd();for(let x of m.items)if(this.lexer.state.top=!1,x.tokens=this.lexer.blockTokens(x.text,[]),!m.loose){let w=x.tokens.filter(T=>T.type==="space"),E=w.length>0&&w.some(T=>this.rules.other.anyLine.test(T.raw));m.loose=E}for(let x of m.items){let w=x.tokens[0];if(x.task&&(w?.type==="text"||w?.type==="paragraph")){x.text=x.text.replace(this.rules.other.listReplaceTask,""),w.raw=w.raw.replace(this.rules.other.listReplaceTask,""),w.text=w.text.replace(this.rules.other.listReplaceTask,"");for(let T=this.lexer.inlineQueue.length-1;T>=0;T--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[T].src)){this.lexer.inlineQueue[T].src=this.lexer.inlineQueue[T].src.replace(this.rules.other.listReplaceTask,"");break}let E=this.rules.other.listTaskCheckbox.exec(x.raw);if(E){let T={type:"checkbox",raw:E[0]+" ",checked:E[0]!=="[ ]"};x.checked=T.checked,m.loose?x.tokens[0]&&["paragraph","text"].includes(x.tokens[0].type)&&"tokens"in x.tokens[0]&&x.tokens[0].tokens?(x.tokens[0].raw=T.raw+x.tokens[0].raw,x.tokens[0].text=T.raw+x.tokens[0].text,x.tokens[0].tokens.unshift(T)):x.tokens.unshift({type:"paragraph",raw:T.raw,text:T.raw,tokens:[T]}):x.tokens.unshift(T)}}else x.task&&(x.task=!1)}if(m.loose)for(let x of m.items){x.loose=!0;for(let w of x.tokens)w.type==="text"&&(w.type="paragraph")}return m}}html(a){let i=this.rules.block.html.exec(a);if(i){let o=vb(i[0]);return{type:"html",block:!0,raw:o,pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:o}}}def(a){let i=this.rules.block.def.exec(a);if(i){if(!this.rules.other.startAngleBracket.test(i[2])&&xb(i[2],"()")!==-1)return;let o=Nc(i[1]),c=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:o,raw:xs(i[0],`
|
|
139
|
+
`),href:c,title:d}}}table(a){let i=this.rules.block.table.exec(a);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;let o=gb(i[1]),c=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),d=i[3]?.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
140
|
+
`):[],h={type:"table",raw:xs(i[0],`
|
|
141
|
+
`),header:[],align:[],rows:[]};if(o.length===c.length){for(let m of c)this.rules.other.tableAlignRight.test(m)?h.align.push("right"):this.rules.other.tableAlignCenter.test(m)?h.align.push("center"):this.rules.other.tableAlignLeft.test(m)?h.align.push("left"):h.align.push(null);for(let m=0;m<o.length;m++)h.header.push({text:o[m],tokens:this.lexer.inline(o[m]),header:!0,align:h.align[m]});for(let m of d)h.rows.push(gb(m,h.header.length).map((p,g)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:h.align[g]})));return h}}lheading(a){let i=this.rules.block.lheading.exec(a);if(i){let o=i[1].trim();return{type:"heading",raw:xs(i[0],`
|
|
142
|
+
`),depth:i[2].charAt(0)==="="?1:2,text:o,tokens:this.lexer.inline(o)}}}paragraph(a){let i=this.rules.block.paragraph.exec(a);if(i){let o=i[1].charAt(i[1].length-1)===`
|
|
143
|
+
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:o,tokens:this.lexer.inline(o)}}}text(a){let i=this.rules.block.text.exec(a);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(a){let i=this.rules.inline.escape.exec(a);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(a){let i=this.rules.inline.tag.exec(a);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(a){if(this.lexer.state.linkParenPossible===!1)return;let i=this.rules.inline.link.exec(a);if(i){let o=i[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&kb(a,i[1],o,this.rules))return;let c=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(c)){if(!this.rules.other.endAngleBracket.test(c))return;let p=xs(c.slice(0,-1),"\\");if((c.length-p.length)%2===0)return}else{let p=xb(i[2],"()");if(p===-2)return;if(p>-1){let g=(i[0].indexOf("!")===0?5:4)+i[1].length+p;i[2]=i[2].substring(0,p),i[0]=i[0].substring(0,g).trim(),i[3]=""}}let d=xs(i[0].slice(0,-1),"\\");if((i[0].length-d.length)%2===0)return;let h=i[2],m="";if(this.options.pedantic){let p=this.rules.other.pedanticHrefTitle.exec(h);p&&(h=p[1],m=p[3])}else m=i[3]?i[3].slice(1,-1):"";return h=h.trim(),this.rules.other.startAngleBracket.test(h)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(c)?h=h.slice(1):h=h.slice(1,-1)),bb(i,{href:h&&h.replace(this.rules.inline.anyPunctuation,"$1"),title:m&&m.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(a,i){let o;if((o=this.rules.inline.reflink.exec(a))||(o=this.rules.inline.nolink.exec(a))){let c=o[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&kb(a,o[1],c,this.rules))return;let d=i[Nc(o[2]||o[1])];if(!d){let h=o[0].charAt(0);return{type:"text",raw:h,text:h}}return bb(o,d,o[0],this.lexer,this.rules)}}emStrong(a,i,o=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||!c[1]&&!c[2]&&!c[3]&&!c[4])return;let d=c[0][0],h=o===d,m=i.length-a.length,p=m;for(;!this.options.pedantic&&p>0&&i[p-1]===d;)p--;let g=[...i.slice(Math.max(0,p-2),p)].at(-1)??"",v=g==="*"||g==="_"||!!this.rules.inline.punctuation.exec(g);p<m&&(o=g);let x=p<m?v:!!this.rules.inline.punctuation.exec(o);if(c[4]&&o.match(this.rules.other.unicodeAlphaNumeric))return;let w=c[1]||c[3]||"";if(!w||!o||x){let E=[...c[0]].length-1,T,C,M=E,A=0,$=m-p+E,O=!this.options.pedantic&&!!g.trim()&&(!!w||d==="*"&&!v);if(d!=="*"&&d!=="_")return;let W=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,ee=tT(this,i,d),I=i.length-a.length+E;if(ee<I)return;i=i.slice(-1*a.length+E);let j=ee-I;for(W.lastIndex=0;(c=W.exec(i))!==null&&!(c.index>j);){if(T=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!T)continue;if(C=[...T].length,c[3]||c[4]){M+=C;continue}else if(c[5]||c[6]||O){if(h&&(c[5]||c[6]))break;if($%3&&!(($+C)%3)){A+=C;continue}}if(M-=C,M>0)continue;C=Math.min(C,C+M+A);let y=[...c[0]][0].length,S=a.slice(0,E+c.index+y+C);if(Math.min(E,C)%2){let Z=S.slice(1,-1);return{type:"em",raw:S,text:Z,tokens:this.lexer.inlineTokens(Z)}}let U=S.slice(2,-2);return{type:"strong",raw:S,text:U,tokens:this.lexer.inlineTokens(U)}}}}codespan(a){let i=this.rules.inline.code.exec(a);if(i){let o=i[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(o),d=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return c&&d&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:i[0],text:o}}}br(a){let i=this.rules.inline.br.exec(a);if(i)return{type:"br",raw:i[0]}}del(a,i,o=""){let c=this.rules.inline.delLDelim.exec(a);if(c&&(!c[1]||!o||this.rules.inline.punctuation.exec(o))){let d=[...c[0]].length-1,h,m,p=d,g=this.rules.inline.delRDelim,v=nT(this,i),x=i.length-a.length+d;if(v<x)return;i=i.slice(-1*a.length+d);let w=v-x;for(g.lastIndex=0;(c=g.exec(i))!==null&&!(c.index>w);){if(h=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!h||(m=[...h].length,m!==d))continue;if(c[3]||c[4]){p+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p);let E=[...c[0]][0].length,T=a.slice(0,d+c.index+E+m),C=T.slice(d,-d);return{type:"del",raw:T,text:C,tokens:this.lexer.inlineTokens(C)}}}}autolink(a){let i=this.rules.inline.autolink.exec(a);if(i){let o,c;return i[2]==="@"?(o=i[1],c="mailto:"+o):(o=i[1],c=o),{type:"link",raw:i[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}url(a){let i;if(i=this.rules.inline.url.exec(a)){let o,c;if(i[2]==="@")o=i[0],c="mailto:"+o;else{let d;do d=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])?.[0]??"";while(d!==i[0]);o=i[0],i[1]==="www."?c="http://"+i[0]:c=i[0]}return{type:"link",raw:i[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(a){let i=this.rules.inline.text.exec(a);if(i){let o=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:o?i[0]:F2(i[0]),escaped:o}}}},$n=class Pf{tokens;options;state;inlineQueue;tokenizer;constructor(a){this.tokens=[],this.tokens.links=Object.create(null),this.options=a||Ll,this.options.tokenizer=this.options.tokenizer||new Ua,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let i={other:xt,block:Wo.normal,inline:Zi.normal};this.options.pedantic?(i.block=Wo.pedantic,i.inline=Zi.pedantic):this.options.gfm&&(i.block=Wo.gfm,this.options.breaks?i.inline=Zi.breaks:i.inline=Zi.gfm),this.tokenizer.rules=i}static get rules(){return{block:Wo,inline:Zi}}static lex(a,i){return new Pf(i).lex(a)}static lexInline(a,i){return new Pf(i).inlineTokens(a)}lex(a){a=a.replace(xt.carriageReturn,`
|
|
144
|
+
`),this.blockTokens(a,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let o=this.inlineQueue[i];this.state.inRawBlock=!1,this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(a,i=[],o=!1){this.tokenizer.lexer=this,this.options.pedantic&&(a=a.replace(xt.tabCharGlobal," ").replace(xt.spaceLine,""));let c=1/0;for(;a;){if(a.length<c)c=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}let d;if(this.options.extensions?.block?.some(m=>(d=m.call({lexer:this},a,i))?(a=a.substring(d.raw.length),i.push(d),!0):!1))continue;if(d=this.tokenizer.space(a)){a=a.substring(d.raw.length);let m=i.at(-1);d.raw.length===1&&m!==void 0?m.raw+=`
|
|
145
|
+
`:i.push(d);continue}if(d=this.tokenizer.code(a)){a=a.substring(d.raw.length);let m=i.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
146
|
+
`)?"":`
|
|
147
|
+
`)+d.raw,m.text+=`
|
|
148
|
+
`+d.text,this.inlineQueue.at(-1).src=m.text):i.push(d);continue}if(d=this.tokenizer.fences(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.heading(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.hr(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.blockquote(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.list(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.html(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.def(a)){a=a.substring(d.raw.length);let m=i.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
149
|
+
`)?"":`
|
|
150
|
+
`)+d.raw,m.text+=`
|
|
151
|
+
`+d.raw,this.inlineQueue.at(-1).src=m.text):(this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title}),i.push(d));continue}if(d=this.tokenizer.table(a)){a=a.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.lheading(a)){a=a.substring(d.raw.length),i.push(d);continue}let h=a;if(this.options.extensions?.startBlock){let m=1/0,p=a.slice(1),g;this.options.extensions.startBlock.forEach(v=>{g=v.call({lexer:this},p),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(h=a.substring(0,m+1))}if(this.state.top&&(d=this.tokenizer.paragraph(h))){let m=i.at(-1);o&&m?.type==="paragraph"?(m.raw+=(m.raw.endsWith(`
|
|
152
|
+
`)?"":`
|
|
153
|
+
`)+d.raw,m.text+=`
|
|
154
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):i.push(d),o=h.length!==a.length,a=a.substring(d.raw.length);continue}if(d=this.tokenizer.text(a)){a=a.substring(d.raw.length);let m=i.at(-1);m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
155
|
+
`)?"":`
|
|
156
|
+
`)+d.raw,m.text+=`
|
|
157
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):i.push(d);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return this.state.top=!0,i}inline(a,i=[]){return this.inlineQueue.push({src:a,tokens:i}),i}linkInText(a){if(!a.includes("["))return!1;let i=this.tokenizer.rules.inline.link;for(let o of a.matchAll(this.tokenizer.rules.inline.blockSkip))if(i.test(o[0])&&a.charAt(o.index-1)!=="!")return!0;for(let o of a.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let c=o[0],d=c.lastIndexOf("[");if(!(c.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Nc(c.slice(d+1,-1))))&&!(d>1&&this.linkInText(c.slice(1,d-1))))return!0}return!1}inlineTokens(a,i=[]){this.tokenizer.lexer=this;let o=this.state.linkParenPossible;this.state.linkParenPossible=o&&a.includes(")");try{return this.#e(a,i)}finally{this.state.linkParenPossible=o}}#e(a,i){let o=a.includes("*")||a.includes("_")||a.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Ua.prototype.emStrong||this.tokenizer.del!==Ua.prototype.del?this.#n(a):a;W2(this.tokenizer,o);try{return this.#t(a,o,i)}finally{eT(this.tokenizer)}}#t(a,i,o){let c=!1,d="",h=1/0;for(;a;){if(a.length<h)h=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}c||(d=""),c=!1;let m;if(this.options.extensions?.inline?.some(g=>(m=g.call({lexer:this},a,o))?(a=a.substring(m.raw.length),o.push(m),!0):!1))continue;if(m=this.tokenizer.escape(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.tag(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.link(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(m.raw.length);let g=o.at(-1);m.type==="text"&&g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(m=this.tokenizer.emStrong(a,i,d)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.codespan(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.br(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.del(a,i,d)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.autolink(a)){a=a.substring(m.raw.length),o.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(a))){a=a.substring(m.raw.length),o.push(m);continue}let p=a;if(this.options.extensions?.startInline){let g=1/0,v=a.slice(1),x;this.options.extensions.startInline.forEach(w=>{x=w.call({lexer:this},v),typeof x=="number"&&x>=0&&(g=Math.min(g,x))}),g<1/0&&g>=0&&(p=a.substring(0,g+1))}if(m=this.tokenizer.inlineText(p)){a=a.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(d=m.raw.slice(-1)),c=!0;let g=o.at(-1);g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return o}#n(a){let i=a;if(this.tokens.links&&a.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let h=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Nc(d.slice(h+1,-1))))return d;if(h>1&&d.charAt(0)!=="!"){let m=d.slice(1,h-1);if(this.linkInText(m))return"["+m.replace(o,c)+"]["+"a".repeat(d.length-h-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};i=i.replace(o,c)}return i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(o,c,d)=>d?"+".repeat(o.length):c?c+o.slice(c.length,-c.length).replace(/`/g,"+")+c:o),i=i.replace(this.tokenizer.rules.inline.blockSkip,(o,c,d)=>{let h=d?d.length:0;return o.slice(0,h)+"["+"a".repeat(o.length-h-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i,i}infiniteLoopError(a){let i="Infinite loop on byte: "+a;if(this.options.silent)console.error(i);else throw new Error(i)}},Sc=class{options;parser;constructor(n){this.options=n||Ll}space(n){return""}code({text:n,lang:a,escaped:i}){let o=(a||"").match(xt.notSpaceStart)?.[0],c=n?n.replace(xt.endingNewline,"")+`
|
|
158
|
+
`:"";return o?'<pre><code class="language-'+dn(o)+'">'+(i?c:dn(c,!0))+`</code></pre>
|
|
159
|
+
`:"<pre><code>"+(i?c:dn(c,!0))+`</code></pre>
|
|
160
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
161
|
+
${this.parser.parse(n)}</blockquote>
|
|
162
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:a}){return`<h${a}>${this.parser.parseInline(n)}</h${a}>
|
|
163
|
+
`}hr(n){return`<hr>
|
|
164
|
+
`}list(n){let a=n.ordered,i=n.start,o="";for(let h=0;h<n.items.length;h++){let m=n.items[h];o+=this.listitem(m)}let c=a?"ol":"ul",d=a&&i!==1?' start="'+i+'"':"";return"<"+c+d+`>
|
|
165
|
+
`+o+"</"+c+`>
|
|
166
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
167
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
168
|
+
`}table(n){let a="",i="";for(let c=0;c<n.header.length;c++)i+=this.tablecell(n.header[c]);a+=this.tablerow({text:i});let o="";for(let c=0;c<n.rows.length;c++){let d=n.rows[c];i="";for(let h=0;h<d.length;h++)i+=this.tablecell(d[h]);o+=this.tablerow({text:i})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
169
|
+
<thead>
|
|
170
|
+
`+a+`</thead>
|
|
171
|
+
`+o+`</table>
|
|
172
|
+
`}tablerow({text:n}){return`<tr>
|
|
173
|
+
${n}</tr>
|
|
174
|
+
`}tablecell(n){let a=this.parser.parseInline(n.tokens),i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+a+`</${i}>
|
|
175
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${dn(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:a,text:i,tokens:o,autolink:c}){let d=c?dn(i,!0):this.parser.parseInline(o),h=pb(n);if(h===null)return d;n=dn(h,c);let m='<a href="'+n+'"';return a&&(m+=' title="'+dn(a)+'"'),m+=">"+d+"</a>",m}image({href:n,title:a,text:i,tokens:o}){o&&(i=this.parser.parseInline(o,this.parser.textRenderer));let c=pb(n);if(c===null)return dn(i);n=c;let d=`<img src="${dn(n)}" alt="${dn(i)}"`;return a&&(d+=` title="${dn(a)}"`),d+=">",d}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:dn(n.text)}},Dh=class{parser;strong({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}em({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}codespan({text:n}){return n}del({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}html({text:n}){return n}text({text:n}){return n}link({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}image({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}br(){return""}checkbox({raw:n}){return n}},Un=class Ff{options;renderer;textRenderer;constructor(a){this.options=a||Ll,this.options.renderer=this.options.renderer||new Sc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Dh,this.textRenderer.parser=this}static parse(a,i){return new Ff(i).parse(a)}static parseInline(a,i){return new Ff(i).parseInline(a)}parse(a){this.renderer.parser=this;let i="";for(let o=0;o<a.length;o++){let c=a[o];if(this.options.extensions?.renderers?.[c.type]){let h=c,m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(h.type)){i+=m||"";continue}}let d=c;switch(d.type){case"space":{i+=this.renderer.space(d);break}case"hr":{i+=this.renderer.hr(d);break}case"heading":{i+=this.renderer.heading(d);break}case"code":{i+=this.renderer.code(d);break}case"table":{i+=this.renderer.table(d);break}case"blockquote":{i+=this.renderer.blockquote(d);break}case"list":{i+=this.renderer.list(d);break}case"checkbox":{i+=this.renderer.checkbox(d);break}case"html":{i+=this.renderer.html(d);break}case"def":{i+=this.renderer.def(d);break}case"paragraph":{i+=this.renderer.paragraph(d);break}case"text":{i+=this.renderer.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(a,i=this.renderer){this.renderer.parser=this;let o="";for(let c=0;c<a.length;c++){let d=a[c];if(this.options.extensions?.renderers?.[d.type]){let m=this.options.extensions.renderers[d.type].call({parser:this},d);if(m!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){o+=m||"";continue}}let h=d;switch(h.type){case"escape":{o+=i.text(h);break}case"html":{o+=i.html(h);break}case"link":{o+=i.link(h);break}case"image":{o+=i.image(h);break}case"checkbox":{o+=i.checkbox(h);break}case"strong":{o+=i.strong(h);break}case"em":{o+=i.em(h);break}case"codespan":{o+=i.codespan(h);break}case"br":{o+=i.br(h);break}case"del":{o+=i.del(h);break}case"text":{o+=i.text(h);break}default:{let m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},Qi=class{options;block;constructor(n){this.options=n||Ll}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?$n.lex:$n.lexInline}provideParser(n=this.block){return n?Un.parse:Un.parseInline}};function Ps(n,a){if(Array.isArray(a))for(let i=0;i<a.length;i++)n.push(a[i]);else n.push(a)}var ak=class{defaults=Ch();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Un;Renderer=Sc;TextRenderer=Dh;Lexer=$n;Tokenizer=Ua;Hooks=Qi;constructor(...n){this.use(...n)}walkTokens(n,a){let i=[];for(let o of n)switch(Ps(i,a.call(this,o)),o.type){case"table":{let c=o;for(let d of c.header)Ps(i,this.walkTokens(d.tokens,a));for(let d of c.rows)for(let h of d)Ps(i,this.walkTokens(h.tokens,a));break}case"list":{let c=o;Ps(i,this.walkTokens(c.items,a));break}default:{let c=o;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(d=>{let h=c[d].flat(1/0);Ps(i,this.walkTokens(h,a))}):c.tokens&&Ps(i,this.walkTokens(c.tokens,a))}}return i}use(...n){let a=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return n.forEach(i=>{let o={...i};if(o.async=this.defaults.async||o.async||!1,i.extensions&&(i.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let d=a.renderers[c.name];d?a.renderers[c.name]=function(...h){let m=c.renderer.apply(this,h);return m===!1&&(m=d.apply(this,h)),m}:a.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=a[c.level];d?d.unshift(c.tokenizer):a[c.level]=[c.tokenizer],c.start&&(c.level==="block"?a.startBlock?a.startBlock.push(c.start):a.startBlock=[c.start]:c.level==="inline"&&(a.startInline?a.startInline.push(c.start):a.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(a.childTokens[c.name]=c.childTokens)}),o.extensions=a),i.renderer){let c=this.defaults.renderer||new Sc(this.defaults);for(let d in i.renderer){if(!(d in c))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let h=d,m=i.renderer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v===!1?"":v??""}}o.renderer=c}if(i.tokenizer){let c=this.defaults.tokenizer||new Ua(this.defaults);for(let d in i.tokenizer){if(!(d in c))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let h=d,m=i.tokenizer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.tokenizer=c}if(i.hooks){let c=this.defaults.hooks||new Qi;for(let d in i.hooks){if(!(d in c))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let h=d,m=i.hooks[h],p=c[h];Qi.passThroughHooks.has(d)?c[h]=g=>{if(c.options.async&&Qi.passThroughHooksRespectAsync.has(d))return(async()=>{let x=await m.call(c,g);return p.call(c,x)})();let v=m.call(c,g);return p.call(c,v)}:c[h]=(...g)=>{if(c.options.async)return(async()=>{let x=await m.apply(c,g);return x===!1&&(x=await p.apply(c,g)),x})();let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.hooks=c}if(i.walkTokens){let c=this.defaults.walkTokens,d=i.walkTokens;o.walkTokens=function(h){let m=[];return Ps(m,d.call(this,h)),c&&Ps(m,c.call(this,h)),m}}this.defaults={...this.defaults,...o}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return $n.lex(n,a??this.defaults)}parser(n,a){return Un.parse(n,a??this.defaults)}parseMarkdown(n){return(a,i)=>{let o={...i},c={...this.defaults,...o},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&o.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof a>"u"||a===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(a)+", string expected"));if(c.hooks&&(c.hooks.options=c,c.hooks.block=n),c.async)return(async()=>{let h=c.hooks?await c.hooks.preprocess(a):a,m=await(c.hooks?await c.hooks.provideLexer(n):n?$n.lex:$n.lexInline)(h,c),p=c.hooks?await c.hooks.processAllTokens(m):m;c.walkTokens&&await Promise.all(this.walkTokens(p,c.walkTokens));let g=await(c.hooks?await c.hooks.provideParser(n):n?Un.parse:Un.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(g):g})().catch(d);try{c.hooks&&(a=c.hooks.preprocess(a));let h=(c.hooks?c.hooks.provideLexer(n):n?$n.lex:$n.lexInline)(a,c);c.hooks&&(h=c.hooks.processAllTokens(h)),c.walkTokens&&this.walkTokens(h,c.walkTokens);let m=(c.hooks?c.hooks.provideParser(n):n?Un.parse:Un.parseInline)(h,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(h){return d(h)}}}onError(n,a){return i=>{if(i.message+=`
|
|
176
|
+
Please report this to https://github.com/markedjs/marked.`,n){let o="<p>An error occurred:</p><pre>"+dn(i.message+"",!0)+"</pre>";return a?Promise.resolve(o):o}if(a)return Promise.reject(i);throw i}}},Dl=new ak;function Fe(n,a){return Dl.parse(n,a)}Fe.options=Fe.setOptions=function(n){return Dl.setOptions(n),Fe.defaults=Dl.defaults,Q0(Fe.defaults),Fe};Fe.getDefaults=Ch;Fe.defaults=Ll;function lT(...n){return Dl.use(...n),Fe.defaults=Dl.defaults,Q0(Fe.defaults),Fe}Fe.use=lT;Fe.walkTokens=function(n,a){return Dl.walkTokens(n,a)};Fe.parseInline=Dl.parseInline;Fe.Parser=Un;Fe.parser=Un.parse;Fe.Renderer=Sc;Fe.TextRenderer=Dh;Fe.Lexer=$n;Fe.lexer=$n.lex;Fe.Tokenizer=Ua;Fe.Hooks=Qi;Fe.parse=Fe;Fe.options;Fe.setOptions;Fe.walkTokens;Fe.parseInline;Un.parse;$n.lex;const In="\\u1100-\\u11ff\\u20a9\\u2329-\\u232a\\u2630-\\u2637\\u268a-\\u268f\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303e\\u3041-\\u3096\\u3099-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u31e5\\u31ef-\\u321e\\u3220-\\u3247\\u3250-\\ua48c\\ua490-\\ua4c6\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufaff\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe66\\ufe68-\\ufe6b\\uff01-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\\uffe0-\\uffe6\\uffe8-\\uffee\\u{16fe0}-\\u{16fe4}\\u{16ff0}-\\u{16ff6}\\u{17000}-\\u{18cda}\\u{18cff}-\\u{18d20}\\u{18d80}-\\u{18df2}\\u{18e00}-\\u{19191}\\u{191a0}-\\u{191d2}\\u{1aff0}-\\u{1aff3}\\u{1aff5}-\\u{1affb}\\u{1affd}-\\u{1affe}\\u{1b000}-\\u{1b128}\\u{1b132}\\u{1b150}-\\u{1b152}\\u{1b155}\\u{1b164}-\\u{1b168}\\u{1b170}-\\u{1b2fb}\\u{1d300}-\\u{1d356}\\u{1d360}-\\u{1d376}\\u{1f1ae}\\u{1f200}\\u{1f202}\\u{1f210}-\\u{1f219}\\u{1f21b}-\\u{1f22e}\\u{1f230}-\\u{1f231}\\u{1f237}\\u{1f23b}\\u{1f240}-\\u{1f248}\\u{1f260}-\\u{1f265}\\u{1f7da}\\u{20000}-\\u{3fffd}",Ya=new RegExp(`[${In}]`,"u"),aT=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${In}])`,"u");function ik(n,a,i){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${n}(\\*+)(?=[\\s]|$)|${i}(\\*+)(?!\\*)(?=${a}|$)|(?!\\*)${a}(\\*+)(?=${i})|[\\s](\\*+)(?!\\*)(?=${n})|(?!\\*)${n}(\\*+)(?!\\*)(?=${n})|${i}(\\*+)(?=${i})`,"gu")}function iT(n,a,i){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${n}(_+)(?=[\\s]|$)|${i}(_+)(?!_)(?=${a}|$)|(?!_)${a}(_+)(?=${i})|[\\s](_+)(?!_)(?=${n})|(?!_)${n}(_+)(?!_)(?=${n})`,"gu")}function rT(n,a,i){return new RegExp(`^[^~]+(?=[^~])|(?!~)${n}(~~?)(?=[\\s]|$)|${i}(~~?)(?!~)(?=${a}|$)|(?!~)${a}(~~?)(?=${i})|[\\s](~~?)(?!~)(?=${n})|(?!~)${n}(~~?)(?!~)(?=${n})|${i}(~~?)(?=${i})`,"gu")}const rk=`[\\p{P}\\p{S}${In}]`,ok=`[\\s\\p{P}\\p{S}${In}]`,ck=`[^\\s\\p{P}\\p{S}${In}]`,oT=`(?![*_])[\\p{P}\\p{S}${In}]`,cT=`(?![*_])[\\s\\p{P}\\p{S}${In}]`,uT=`(?:[^\\s\\p{P}\\p{S}${In}]|[*_])`,dT=`(?!~)[\\p{P}\\p{S}${In}]`,fT=`(?!~)[\\s\\p{P}\\p{S}${In}]`,hT=`(?:[^\\s\\p{P}\\p{S}${In}]|~)`,mT=ik(rk,ok,ck),pT=ik(dT,fT,hT),gT=iT(rk,ok,ck),yb=rT(oT,cT,uT);function jb(n,a,i){let o=aT.test(n);if(!o&&n){const c=a.length-i.length;if(c>=1){let d=c-1,h=a.charCodeAt(d);if(h>=65024&&h<=65038&&d>=1&&(d--,h=a.charCodeAt(d)),(h&64512)===56320&&d>=1){const m=a.codePointAt(d-1);m!==void 0&&m>65535&&(m>=917760&&m<=917999?o=!0:o=Ya.test(String.fromCodePoint(m)))}else o=Ya.test(String.fromCharCode(h))}}return o}function wb(n,a){if(!(n[1]||n[2]||n[3]||n[4]))return!1;const i=String.fromCodePoint(n[0].codePointAt(0)),o=n.index+n[0].length,c=o<a.length?String.fromCodePoint(a.codePointAt(o)):"";return Ya.test(i)||Ya.test(c)}function $h(n){return n.length>=5}function vT(n){return!!(n[1]||n[2]||n[3]||n[4])}function xT(n){return $h(n)?!!n[4]:!!n[3]}function bT(n){return $h(n)?n[1]||n[3]||"":n[1]||n[2]||""}function tc(n){let a=n.length;const i=a-1;for(let o=0;o<i;){const c=n.charCodeAt(o++);if(c<55296||56320<=c)continue;const d=n.charCodeAt(o);d<56320||57344<=d||(o++,a--)}return a}function kT(){return{tokenizer:{emStrong(n,a,i=""){const{rules:o}=this,c=o.inline.emStrongLDelim.exec(n);if(!c)return!1;const d=$h(c);if(d&&!vT(c))return;if(xT(c)&&i.match(o.other.unicodeAlphaNumeric))return!1;const h=bT(c),m=jb(i,a,n);if(!h||!i||o.inline.punctuation.exec(i)||m||Ya.test(h)){const p=tc(c[0])-1;let g,v,x=p,w=0;const E=d&&i===c[0][0],T=o.inline.emStrongRDelimAst.source.includes("(?!~)");let C;c[0][0]==="*"?C=T?pT:mT:C=gT,C.lastIndex=0;const M=a.slice(-1*n.length+p);let A;for(;(A=C.exec(M))!=null;){if(g=A[1]||A[2]||A[3]||A[4]||A[5]||A[6],!g)continue;v=tc(g);const $=wb(A,M),O=!!(A[3]||A[4]),W=!!(A[5]||A[6]);if(O&&!$){x+=v;continue}if(W||$){if(p%3&&!((p+v)%3)){w+=v;continue}if(E&&W)break}if(x-=v,x>0)continue;v=Math.min(v,v+x+w);const ee=A[0].codePointAt(0)>65535?2:1,I=n.slice(0,p+A.index+ee+v);if(Math.min(p,v)%2){const y=I.slice(1,-1);return{type:"em",raw:I,text:y,tokens:this.lexer.inlineTokens(y)}}const j=I.slice(2,-2);return{type:"strong",raw:I,text:j,tokens:this.lexer.inlineTokens(j)}}}},del(n,a,i=""){const{rules:o}=this,c=o.inline.delLDelim.exec(n);if(!c)return!1;const d=c[1]||"",h=jb(i,a,n);if(!d||!i||o.inline.punctuation.exec(i)||h||Ya.test(d)){const m=tc(c[0])-1;let p,g,v=m;yb.lastIndex=0;const x=a.slice(-1*n.length+m);let w;for(;(w=yb.exec(x))!=null;){if(p=w[1]||w[2]||w[3]||w[4]||w[5]||w[6],!p||(g=tc(p),g!==m))continue;const E=wb(w,x);if((w[3]||w[4])&&!E){v+=g;continue}if(v-=g,v>0)continue;g=Math.min(g,g+v);const T=w[0].codePointAt(0)>65535?2:1,C=n.slice(0,m+w.index+T+g),M=C.slice(m,-m);return{type:"del",raw:C,text:M,tokens:this.lexer.inlineTokens(M)}}}}}}}function er(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let Wf,yT;function jT(){return yT??=hr(()=>import("./math-weKGDUmL.js"),__vite__mapDeps([0,1])).then(n=>{Wf=n.default})}function wT(n){let a=!1;return ir.walkTokens(ir.lexer(n),i=>{(i.type==="inlineMath"||i.type==="displayMath")&&(a=!0)}),a}function Nb(n,a,i){if(!Wf)return er(i);try{return Wf.renderToString(n,{displayMode:a,throwOnError:!0,trust:!1})}catch{return er(i)}}const ir=new ak({extensions:[{name:"displayMath",level:"block",start(n){return n.search(/\$\$|\\\[/)},tokenizer(n){const a=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])(?:\n|$)/.exec(n);if(a)return{type:"displayMath",raw:a[0],text:a[1]??a[2]}},renderer(n){return`<div class="math-display">${Nb(String(n.text),!0,n.raw.trimEnd())}</div>`}},{name:"inlineMath",level:"inline",start(n){return n.search(/\$|\\\(/)},tokenizer(n){const a=/^(?:\$(?!\$|\s)([^$`\n]*?[^$`\s])\$(?!\d)|\\\((.+?)\\\))/.exec(n);if(a)return{type:"inlineMath",raw:a[0],text:a[1]??a[2]}},renderer(n){return Nb(String(n.text),!1,n.raw)}}],renderer:{html(n){return er(n.text??"")},code(n){const a=n.lang?.trim().split(/\s+/)[0]??"";return`<div class="code-block">${a?`<div class="code-head">${er(a)}</div>`:""}<button type="button" class="code-copy" aria-label="复制代码" title="复制代码">${jc("copy",15)}</button><pre><code>${er(n.text)}
|
|
177
|
+
</code></pre></div>`}}});ir.use(kT());const NT=/^(https?:|mailto:|\/|#|\.)/i;function ST(n){return ir.parse(n,{async:!1,gfm:!0,breaks:!0}).replace(/<a href="([^"]*)"/g,(i,o)=>h0(o)?`<a class="knowledge-citation" href="${o}"`:NT.test(o.trim())?`<a target="_blank" rel="noreferrer" href="${o}"`:"<a").replace(/(<a class="knowledge-citation"[^>]*>)/g,`$1${jc("doc",13)}`).replace(/[((]\s*(<a class="knowledge-citation"[^>]*>[\s\S]*?<\/a>)\s*[))]/g,"$1")}function TT(n){const a=[];for(const o of ir.lexer(n,{gfm:!0})){const c=o.type==="table",d=a.at(-1);d&&!d.table&&!c?d.md+=o.raw:a.push({table:c,md:o.raw})}const i=a.filter(o=>o.table||o.md.trim());return i.length?i:[{table:!1,md:n}]}const eh=/[\p{L}\p{N}]/u;function CT(n){const a=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s*[#>\-*]+\s*/gm,"");return Array.from(a).filter(i=>eh.test(i)).join("")}function ET(n,a){const i=[];let o="";for(const g of n)for(let v=0;v<g.data.length;){const x=String.fromCodePoint(g.data.codePointAt(v));if(eh.test(x)){o+=x;for(let w=0;w<x.length;w++)i.push({node:g,offset:v,end:v+x.length})}v+=x.length}const c=Array.from(a).filter(g=>eh.test(g)).join("");if(!c)return null;let d=o.indexOf(c),h=d+c.length;if(d<0){const g=Array.from(c),v=g.slice(0,40).join(""),x=g.slice(-40).join("");if(d=o.indexOf(v),d<0)return null;const w=o.lastIndexOf(x,d+c.length*2-x.length);h=w>=d+v.length?w+x.length:d+v.length}const m=i[d],p=i[h-1];return{start:{node:m.node,offset:m.offset},end:{node:p.node,offset:p.end}}}async function AT(n,a){try{const i=await GN(n,a);zt(i.entry.path,i.entry.name,{find:i.chunk?CT(i.chunk.text):void 0,page:i.chunk?.page})}catch(i){Za(i instanceof Ue&&i.status===404?"这份资料已经删除":`无法打开资料:${i instanceof Error?i.message:String(i)}`)}}function Ka({text:n,className:a,streaming:i,onMathRendered:o}){const[c,d]=k.useState(0);return k.useEffect(()=>{let h=!0;return wT(n)&&jT().then(()=>{h&&d(m=>m+1)}).catch(()=>{}),()=>{h=!1}},[n]),k.useEffect(()=>{c&&o?.()},[c,o]),s.jsx("div",{className:a,onClick:h=>{const m=h.target.closest("a.knowledge-citation"),p=m&&h0(m.getAttribute("href")??"");if(p){h.preventDefault(),h.stopPropagation(),AT(p.entryId,p.chunk);return}const g=h.target.closest(".code-copy");if(!g)return;h.stopPropagation();const v=g.closest(".code-block")?.querySelector("code")?.textContent??"";Th(v.endsWith(`
|
|
178
|
+
`)?v.slice(0,-1):v).then(x=>{if(!x){Za("复制失败:浏览器不允许写入剪贴板");return}g.innerHTML=jc("check",15),g.setAttribute("aria-label","已复制"),window.setTimeout(()=>{g.innerHTML=jc("copy",15),g.setAttribute("aria-label","复制代码")},1500)})},dangerouslySetInnerHTML:{__html:ST(n)+(i?'<span class="cur"></span>':"")}})}const MT={".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".webp":"image",".avif":"image",".bmp":"image",".ico":"image",".svg":"svg",".pdf":"pdf",".mp3":"audio",".wav":"audio",".ogg":"audio",".m4a":"audio",".flac":"audio",".aac":"audio",".mp4":"video",".webm":"video",".mov":"video",".m4v":"video",".md":"markdown",".markdown":"markdown",".json":"json",".jsonl":"json",".ndjson":"json",".csv":"csv",".tsv":"csv",".html":"html",".htm":"html",".xml":"xml",".ts":"code",".tsx":"code",".js":"code",".jsx":"code",".mjs":"code",".cjs":"code",".py":"code",".sh":"code",".bash":"code",".zsh":"code",".go":"code",".rs":"code",".java":"code",".kt":"code",".swift":"code",".c":"code",".h":"code",".cc":"code",".cpp":"code",".hpp":"code",".cs":"code",".rb":"code",".php":"code",".scala":"code",".lua":"code",".pl":"code",".css":"code",".scss":"code",".less":"code",".vue":"code",".svelte":"code",".yaml":"code",".yml":"code",".toml":"code",".ini":"code",".conf":"code",".cfg":"code",".properties":"code",".sql":"code",".graphql":"code",".proto":"code",".diff":"code",".patch":"code",".log":"text",".txt":"text",".text":"text"};function zT(n){const a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function RT(n){return MT[zT(n)]}function OT(n,a){return Array.from({length:a},(i,o)=>{const c=Math.floor(o*n.length/a),d=Math.floor((o+1)*n.length/a);let h=0;for(let m=c;m<d;m++)h=Math.max(h,Math.abs(n[m]));return h})}let Ma=null;function _T({path:n,name:a,fallback:i,itemId:o}){const c=k.useRef(null),[d,h]=k.useState(null),[m,p]=k.useState(0),[g,v]=k.useState(0),[x,w]=k.useState(!0),[E,T]=k.useState(1);k.useEffect(()=>{const A=new AbortController;let $;return(async()=>{try{const O=await fetch(It(n),{signal:A.signal});if(!O.ok||Number(O.headers.get("content-length"))>20*1024*1024)return;const W=O.body?.getReader();if(!W)return;const ee=[];let I=0;for(;;){const{done:U,value:Z}=await W.read();if(U)break;if(I+=Z.byteLength,I>20*1024*1024){await W.cancel();return}ee.push(Z)}const j=new Uint8Array(I);let y=0;for(const U of ee)j.set(U,y),y+=U.byteLength;$=new AudioContext;const S=await $.decodeAudioData(j.buffer);A.signal.aborted||h(OT(S.getChannelData(0),50))}catch{}finally{$&&$.close()}})(),()=>{A.abort(),Ma===c.current&&(Ma=null)}},[n]);const C=g?Math.min(1,m/g):0,M=A=>`${Math.floor(A/60)}:${String(Math.floor(A%60)).padStart(2,"0")}`;return s.jsxs("div",{className:"media-audio","data-item-id":o,children:[s.jsx("audio",{ref:c,src:It(n),preload:"metadata",onError:i,onPlay:A=>{Ma&&Ma!==A.currentTarget&&Ma.pause(),Ma=A.currentTarget,w(!1)},onPause:()=>w(!0),onTimeUpdate:A=>p(A.currentTarget.currentTime),onLoadedMetadata:A=>v(A.currentTarget.duration)}),s.jsx("button",{className:"audio-play","aria-label":x?"播放":"暂停",onClick:()=>{const A=c.current;A&&(A.paused?A.play().catch(i):A.pause())},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",children:x?s.jsx("path",{d:"M8.5 5.8v12.4a1 1 0 0 0 1.5.86l10-6.2a1 1 0 0 0 0-1.72l-10-6.2a1 1 0 0 0-1.5.86Z"}):s.jsx("path",{d:"M7 5h3.5v14H7zM13.5 5H17v14h-3.5z"})})}),s.jsxs("div",{className:"audio-main",children:[s.jsx("button",{className:"audio-name",onClick:()=>zt(n,a),children:a}),s.jsxs("div",{className:"audio-track",children:[d?s.jsx("div",{className:"audio-bars","aria-hidden":"true",children:d.map((A,$)=>s.jsx("i",{className:$/d.length<C?"played":"",style:{height:`${Math.max(12,A*100)}%`}},$))}):s.jsx("div",{className:"audio-line",children:s.jsx("i",{style:{width:`${C*100}%`}})}),s.jsx("input",{type:"range","aria-label":"播放进度",min:0,max:g||0,step:"0.01",value:Math.min(m,g||0),onChange:A=>{c.current&&(c.current.currentTime=Number(A.target.value))}})]})]}),s.jsx("span",{className:"audio-time",children:M(g||0)}),s.jsxs("button",{className:"audio-rate",onClick:()=>{const A=E===1?1.5:E===1.5?2:1;T(A),c.current&&(c.current.playbackRate=A)},children:[E,"×"]})]})}function Sb({path:n,name:a,fallback:i,itemId:o}){const[c,d]=k.useState(!1);if(c)return i;const h=RT(n);return h==="audio"?s.jsx(_T,{path:n,name:a,fallback:()=>d(!0),itemId:o}):h==="video"?s.jsxs("div",{className:"media-video","data-item-id":o,children:[s.jsx("video",{controls:!0,playsInline:!0,preload:"metadata",src:It(n),onError:()=>d(!0)}),s.jsx("button",{onClick:()=>zt(n,a),children:a})]}):i}const za=13,DT=2.7,Tb=700;function $T(n){const a=/^(\d{2,5})x(\d{2,5})$/.exec(n??""),i=a?Number(a[1])/Number(a[2]):1;return Math.min(16/9,Math.max(9/16,i))}function UT(n){return Math.min(.96,1-Math.exp(-n/30))}function LT(n){return n<.2?"正在构思":n<.55?"正在勾勒草图":n<.85?"正在上色":"正在润色细节"}function HT(){return[[.22,.6,.3],[.18,.5,.7]].map(([n,a,i])=>{const o=.3+Math.random()*.4;return{x:i,y:o,tx:i,ty:o,next:0,r:n,gain:a}})}function BT(n,a){for(let i=0;i<6;i++)if(n.tx=.2+Math.random()*.6,n.ty=.2+Math.random()*.6,Math.hypot(n.tx-a.tx,n.ty-a.ty)>.35)return}const zf=[3500,7500];function qT(n,a,i,o){const c=(a-n.at)/n.dur;if(c<0||c>=1)return 0;const d=Math.hypot(i,o);if(n.kind==="ring"){const h=d-c*.85;return .75*(1-c)*Math.exp(-(h*h)/.008)}return .7*Math.sin(Math.PI*c)*Math.exp(-(d*d)/.03)}function IT({status:n,prompt:a,size:i,path:o,error:c,startedAt:d,fresh:h,itemId:m}){const p=k.useRef(null),[g,v]=k.useState(n==="done"?"shown":"live"),[x,w]=k.useState(()=>Date.now()),E=Date.parse(d)||Date.now(),T=k.useRef(g);T.current=g,k.useEffect(()=>{if(n!=="pending")return;const A=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(A)},[n]),k.useEffect(()=>{if(g!=="reveal")return;const A=setTimeout(()=>v("shown"),Tb+200);return()=>clearTimeout(A)},[g]),k.useEffect(()=>{const A=p.current;if(!A||g==="shown")return;const $=A.getContext("2d");if(!$)return;const O=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let W=0,ee=!0,I=0,j=[];const y=HT();let S=[],U=0,Z=0;const oe=new IntersectionObserver(([ke])=>{ee=ke.isIntersecting,ee&&!W&&(W=requestAnimationFrame(ce))});oe.observe(A);function ce(ke){W=0;const Ce=Math.min(2,window.devicePixelRatio||1),{width:ue,height:xe}=A.getBoundingClientRect();(A.width!==Math.round(ue*Ce)||A.height!==Math.round(xe*Ce))&&(A.width=Math.round(ue*Ce),A.height=Math.round(xe*Ce)),$.setTransform(Ce,0,0,Ce,0,0),$.clearRect(0,0,ue,xe);const ge=Math.max(1,Math.floor(ue/za)),Re=Math.max(1,Math.floor(xe/za)),Te=(ue-(ge-1)*za)/2,pt=(xe-(Re-1)*za)/2;j.length!==ge*Re&&(j=Array.from({length:ge*Re},()=>Math.random()));const wt=document.documentElement.classList.contains("dark");T.current==="reveal"&&!I&&(I=ke);const gt=I?Math.min(1,(ke-I)/Tb):0,D=n==="pending"&&!O,se=Z?Math.min(.1,(ke-Z)/1e3):0;if(Z=ke,D){if(U||(U=ke+1200+Math.random()*1500),ke>U){const te=Math.random()<.5;S.push({kind:te?"ring":"swell",x:.2+Math.random()*.6,y:.2+Math.random()*.6,at:ke,dur:te?2600:1800}),U=ke+zf[0]+Math.random()*(zf[1]-zf[0])}S=S.filter(te=>ke-te.at<te.dur);for(const[te,ae]of y.entries()){ke>ae.next&&(BT(ae,y[1-te]),ae.next=ke+3e3+Math.random()*2500);const fe=1-Math.exp(-se*.7);ae.x+=(ae.tx-ae.x)*fe,ae.y+=(ae.ty-ae.y)*fe}}$.fillStyle=wt?"rgb(232,232,230)":"rgb(38,38,36)";const L=ue/xe,G=ke/1e3;for(let te=0;te<Re;te++)for(let ae=0;ae<ge;ae++){const fe=j[te*ge+ae],ve=ge>1?ae/(ge-1):.5,tt=Re>1?te/(Re-1):.5,at=Math.min(1,Math.min(ve,1-ve,tt,1-tt)/.3);let ot=.12;if(n!=="failed"){for(const Ut of y){const An=(ve-Ut.x)*L,el=tt-Ut.y;ot+=Ut.gain*Math.exp(-(An*An+el*el)/(Ut.r*Ut.r))}for(const Ut of S)ot+=qT(Ut,ke,(ve-Ut.x)*L,tt-Ut.y)}const Dt=D?Math.sin(G*1.3+fe*6.28)*.03:0,nt=Math.min(1,Math.max(0,.08+.92*(.35+.65*at)*Math.min(1,ot)+Dt)),qe=Math.min(1,Math.max(0,(gt-fe*.6)/.4)),$t=(.45+(DT-.45)*nt)*(1-qe);$t<.3||($.globalAlpha=(.16+.84*nt)*(1-qe),$.beginPath(),$.arc(Te+ae*za,pt+te*za,$t,0,Math.PI*2),$.fill())}$.globalAlpha=1,(T.current==="reveal"?gt<1:D)&&ee&&(W=requestAnimationFrame(ce))}return W=requestAnimationFrame(ce),()=>{cancelAnimationFrame(W),oe.disconnect()}},[g,n,E]);const C=Math.max(0,Math.floor((x-E)/1e3)),M=UT(C);return s.jsxs("div",{className:`igen ${g}${n==="failed"?" failed":""}${h?" enter":""}`,"data-item-id":m,children:[g==="live"&&n!=="failed"?s.jsx("div",{className:"igen-stage",role:"status",title:a,children:LT(M)}):null,s.jsxs("div",{className:"igen-frame",style:{aspectRatio:String($T(i))},children:[o?s.jsx("button",{className:"igen-img",onClick:()=>zt(o),title:a,tabIndex:g==="live"?-1:0,children:s.jsx("img",{src:$l(o),alt:a,onLoad:()=>{T.current==="live"&&v("reveal")}})}):null,g==="shown"?null:s.jsx("canvas",{ref:p,"aria-hidden":"true"}),g==="live"&&n==="pending"?s.jsxs("span",{className:"igen-pct",children:[Math.floor(M*100),"%"]}):null]}),n==="failed"&&g==="live"?s.jsxs("div",{className:"igen-cap",role:"status",title:a,children:[s.jsx("span",{children:"没有生成出来"}),s.jsx("span",{className:"igen-note",children:c||"图片生成失败。"})]}):null]})}const GT=50,YT=110;function KT({photos:n,onOpen:a}){const[i,o]=k.useState(0),[c,d]=k.useState(0),h=k.useRef(null),m=n.length,p=Math.min(1,Math.abs(c)/YT),g=v=>{const x=h.current;h.current=null,x&&(x.moved?Math.abs(c)>GT&&o((i+1)%m):v&&a(n[i]),d(0))};return s.jsx("div",{className:`album-stack${c?" dragging":""}`,role:"group","aria-label":`${m} 张图片,左右滑动切换,点一下查看`,onPointerDown:v=>{h.current={id:v.pointerId,x:v.clientX,moved:!1},v.currentTarget.setPointerCapture(v.pointerId)},onPointerMove:v=>{const x=h.current;if(!x||x.id!==v.pointerId)return;const w=v.clientX-x.x;!x.moved&&Math.abs(w)<6||(x.moved=!0,d(w))},onPointerUp:()=>g(!0),onPointerCancel:()=>g(!1),children:n.map((v,x)=>{const w=(x-i+m)%m;if(w>2)return null;const T={"--d":w===0?0:w-p,"--dx":w===0?`${c}px`:"0px","--rot":w===0?`${c*.06}deg`:"0deg",zIndex:m-w};return s.jsx("img",{src:$l(v),alt:"",draggable:!1,style:T},v)})})}const uk=["日","一","二","三","四","五","六"];function Ji(n){return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function Uh(n,a){const i=new Date(n),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),c=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime();return Math.round((o-c)/864e5)}function Pt(n,a=new Date){const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=Uh(n,a);return o===0?`今天 ${Ji(i)}`:o===1?`昨天 ${Ji(i)}`:o===-1?`明天 ${Ji(i)}`:`${i.getMonth()+1}月${i.getDate()}日 ${Ji(i)}`}function dc(n,a=new Date){if(!n)return"";const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=Uh(n,a);return o===0?Ji(i):o===1?"昨天":`${i.getMonth()+1}月${i.getDate()}日`}function vr(n,a=Date.now()){const i=Math.max(0,Math.round((a-new Date(n).getTime())/6e4));if(i<1)return"刚刚";if(i<60)return`${i} 分钟`;const o=Math.floor(i/60),c=i%60;return c?`${o} 小时 ${c} 分钟`:`${o} 小时`}function Hl(n){const a=Math.max(0,Math.round(n/1e3));if(a<60)return`${a} 秒`;const i=Math.floor(a/60);if(i<60){const o=a%60;return o?`${i} 分 ${o} 秒`:`${i} 分钟`}return`${Math.floor(i/60)} 小时 ${i%60} 分钟`}function th(n){if(n<1e3)return String(n);const a=n/1e3;return`${a<10?a.toFixed(1):Math.round(a)}k`}function ZT(n){return[n.durationMs!==void 0?Hl(n.durationMs):void 0,n.tools!==void 0?`${n.tools} 次操作`:void 0,n.tokens!==void 0?`${th(n.tokens)} token`:void 0].filter(Boolean).join(" · ")}function Va(n){return n<1024?`${n} B`:n<1024*1024?`${n<10240?(n/1024).toFixed(1):Math.round(n/1024)} KB`:n<1024*1024*1024?`${(n/1024/1024).toFixed(1)} MB`:`${(n/1024/1024/1024).toFixed(1)} GB`}function XT(n,a=new Date){return Uh(n,a)===0}function VT(n,a){return n?new Date(a).getTime()-new Date(n).getTime()>300*1e3:!1}function Lh(n){const a={kind:"raw",hour:9,minute:0,weekday:5,day:1,raw:n},i=n.trim().split(/\s+/);if(i.length!==5)return a;const[o,c,d,h,m]=i;if(!/^\d+$/.test(o)||!/^\d+$/.test(c)||h!=="*")return a;const p=Number(o),g=Number(c);return p>59||g>23?a:d==="*"&&m==="*"?{...a,kind:"daily",hour:g,minute:p}:d==="*"&&/^\d$/.test(m)?{...a,kind:"weekly",hour:g,minute:p,weekday:Number(m)}:/^\d{1,2}$/.test(d)&&m==="*"?{...a,kind:"monthly",hour:g,minute:p,day:Number(d)}:a}function QT(n){const a=String(n.minute).padStart(2,"0"),i=String(n.hour).padStart(2,"0");return n.kind==="daily"?`${n.minute} ${n.hour} * * *`:n.kind==="weekly"?`${n.minute} ${n.hour} * * ${n.weekday}`:n.kind==="monthly"?`${n.minute} ${n.hour} ${n.day} * *`:n.raw.trim()||`${a} ${i} * * *`}function Hh(n){const a=Lh(n),i=`${String(a.hour).padStart(2,"0")}:${String(a.minute).padStart(2,"0")}`;return a.kind==="daily"?`每天 ${i}`:a.kind==="weekly"?`每周${uk[a.weekday]??"?"} ${i}`:a.kind==="monthly"?`每月${a.day}日 ${i}`:n}function JT(n,a,i){const o=a-n.x,c=i-n.y;let d=n.direction;return d==="pending"&&Math.hypot(o,c)>8&&(o<-8&&Math.abs(o)>Math.abs(c)*1.5?d="horizontal":(Math.abs(c)>Math.abs(o)||o>8)&&(d="vertical")),{...n,direction:d,distance:d==="horizontal"?Math.max(0,-o):0}}function Cb(n){return n.direction==="horizontal"&&n.distance>48}function PT(n,a){return{top:n.bottom+8+92<=a.bottom?n.bottom+8:Math.max(a.top+8,n.top-92-8),left:Math.max(a.left+8,Math.min(n.right-160,a.right-168))}}function FT(n,a){return a.type==="open"?a.id:a.type==="outside"&&a.inside?n:null}function dk(n){return n.status==="running"?"沉淀技能中…":n.status==="empty"?"没有要沉淀的":n.status==="failed"?"沉淀失败":n.updated?`已更新技能「${n.title}」· 第 ${n.version} 版`:`已沉淀技能「${n.title}」`}const es={queued:{text:"排队中",icon:"clock",color:"",spin:!1},running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等助手回复",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},failed:{text:"失败",icon:"close",color:"bad",spin:!1},stopped:{text:"已停止",icon:"stop",color:"",spin:!1}},fk={running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等你确认",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},interrupted:{text:"已中断",icon:"close",color:"bad",spin:!1},returned:{text:"已退回",icon:"close",color:"bad",spin:!1},takenOver:{text:"已被你接手",icon:"user",color:"",spin:!1}};function Bh(n,a,i){const o=es[n];return s.jsx(Q,{name:o.icon,size:a,w:i,className:o.spin?"spin":""})}function js({meta:n,card:a=!1,animated:i=!1,swapped:o=!1,children:c}){const d=a?`st${n.color==="ok"?" done":n.color==="bad"?" bad":""}`:`jt-st${n.color?` ${n.color}`:""}`;return s.jsxs("span",{className:d,children:[i?s.jsxs("span",{className:"stico",children:[s.jsx(Q,{name:"spin",size:14,w:2,className:`spin stspin${n.spin?"":" off"}`}),n.spin?null:s.jsx(Q,{name:n.icon,size:14,w:2,className:`stic${n.color==="ok"?" pop":""}${o?" anim":""}`})]}):s.jsx(Q,{name:n.icon,size:a?14:13,className:n.spin?"spin":""}),n.text,c]})}const WT={memory:"mem",skill:"bulb",rule:"rule",routine:"clock",split:"split",info:"info"};function eC(){const[n,a]=k.useState(()=>window.matchMedia("(hover: none)").matches);return k.useEffect(()=>{const i=window.matchMedia("(hover: none)"),o=()=>a(i.matches);return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]),n}function nh({text:n,itemId:a,menu:i=!1,close:o}){const[c,d]=k.useState(!1),h=k.useRef(0);k.useEffect(()=>()=>window.clearTimeout(h.current),[]);const m=async()=>{if(!await Th(n)){Za("复制失败:浏览器不允许写入剪贴板");return}if(i){o?.();return}d(!0),window.clearTimeout(h.current),h.current=window.setTimeout(()=>d(!1),1500)};return s.jsxs("div",{className:`tools${i?" menu":""}`,children:[s.jsxs("button",{title:"回复","aria-label":"回复",onClick:()=>{xc({itemId:a,text:Ba(n).slice(0,60)}),lr(),o?.()},children:[s.jsx(Q,{name:"reply",size:16}),i?"回复":null]}),s.jsxs("button",{className:c?"copied":"",title:c?"已复制":"复制","aria-label":c?"已复制":"复制",onClick:()=>void m(),children:[s.jsx(Q,{name:c?"check":"copy",size:16}),i?"复制":null]})]})}function Eb({anchor:n,text:a,itemId:i,close:o}){const[c,d]=k.useState(null),h=k.useRef(null);if(k.useLayoutEffect(()=>{const v=n.current,x=v?.closest(".mmsgs, .msgs");v&&x&&d({bubble:v.getBoundingClientRect(),area:x.getBoundingClientRect()})},[n]),k.useLayoutEffect(()=>{!c||!h.current||!n.current||h.current.replaceChildren(n.current.cloneNode(!0))},[n,c]),!c)return null;const{bubble:m,area:p}=c,g=PT(m,p);return fr.createPortal(s.jsxs("div",{className:"message-popup",onPointerDown:v=>v.stopPropagation(),children:[s.jsx("div",{className:"message-shade",style:{left:p.left,top:p.top,width:p.width,height:p.height},onPointerDown:o}),s.jsx("div",{ref:h,className:"message-popup-bubble",style:{left:m.left,top:m.top,width:m.width}}),s.jsx("div",{className:"message-popup-menu",style:g,children:s.jsx(nh,{text:a,itemId:i,menu:!0,close:o})})]}),document.body)}function tC(n,a){const o=[...n.currentTarget.closest(".col")?.querySelectorAll(".message-row[data-item-id]")??[]].find(c=>c.dataset.itemId===a);o&&f0(o)}function Ab(n){const a=n.durationMs??(n.startedAt&&n.endedAt?Date.parse(n.endedAt)-Date.parse(n.startedAt):void 0);return a===void 0?void 0:Hl(a)}function nC({job:n,round:a,fresh:i,itemId:o}){const c=we(),d=Pw(n,a),h=d!==n,[m,p]=k.useState(!1),[g,v]=k.useState(""),[x,w]=k.useState(!1),E=fn(m,200),T=d.status==="running",C=!h&&(T||d.status==="waiting"),M=d.status==="stuck"||d.status==="failed",A=hh(d),$=c.assistants.find(S=>S.id===d.assistantId),O=h?void 0:d.sediment,W=O&&O.status!=="empty"?O:void 0,ee=k.useRef(void 0);W&&(ee.current=W);const I=fn(!!W,200),j=I.mounted?W??ee.current:void 0,y=k.useRef(d.status);return k.useEffect(()=>{if(y.current===d.status)return;y.current=d.status,w(!0);const S=window.setTimeout(()=>w(!1),400);return()=>window.clearTimeout(S)},[d.status]),s.jsx("div",{className:`hov${i?" enter":""}`,id:h?void 0:`job-${d.id}`,"data-item-id":o,children:s.jsxs("div",{className:"b jobcard",role:"button",tabIndex:0,onClick:()=>Ln(d.id,a??0),onKeyDown:S=>{S.key==="Enter"&&Ln(d.id,a??0)},children:[s.jsxs("div",{className:"tt",children:[$?s.jsx("span",{className:"jav",children:s.jsx(ut,{sprite:$.sprite,prop:$.prop,size:40})}):null,s.jsxs("span",{className:"jt",children:[d.routineId?s.jsx(Q,{name:"clock",size:14}):null,d.title]}),s.jsx("span",{className:"stline",children:s.jsx(js,{meta:es[d.status],card:!0,animated:!0,swapped:x,children:T?` · ${vr(d.startedAt??d.createdAt)}`:Ab(d)?` · 用时 ${Ab(d)}`:null})})]}),A||j?s.jsxs("div",{className:`jnote${!A&&I.leaving?" leaving":""}`,children:[A?s.jsx("div",{className:`jnote-row${M?" bad":""}`,children:s.jsx("span",{className:"clamp",children:A})}):null,j?s.jsxs("div",{className:`jnote-row${j.status==="failed"?" bad":""}`,children:[s.jsx(Q,{name:j.status==="running"?"spin":"mem",size:13,className:j.status==="running"?"spin":void 0}),s.jsx("span",{children:dk(j)})]}):null]}):null,C||T?s.jsxs("div",{className:"acts",children:[C?s.jsxs("button",{className:`hob-btn job-reply${m?" selected":""}`,"aria-pressed":m,onClick:S=>{S.stopPropagation(),p(U=>!U)},children:[s.jsx(Q,{name:"edit",size:14}),"补充要求"]}):null,T?s.jsxs("button",{className:"hob-btn hob-btn-danger job-stop",onClick:S=>{S.stopPropagation(),_0(d.id)},children:[s.jsx(Q,{name:"stop",size:14}),"停止"]}):null]}):null,E.mounted?s.jsx("div",{className:`replywrap${E.leaving?" leaving":""}`,onClick:S=>S.stopPropagation(),children:s.jsx("div",{className:"replyclip",children:s.jsxs("div",{className:"replybox",children:[s.jsx("input",{autoFocus:!0,value:g,placeholder:"补充说明或更正方向",onChange:S=>v(S.target.value),onKeyDown:S=>{S.key==="Enter"&&g.trim()&&(Xf(d.id,g.trim()),v(""),p(!1)),S.key==="Escape"&&p(!1)}}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{g.trim()&&Xf(d.id,g.trim()),v(""),p(!1)},children:"发送"})]})})}):null]})})}function Mb({draft:n}){const a=we(),i=n.status==="created"&&n.createdAssistantId,o=i?a.assistants.find(h=>h.id===n.createdAssistantId):void 0,c=o?.prop??n.prop,d=!!i&&!o;return s.jsxs("div",{className:"draft",children:[s.jsxs("div",{className:"top",children:[s.jsx(ut,{sprite:o?.sprite??n.sprite,prop:c,size:46}),s.jsxs("div",{children:[s.jsx("div",{className:"dn",children:n.name}),s.jsx("div",{className:"ds",children:n.status==="created"?"新助手 · 已创建":"新助手 · 草稿"})]})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"职责"}),s.jsx("span",{children:n.dutyLong})]}),s.jsx("div",{className:`expand${i?"":" open"}`,inert:!!i,children:s.jsxs("div",{children:[s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"定时任务"}),s.jsx("span",{className:n.routinesText?void 0:"none",children:n.routinesText||"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"执行前确认"}),s.jsx("span",{className:n.askFirst.length?void 0:"none",children:n.askFirst.join(" · ")||"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"补充说明"}),n.instructions.length?s.jsx("span",{children:n.instructions.map((h,m)=>s.jsx("span",{className:"line",children:h},m))}):s.jsx("span",{className:"none",children:"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"迁移"}),s.jsxs("span",{children:[n.carry.conversations," 段对话"]})]})]})}),s.jsxs("div",{className:"acts swap",style:{marginTop:12},children:[s.jsxs("div",{className:i?"off":void 0,children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void oS(n.id),children:"创建"}),s.jsx("button",{className:"hob-btn",onClick:()=>{kh("请修改草稿:"),lr()},children:"修改草稿"})]}),s.jsx("div",{className:i?void 0:"off",children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:d,onClick:()=>void Jt(n.createdAssistantId),children:d?"已归档":"已创建 · 查看"})})]})]})}function sC({delegation:n,fresh:a}){const i=we(),[o,c]=k.useState(!1),d=k.useRef(n.status),h=d.current!==n.status;k.useEffect(()=>{d.current=n.status},[n.status]);const m=i.assistants.find(v=>v.id===n.to),p=m?.name??n.to,g=Object.values(i.approvals).filter(v=>v.status==="pending"&&((n.approvalIds??[]).includes(v.id)||!!(v.jobId&&n.jobIds.includes(v.jobId))));return s.jsx("div",{className:`hov${a?" enter":""}`,id:`delegation-${n.id}`,children:s.jsxs("div",{className:"b jobcard delegation-card",children:[s.jsxs("div",{className:"tt",children:[m?s.jsx("span",{className:"jav",children:s.jsx(ut,{sprite:m.sprite,prop:m.prop,size:40})}):null,s.jsxs("span",{className:"jt",children:["交给「",p,"」"]}),s.jsx("span",{className:h?"status-fade":void 0,children:s.jsx(js,{meta:fk[n.status],card:!0})},n.status)]}),s.jsx("button",{className:`delegation-text${o?" expanded":""}`,onClick:()=>c(!o),title:o?"收起":"查看全文",children:n.text}),n.status==="returned"&&n.reply?s.jsx("div",{className:"note",children:n.reply}):null,n.jobIds.map(v=>{const x=i.jobs[v];return x?s.jsxs("button",{className:`delegation-job ${x.status}`,onClick:()=>Ln(v),title:es[x.status].text,children:[Bh(x.status,14,2),s.jsx("span",{children:x.title}),s.jsx(Q,{name:"chev",size:14,className:"go"})]},v):null}),g.map(v=>s.jsx(hk,{approval:v,fresh:!1},v.id)),s.jsxs("div",{className:"delegation-actions",children:[s.jsxs("button",{onClick:()=>void yh(n.to,n.id,!0),children:["去「",p,"」看看 →"]}),n.status==="interrupted"?s.jsx("button",{onClick:()=>void uS(n.id),children:"重新转交"}):null]})]})})}function hk({approval:n,fresh:a}){const i=k.useRef(n.status),o=i.current!==n.status;k.useEffect(()=>{i.current=n.status},[n.status]);const c=n.options.find(C=>C.key===n.chosen),d=n.status==="answered"&&c?n.chosen:void 0,[h,m]=k.useState(null),[p,g]=k.useState(""),v=h??d,x=h!==null,w=n.status==="answered"?n.answerText:void 0,E=p.trim(),T=()=>{E&&eb(n.id,{text:E})};return s.jsxs("div",{className:`b q${a?" enter":""}`,children:[s.jsx("div",{className:"qt",children:n.title}),n.detail?s.jsx("div",{className:"qs",children:n.detail}):null,s.jsxs("div",{className:"opts",children:[n.status==="expired"?s.jsx("div",{className:`opt${o?" status-fade":""}`,children:"已结束"}):w?s.jsxs("div",{className:"opt chosen",children:[s.jsx("span",{className:"key",children:s.jsx(Q,{name:"user",size:12})}),w,s.jsx("span",{className:`ck${o?" check-enter":""}`,children:s.jsx(Q,{name:"check",size:16})})]}):v&&!x?s.jsxs("div",{className:"opt chosen",children:[s.jsx("span",{className:"key",children:v}),n.options.find(C=>C.key===v)?.label,s.jsx("span",{className:"ck",children:s.jsx(Q,{name:"check",size:16})})]}):n.options.map(C=>{const M=C.key===v;return s.jsx("div",{className:`optrow${x&&!M?" away":""}`,children:s.jsx("div",{className:"optclip",children:s.jsxs("button",{className:`opt${M?" chosen":""}`,disabled:x,onClick:()=>{m(C.key),eb(n.id,{key:C.key})},children:[s.jsx("span",{className:"key",children:C.key}),C.label,M&&x?s.jsx("span",{className:"ck",children:s.jsx(Q,{name:"check",size:16})}):null]})})},C.key)}),n.status==="expired"||w||x||v?null:s.jsxs("div",{className:"other",children:[s.jsx("input",{value:p,placeholder:"其他想法…",onChange:C=>g(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!C.nativeEvent.isComposing&&T()}}),E?s.jsx("button",{className:"hob-icon-btn other-send",title:"发送",onClick:T,children:s.jsx(Q,{name:"send",size:16})}):null]})]})]})}function lC({name:n,path:a,meta:i,fresh:o,itemId:c}){return s.jsxs("button",{className:`att filecard${o?" enter":""}`,"data-item-id":c,onClick:()=>zt(a,n),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:Ul(a),size:18})}),s.jsxs("span",{children:[s.jsx("span",{className:"n",style:{display:"block"},children:n}),i?s.jsx("span",{className:"m",children:i}):null]})]})}function aC({name:n,path:a,fresh:i,itemId:o}){return s.jsx("button",{className:`imgcard${i?" enter":""}`,"data-item-id":o,onClick:()=>zt(a),title:n,children:s.jsx("img",{src:$l(a),alt:n,loading:"lazy"})})}function iC(n){const a=k.useRef(null);return k.useLayoutEffect(()=>{const i=a.current;if(!i||(i.style.maxWidth="",n===void 0))return;let o=!0;const c=()=>{if(!o)return;i.style.maxWidth="";const d=i.getBoundingClientRect();if(!d.width)return;let h=0;const m=document.createRange(),p=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let v=p.nextNode();v;v=p.nextNode()){let x;if(v instanceof Element){if(getComputedStyle(v).display!=="inline")continue;x=v.getClientRects()}else m.selectNodeContents(v),x=m.getClientRects();for(const w of x)h=Math.max(h,w.right)}if(!h)return;const g=Math.ceil(h-d.left+parseFloat(getComputedStyle(i).paddingRight));g>=d.width-1||(i.style.maxWidth=`${g}px`,i.getBoundingClientRect().height>d.height+.5&&(i.style.maxWidth=""))};return c(),document.fonts.ready.then(c),()=>{o=!1}},[n]),a}function rC({item:n,inlineDraft:a,fresh:i,tools:o}){const c=we(),d=i?" enter":"",[h,m]=k.useState(!1),p=iC(n.kind==="user"&&!n.files?.length?n.text:void 0),g=o.touch?E=>E.preventDefault():void 0,v=o.distance?{transform:`translateX(-${Math.min(64,o.distance*.8)}px)`,transition:"none"}:void 0,x=Math.min(1,o.distance/48),w=o.distance>0?s.jsx("span",{className:`swipe-reply${o.ready?" ready":""}`,style:{opacity:x,transform:`scale(${x})`},children:s.jsx("span",{className:"swipe-reply-inner",children:s.jsx(Q,{name:"reply",size:18})})}):null;if(n.kind==="user"){const E=n.files?.filter(Wi)??[],T=n.files?.filter(I=>!Wi(I))??[],C=E.length===1,M=E.length>1,A=!!(n.from||n.quote||n.text||T.length),$=iS(c,c.sel,n.id),O=I=>{I.startsWith("pending/")||zt(I,Yi(I))},W=(I,j)=>s.jsx("button",{className:j,onClick:()=>O(I),title:Yi(I),children:s.jsx("img",{src:$l(I),alt:Yi(I),loading:"lazy"})},I),ee=I=>s.jsxs("button",{className:"ufile",onClick:()=>O(I),children:[s.jsx("span",{className:"fi",children:s.jsx(Q,{name:Ul(I),size:16})}),s.jsx("span",{className:"fn",children:Yi(I)})]});return s.jsxs("div",{className:"message-row right",id:n.from?`forward-${n.from.delegationId}`:void 0,"data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[w,$?.status==="failed"?s.jsx("button",{className:"send-failed",title:"重试","aria-label":"未送达,重试",onClick:()=>Wx($.assistantId,$.localId),children:"!"}):$&&n.files?.length?s.jsx("span",{className:"send-progress","aria-label":"正在发送",children:s.jsx(Q,{name:"spin",size:16,w:2.2,className:"spin"})}):null,s.jsxs("div",{className:`hov right msg${i?" enter-right":""}${$?" pending":""}`,children:[M?s.jsxs("div",{className:`u-album${h?" open":""}`,ref:A?void 0:p,style:A?void 0:v,children:[s.jsx("button",{className:"album-pill",onClick:()=>m(!h),children:h?"收起":`展开 ${E.length}`}),h?s.jsx("div",{className:"album-list",children:E.map(I=>W(I,"u-photo album-item"))}):s.jsx(KT,{photos:E,onOpen:O})]}):null,C?s.jsx("div",{className:"u-solo",ref:A?void 0:p,style:A?void 0:v,children:W(E[0],"u-photo album-item")}):null,A?s.jsxs("div",{className:"u",ref:p,style:v,children:[n.from?s.jsxs("button",{className:"forward-label",onClick:()=>void(n.from.assistantId==="hob"?yh(n.from.assistantId,n.from.delegationId,!1):tb(n.from.assistantId,n.from.delegationId,!1)),children:[(()=>{const I=c.assistants.find(j=>j.id===n.from.assistantId);return I?s.jsx(ut,{sprite:I.sprite,prop:I.prop,size:16}):null})(),"转自 ",n.from.assistantId==="hob"?n.from.name:`「${n.from.name}」`]}):null,n.quote?s.jsx("button",{className:"quote",onClick:I=>tC(I,n.quote.itemId),children:n.quote.text}):null,n.text?s.jsx("span",{className:"u-text",children:n.text}):null,T.map(I=>I.startsWith("pending/")?s.jsx(k.Fragment,{children:ee(I)},I):s.jsx(Sb,{path:I,name:Yi(I),fallback:ee(I)},I))]}):null,$?.status==="failed"?s.jsxs("div",{className:"send-status",children:["未送达",s.jsx("button",{onClick:()=>Wx($.assistantId,$.localId),children:"重试"}),s.jsx("button",{onClick:()=>aS($.assistantId,$.localId),children:"删除"})]}):null,$?null:s.jsx(nh,{text:n.text,itemId:n.id})]}),o.open?s.jsx(Eb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})}if(n.kind==="assistant")return s.jsxs(s.Fragment,{children:[n.routine?s.jsx("div",{className:`tag${i?" enter-fade":""}`,children:n.routine.jobId?s.jsxs("button",{onClick:()=>Ln(n.routine.jobId),children:[s.jsx(Q,{name:"clock",size:13}),n.routine.name]}):s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"clock",size:13}),n.routine.name]})}):null,s.jsxs("div",{className:"message-row","data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[w,s.jsxs("div",{className:`hov msg${d}`,children:[TT(n.text).map((E,T,C)=>E.table?s.jsx("div",{className:"tablecard",ref:T===0?p:void 0,style:T===0?v:void 0,children:s.jsx(Ka,{text:E.md})},T):s.jsxs("div",{className:`b${a&&T===C.length-1?" wide":""}`,ref:T===0?p:void 0,style:T===0?v:void 0,children:[s.jsx(Ka,{text:E.md,streaming:n.streaming&&T===C.length-1}),a&&T===C.length-1?s.jsx(Mb,{draft:a}):null]},T)),s.jsx(nh,{text:n.text,itemId:n.id})]}),o.open?s.jsx(Eb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})]});if(n.kind==="note")return s.jsxs("div",{className:`sys${i?" enter-fade":""}`,id:n.handbackId?`handback-${n.handbackId}`:void 0,children:[n.icon!=="split"?s.jsx(Q,{name:WT[n.icon],size:14}):null,n.handbackId?s.jsx("button",{onClick:()=>void tb("hob",n.handbackId,!0),children:n.text}):n.icon==="skill"&&n.path?s.jsx("button",{onClick:()=>zt(n.path),children:n.text}):n.icon==="memory"?s.jsx("span",{className:"sys-memory",title:n.text,children:n.text.replace(/[::,,;;、]+\s*$/u,"")}):n.text]});if(n.kind==="question"){const E=c.approvals[n.approvalId];return E?s.jsx(hk,{approval:E,fresh:i}):null}if(n.kind==="job"){const E=c.jobs[n.jobId];return E?s.jsx(nC,{job:E,round:n.round,fresh:i,itemId:n.id}):null}if(n.kind==="draft"){const E=c.drafts[n.draftId];return E?s.jsx("div",{className:`b wide${d}`,children:s.jsx(Mb,{draft:E})}):null}if(n.kind==="delegation"){const E=c.delegations[n.delegationId];return E?s.jsx(sC,{delegation:E,fresh:i}):null}return n.kind==="image"?s.jsx(IT,{...n,fresh:i,itemId:n.id}):Wi(n.path)?s.jsx(aC,{path:n.path,name:n.name,fresh:i,itemId:n.id}):s.jsx(Sb,{path:n.path,name:n.name,itemId:n.id,fallback:s.jsx(lC,{path:n.path,name:n.name,meta:n.meta,fresh:i,itemId:n.id})})}function oC(n,a){return n?n.kind==="user"!=(a.kind==="user")||!!a.lead:!1}function mk({items:n}){const a=we(),i=eC(),[o,c]=k.useReducer(FT,null),d=k.useRef(null),[h,m]=k.useState(null);k.useEffect(()=>{const g=()=>{d.current&&window.clearTimeout(d.current.timer),d.current=null,m(null)},v=T=>{c({type:"outside",inside:T.target instanceof Element&&!!T.target.closest(".tools.menu")})},x=T=>{const C=d.current;if(!C||C.pointerId!==T.pointerId)return;if(C.swipe=JT(C.swipe,T.clientX,T.clientY),Math.hypot(T.clientX-C.swipe.x,T.clientY-C.swipe.y)>10&&window.clearTimeout(C.timer),C.swipe.direction==="vertical"){g();return}if(C.swipe.direction!=="horizontal")return;window.clearTimeout(C.timer);const M=Cb(C.swipe);if(M&&!C.ready&&navigator.vibrate?.(10),C.ready=M,window.matchMedia("(prefers-reduced-motion: reduce)").matches){M&&(xc({itemId:C.id,text:Ba(C.text).slice(0,60)}),lr(),g());return}m({id:C.id,distance:C.swipe.distance,ready:M})},w=T=>{const C=d.current;!C||C.pointerId!==T.pointerId||(Cb(C.swipe)&&(xc({itemId:C.id,text:Ba(C.text).slice(0,60)}),lr()),g())},E=()=>{g(),c({type:"close"})};return document.addEventListener("pointerdown",v,!0),document.addEventListener("pointermove",x,!0),document.addEventListener("pointerup",w,!0),document.addEventListener("pointercancel",g,!0),document.addEventListener("scroll",E,!0),()=>{g(),document.removeEventListener("pointerdown",v,!0),document.removeEventListener("pointermove",x,!0),document.removeEventListener("pointerup",w,!0),document.removeEventListener("pointercancel",g,!0),document.removeEventListener("scroll",E,!0)}},[]);const p=[];n.length&&!XT(n[0].at)&&n[0].kind!=="note"&&p.push(s.jsx("div",{className:"div",children:Pt(n[0].at)},"first-div"));for(let g=0;g<n.length;g++){const v=n[g],x=n[g-1],w=n[g+1],E=gw(v.id),T=v.kind==="assistant"&&w?.kind==="draft"?a.drafts[w.draftId]:void 0,C={open:i&&o===v.id,touch:i,distance:h?.id===v.id?h.distance:0,ready:h?.id===v.id&&h.ready,close:()=>c({type:"close"}),start:i?M=>{if(M.pointerType!=="touch"||v.kind!=="user"&&v.kind!=="assistant"||M.target.closest("a,button,input,textarea,select,[contenteditable],.draft,.album-stack"))return;d.current&&window.clearTimeout(d.current.timer);const{clientX:A,clientY:$,pointerId:O}=M,W=window.setTimeout(()=>{d.current=null,c({type:"open",id:v.id})},500);d.current={timer:W,pointerId:O,id:v.id,text:v.text,swipe:{x:A,y:$,direction:"pending",distance:0},ready:!1}}:void 0};T&&g++,p.push(s.jsxs(k.Fragment,{children:[VT(x?.at,v.at)?s.jsx("div",{className:`div${E?" enter-fade":""}`,children:Pt(v.at)}):oC(x,v)?s.jsx("div",{className:"g"}):null,s.jsx(rC,{item:v,inlineDraft:T,fresh:E,tools:C})]},v.id))}for(const g of mw(Object.values(a.livePages),a.sel))p.push(s.jsxs("button",{className:`att filecard${g.state==="failed"?" bad":""}`,onClick:()=>RS(g.callId),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:g.state==="writing"?"spin":"close",className:g.state==="writing"?"spin":"",size:18})}),s.jsxs("span",{children:[s.jsx("span",{className:"n",style:{display:"block"},children:g.title||"正在写页面…"}),s.jsx("span",{className:"m",children:g.state==="failed"?`生成失败:${g.error}`:"生成中"})]})]},g.callId));return s.jsx(s.Fragment,{children:p})}function ze({children:n,action:a,large:i=!1}){return s.jsxs("div",{className:`empty${i?" empty-large":""}`,children:[n,a?s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{onClick:a.onClick,children:a.label})]}):null]})}function Hn({text:n}){const[a,i]=k.useState(!1);return k.useEffect(()=>{const o=setTimeout(()=>i(!0),300);return()=>clearTimeout(o)},[]),a?n:null}function pk({leaving:n,gap:a,a:i}){return s.jsxs(s.Fragment,{children:[a?s.jsx("div",{className:"g"}):null,s.jsx("div",{className:`hov think${n?" leaving":""}`,children:s.jsxs("div",{className:"activity-line",role:"status",children:[s.jsx(ut,{sprite:i.sprite,prop:i.prop,size:46,free:!0,motion:i.activity?.state==="tool"?"work":"think"}),s.jsx("span",{className:"activity-shimmer",children:i.activity?.label??"正在想…"})]})})]})}function gk(n,a,i,o,c,d){const[h,m]=k.useState(!0),p=k.useRef(!0),g=k.useRef({key:"",len:0});return k.useEffect(()=>{const x=n.current;if(!x)return;const w=()=>({top:x.scrollTop,height:x.scrollHeight,view:x.clientHeight}),E=()=>{const C=FS(p.current,a.current,w());a.current=C.expect,C.stuck!==p.current&&(p.current=C.stuck,m(C.stuck))},T=new ResizeObserver(()=>{a.current=PS(p.current,a.current,w()),p.current&&(x.scrollTop=a.current)});x.addEventListener("scroll",E,{passive:!0}),T.observe(x);for(const C of Array.from(x.children))T.observe(C);return()=>{x.removeEventListener("scroll",E),T.disconnect()}},[n,a]),k.useLayoutEffect(()=>{const x=n.current;if(!x)return;const w=g.current;g.current={key:i,len:o,firstId:c},w.key!==i||o<w.len?(p.current=!0,m(!0),x.scrollTop=x.scrollHeight,a.current=x.scrollTop):o>w.len&&w.firstId===c&&(p.current||d)&&(p.current=!0,m(!0),x.scrollTo({top:x.scrollHeight,behavior:"smooth"}))},[n,a,i,o,c,d]),{atBottom:h,toBottom:()=>{const x=n.current;x&&(p.current=!0,m(!0),x.scrollTo({top:x.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}))}}}function vk(n,a,i,o,c){const d=k.useRef(null),h=k.useRef({key:""}),m=()=>{const p=n.current;if(!p)return;const g=p.getBoundingClientRect().top,v=Array.from(p.querySelectorAll("[data-item-id]")).find(x=>x.getBoundingClientRect().bottom>g);d.current=v?{id:v.dataset.itemId,top:v.getBoundingClientRect().top,key:i}:null};return k.useLayoutEffect(()=>{const p=n.current,g=h.current;if(p&&g.key===i&&g.id&&g.id!==o&&d.current?.key===i){const v=Array.from(p.querySelectorAll("[data-item-id]")).find(x=>x.dataset.itemId===d.current?.id);v&&(p.scrollTop+=v.getBoundingClientRect().top-d.current.top,c.current=p.scrollTop)}h.current={key:i,id:o}},[n,i,o,c]),()=>{const p=n.current;!p||!a||(m(),p.scrollTop<120&&bh(a))}}function xk({id:n}){const a=we().itemPages[n??""];return!a?.hasMore&&!a?.loading&&!a?.error?null:s.jsx("div",{className:"older-messages",role:"status",children:a.error?s.jsxs("button",{onClick:()=>n&&void bh(n,!0),children:["读取失败:",a.error," · 重试"]}):a.loading?s.jsx(Hn,{text:"正在读取更早的消息…"}):null})}function bk(n){return n?.kind==="user"&&!n.from}function kk({show:n,busy:a,onClick:i}){return s.jsx("button",{className:`jump${n?" show":""}`,onClick:i,title:"回到最新消息","aria-label":"回到最新消息","aria-hidden":!n,tabIndex:n?0:-1,children:a?s.jsxs("span",{className:"jump-dots","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}):s.jsx(Q,{name:"arrowDown",size:20})})}const cC=["查看这台电脑的磁盘和内存占用","每天早上 9 点给我一份科技新闻简报","把附件里的会议记录整理成要点"];function yk({a:n}){const i=we().settings.settings.models,o=i.roster.length>0&&i.conversation.ref!=="";return s.jsxs("div",{className:"hello",children:[s.jsx(ut,{sprite:n.sprite,prop:n.prop,size:88,free:!0,motion:"home"}),s.jsx("div",{className:"t",children:`我是${jk(n.name,!1)}${n.primary?",你的主助手":""}`}),s.jsx("div",{className:"d",children:n.primary?"交给我的事,我会分派给后台任务执行,完成、受阻或需要你确认时再告诉你;也可以让我定时执行。同类工作多了,我会建议创建专属助手。":`负责${n.duty}。`}),o?n.primary?s.jsx("div",{className:"ex",children:cC.map(c=>s.jsx("button",{className:"hob-btn",onClick:()=>{kh(c),lr()},children:c},c))}):null:s.jsxs("div",{className:"setup",children:[s.jsx("div",{children:"开始使用前,请先添加模型服务商并选择模型。"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{Ac(),Rl("providers")},children:"前往设置"})]})]})}function jk(n,a=!0){const i=o=>!!(o&&/[A-Za-z0-9]/.test(o));return`${i(n[0])?" ":""}${n}${a&&i(n.at(-1))?" ":""}`}function wk(n,a){return`${n??""}|${a??0}`}function uC(){const n=we(),a=n.assistants.find(x=>x.id===n.sel),i=z0(n,n.sel),o=!!(a&&n.sel&&i.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=k.useRef(null),d=wk(n.sel,n.sel?n.itemGen[n.sel]:0),h=!!a?.busy&&!u0(i),m=fn(h,180),p=k.useRef(0),g=vk(c,n.sel,d,i[0]?.id,p),v=gk(c,p,d,i.length,i[0]?.id,bk(i.at(-1)));return s.jsxs("main",{className:"chat",children:[s.jsxs("div",{className:"head",children:[a?s.jsx(ut,{sprite:a.sprite,prop:a.prop,size:24}):null,s.jsx("span",{className:"nm",children:a?.name??""}),s.jsx("span",{className:"sp"}),n.collapsed?s.jsx("button",{className:"hob-icon-btn",title:"展开右栏",onClick:CS,children:s.jsx(Q,{name:"panel",size:18})}):null]}),s.jsx("div",{className:"msgs",ref:c,onScroll:g,children:s.jsxs("div",{className:`col${o?" mid":""}`,children:[s.jsx(xk,{id:n.sel}),o&&a?s.jsx(yk,{a}):s.jsx(mk,{items:i}),m.mounted&&a?s.jsx(pk,{a,leaving:m.leaving,gap:i.at(-1)?.kind==="user"}):null]})}),s.jsx(kk,{show:!v.atBottom,busy:!!a?.busy,onClick:v.toBottom}),s.jsx(Nk,{})]})}function Nk({variant:n="desktop"}){const a=we(),i=a.assistants.find(g=>g.id===a.sel),o=k.useRef(null),c=a.text.trim().length>0||a.attachments.length>0,d=fn(a.quote!==null,180);k.useLayoutEffect(()=>{const g=o.current;if(!g)return;g.style.height="auto";const v=n==="mobile"?120:180;g.style.height=`${Math.min(g.scrollHeight,v)}px`},[a.text,a.nonce,n]),k.useEffect(()=>{a.nonce&&o.current?.focus()},[a.nonce]);const h=g=>{const v=BS(g.clipboardData);v.length&&(g.preventDefault(),Jx(v))},m=k.useRef(null);k.useLayoutEffect(()=>{const g=m.current,v=g?.closest(".chat");if(!g||!v)return;const x=new ResizeObserver(()=>v.style.setProperty("--comp-h",`${g.offsetHeight}px`));return x.observe(g),()=>x.disconnect()},[n]);const p=s.jsxs("div",{className:n==="mobile"?"mcomp":"comp",onPaste:h,children:[d.mounted?s.jsxs("div",{className:`comp-quote${d.leaving?" leaving":""}`,children:[s.jsx("div",{className:"quote",children:a.quote?.text}),s.jsx("button",{className:"hob-icon-btn",style:{width:20,height:20},onClick:()=>xc(null),title:"取消引用",children:s.jsx(Q,{name:"close",size:13})})]}):null,a.attachments.length?s.jsx("div",{className:"comp-files",children:a.attachments.map(g=>{const v=g.path??Cc(g),x=g.status==="uploading"?" uploading":g.status==="failed"?" failed":"";return Wi(g.name)?s.jsxs("span",{className:`comp-thumb${x}`,children:[s.jsx("img",{src:$l(v),alt:g.name}),g.status==="uploading"?s.jsx("span",{className:"att-spin",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,g.status==="failed"?s.jsx("span",{className:"att-bad",children:"!"}):null,s.jsx("button",{onClick:()=>Px(g.id),title:"移除","aria-label":"移除",children:s.jsx(Q,{name:"close",size:11,w:2.2})})]},g.id):s.jsxs("span",{className:`filechip${x}`,children:[s.jsx("span",{className:"fi",children:g.status==="uploading"?s.jsx(Q,{name:"spin",size:16,w:2.2,className:"spin"}):s.jsx(Q,{name:Ul(g.name),size:16})}),s.jsx("span",{className:"fn",children:g.name}),s.jsx("button",{onClick:()=>Px(g.id),title:"移除","aria-label":"移除",children:s.jsx(Q,{name:"close",size:12})})]},g.id)})}):null,s.jsxs("div",{className:"comp-main",children:[s.jsxs("label",{className:"pl",title:"加文件(也可粘贴截图)",children:[s.jsx(Q,{name:"plus",size:19}),s.jsx("input",{type:"file",multiple:!0,hidden:!0,onChange:g=>{const v=Array.from(g.target.files??[]);g.target.value="",v.length&&Jx(v)}})]}),s.jsx("textarea",{ref:o,className:"ta",rows:1,value:a.text,placeholder:`给${jk(i?.name??"")}发消息`,onChange:g=>kh(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),Fx())}}),i?.busy&&!c?s.jsx("button",{className:"sendbtn stop",title:"停止",onClick:()=>void rS(i.id),children:s.jsx(Q,{name:"stop",size:18})}):s.jsx("button",{className:"sendbtn",title:"发送",disabled:!c,onClick:()=>void Fx(),children:s.jsx(Q,{name:"send",size:17})})]})]});return n==="mobile"?s.jsx("div",{className:"mcomp-wrap",ref:m,children:p}):s.jsx("div",{className:"compwrap",ref:m,children:s.jsx("div",{className:"col",children:p})})}function dC(){const n=we(),a=n.assistants.find(x=>x.id===n.sel),i=z0(n,n.sel),o=!!(a&&n.sel&&i.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=k.useRef(null),d=!!a?.busy&&!u0(i),h=fn(d,180),m=wk(n.sel,n.sel?n.itemGen[n.sel]:0),p=k.useRef(0),g=vk(c,n.sel,m,i[0]?.id,p),v=gk(c,p,m,i.length,i[0]?.id,bk(i.at(-1)));return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mchat-head",children:[s.jsx("button",{className:"hob-icon-btn",style:{marginLeft:-8},title:"返回",onClick:()=>Qf("list"),children:s.jsx(Q,{name:"left",size:22})}),a?s.jsx(ut,{sprite:a.sprite,prop:a.prop,size:30}):null,s.jsx("span",{className:"nm",children:a?.name??""}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-icon-btn",title:"助手信息",onClick:ES,children:s.jsx(Q,{name:"more",size:20})})]}),s.jsx("div",{className:"mmsgs",ref:c,onScroll:g,children:s.jsxs("div",{className:`col${o?" mid":""}`,children:[s.jsx(xk,{id:n.sel}),o&&a?s.jsx(yk,{a}):s.jsx(mk,{items:i}),h.mounted&&a?s.jsx(pk,{a,leaving:h.leaving,gap:i.at(-1)?.kind==="user"}):null]})}),s.jsx(kk,{show:!v.atBottom,busy:!!a?.busy,onClick:v.toBottom}),s.jsx(Nk,{variant:"mobile"})]})}const fC="document.addEventListener('click',function(e){if(!e.isTrusted)return;const a=e.target.closest('a[href]');if(!a||!/^https?:\\/\\//i.test(a.getAttribute('href')||''))return;let u;try{u=new URL(a.href)}catch{return}if(!['http:','https:'].includes(u.protocol))return;e.preventDefault();if(window.parent!==window)window.parent.postMessage({type:'hob-page-link',url:u.href},'*');else window.open(u.href,'_blank','noopener')});",hC="addEventListener('DOMContentLoaded',function(){document.querySelectorAll('main table').forEach(function(t){if(t.parentElement.classList.contains('tw'))return;var w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});document.querySelectorAll('main figure>svg').forEach(function(g){var v=g.viewBox&&g.viewBox.baseVal;if(v&&v.width)g.style.minWidth=Math.round(v.width*0.75)+'px'})});",mC="(function(){function f(){var h=location.hash;document.documentElement.classList.toggle('dark',h==='#dark'||(h!=='#light'&&matchMedia('(prefers-color-scheme: dark)').matches))}f();addEventListener('hashchange',f)})();",pC="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: https:; media-src data: https:; font-src data:",gC=`:root{--bg:#fff;--soft:#f5f5f2;--line:#e8e8e5;--ink:#18181a;--muted:#6d6d72;--faint:#a4a4a9;--accent:#ff6a2b;--accent-soft:#fff0e7;--ok:#1f9a5f;--ok-soft:#e8f5ee;--warn:#b7740a;--warn-soft:#fbf2df;--bad:#d92d20;--bad-soft:#fcebe9;color-scheme:light}
|
|
179
|
+
:root.dark{--bg:#151516;--soft:#1f1f21;--line:#2c2c2f;--ink:#ececed;--muted:#a1a1a7;--faint:#6b6b71;--accent:#ff7a42;--accent-soft:#36211a;--ok:#3cc183;--ok-soft:#15281e;--warn:#e9a53a;--warn-soft:#2c2414;--bad:#ff6b5e;--bad-soft:#321b19;color-scheme:dark}
|
|
180
|
+
*{box-sizing:border-box}
|
|
181
|
+
html{background:var(--bg);color:var(--ink);font:16px/1.75 system-ui,-apple-system,"PingFang SC","Hiragino Sans GB","Noto Sans CJK SC","Microsoft YaHei",sans-serif;-webkit-text-size-adjust:100%;text-rendering:optimizeLegibility}
|
|
182
|
+
body{margin:0;padding:52px 24px 80px}
|
|
183
|
+
.page{max-width:760px;margin:0 auto}
|
|
184
|
+
.hd{margin-bottom:40px;padding-bottom:28px;border-bottom:1px solid var(--line)}
|
|
185
|
+
.hd h1{font-size:32px;line-height:1.25;letter-spacing:-.015em;margin:0 0 10px;font-weight:700}
|
|
186
|
+
.hd p{margin:0;color:var(--muted);font-size:17px;line-height:1.6}
|
|
187
|
+
h2{font-size:22px;line-height:1.35;letter-spacing:-.01em;margin:48px 0 14px;font-weight:700}
|
|
188
|
+
h3{font-size:16.5px;line-height:1.45;margin:28px 0 8px;font-weight:650}
|
|
189
|
+
main>h2:first-child,main>section:first-child>h2:first-child{margin-top:0}
|
|
190
|
+
p,ul,ol,table,pre,figure,blockquote,.note,.cards,.cols,.kpis,.steps{margin:0 0 18px}
|
|
191
|
+
ul,ol{padding-left:1.4em}li{margin:5px 0}li::marker{color:var(--faint)}
|
|
192
|
+
a{color:var(--accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--accent) 35%,transparent)}
|
|
193
|
+
strong,b{font-weight:650}
|
|
194
|
+
.muted{color:var(--muted)}.accent{color:var(--accent)}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}
|
|
195
|
+
code{font:.88em/1.5 ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;background:var(--soft);padding:.12em .4em;border-radius:5px}
|
|
196
|
+
pre{background:var(--soft);border-radius:12px;padding:14px 18px;overflow:auto;line-height:1.6}pre code{background:none;padding:0;font-size:13.5px}
|
|
197
|
+
blockquote{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted)}
|
|
198
|
+
hr{border:0;border-top:1px solid var(--line);margin:36px 0}
|
|
199
|
+
table{width:100%;border-collapse:collapse;font-size:14.5px;line-height:1.6}
|
|
200
|
+
.tw{overflow-x:auto;margin:0 0 18px}.tw>table{margin:0}
|
|
201
|
+
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
|
|
202
|
+
th{font-size:13px;font-weight:600;color:var(--muted);border-bottom-width:1.5px;white-space:nowrap}
|
|
203
|
+
td{min-width:5.5em}
|
|
204
|
+
th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}
|
|
205
|
+
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
|
|
206
|
+
.card{background:var(--soft);border-radius:14px;padding:16px 18px}.card h3{margin:0 0 6px;font-size:15.5px}
|
|
207
|
+
.cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px 28px}
|
|
208
|
+
.cols>div>h3:first-child{margin-top:0}
|
|
209
|
+
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
|
|
210
|
+
.kpi{border:1px solid var(--line);border-radius:14px;padding:14px 16px 12px}
|
|
211
|
+
.kpi b{display:block;font-size:28px;line-height:1.2;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}.kpi span{color:var(--muted);font-size:13.5px}
|
|
212
|
+
.steps{list-style:none;padding:0;counter-reset:s}
|
|
213
|
+
.steps>li{position:relative;margin:0;padding:1px 0 20px 44px;counter-increment:s}
|
|
214
|
+
.steps>li::before{content:counter(s);position:absolute;left:0;top:0;width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-weight:700;font-size:14px;line-height:28px;text-align:center}
|
|
215
|
+
.steps>li::after{content:"";position:absolute;left:13.5px;top:34px;bottom:6px;width:1px;background:var(--line)}
|
|
216
|
+
.steps>li:last-child{padding-bottom:0}.steps>li:last-child::after{display:none}.steps>li>b:first-child{display:block}
|
|
217
|
+
.note{border-radius:12px;padding:12px 16px;background:var(--accent-soft)}.note.ok{background:var(--ok-soft)}.note.warn{background:var(--warn-soft)}.note.bad{background:var(--bad-soft)}
|
|
218
|
+
.card>:last-child,.note>:last-child,.cols>div>:last-child,section>:last-child{margin-bottom:0}
|
|
219
|
+
.tag{display:inline-block;font-size:12px;line-height:1.7;padding:0 8px;border-radius:99px;background:var(--soft);color:var(--muted);vertical-align:.08em;white-space:nowrap}
|
|
220
|
+
.card .tag{background:var(--bg)}
|
|
221
|
+
.tag.accent{background:var(--accent-soft);color:var(--accent)}.tag.ok{background:var(--ok-soft);color:var(--ok)}.tag.warn{background:var(--warn-soft);color:var(--warn)}.tag.bad{background:var(--bad-soft);color:var(--bad)}
|
|
222
|
+
figure{margin:28px 0;overflow-x:auto}img,svg{max-width:100%;height:auto}figure>svg,figure>img{display:block;margin:0 auto}
|
|
223
|
+
figcaption{color:var(--muted);font-size:13.5px;margin-top:10px;text-align:center}
|
|
224
|
+
svg{color:var(--ink)}svg text{fill:var(--ink);font-family:inherit;font-size:13px}
|
|
225
|
+
svg .box{fill:var(--bg);stroke:var(--line);stroke-width:1.5}svg .hl{fill:var(--accent-soft);stroke:var(--accent);stroke-width:1.5}
|
|
226
|
+
svg .line{fill:none;stroke:var(--faint);stroke-width:1.5}svg text.muted{fill:var(--muted)}svg text.accent{fill:var(--accent)}
|
|
227
|
+
@media (max-width:600px){body{padding:32px 18px 64px}.hd{margin-bottom:32px}.hd h1{font-size:26px}h2{font-size:19.5px;margin-top:40px}}`,Rf=n=>n.replace(/[&<>"]/g,a=>({"&":"&","<":"<",">":">",'"':"""})[a]);function vC(){return xC("","","").replace("</body>",`<script>
|
|
228
|
+
(function(){
|
|
229
|
+
let latest, scheduled = false, follow = true;
|
|
230
|
+
addEventListener('scroll', function(){ follow = document.documentElement.scrollHeight - innerHeight - scrollY < 48; }, {passive:true});
|
|
231
|
+
addEventListener('message', function(e){
|
|
232
|
+
if(e.source !== parent || e.data?.type !== 'hob-page-live') return;
|
|
233
|
+
latest = e.data;
|
|
234
|
+
if(scheduled) return;
|
|
235
|
+
scheduled = true;
|
|
236
|
+
requestAnimationFrame(function(){
|
|
237
|
+
scheduled = false;
|
|
238
|
+
document.documentElement.classList.toggle('dark', !!latest.dark);
|
|
239
|
+
document.title = latest.title || '';
|
|
240
|
+
document.querySelector('.hd h1').textContent = latest.title || '';
|
|
241
|
+
document.querySelector('.hd p').textContent = latest.summary || '';
|
|
242
|
+
const main = document.querySelector('main');
|
|
243
|
+
const template = document.createElement('template');
|
|
244
|
+
template.innerHTML = (latest.html || '').replace(/<[^>]*$/, '');
|
|
245
|
+
template.content.querySelectorAll('script,iframe,object,embed').forEach(function(el){el.remove()});
|
|
246
|
+
template.content.querySelectorAll('*').forEach(function(el){
|
|
247
|
+
Array.from(el.attributes).forEach(function(a){if(/^on/i.test(a.name)||a.name.toLowerCase()==='srcdoc'||/^\\s*javascript:/i.test(a.value))el.removeAttribute(a.name)});
|
|
248
|
+
});
|
|
249
|
+
main.innerHTML = template.innerHTML;
|
|
250
|
+
main.querySelectorAll('table').forEach(function(t){const w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});
|
|
251
|
+
main.querySelectorAll('figure>svg').forEach(function(g){const v=g.viewBox&&g.viewBox.baseVal;if(v&&v.width)g.style.minWidth=Math.round(v.width*.75)+'px'});
|
|
252
|
+
if(follow) scrollTo(0, document.documentElement.scrollHeight);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
})();<\/script></body>`)}function xC(n,a,i){return`<!doctype html>
|
|
256
|
+
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
257
|
+
<meta http-equiv="Content-Security-Policy" content="${pC}">
|
|
258
|
+
<title>${Rf(n)}</title><script>${mC}${hC}<\/script><style>${gC}</style></head>
|
|
259
|
+
<body><div class="page"><header class="hd"><h1>${Rf(n)}</h1><p>${Rf(a)}</p></header>
|
|
260
|
+
<main>
|
|
261
|
+
${i}
|
|
262
|
+
</main></div><script>${fC}<\/script></body></html>
|
|
263
|
+
`}function bC(n){const[a,...i]=n;return a?a.map((o,c)=>i.length>0&&i.every(d=>{const h=d[c]?.trim();return!!h&&/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(h)&&Number.isFinite(Number(h))})):[]}function rr({title:n,children:a,root:i=!1,close:o=!1,className:c=""}){const d=we(),h=i||d.page!=="main"&&d.panelStack.length<=1;return s.jsxs("div",{className:`panel-head ${c}`,children:[s.jsx("button",{className:`hob-icon-btn${h?" panel-mobile-back":""}`,title:"返回",onClick:i?I0:ur,children:s.jsx(Q,{name:"left",size:18})}),n,a,o?s.jsx("button",{className:"hob-icon-btn panel-close",title:"关闭",onClick:dr,children:s.jsx(Q,{name:"close",size:17})}):null]})}const kC=1024*1024;function fc({embedded:n=!1,page:a}){const i=we(),o=a??i.panelStack.at(-1),c=o?.kind==="file"?o:null,d=fn(!!c,180),h=k.useRef(c);c&&(h.current=c);const m=c??h.current;return!d.mounted||!m?null:s.jsx("div",{className:`${n?"fp-embedded":"fpwrap"}${d.leaving?" leaving":""}`,onClick:n?void 0:dr,children:s.jsx("div",{className:`fp${m.full?" full":""}`,onClick:p=>p.stopPropagation(),children:m.liveId&&i.livePages[m.liveId]?s.jsx(yC,{page:i.livePages[m.liveId]}):s.jsx(jC,{path:m.path,title:m.title,find:m.find,page:m.page})})})}function yC({page:n}){const a=k.useRef(null),i=k.useRef(n);i.current=n;const[o,c]=k.useState(null),d=k.useMemo(()=>vC(),[]),h=()=>a.current?.contentWindow?.postMessage({type:"hob-page-live",title:i.current.title,summary:i.current.summary,html:i.current.html,dark:document.documentElement.classList.contains("dark")},"*");k.useEffect(()=>{h()},[n]),k.useEffect(()=>{const p=new MutationObserver(h);p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const g=v=>{if(!(v.source!==a.current?.contentWindow||v.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const x=new URL(v.data.url);["http:","https:"].includes(x.protocol)&&window.open(x.href,"_blank","noopener")}catch{}};return window.addEventListener("message",g),()=>{p.disconnect(),window.removeEventListener("message",g)}},[]),k.useEffect(()=>{let p=!0;return n.path&&Sh(n.path).then(g=>{p&&c(g)}).catch(g=>Za(`无法加载文件信息:${g instanceof Error?g.message:String(g)}`)),()=>{p=!1}},[n.path]);const m=n.state!=="done";return s.jsxs(s.Fragment,{children:[s.jsx(Sk,{name:n.title||"正在写页面…",meta:o,path:n.path||"page.html",liveStatus:n.state==="writing"?"正在生成…":n.state==="failed"?`生成失败:${n.error}`:void 0,disabled:m}),s.jsx("div",{className:"fp-body",children:n.state==="done"&&/<\s*script\b/i.test(n.html)&&o?s.jsx(Tk,{meta:o}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),s.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",srcDoc:d,onLoad:h,title:n.title||"正在写页面"})]})})]})}function jC({path:n,title:a,find:i,page:o}){const[c,d]=k.useState({state:"loading"});k.useEffect(()=>{let p=!0;return d({state:"loading"}),Sh(n).then(g=>{p&&d({state:"ok",meta:g})}).catch(g=>{if(!p)return;const v=g instanceof Error?g.message:String(g),x=v.includes("只允许读 Hob 自己的文件");d({state:"error",outside:x,message:v})}),()=>{p=!1}},[n]);const h=c.state==="ok"?c.meta:null,m=a??h?.name??n.split("/").pop()??n;return s.jsxs(s.Fragment,{children:[s.jsx(Sk,{name:m,meta:h,path:n}),s.jsx("div",{className:"fp-body",children:c.state==="loading"?s.jsx("div",{className:"fp-center dim",children:s.jsx(Hn,{text:"正在读取文件信息…"})}):c.state==="error"?s.jsx("div",{className:"fp-center",children:s.jsxs("div",{className:"fp-nofile",children:[s.jsx(Q,{name:"doc",size:22}),s.jsx("div",{children:c.outside?"这个文件不在 Hob 的数据目录或任务的工作目录里,无法预览":c.message}),s.jsx("button",{className:"hob-btn",onClick:()=>void Th(n).then(p=>Za(p?"路径已复制":"复制失败:浏览器不允许写入剪贴板")),children:"复制路径"})]})}):s.jsx(wC,{meta:c.meta,find:i,page:o})})]})}function Sk({name:n,meta:a,path:i,liveStatus:o,disabled:c}){const d=we().panelStack.at(-1),h=d?.kind==="file"&&d.full;return s.jsxs(rr,{className:"fphead",close:!0,children:[s.jsx(Q,{name:Ul(i),size:18,className:"fp-file-icon"}),s.jsxs("div",{className:"fpt",children:[s.jsx("div",{className:"n",title:n,children:n}),o?s.jsx("div",{className:"m",children:o}):a?s.jsxs("div",{className:"m",children:[Va(a.size)," · ",Pt(a.modifiedAt)]}):null]}),c?s.jsx("button",{className:"hob-icon-btn fp-act",title:"下载",disabled:!0,children:s.jsx(Q,{name:"dl",size:17})}):s.jsx("a",{className:"hob-icon-btn fp-act",title:"下载",href:It(i),download:n,children:s.jsx(Q,{name:"dl",size:17})}),s.jsx("button",{className:"hob-icon-btn fp-act",title:"在新窗口打开",disabled:c,onClick:()=>window.open(It(i,{inline:!0}),"_blank","noopener"),children:s.jsx(Q,{name:"out",size:17})}),s.jsx("button",{className:"hob-icon-btn fp-act fp-wide-btn",title:"切换全宽",onClick:OS,children:s.jsx(Q,{name:h?"shrink":"expand",size:17})})]})}function Tk({meta:n}){const a=k.useRef(null);return k.useEffect(()=>{const i=o=>{if(!(!n.page||o.source!==a.current?.contentWindow||o.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const c=new URL(o.data.url);(c.protocol==="https:"||c.protocol==="http:")&&window.open(c.href,"_blank","noopener")}catch{}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[n.page]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),s.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",src:It(n.path,{inline:!0})+(n.page?document.documentElement.classList.contains("dark")?"#dark":"#light":""),title:n.name})]})}function wC({meta:n,find:a,page:i}){switch(n.kind){case"image":return s.jsx(zb,{path:n.path,name:n.name,svg:!1},n.path);case"svg":return s.jsx(zb,{path:n.path,name:n.name,svg:!0},n.path);case"pdf":return s.jsx("iframe",{className:"fp-frame",src:It(n.path)+(i?`#page=${i}`:""),title:n.name});case"audio":return s.jsx("div",{className:"fp-center",children:s.jsx("audio",{controls:!0,src:It(n.path)})});case"video":return s.jsx("div",{className:"fp-center",children:s.jsx("video",{controls:!0,src:It(n.path)})});case"html":return s.jsx(Tk,{meta:n});case"other":return s.jsx("div",{className:"fp-center",children:s.jsxs("div",{className:"fp-nofile",children:[s.jsx(Q,{name:"doc",size:22}),s.jsx("div",{children:"这种文件不在浏览器里预览,可以下载后打开。"}),s.jsx("a",{className:"hob-btn hob-btn-primary",href:It(n.path),download:n.name,children:"下载"})]})});default:return s.jsx(NC,{meta:n,find:a})}}function zb({path:n,name:a,svg:i}){const[o,c]=k.useState(!1),d=It(n,i?{inline:!0}:void 0),[h,m]=k.useState(i?"loaded":"loading"),p=h==="loading",g=$l(n);return k.useEffect(()=>{if(!o)return;const v=x=>{x.key==="Escape"&&(x.stopImmediatePropagation(),c(!1))};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[o]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-img",children:s.jsxs("button",{onClick:()=>c(!0),title:"放大",className:p?"fp-img-loading":void 0,children:[p?s.jsx("img",{className:"fp-img-thumb",src:g,alt:"","aria-hidden":"true"}):null,s.jsx("img",{src:d,alt:a,onLoad:()=>m("loaded"),onError:()=>m("error"),style:p?{position:"absolute",opacity:0}:void 0}),p?s.jsx("span",{className:"fp-img-spin","aria-label":"图片加载中",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,h==="error"?s.jsx("span",{children:"图片加载失败"}):null]})}),o?s.jsx("div",{className:"lightbox fp-lightbox",role:"dialog","aria-label":a,onClick:()=>c(!1),children:s.jsxs("div",{className:p?"fp-lightbox-image fp-img-loading":"fp-lightbox-image",children:[s.jsx("img",{src:p?g:d,alt:a}),p?s.jsx("span",{className:"fp-img-spin","aria-label":"图片加载中",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,h==="error"?s.jsx("span",{children:"图片加载失败"}):null]})}):null]})}function NC({meta:n,find:a}){const[i,o]=k.useState(null),[c,d]=k.useState(null),[h,m]=k.useState(0),p=k.useCallback(()=>m(v=>v+1),[]);if(k.useEffect(()=>{let v=!0;return o(null),d(null),(async()=>{try{const x=await fetch(It(n.path,{truncate:!0}));if(!x.ok)throw new Error(`读取失败(${x.status})`);v&&o(await x.text())}catch(x){v&&d(x instanceof Error?x.message:String(x))}})(),()=>{v=!1}},[n.path]),c)return s.jsx("div",{className:"fp-center fp-nofile",children:c});if(i===null)return s.jsx("div",{className:"fp-center dim",children:s.jsx(Hn,{text:"正在读取内容…"})});const g=n.size>kC?s.jsxs("div",{className:"fp-note",children:["文件有 ",Va(n.size),",只显示前 1 MB,完整内容请下载。"]}):null;if(n.kind==="markdown")return s.jsxs(s.Fragment,{children:[g,s.jsx(nc,{find:a,text:i,mathVersion:h,children:s.jsx(Ka,{className:"fp-md markdown-body",text:i,onMathRendered:p})})]});if(n.kind==="json"){let v=i;try{v=JSON.stringify(JSON.parse(i),null,2)}catch{}return s.jsxs(s.Fragment,{children:[g,s.jsx(nc,{find:a,text:i,children:s.jsx(Rb,{text:v})})]})}return n.kind==="csv"?s.jsxs(s.Fragment,{children:[g,s.jsx(nc,{find:a,text:i,children:s.jsx(SC,{text:i,tsv:n.mime.includes("tab-separated")})})]}):s.jsxs(s.Fragment,{children:[g,s.jsx(nc,{find:a,text:i,children:s.jsx(Rb,{text:i})})]})}function nc({find:n,text:a,mathVersion:i,children:o}){const c=k.useRef(null);return k.useEffect(()=>{const d=CSS.highlights;if(!c.current||!n||!d||typeof Highlight>"u")return;const h=document.createTreeWalker(c.current,NodeFilter.SHOW_TEXT,{acceptNode(w){return w.parentElement?.closest(".ln, .code-copy, .fp-codebar, .katex-mathml")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),m=[];for(;h.nextNode();)m.push(h.currentNode);const p=ET(m,n);if(!p)return;const{start:g,end:v}=p,x=document.createRange();return x.setStart(g.node,g.offset),x.setEnd(v.node,v.offset),d.set("knowledge-source",new Highlight(x)),g.node.parentElement?.scrollIntoView({block:"center"}),()=>{d.delete("knowledge-source")}},[n,a,i]),s.jsx("div",{ref:c,children:o})}function Rb({text:n}){const[a,i]=k.useState(!0),o=k.useMemo(()=>n.split(`
|
|
264
|
+
`),[n]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fp-codebar",children:[s.jsxs("span",{className:"dim",children:[o.length," 行"]}),s.jsx("button",{className:"hob-btn",onClick:()=>i(!a),children:a?"不自动换行":"自动换行"})]}),s.jsx("div",{className:`fp-code mono${a?" wrap":""}`,children:o.map((c,d)=>s.jsxs("div",{className:"cl",children:[s.jsx("span",{className:"ln",children:d+1}),s.jsx("span",{className:"ct",children:c||" "})]},d))})]})}function SC({text:n,tsv:a}){const i=k.useMemo(()=>TC(n,a?" ":","),[n,a]),o=k.useMemo(()=>bC(i),[i]),c=i.slice(0,1e3),[d,...h]=c;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-codebar",children:s.jsxs("span",{className:"dim",children:[i.length," 行",i.length>1e3?"(只显示前 1000 行)":""]})}),s.jsx("div",{className:"fp-table-wrap",children:s.jsxs("table",{className:"fp-table",children:[d?s.jsx("thead",{children:s.jsx("tr",{children:d.map((m,p)=>s.jsx("th",{className:o[p]?"numeric":void 0,children:m},p))})}):null,s.jsx("tbody",{children:h.map((m,p)=>s.jsx("tr",{children:m.map((g,v)=>s.jsx("td",{className:o[v]?"numeric":void 0,children:g},v))},p))})]})})]})}function TC(n,a){const i=[];let o=[],c="",d=!1;for(let h=0;h<n.length;h+=1){const m=n[h];d?m==='"'?n[h+1]==='"'?(c+='"',h+=1):d=!1:c+=m:m==='"'?d=!0:m===a?(o.push(c),c=""):m===`
|
|
265
|
+
`?(o.push(c),i.push(o),o=[],c=""):m!=="\r"&&(c+=m)}return(c||o.length)&&(o.push(c),i.push(o)),i}const CC=k.lazy(()=>hr(()=>import("./DesktopView-A11jmUwu.js"),[]).then(n=>({default:n.DesktopView}))),EC={off:"关",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},AC=["running","waiting","queued","done","stuck","failed","stopped"],MC={bash:"term",overview:"clock",generate_image:"image",read:"doc",write:"edit",edit:"edit",ls:"doc",grep:"search",find:"search",report:"rule",ask_user:"info"};function or(n){return n.status==="running"||n.status==="queued"||n.status==="waiting"}function Of({embedded:n=!1,page:a}){const i=we(),o=a??i.panelStack.at(-1),c=o?.kind==="job"||o?.kind==="jobs"?o:null,d=fn(!!c,180),h=k.useRef(c);c&&(h.current=c);const m=c??h.current;return!d.mounted||!m?null:s.jsx("div",{className:`${n?"jd-embedded":"jd-overlay"}${d.leaving?" leaving":""}`,onClick:n?void 0:dr,children:s.jsx("div",{className:"jd",onClick:p=>p.stopPropagation(),children:m.kind==="jobs"?s.jsxs(s.Fragment,{children:[s.jsx(rr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务记录"}),close:!0}),s.jsx(IC,{})]}):s.jsx(zC,{id:m.id,round:m.round},`${m.id}-${m.round??"default"}`)})})}function zC({id:n,round:a}){const i=we(),o=i.jobs[n],c=i.steps[n],d=k.useRef(null),h=k.useRef(a===void 0&&(o?or(o):!0)),[m,p]=k.useState(null),[g,v]=k.useState(!1),[x,w]=k.useState(a);if(k.useEffect(()=>{gh().then(O=>p(O?.models??null))},[]),k.useEffect(()=>{const O=d.current;if(!O)return;const W=()=>{h.current=O.scrollHeight-O.scrollTop-O.clientHeight<80};return O.addEventListener("scroll",W),()=>O.removeEventListener("scroll",W)},[]),k.useEffect(()=>{const O=d.current,W=c?.[c.length-1]?.queued;O&&(h.current||W)&&(O.scrollTop=O.scrollHeight,h.current=!0)},[c?.length,c?.[c.length-1]?.id]),!o)return s.jsxs("div",{className:"jdbody",children:[s.jsx(rr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务"}),close:!0}),s.jsx(ze,{children:"无法读取这个任务。"})]});const E=i.assistants.find(O=>O.id===o.assistantId),T=o.model?m?.find(O=>O.ref===o.model)?.name??o.model:"",C=o.startedAt??o.createdAt,M=o.durationMs??(or(o)?Date.now()-new Date(C).getTime():void 0),A=o.usage,$=hh(o);return s.jsxs(s.Fragment,{children:[s.jsxs(rr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务"}),close:!0,children:[o.status==="done"?s.jsxs("button",{className:"hob-btn hob-btn-compact",disabled:o.sediment?.status==="running",onClick:()=>{dS(o.id)},children:[s.jsx(Q,{name:"mem",size:14}),o.sediment?.status==="running"?"正在沉淀…":"沉淀成技能"]}):null,c?.some(O=>O.name?.startsWith("browser_")||O.name?.startsWith("desktop_"))?s.jsxs("button",{className:"hob-btn hob-btn-compact",onClick:()=>v(!0),children:[s.jsx(Q,{name:"pointer",size:14}),"看桌面"]}):null]}),s.jsxs("div",{className:"jdbody",ref:d,children:[s.jsx("div",{className:"jd-title",children:o.title}),s.jsxs("div",{className:"jd-meta",children:[s.jsx(js,{meta:es[o.status]}),E||o.assistantName?s.jsxs("span",{className:"jd-owner",children:[E?s.jsx(ut,{sprite:E.sprite,prop:E.prop,size:16}):null,E?.name??o.assistantName]}):null,s.jsx("span",{children:Pt(C)}),M!==void 0?s.jsxs("span",{children:["用时 ",Hl(M)]}):null]}),o.model||A?s.jsxs("div",{className:"jd-meta dim",children:[o.model?s.jsx("span",{className:T===o.model?"mono":void 0,title:o.model,children:T}):null,o.thinking?s.jsxs("span",{children:["思考 ",EC[o.thinking]??o.thinking]}):null,o.modelReason?s.jsx("span",{children:o.modelReason}):null,A?s.jsxs("span",{children:["输入 ",th(A.input)," · 输出 ",th(A.output),A.cost>0?` · $${A.cost.toFixed(4)}`:""]}):null]}):null,$?s.jsx("div",{className:"jd-reason",children:$}):null,o.rounds?.length?(()=>{const O=Qw(o,c),W=Math.min(x??O.length-1,O.length-1);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"seg jd-rounds",role:"tablist",style:{"--seg-count":O.length,"--seg-index":W},children:O.map((ee,I)=>s.jsxs("button",{role:"tab","aria-selected":I===W,className:I===W?"on":void 0,onClick:()=>w(I),children:["第 ",I+1," 轮"]},I))}),s.jsx("div",{className:x!==a?"jd-round-content":void 0,children:s.jsx(Ob,{part:O[W],last:W===O.length-1,index:W})},W)]})})():s.jsx(s.Fragment,{children:s.jsx(Ob,{part:{job:o,instruction:o.instruction,steps:c},last:!0,index:0})})]}),s.jsx(RC,{job:o}),g?s.jsx(k.Suspense,{fallback:s.jsx("div",{children:"正在打开云桌面…"}),children:s.jsx(CC,{onClose:()=>v(!1)})}):null]})}function Ob({part:n,last:a,index:i}){const[o,c]=k.useState(!1),d=n.steps?.findIndex(x=>x.from==="user"&&x.text==="沉淀技能")??-1,h=n.steps===void 0?void 0:zx(d<0?n.steps:n.steps.slice(0,d)),m=d<0?void 0:zx(n.steps.slice(d+1)),p=hh(n.job),g=!or(n.job),v=new Set(h?Jo(h.rows,g,!1).rows.map(x=>x.id):[]);return s.jsxs(s.Fragment,{children:[a?null:s.jsxs("div",{className:"jd-meta",children:[s.jsx(js,{meta:es[n.job.status]}),n.job.durationMs!==void 0?s.jsxs("span",{children:["用时 ",Hl(n.job.durationMs)]}):null]}),p&&!a?s.jsx("div",{className:"jd-reason",children:p}):null,g?s.jsxs(s.Fragment,{children:[s.jsx(UC,{job:n.job}),s.jsx(LC,{job:n.job})]}):null,n.instruction?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:i===0?"任务内容":"这一轮的要求"}),s.jsx("div",{className:"jd-instruction",children:n.instruction})]}):null,s.jsx("div",{className:"lbl",children:"执行过程"}),s.jsx("div",{className:"jd-timeline",children:h===void 0?s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取执行过程…"})}):h.rows.length||h.thinking?s.jsxs(s.Fragment,{children:[Jo(h.rows,g,o).rows.map(x=>o&&!v.has(x.id)?s.jsx("div",{className:"jd-unfold",children:s.jsx("div",{children:s.jsx(_f,{step:x,cwd:n.job.cwd})})},x.id):s.jsx(_f,{step:x,cwd:n.job.cwd},x.id)),Jo(h.rows,g,o).remaining?s.jsx("div",{className:"jd-tool",children:s.jsxs("button",{className:"jd-tool-head",onClick:()=>c(!0),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"more",size:14})}),s.jsxs("span",{className:"tt",children:["还有 ",Jo(h.rows,g,o).remaining," 步"]})]})}):null,h.thinking?s.jsx(_b,{text:h.thinking}):null]}):s.jsx(ze,{children:"还没有执行步骤。"})}),m||a&&n.job.sediment?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"lbl",children:["沉淀技能",a&&n.job.sediment?` · ${dk(n.job.sediment)}`:""]}),s.jsxs("div",{className:"jd-timeline",children:[m?.rows.map(x=>s.jsx(_f,{step:x,cwd:n.job.cwd},x.id)),m?.thinking?s.jsx(_b,{text:m.thinking}):null]})]}):null,a?s.jsx(BC,{jobId:n.job.id}):null]})}function RC({job:n}){const[a,i]=k.useState(""),o=a.trim().length>0,c=()=>{if(!o)return;const d=a.trim();i(""),Xf(n.id,d).then(h=>{h||i(m=>m||d)})};return s.jsxs("div",{className:"jd-foot",children:[s.jsx("input",{value:a,placeholder:or(n)?"补充说明或更正方向":"接着说…",onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.nativeEvent.isComposing&&c()}}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!o,onClick:c,children:"发送"}),n.status==="running"?s.jsx("button",{className:"hob-btn",onClick:()=>void _0(n.id),children:"停止"}):null]})}function _f({step:n,cwd:a}){const[i,o]=k.useState(!1),c=fn(i,180);if(n.kind==="text")return n.from==="user"?s.jsxs("div",{className:`jd-mine${n.queued?" queued":""}`,children:[n.text,n.queued?s.jsx("div",{className:"jd-mine-note",children:"已送达,当前这一步做完后读取"}):null]}):s.jsxs("div",{className:"jd-textrow",children:[n.thinking?s.jsx(Ck,{text:n.thinking,open:!1}):null,s.jsx(Ka,{className:"jd-text",text:n.text??""})]});const d=n.title??n.name??"",h=Fw(d);return s.jsxs("div",{className:`jd-tool${n.isError?" bad":""}${i?" open":""}`,children:[s.jsxs("button",{className:"jd-tool-head",onClick:()=>o(m=>!m),children:[s.jsx("span",{className:"ico",children:n.running?s.jsx(Q,{name:"spin",size:14,className:"spin"}):s.jsx(Q,{name:MC[n.name??""]??(/^(lore|memory)_/.test(n.name??"")?"mem":"more"),size:14})}),s.jsx("span",{className:"tt",children:h.map((m,p)=>s.jsx("span",{className:m.mono?"mono":void 0,children:m.text},p))}),n.thinking?s.jsx("span",{className:"blb",title:"有思考过程",children:s.jsx(Q,{name:"bulb",size:13})}):null,s.jsx("span",{className:"tm",children:n.isError?"出错":n.durationMs&&n.durationMs>=1e3?Hl(n.durationMs):""}),s.jsx(Q,{name:i?"down":"chev",size:13})]}),s.jsx("div",{className:`expand${i?" open":""}`,inert:!i,children:s.jsx("div",{children:c.mounted?s.jsx(_C,{step:n,cwd:a}):null})})]})}function Ck({text:n,open:a}){const[i,o]=k.useState(a);return s.jsxs("div",{className:"jd-think-in",children:[s.jsxs("button",{className:"jd-think-head",title:i?"收起思考过程":"展开思考过程",onClick:()=>o(c=>!c),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"bulb",size:13})}),s.jsx("span",{className:"tt",children:"思考过程"}),s.jsx(Q,{name:i?"down":"chev",size:12})]}),i?s.jsx("div",{className:"jd-think-body",children:n}):null]})}function _b({text:n}){const[a,i]=k.useState(!1);return s.jsxs("div",{className:"jd-think",children:[s.jsxs("button",{onClick:()=>i(o=>!o),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"bulb",size:14})}),s.jsx("span",{className:"tt",children:"思考中"}),s.jsx(Q,{name:a?"down":"chev",size:13})]}),a?s.jsx("div",{className:"jd-think-body",children:n}):null]})}function OC(n){const a=n.args?.edits;return Array.isArray(a)?a.map(i=>({oldText:String(i?.oldText??""),newText:String(i?.newText??"")})):[]}function sh({path:n,cwd:a}){if(!n)return null;const i=n.startsWith("/")?n:a?`${a.replace(/\/+$/,"")}/${n}`:null;return i?s.jsx("button",{className:"jd-kv mono jd-path",title:i,onClick:()=>zt(i),children:n}):s.jsx("div",{className:"jd-kv mono",children:n})}function _C({step:n,cwd:a}){const i=n.args??{},o=OC(n);return s.jsxs("div",{className:"jd-tool-body",children:[n.thinking?s.jsx(Ck,{text:n.thinking,open:!0}):null,o.length?s.jsxs(s.Fragment,{children:[s.jsx(sh,{path:String(i.path??""),cwd:a}),o.map((c,d)=>s.jsx($C,{before:c.oldText,after:c.newText},d))]}):s.jsx(DC,{step:n,args:i,cwd:a}),n.output?s.jsx(lh,{text:n.output,className:"jd-out mono"}):null,n.outputPath?s.jsxs("button",{className:"jd-file",onClick:()=>zt(n.outputPath),children:[s.jsx(Q,{name:"doc",size:12}),"完整输出"]}):null]})}function DC({step:n,args:a,cwd:i}){if(n.name==="bash")return s.jsx(lh,{text:String(a.command??""),className:"jd-arg mono",lines:8});if(n.name==="write")return s.jsxs("div",{className:"jd-kv-wrap",children:[s.jsx(sh,{path:String(a.path??""),cwd:i}),s.jsxs("span",{className:"jd-kv-len",children:[String(a.contentLength??0)," 字"]})]});if(n.name==="read"||n.name==="ls"||n.name==="edit")return s.jsx(sh,{path:String(a.path??""),cwd:i});const o=JSON.stringify(a,null,2);return o==="{}"?null:s.jsx(lh,{text:o,className:"jd-arg mono",lines:6})}function $C({before:n,after:a}){const[i,o]=k.useState(!1),c=Xw(n,a),d=i?c:c.slice(0,24);return s.jsxs("div",{className:"jd-diff",children:[d.map((h,m)=>s.jsxs("div",{className:`dl ${h.sign==="-"?"del":h.sign==="+"?"add":""}`,children:[s.jsx("span",{className:"sg",children:h.sign}),s.jsx("span",{className:"mono",children:h.text||" "})]},m)),c.length>d.length?s.jsxs("button",{className:"jd-more",onClick:()=>o(!0),children:["展开全部 ",c.length," 行"]}):null]})}function lh({text:n,className:a,lines:i=12}){const[o,c]=k.useState(!1),d=n.split(`
|
|
266
|
+
`).length;return s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:`${a}${o?" all":""}`,style:o?void 0:{maxHeight:`${i*1.6}em`},children:n}),d>i?s.jsx("button",{className:"jd-more",onClick:()=>c(!o),children:o?"收起":`展开全部 ${d} 行`}):null]})}function UC({job:n}){return n.summary?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"报告"}),s.jsx(Ka,{className:"jd-report",text:n.summary})]}):null}function LC({job:n}){const a=[...new Set(n.files??[])];return a.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"产出文件"}),s.jsx("div",{className:"jd-files",children:a.map(i=>s.jsx(HC,{path:i},i))})]}):null}function HC({path:n}){const[a,i]=k.useState(),[o,c]=k.useState("");return k.useEffect(()=>{let d=!0;return Sh(n).then(h=>{d&&i(h.size)}).catch(h=>{d&&c(h instanceof Error?h.message:String(h))}),()=>{d=!1}},[n]),s.jsxs("button",{className:"jd-file-row",onClick:()=>zt(n),children:[s.jsx(Q,{name:Ul(n),size:18}),s.jsx("span",{children:n.split("/").pop()}),o?s.jsx("small",{title:o,children:"大小读取失败"}):a!==void 0?s.jsx("small",{children:Va(a)}):null]})}function BC({jobId:n}){const[a,i]=k.useState(!1),[o,c]=k.useState(),[d,h]=k.useState(""),[m,p]=k.useState(0);return k.useEffect(()=>{let g=!0;return h(""),G0(n).then(v=>{g&&c(v)}).catch(v=>{g&&h(v instanceof Error?v.message:String(v))}),()=>{g=!1}},[n,m]),o&&!o.total&&!d?null:s.jsxs("div",{className:"jd-directory",children:[s.jsxs("button",{className:"jd-directory-head",onClick:()=>i(!a),children:[s.jsx(Q,{name:a?"down":"chev",size:15}),"工作目录",o?` · ${o.fileCount} 个文件、${o.directoryCount} 个文件夹`:""]}),d?s.jsxs("div",{className:"jd-dir-error",children:[d," ",s.jsx("button",{className:"jd-more",onClick:()=>p(m+1),children:"重试"})]}):null,a&&o?s.jsx(Ek,{jobId:n,view:o}):null]})}function Ek({jobId:n,view:a}){return s.jsxs("div",{className:"jd-files",children:[a.files.map(i=>i.type==="file"?s.jsxs("button",{className:"jd-file-row",onClick:()=>zt(i.path),children:[s.jsx(Q,{name:Ul(i.name),size:18}),s.jsx("span",{children:i.name}),s.jsx("small",{children:Va(i.size)})]},i.rel):s.jsx(qC,{jobId:n,entry:i},i.rel)),a.total>a.files.length?s.jsxs("div",{className:"jd-dir-more",children:["还有 ",a.total-a.files.length," 项"]}):null]})}function qC({jobId:n,entry:a}){const[i,o]=k.useState(!1),[c,d]=k.useState(),[h,m]=k.useState(""),[p,g]=k.useState(0);return k.useEffect(()=>{if(!i||c)return;let v=!0;return m(""),G0(n,a.rel).then(x=>{v&&d(x)}).catch(x=>{v&&m(x instanceof Error?x.message:String(x))}),()=>{v=!1}},[i,c,n,a.rel,p]),s.jsxs("div",{children:[s.jsxs("button",{className:"jd-file-row",onClick:()=>o(!i),children:[s.jsx(Q,{name:i?"down":"chev",size:14}),s.jsx(Q,{name:"folder",size:18}),s.jsx("span",{children:a.name}),s.jsxs("small",{children:[a.count," 项"]})]}),i?s.jsx("div",{className:"jd-dir-child",children:h?s.jsxs("div",{className:"jd-dir-error",children:[h," ",s.jsx("button",{className:"jd-more",onClick:()=>g(p+1),children:"重试"})]}):c?s.jsx(Ek,{jobId:n,view:c}):s.jsx("div",{className:"jd-dir-more",children:"正在读取…"})}):null]})}function IC(){const n=we(),a=n.worklog,i=a?.assistantId??null,o=a?.status??null;return s.jsxs("div",{className:"jdbody",onScroll:c=>{const d=c.currentTarget;a?.hasMore&&!a.loading&&d.scrollHeight-d.scrollTop-d.clientHeight<100&&nb()},children:[s.jsxs("div",{className:"jd-filters",children:[s.jsxs("select",{className:"pick",value:i??"",onChange:c=>void yc({assistantId:c.target.value||null,status:o}),children:[s.jsx("option",{value:"",children:"全部助手"}),n.assistants.map(c=>s.jsx("option",{value:c.id,children:c.name},c.id))]}),s.jsxs("select",{className:"pick",value:o??"",onChange:c=>void yc({assistantId:i,status:c.target.value||null}),children:[s.jsx("option",{value:"",children:"全部状态"}),AC.map(c=>s.jsx("option",{value:c,children:es[c].text},c))]}),s.jsx("span",{className:"sp"}),a?s.jsxs("span",{className:"dim",children:[a.jobs.length," 个"]}):null]}),a===null?s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取任务记录…"})}):a.jobs.length?s.jsx("div",{className:"jd-rows",children:a.jobs.map(c=>{const d=n.jobs[c.id]??c,h=n.assistants.find(m=>m.id===d.assistantId);return s.jsxs("button",{className:"list-row history-row",onClick:()=>{h&&Jt(d.assistantId,!0,!0),Ln(d.id)},children:[h?s.jsx(ut,{sprite:h.sprite,prop:h.prop,size:26}):s.jsx("span",{style:{width:26}}),s.jsxs("span",{className:"history-content",children:[s.jsx("span",{className:"n",children:d.title}),s.jsxs("span",{className:"tm",children:[Pt(d.startedAt??d.createdAt),d.durationMs!==void 0?` · ${Hl(d.durationMs)}`:or(d)?` · ${vr(d.startedAt??d.createdAt)}`:""]})]}),s.jsx(js,{meta:es[d.status]})]},d.id)})}):s.jsx(ze,{children:"没有符合条件的任务。"}),a?.hasMore?s.jsx("button",{className:"hob-btn jd-morebtn",onClick:()=>void nb(),children:a.loading?"正在读取…":"加载更多"}):null]})}function GC(){const n=we(),[a,i]=k.useState(""),[o,c]=k.useState(!1);k.useEffect(()=>{if(!n.error)return;c(!0);const h=window.setTimeout(()=>c(!1),260);return()=>window.clearTimeout(h)},[n.error]);const d=()=>{a&&eS(a)};return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"card",children:[s.jsx(ut,{sprite:"hob",size:88,free:!0,motion:"home"}),s.jsx("div",{className:"nm",children:"Hob"}),s.jsx("div",{className:"ds",children:"请输入密码"}),s.jsx("label",{className:`field${o?" shake":""}`,children:s.jsx("input",{type:"password",autoFocus:!0,value:a,placeholder:"密码",onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&d()}})}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:d,disabled:n.loggingIn,children:n.loggingIn?"正在登录…":"登录"}),n.error?s.jsx("div",{className:"err",style:{width:"100%"},children:n.error}):null]})})}const YC=[["","全部类型"],["image","图片"],["document","文档"],["table","表格"],["page","网页"],["other","其他"]],KC=n=>`删除知识库「${n}」?直接上传到这里、又不在别的知识库里的文件会一起删除,其余文件只是移出。`;function Mc(n="right"){const[a,i]=k.useState(null),o=k.useRef(null);return k.useLayoutEffect(()=>{if(!a||!o.current)return;const c=a.anchor.getBoundingClientRect(),d=o.current.getBoundingClientRect(),h=n==="left"?c.left:c.right-d.width;o.current.style.left=`${Math.max(8,Math.min(h,window.innerWidth-d.width-8))}px`,o.current.style.top=`${Math.max(8,Math.min(c.bottom+4,window.innerHeight-d.height-8))}px`}),k.useEffect(()=>{if(!a)return;const c=m=>{!o.current?.contains(m.target)&&!a.anchor.contains(m.target)&&i(null)},d=m=>{m.key==="Escape"&&(m.stopPropagation(),i(null))},h=m=>{o.current?.contains(m.target)||i(null)};return document.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",d,!0),document.addEventListener("scroll",h,!0),()=>{document.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",d,!0),document.removeEventListener("scroll",h,!0)}},[a]),{menu:a,box:o,close:()=>i(null),toggle:(c,d)=>i(h=>h?.id===c?null:{id:c,anchor:d})}}function Tc({initial:n="",label:a,save:i,cancel:o}){const[c,d]=k.useState(n),[h,m]=k.useState(!1);return s.jsx("form",{className:"knowledge-name",onSubmit:p=>{p.preventDefault(),!(!c.trim()||h)&&(m(!0),i(c.trim()).then(g=>{g?o():m(!1)}))},children:s.jsx("input",{autoFocus:!0,"aria-label":a,value:c,disabled:h,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),o())}})})}function ZC({collections:n,selected:a,narrow:i}){const[o,c]=k.useState(!1),[d,h]=k.useState(null),m=Mc(),p=n.find(g=>g.id===m.menu?.id);return s.jsxs("nav",{className:i?"knowledge-categories":"setnav","aria-label":"知识库分类",children:[!i&&s.jsx("div",{className:"setnavtitle",children:"知识库"}),[["all","全部"],["output","助手产出"],["chat","对话上传"]].map(([g,v])=>s.jsx("div",{children:s.jsx("button",{className:`navrow${a===g?" sel":""}`,onClick:()=>zl({category:g}),children:v})},g)),!i&&s.jsx("div",{className:"knowledge-label",children:"我的知识库"}),n.map(g=>s.jsxs("div",{className:`knowledge-category${m.menu?.id===g.id?" menu-open":""}${a===g.id?" selected":""}`,onContextMenu:v=>{v.preventDefault();const x=v.currentTarget.querySelector(".category-dots");x&&m.toggle(g.id,x)},children:[d===g.id?s.jsx(Tc,{initial:g.name,label:"知识库名称",save:v=>yS(g.id,v),cancel:()=>h(null)}):s.jsxs("button",{className:`navrow${a===g.id?" sel":""}`,onClick:()=>zl({category:g.id}),children:[s.jsx("span",{children:g.name}),s.jsx("span",{className:"knowledge-count",children:g.count})]}),s.jsx("button",{className:"knowledge-dots category-dots","aria-label":`${g.name}的操作`,onClick:v=>m.toggle(g.id,v.currentTarget),children:s.jsx(Q,{name:"more",size:18})})]},g.id)),s.jsx("div",{children:o?s.jsx(Tc,{label:"新知识库名称",save:async g=>!!await B0(g),cancel:()=>c(!1)}):s.jsx("button",{className:"navrow knowledge-new",onClick:()=>c(!0),children:"+ 新建"})}),!i&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sp"}),s.jsx("button",{className:"navrow",onClick:ar,children:"返回 Hob"})]}),p&&fr.createPortal(s.jsxs("div",{className:"amenu knowledge-popup",ref:m.box,children:[s.jsx("button",{onClick:()=>{m.close(),h(p.id)},children:"改名"}),s.jsx("button",{onClick:()=>{m.close(),window.confirm(KC(p.name))&&jS(p.id)},children:"删除"})]}),document.body)]})}function XC({knowledge:n,assistants:a,uploading:i,upload:o}){const[c,d]=k.useState(n.q),[h,m]=k.useState(!1),p=k.useRef(null),g=n.collections.some(v=>v.id===n.category);return k.useEffect(()=>{if(h||c===n.q)return;const v=window.setTimeout(()=>zl({q:c}),250);return()=>window.clearTimeout(v)},[c,h,n.q]),s.jsxs("div",{className:"knowledge-filters",children:[s.jsxs("label",{className:"knowledge-search",children:[s.jsx(Q,{name:"search",size:16}),s.jsx("input",{placeholder:"搜索知识库",value:c,onChange:v=>d(v.target.value),onCompositionStart:()=>m(!0),onCompositionEnd:v=>{d(v.currentTarget.value),m(!1)}})]}),s.jsx("select",{"aria-label":"类型",value:n.kind,onChange:v=>zl({kind:v.target.value}),children:YC.map(([v,x])=>s.jsx("option",{value:v,children:x},v))}),s.jsxs("select",{"aria-label":"助手",value:n.assistantId,onChange:v=>zl({assistantId:v.target.value}),children:[s.jsx("option",{value:"",children:"全部助手"}),a.map(v=>s.jsx("option",{value:v.id,children:v.name},v.id))]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:p,type:"file",multiple:!0,hidden:!0,onChange:v=>{o(Array.from(v.target.files??[])),v.target.value=""}}),s.jsx("button",{className:"hob-btn hob-btn-upload",disabled:i,onClick:()=>p.current?.click(),children:i?"正在上传…":"上传"})]})]})}function VC({entry:n,collections:a}){return s.jsx(s.Fragment,{children:a.map(i=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:n.collections.includes(i.id),onChange:o=>{const c=o.target.checked?[...n.collections,i.id]:n.collections.filter(d=>d!==i.id);uc(n.id,{collections:c})}}),i.name]},i.id))})}function QC({entry:n,collections:a,category:i,join:o,rename:c,remove:d,confirm:h}){return s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:o,children:"加入知识库"}),s.jsx("button",{onClick:c,children:"改名"}),s.jsx("a",{href:It(n.path),download:n.name,children:"下载"}),a.some(m=>m.id===i)&&s.jsx("button",{onClick:d,children:"移出这个知识库"}),s.jsx("button",{onClick:h,children:"删除"})]})}function JC({entry:n,collections:a,assistants:i,selected:o,category:c}){const d=Mc(),[h,m]=k.useState(!1),[p,g]=k.useState(!1),[v,x]=k.useState(!1),w=m0(n.kind),E=i.find(A=>A.id===n.source?.assistantId),T=n.source,C=n.index?.state==="queued"||n.index?.state==="indexing"?"正在建索引…":n.index?.state==="failed"?`未能建索引:${n.index.error||"未知原因"}`:n.index?.state==="unsupported"?"这类文件还不能建索引":"",M=[n.origin==="upload"?"上传":E?.name,Pt(n.updatedAt),Va(n.size),n.versions?.length?`第 ${n.versions.length+1} 版`:"",C].filter(Boolean).join(" · ");return s.jsxs("div",{className:`knowledge-row${o?" selected":""}`,children:[s.jsxs("div",{className:"knowledge-open",role:"button",tabIndex:0,onClick:()=>{v||zt(n.path,n.name)},onKeyDown:A=>{!v&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),zt(n.path,n.name))},children:[s.jsx("span",{className:"knowledge-thumb",children:w==="image"?s.jsx("img",{src:$l(n.path),alt:""}):s.jsx(Q,{name:w==="table"?"table":w==="page"?"globe":"doc",size:24})}),s.jsxs("div",{className:"knowledge-info",children:[v?s.jsx(Tc,{initial:n.name,label:"文件名称",save:A=>uc(n.id,{name:A}),cancel:()=>x(!1)}):s.jsx("strong",{children:n.name}),n.snippet||n.description?s.jsx("span",{className:"knowledge-description",children:n.snippet||n.description}):null,s.jsxs("span",{className:"knowledge-meta",children:[s.jsx("span",{className:"knowledge-meta-text",children:M}),s.jsx("span",{className:"knowledge-tags",children:n.collections.map(A=>{const $=a.find(O=>O.id===A);return $?s.jsx("span",{children:$.name},A):null})})]})]})]}),T&&(T.itemId||T.jobId)?s.jsx("button",{className:"knowledge-source",onClick:()=>{T.itemId?SS(T.assistantId,T.itemId):T.jobId&&(ar(),Ln(T.jobId))},children:"出处"}):null,s.jsx("div",{className:"knowledge-actions",children:s.jsx("button",{className:"knowledge-dots","aria-label":`${n.name}的操作`,onClick:A=>{d.toggle(n.id,A.currentTarget),m(!1)},children:s.jsx(Q,{name:"more",size:18})})}),d.menu&&fr.createPortal(s.jsx("div",{className:"amenu knowledge-popup",ref:d.box,children:h?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"knowledge-menu-title",children:"加入知识库"}),s.jsx(VC,{entry:n,collections:a}),p?s.jsx(Tc,{label:"新知识库名称",save:async A=>{const $=await B0(A,!1);return!!$&&await uc(n.id,{collections:[...n.collections,$.id]})},cancel:()=>g(!1)}):s.jsx("button",{onClick:()=>g(!0),children:"+ 新建知识库"})]}):s.jsx(QC,{entry:n,collections:a,category:c,join:()=>m(!0),rename:()=>{d.close(),x(!0)},remove:()=>{d.close(),uc(n.id,{collections:n.collections.filter(A=>A!==c)})},confirm:()=>{d.close(),window.confirm(`删除「${n.name}」?会从所有知识库里移除,不能恢复。`)&&wS(n.id)}})}),document.body)]})}function PC({knowledge:n,assistants:a,previewPath:i,upload:o}){const c=n.collections.some(h=>h.id===n.category),d=n.category==="output"&&!n.q?"还没有助手产出。助手交给你的文件、图片和页面会自动收在这里。":n.category==="chat"&&!n.q?"还没有对话上传的文件。":n.q?"没有找到匹配的资料。":"这里还没有资料。";return s.jsxs("div",{className:"knowledge-list",onDragOver:h=>{c&&h.preventDefault()},onDrop:h=>{c&&(h.preventDefault(),o(Array.from(h.dataTransfer.files)))},onScroll:h=>{const m=h.currentTarget;m.scrollHeight-m.scrollTop-m.clientHeight<120&&_t(!0)},children:[n.error?s.jsxs(ze,{large:!0,action:{label:"重试",onClick:()=>void _t()},children:["加载失败:",n.error]}):!n.entries.length&&!n.loading?s.jsx(ze,{large:!0,children:d}):null,n.entries.map(h=>s.jsx(JC,{entry:h,collections:n.collections,assistants:a,selected:h.path===i,category:n.category},h.id)),n.loading?s.jsx(ze,{large:!0,children:"正在加载…"}):null,n.hasMore&&!n.loading?s.jsx("button",{className:"knowledge-more",onClick:()=>void _t(!0),children:"加载更多"}):null]})}function FC({collectionId:n,collections:a,assistants:i,busy:o,setBusy:c}){return s.jsx(s.Fragment,{children:i.map(d=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:d.knowledge?.includes(n)??!1,disabled:o,onChange:()=>{const h=(d.knowledge??[]).filter(m=>a.some(p=>p.id===m));c(!0),kc(d.id,{knowledge:h.includes(n)?h.filter(m=>m!==n):[...h,n]}).finally(()=>c(!1))}}),d.name]},d.id))})}function WC({id:n,busy:a,setBusy:i}){return s.jsx("button",{disabled:a,onClick:()=>{i(!0),YN(n).then(()=>_t(!1,!0)).catch(o=>Za(`重试失败:${o instanceof Error?o.message:String(o)}`)).finally(()=>i(!1))},children:"重试"})}function eE({collection:n,collections:a,assistants:i,embedding:o}){const c=Mc("left"),d=i.filter(p=>p.knowledge?.includes(n.id)),[h,m]=k.useState(!1);return s.jsxs("div",{className:"knowledge-status",children:[s.jsxs("div",{children:[d.length?`给 ${d.map(p=>p.name).join("、")} 用`:s.jsx("strong",{children:"还没有助手用这个库"})," · ",s.jsx("button",{onClick:p=>c.toggle(n.id,p.currentTarget),children:d.length?"修改":"选择助手"})]}),c.menu&&fr.createPortal(s.jsx("div",{className:"amenu knowledge-popup",ref:c.box,children:s.jsx(FC,{collectionId:n.id,collections:a,assistants:i,busy:h,setBusy:m})}),document.body),s.jsxs("div",{children:["已建索引 ",n.indexed??0,"/",n.count-(n.unsupported??0),(n.failed??0)>0?s.jsxs(s.Fragment,{children:[" · ",n.failed," 个失败 · ",s.jsx(WC,{id:n.id,busy:h,setBusy:m})]}):null,o?null:s.jsxs(s.Fragment,{children:[" · 只按关键词查 · ",s.jsx("button",{onClick:()=>{Ac(),Rl("knowledge")},children:"去设置向量模型"})]})]})]})}function tE({narrow:n,leaving:a}){const i=we(),o=i.knowledge,c=i.panelStack.at(-1),d=c?.kind==="file"?c:null,[h,m]=k.useState(!1),p=g=>{!g.length||h||(m(!0),NS(o.category,g).finally(()=>m(!1)))};return k.useEffect(()=>{if(i.page!=="knowledge"||d)return;const g=v=>{v.key==="Escape"&&ar()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i.page,d]),s.jsxs("main",{className:`setpage knowledge${n?" narrow":""}${d&&!n?" has-preview":""}${d?.full&&!n?" preview-full":""}${a?" leaving":""}`,children:[n?s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:ar,children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:"知识库"})]}):null,s.jsx(ZC,{collections:o.collections,selected:o.category,narrow:n}),s.jsxs("section",{className:"knowledge-main",children:[s.jsx(XC,{knowledge:o,assistants:i.assistants,uploading:h,upload:p}),o.collections.find(g=>g.id===o.category)?s.jsx(eE,{collection:o.collections.find(g=>g.id===o.category),collections:o.collections,assistants:i.assistants,embedding:i.settings.settings.knowledge?.embedding.source==="openai"}):null,s.jsx(PC,{knowledge:o,assistants:i.assistants,previewPath:d?.path,upload:p})]}),!n&&d?s.jsx("aside",{className:"knowledge-preview",children:s.jsx(fc,{embedded:!0})}):null]})}const nE=5,sE=24*3600*1e3;function tr(n,a){const i=a.trim();return i?n.name.includes(i)||n.duty.includes(i)||(n.last?.text??"").includes(i):!0}function Db(n,a){return(a.last?.at??"").localeCompare(n.last?.at??"")}const $b=n=>n.status==="running"||n.status==="queued"||n.status==="waiting";function lE(n,a){return(a.startedAt??a.createdAt).localeCompare(n.startedAt??n.createdAt)}function aE(n,a){return(a.endedAt??a.createdAt).localeCompare(n.endedAt??n.createdAt)}function Ub(n){const a=Lh(n.schedules[0]??"");return a.kind==="raw"?1440:a.hour*60+a.minute}function iE(n,a=Date.now()){const i=n.query.trim().length>0,o=new Date(a-sE).toISOString(),c=Object.values(n.jobs),d=n.assistants.filter(E=>E.pinned&&!E.hidden&&tr(E,n.query)),h=n.assistants.filter(E=>!E.pinned&&!E.hidden&&tr(E,n.query)).sort(Db),m=n.assistants.filter(E=>E.hidden&&tr(E,n.query)).sort(Db),p=i?[]:Object.values(n.approvals).filter(E=>E.status==="pending").sort((E,T)=>T.createdAt.localeCompare(E.createdAt)),g=i?[]:c.filter($b).sort(lE),v=i?[]:c.filter(E=>!$b(E)&&(E.endedAt??E.createdAt)>o).sort(aE).slice(0,nE),x=i?[]:n.routines.filter(E=>E.active).sort((E,T)=>Ub(E)-Ub(T)),w=!i&&!p.length&&!g.length&&!h.length&&!m.length&&!v.length&&!x.length;return{searching:i,pins:d,rows:h,hidden:m,asks:p,live:g,recent:v,routines:x,empty:w}}function Ot(n,a,i,o,c,d,h,m){return Ot.fromTZ(Ot.tp(n,a,i,o,c,d,h),m)}Ot.fromTZISO=(n,a,i)=>Ot.fromTZ(rE(n,a),i);Ot.fromTZ=function(n,a){let i=new Date(Date.UTC(n.y,n.m-1,n.d,n.h,n.i,n.s)),o=Df(n.tz,i),c=new Date(i.getTime()-o),d=Df(n.tz,c);if(d-o===0)return c;{let h=new Date(i.getTime()-d),m=Df(n.tz,h);if(m-d===0||!a&&m-d>0)return h;if(a)throw new Error("Invalid date passed to fromTZ()");return c}};Ot.toTZ=function(n,a){let i=n.toLocaleString("en-US",{timeZone:a}).replace(/[\u202f]/," "),o=new Date(i);return{y:o.getFullYear(),m:o.getMonth()+1,d:o.getDate(),h:o.getHours(),i:o.getMinutes(),s:o.getSeconds(),tz:a}};Ot.tp=(n,a,i,o,c,d,h)=>({y:n,m:a,d:i,h:o,i:c,s:d,tz:h});function Df(n,a=new Date){let i=a.toLocaleString("en-US",{timeZone:n,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],o=a.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${o} GMT`)-Date.parse(`${o} ${i}`)}function rE(n,a){let i=new Date(Date.parse(n));if(isNaN(i))throw new Error("minitz: Invalid ISO8601 passed to parser.");let o=n.substring(9);return n.includes("Z")||o.includes("-")||o.includes("+")?Ot.tp(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),"Etc/UTC"):Ot.tp(i.getFullYear(),i.getMonth()+1,i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),a)}Ot.minitz=Ot;var qh=32,nr=31|qh,Ak=[1,2,4,8,16],Lb=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(n,a){this.pattern=n,this.timezone=a,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let n=this.pattern.replace(/\s+/g," ").split(" ");if(n.length<5||n.length>6)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five or six space separated parts are required.");if(n.length===5&&n.unshift("0"),n[3].indexOf("L")>=0&&(n[3]=n[3].replace("L",""),this.lastDayOfMonth=!0),n[3]=="*"&&(this.starDOM=!0),n[4].length>=3&&(n[4]=this.replaceAlphaMonths(n[4])),n[5].length>=3&&(n[5]=this.replaceAlphaDays(n[5])),n[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0){let a=new Nn(new Date,this.timezone).getDate(!0);n[0]=n[0].replace("?",a.getSeconds().toString()),n[1]=n[1].replace("?",a.getMinutes().toString()),n[2]=n[2].replace("?",a.getHours().toString()),this.starDOM||(n[3]=n[3].replace("?",a.getDate().toString())),n[4]=n[4].replace("?",(a.getMonth()+1).toString()),this.starDOW||(n[5]=n[5].replace("?",a.getDay().toString()))}this.throwAtIllegalCharacters(n),this.partToArray("second",n[0],0,1),this.partToArray("minute",n[1],0,1),this.partToArray("hour",n[2],0,1),this.partToArray("day",n[3],-1,1),this.partToArray("month",n[4],-1,1),this.partToArray("dayOfWeek",n[5],0,nr),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(n,a,i,o){let c=this[n],d=n==="day"&&this.lastDayOfMonth;if(a===""&&!d)throw new TypeError("CronPattern: configuration entry "+n+" ("+a+") is empty, check for trailing spaces.");if(a==="*")return c.fill(o);let h=a.split(",");if(h.length>1)for(let m=0;m<h.length;m++)this.partToArray(n,h[m],i,o);else a.indexOf("-")!==-1&&a.indexOf("/")!==-1?this.handleRangeWithStepping(a,n,i,o):a.indexOf("-")!==-1?this.handleRange(a,n,i,o):a.indexOf("/")!==-1?this.handleStepping(a,n,i,o):a!==""&&this.handleNumber(a,n,i,o)}throwAtIllegalCharacters(n){for(let a=0;a<n.length;a++)if((a===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(n[a]))throw new TypeError("CronPattern: configuration entry "+a+" ("+n[a]+") contains illegal characters.")}handleNumber(n,a,i,o){let c=this.extractNth(n,a),d=parseInt(c[0],10)+i;if(isNaN(d))throw new TypeError("CronPattern: "+a+" is not a number: '"+n+"'");this.setPart(a,d,c[1]||o)}setPart(n,a,i){if(!Object.prototype.hasOwnProperty.call(this,n))throw new TypeError("CronPattern: Invalid part specified: "+n);if(n==="dayOfWeek"){if(a===7&&(a=0),a<0||a>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+a);this.setNthWeekdayOfMonth(a,i);return}if(n==="second"||n==="minute"){if(a<0||a>=60)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="hour"){if(a<0||a>=24)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="day"){if(a<0||a>=31)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="month"&&(a<0||a>=12))throw new RangeError("CronPattern: Invalid value for "+n+": "+a);this[n][a]=i}handleRangeWithStepping(n,a,i,o){let c=this.extractNth(n,a),d=c[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(d===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+n+"'");let[,h,m,p]=d,g=parseInt(h,10)+i,v=parseInt(m,10)+i,x=parseInt(p,10);if(isNaN(g))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(v))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(x))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(x===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(x>this[a].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[a].length+")");if(g>v)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let w=g;w<=v;w+=x)this.setPart(a,w,c[1]||o)}extractNth(n,a){let i=n,o;if(i.includes("#")){if(a!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=i.split("#")[1],i=i.split("#")[0]}return[i,o]}handleRange(n,a,i,o){let c=this.extractNth(n,a),d=c[0].split("-");if(d.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+n+"'");let h=parseInt(d[0],10)+i,m=parseInt(d[1],10)+i;if(isNaN(h))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(h>m)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let p=h;p<=m;p++)this.setPart(a,p,c[1]||o)}handleStepping(n,a,i,o){let c=this.extractNth(n,a),d=c[0].split("/");if(d.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+n+"'");d[0]===""&&(d[0]="*");let h=0;d[0]!=="*"&&(h=parseInt(d[0],10)+i);let m=parseInt(d[1],10);if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(m===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(m>this[a].length)throw new TypeError("CronPattern: Syntax error, max steps for part is ("+this[a].length+")");for(let p=h;p<this[a].length;p+=m)this.setPart(a,p,c[1]||o)}replaceAlphaDays(n){return n.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaMonths(n){return n.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(n){let a=n.trim().toLowerCase();return a==="@yearly"||a==="@annually"?"0 0 1 1 *":a==="@monthly"?"0 0 1 * *":a==="@weekly"?"0 0 * * 0":a==="@daily"?"0 0 * * *":a==="@hourly"?"0 * * * *":n}setNthWeekdayOfMonth(n,a){if(typeof a!="number"&&a==="L")this.dayOfWeek[n]=this.dayOfWeek[n]|qh;else if(a===nr)this.dayOfWeek[n]=nr;else if(a<6&&a>0)this.dayOfWeek[n]=this.dayOfWeek[n]|Ak[a-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${a}, Type: ${typeof a}`)}},Hb=[31,28,31,30,31,30,31,31,30,31,30,31],bs=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Nn=class Mk{tz;ms;second;minute;hour;day;month;year;constructor(a,i){if(this.tz=i,a&&a instanceof Date)if(!isNaN(a))this.fromDate(a);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(a===void 0)this.fromDate(new Date);else if(a&&typeof a=="string")this.fromString(a);else if(a instanceof Mk)this.fromCronDate(a);else throw new TypeError("CronDate: Invalid type ("+typeof a+") passed to CronDate constructor")}isNthWeekdayOfMonth(a,i,o,c){let d=new Date(Date.UTC(a,i,o)).getUTCDay(),h=0;for(let m=1;m<=o;m++)new Date(Date.UTC(a,i,m)).getUTCDay()===d&&h++;if(c&nr&&Ak[h-1]&c)return!0;if(c&qh){let m=new Date(Date.UTC(a,i+1,0)).getUTCDate();for(let p=o+1;p<=m;p++)if(new Date(Date.UTC(a,i,p)).getUTCDay()===d)return!1;return!0}return!1}fromDate(a){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes()+this.tz,this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),this.apply();else{let i=Ot.toTZ(a,this.tz);this.ms=a.getMilliseconds(),this.second=i.s,this.minute=i.i,this.hour=i.h,this.day=i.d,this.month=i.m-1,this.year=i.y}else this.ms=a.getMilliseconds(),this.second=a.getSeconds(),this.minute=a.getMinutes(),this.hour=a.getHours(),this.day=a.getDate(),this.month=a.getMonth(),this.year=a.getFullYear()}fromCronDate(a){this.tz=a.tz,this.year=a.year,this.month=a.month,this.day=a.day,this.hour=a.hour,this.minute=a.minute,this.second=a.second,this.ms=a.ms}apply(){if(this.month>11||this.day>Hb[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let a=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes(),this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),!0}else return!1}fromString(a){if(typeof this.tz=="number"){let i=Ot.fromTZISO(a);this.ms=i.getUTCMilliseconds(),this.second=i.getUTCSeconds(),this.minute=i.getUTCMinutes(),this.hour=i.getUTCHours(),this.day=i.getUTCDate(),this.month=i.getUTCMonth(),this.year=i.getUTCFullYear(),this.apply()}else return this.fromDate(Ot.fromTZISO(a,this.tz))}findNext(a,i,o,c){let d=this[i],h;o.lastDayOfMonth&&(this.month!==1?h=Hb[this.month]:h=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let m=!o.starDOW&&i=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let p=this[i]+c;p<o[i].length;p++){let g=o[i][p];if(i==="day"&&o.lastDayOfMonth&&p-c==h&&(g=1),i==="day"&&!o.starDOW){let v=o.dayOfWeek[(m+(p-c-1))%7];if(v&&v&nr)v=this.isNthWeekdayOfMonth(this.year,this.month,p-c,v)?1:0;else if(v)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${v}`);a.legacyMode&&!o.starDOM?g=g||v:g=g&&v}if(g)return this[i]=p-c,d!==this[i]?2:1}return 3}recurse(a,i,o){let c=this.findNext(i,bs[o][0],a,bs[o][2]);if(c>1){let d=o+1;for(;d<bs.length;)this[bs[d][0]]=-bs[d][2],d++;if(c===3)return this[bs[o][1]]++,this[bs[o][0]]=-bs[o][2],this.apply(),this.recurse(a,i,0);if(this.apply())return this.recurse(a,i,o-1)}return o+=1,o>=bs.length?this:this.year>=3e3?null:this.recurse(a,i,o)}increment(a,i,o){return this.second+=i.interval!==void 0&&i.interval>1&&o?i.interval:1,this.ms=0,this.apply(),this.recurse(a,i,0)}getDate(a){return a||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):Ot.fromTZ(Ot.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oE(n){if(n===void 0&&(n={}),delete n.name,n.legacyMode=n.legacyMode===void 0?!0:n.legacyMode,n.paused=n.paused===void 0?!1:n.paused,n.maxRuns=n.maxRuns===void 0?1/0:n.maxRuns,n.catch=n.catch===void 0?!1:n.catch,n.interval=n.interval===void 0?0:parseInt(n.interval.toString(),10),n.utcOffset=n.utcOffset===void 0?void 0:parseInt(n.utcOffset.toString(),10),n.unref=n.unref===void 0?!1:n.unref,n.startAt&&(n.startAt=new Nn(n.startAt,n.timezone)),n.stopAt&&(n.stopAt=new Nn(n.stopAt,n.timezone)),n.interval!==null){if(isNaN(n.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(n.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(n.utcOffset!==void 0){if(isNaN(n.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(n.utcOffset<-870||n.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(n.utcOffset!==void 0&&n.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(n.unref!==!0&&n.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");return n}function Pi(n){return Object.prototype.toString.call(n)==="[object Function]"||typeof n=="function"||n instanceof Function}function cE(n){return Pi(n)}function uE(n){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(n):n&&typeof n.unref<"u"&&n.unref()}var Bb=30*1e3,sc=[],dE=class{name;options;_states;fn;constructor(n,a,i){let o,c;if(Pi(a))c=a;else if(typeof a=="object")o=a;else if(a!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(Pi(i))c=i;else if(typeof i=="object")o=i;else if(i!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=oE(o),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:o?o.maxRuns:void 0,paused:o?o.paused:!1,pattern:new Lb("* * * * *")},n&&(n instanceof Date||typeof n=="string"&&n.indexOf(":")>0)?this._states.once=new Nn(n,this.options.timezone||this.options.utcOffset):this._states.pattern=new Lb(n,this.options.timezone),this.name){if(sc.find(d=>d.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");sc.push(this)}return c!==void 0&&cE(c)&&(this.fn=c,this.schedule()),this}nextRun(n){let a=this._next(n);return a?a.getDate(!1):null}nextRuns(n,a){this._states.maxRuns!==void 0&&n>this._states.maxRuns&&(n=this._states.maxRuns);let i=[],o=a||this._states.currentRun||void 0;for(;n--&&(o=this.nextRun(o));)i.push(o);return i}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let n=this.nextRun(this._states.currentRun),a=!this._states.paused,i=this.fn!==void 0,o=!this._states.kill;return a&&i&&o&&n!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(n){let a=this._next(n);return a?n instanceof Nn||n instanceof Date?a.getTime()-n.getTime():a.getTime()-new Nn(n).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let n=sc.indexOf(this);n>=0&&sc.splice(n,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(n){if(n&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");n&&(this.fn=n);let a=this.msToNext(),i=this.nextRun(this._states.currentRun);return a==null||isNaN(a)||i===null?this:(a>Bb&&(a=Bb),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(i),a),this._states.currentTimeout&&this.options.unref&&uE(this._states.currentTimeout),this)}async _trigger(n){if(this._states.blocking=!0,this._states.currentRun=new Nn(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(a){Pi(this.options.catch)&&this.options.catch(a,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new Nn(n,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(n){let a=new Date,i=!this._states.paused&&a.getTime()>=n.getTime(),o=this._states.blocking&&this.options.protect;i&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):i&&o&&Pi(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(n){let a=!!(n||this._states.currentRun),i=!1;!n&&this.options.startAt&&this.options.interval&&([n,a]=this._calculatePreviousRun(n,a),i=!n),n=new Nn(n,this.options.timezone||this.options.utcOffset),this.options.startAt&&n&&n.getTime()<this.options.startAt.getTime()&&(n=this.options.startAt);let o=this._states.once||new Nn(n,this.options.timezone||this.options.utcOffset);return!i&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,a)),this._states.once&&this._states.once.getTime()<=n.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_calculatePreviousRun(n,a){let i=new Nn(void 0,this.options.timezone||this.options.utcOffset),o=n;if(this.options.startAt.getTime()<=i.getTime()){o=this.options.startAt;let c=o.getTime()+this.options.interval*1e3;for(;c<=i.getTime();)o=new Nn(o,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),c=o.getTime()+this.options.interval*1e3;a=!0}return o===null&&(o=void 0),[o,a]}};function zk(n,a,i=new Date){let o;for(const c of n)if(c.active)for(const d of c.schedules)try{const h=new dE(d,{timezone:a}).nextRun(i);h&&(!o||h<o.at)&&(o={routine:c,at:h})}catch{}return o}function Ih(n,a,i,o){const c=a.filter(d=>d.assistantId===n.id);return i.some(d=>d.status==="pending"&&(d.assistantId===n.id||c.some(h=>h.id===d.jobId)))||c.some(d=>d.status==="waiting")?"等你确认":n.busy||c.some(d=>d.status==="running")||o.some(d=>d.status==="running"&&(d.from===n.id||d.to===n.id))?"执行中":c.some(d=>d.status==="queued")?"排队中":"空闲"}function fE(n,a){const i=n.filter(h=>h.assistantId===a),o=i.filter(h=>["running","queued","waiting"].includes(h.status)).sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0],c=i.filter(h=>!["running","queued","waiting"].includes(h.status)&&h.endedAt).sort((h,m)=>m.endedAt.localeCompare(h.endedAt))[0],d=i.filter(h=>h.status==="running").sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0];return{active:o,running:d,last:c,recent:i.sort((h,m)=>m.createdAt.localeCompare(h.createdAt)).slice(0,20)}}function Rk(n,a,i=new Date){const o=x=>new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"}).format(x),c=o(n),[d,h,m]=o(i).split("-").map(Number),p=new Date(Date.UTC(d,h-1,m+1)).toISOString().slice(0,10),g=new Intl.DateTimeFormat("zh-CN",{timeZone:a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(n);return c===o(i)?`今天 ${g}`:c===p?`明天 ${g}`:`${new Intl.DateTimeFormat("zh-CN",{timeZone:a,month:"numeric",day:"numeric"}).format(n)} ${g}`}function hE(n,a,i=new Date){if(!n.length)return"没有";const o=zk(n,a,i);return o?`${n.length} 个 · ${Rk(o.at,a,i)}`:`${n.length} 个 · ${n.some(c=>c.active)?"无下次执行时间":"已暂停"}`}function mE(n,a,i){return{skills:n?`${n} 个`:"没有",knowledge:a.length?a.join("、"):"未开启",rules:i?`${i} 条`:"没有"}}function pE(n,a=new Date){const i=new Date(a.getFullYear(),a.getMonth(),a.getDate());return i.setDate(i.getDate()-(i.getDay()+6)%7),{week:n.filter(o=>new Date(o.updatedAt)>=i),older:n.filter(o=>new Date(o.updatedAt)<i)}}function qb(n,a=new Date){return`${n.uses?`用过 ${n.uses} 次${n.lastUsedAt?` · 上次${Pt(n.lastUsedAt,a)}`:""}`:"还没用过"} · 第 ${n.version} 版`}function Ok(n){let a=n.trim();for(;;){const o=a.replace(/^cd\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;)\s*/,"").replace(/^timeout\s+(?:-[ks]\s+\S+\s+|-\S+\s+)*\d+(?:\.\d+)?[smhd]?\s+/,"");if(o===a)break;a=o}const i=gE.exec(a);if(i){let o=i[2];const c=Ib(o);if(c){let[d,h]=c;const m=/^(?:ba)?sh\s+-l?c\s+/.exec(d),p=m?Ib(d.slice(m[0].length)):void 0;p&&(d=p[0]+p[1]),o=d+h}a=`${i[1]}: ${Ok(o)}`}return a||n.trim()}const gE=/^ssh\s+(?:-[BbcDEeFIiJLlmOoPpQRSWw]\s*\S+\s+|-[46AaCfGgKkMNnqsTtVvXxYy]+\s+)*([^\s'"-]\S*)\s+(.+)$/s;function Ib(n){const a=/^'([^']*)'?/.exec(n)??/^"((?:[^"\\]|\\.)*)"?/s.exec(n);return a?[n[0]==='"'?a[1].replace(/\\(["\\$`])/g,"$1"):a[1],n.slice(a[0].length)]:void 0}function vE(){return s.jsx("div",{className:"sidebar-loading",role:"status",children:s.jsx(Hn,{text:"正在读取…"})})}function xE(){const n=we(),a=n.sel??"hob",i=n.profiles[a],o=i?.assistant??n.assistants.find(y=>y.id===a),c=n.routines.filter(y=>y.assistantId===a),d=n.assistantSkills[a],[h,m]=k.useState("任务"),[p,g]=k.useState(""),[v,x]=k.useState(!n.knowledge.collectionsLoaded),w=n.sidebarJobs?.[a],E=n.sidebarFiles?.[a],T=E?.items??[],C=Object.values({...Object.fromEntries((w?.items??[]).map(y=>[y.id,y])),...n.jobs}).filter(y=>y.assistantId===a).sort((y,S)=>S.createdAt.localeCompare(y.createdAt)),M=k.useRef(null),A=k.useRef(!1);(!M.current||M.current.aid!==a)&&(M.current={aid:a,ids:new Set},A.current=!1);const $=w?.loaded?new Set(C.filter(y=>!M.current.ids.has(y.id)).map(y=>y.id)):new Set;k.useEffect(()=>{if(!w?.loaded){A.current=!1;return}C.forEach(y=>M.current?.ids.add(y.id)),A.current=!0}),k.useEffect(()=>{m("任务"),ys(a),Nf(a)},[a]),k.useEffect(()=>{kS().catch(y=>g(y instanceof Error?y.message:String(y))).finally(()=>x(!1))},[]),k.useEffect(()=>{h==="文件"&&Sf(a)},[a,h]);const O=h==="任务"?w:E,W=k.useRef(null);k.useEffect(()=>{const y=W.current;if(!y||!O?.hasMore||O.loading||O.error)return;const S=new IntersectionObserver(U=>{U.some(Z=>Z.isIntersecting)&&(h==="任务"?Nf(a,!0):Sf(a,!0))},{root:y.closest(".panel")});return S.observe(y),()=>S.disconnect()},[a,h,O?.hasMore,O?.loading,O?.error,O?.cursor]);const ee=(o?.knowledge??[]).map(y=>n.knowledge.collections.find(S=>S.id===y)?.name).filter(y=>!!y),I=mE(d?.skills.length??0,ee,i?.rules.length??0),j=pE(T);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"group-card sidebar-info",children:[s.jsxs("button",{className:"sidebar-instructions",onClick:wh,children:[s.jsx("small",{children:"补充说明"}),s.jsx("span",{className:o?.instructions?"":"muted",children:o?.instructions||"记下这个助手要知道的事实"}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Fo("routines"),children:[s.jsx(Q,{name:"clock",size:15}),s.jsx("span",{children:"定时任务"}),s.jsx("small",{children:hE(c,n.settings.settings.general.timezone)}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Fo("skills"),children:[s.jsx(Q,{name:"mem",size:15}),s.jsx("span",{children:"技能"}),s.jsx("small",{children:d?.error?"加载失败":d?.loaded?I.skills:s.jsx(Hn,{text:"正在加载…"},a)}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Fo("knowledge"),children:[s.jsx(Q,{name:"archive",size:15}),s.jsx("span",{children:"知识库"}),s.jsx("small",{children:p?"加载失败":v?s.jsx(Hn,{text:"正在加载…"}):I.knowledge}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Fo("rules"),children:[s.jsx(Q,{name:"rule",size:15}),s.jsx("span",{children:"执行前确认"}),s.jsx("small",{children:I.rules}),s.jsx("b",{children:"›"})]})]}),s.jsx("div",{className:"sidebar-tabs",children:s.jsx("div",{className:"seg",style:{"--seg-count":2,"--seg-index":["任务","文件"].indexOf(h)},children:["任务","文件"].map(y=>s.jsx("button",{className:h===y?"on":"",onClick:()=>m(y),children:y},y))})}),s.jsx("div",{className:"sidebar-tab-content",children:s.jsxs("div",{className:"group-card sidebar-list",children:[h==="任务"?C.map(y=>s.jsx("div",{className:`srow${A.current&&$.has(y.id)?" enter":""}`,children:s.jsx("div",{className:"srowclip",children:s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Ln(y.id),children:[Bh(y.status,16),s.jsxs("span",{children:[s.jsxs("strong",{children:[y.routineId?"⏱ ":"",y.title]}),s.jsxs("small",{children:[Pt(y.startedAt??y.createdAt),y.status==="running"||y.status==="waiting"?` · 已进行 ${vr(y.startedAt??y.createdAt)}`:y.durationMs!==void 0?` · 用时 ${Hl(y.durationMs)}`:""]})]}),s.jsx("b",{children:"›"})]})})},y.id)):[["本周",j.week],["更早",j.older]].map(([y,S])=>S.length?s.jsxs("div",{children:[s.jsx("div",{className:"sidebar-group-label",children:y}),S.map(U=>s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>zt(U.path,U.name),children:[s.jsx(Q,{name:Ul(U.name),size:18}),s.jsxs("span",{children:[s.jsx("strong",{children:U.name}),s.jsxs("small",{children:[Va(U.size)," · ",Pt(U.updatedAt)]})]}),s.jsx("b",{children:"›"})]},U.id))]},y):null),O?.loaded&&!(h==="任务"?C.length:T.length)&&!O.error?s.jsx(ze,{children:h==="任务"?"分派的任务会显示在这里":"还没有产出文件"}):null,O?.error?s.jsxs("div",{className:"badline",children:["加载失败:",O.error," ",s.jsx("button",{onClick:()=>void(h==="任务"?Nf(a,O.failedMore):Sf(a,O.failedMore)),children:"重试"})]}):null,!O?.loaded&&!O?.error||O?.loadingMore?s.jsx(vE,{}):null,O?.hasMore&&!O.error?s.jsx("div",{ref:W}):null]})},h)]})}const Da=["off","minimal","low","medium","high","xhigh","max"];function _k(n){return n?.thinkingLevels??["off"]}function cr(n,a){const i=_k(n);if(!n||i.includes(a))return a;const o=Da.indexOf(a);return[...i].reverse().find(c=>Da.indexOf(c)<=o)??"off"}function bE(n,a){const i=a.trim().toLowerCase();return i?n.filter(o=>o.name.toLowerCase().includes(i)||o.ref.toLowerCase().includes(i)):n}function kE(n){const a=[];for(const i of n){let o=a.find(c=>c.provider===i.provider);o||(o={provider:i.provider,models:[]},a.push(o)),o.models.push(i)}return a}function yE(){const[n,a]=k.useState({screens:[],profiles:{}});return k.useEffect(()=>{if(Ol){(gc()==="ready"||gc()==="deployed")&&a({screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}],profiles:{hob:"hob"}});return}let i=!0,o=0;const c=async()=>{const h=o;try{const m=await fetch("/api/desktop/screens");if(!m.ok)throw new Error("无法读取屏幕状态。");const p=await m.json();i&&a(g=>({profiles:p.profiles,screens:o===h?p.screens:g.screens}))}catch{i&&a({screens:[],profiles:{}})}},d=new EventSource("/api/events");return d.onopen=()=>{c()},d.onerror=()=>{i&&a(h=>({...h,screens:[]}))},d.onmessage=h=>{try{const m=JSON.parse(h.data);m.type==="desktop-screens"&&Array.isArray(m.screens)?(o++,a(p=>({...p,screens:m.screens}))):(m.type==="assistant"||m.type==="assistant_removed")&&c()}catch{}},()=>{i=!1,d.close()}},[]),n}async function nA(n){const a=await fetch(`/api/desktop/screens/${encodeURIComponent(n)}/start`,{method:"POST"});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error??"无法启动屏幕。")}}const jE=k.lazy(()=>hr(()=>import("./DesktopView-A11jmUwu.js"),[]).then(n=>({default:n.DesktopMini}))),wE=k.lazy(()=>hr(()=>import("./DesktopView-A11jmUwu.js"),[]).then(n=>({default:n.DesktopView}))),NE={读:"读取",跑:"运行",改:"修改",写:"写入",搜:"搜索"};function ah(n){return[NE[n.verb]??n.verb,n.verb==="跑"?Ok(n.text):n.text]}function ih({mobile:n=!1,page:a}){const i=we(),o=a===void 0?i.panelStack.at(-1):a,c=o&&o.kind!=="job"&&o.kind!=="jobs"&&o.kind!=="file"?o:{kind:"now"},d=c.kind,[h,m]=k.useState(!1),p=i.profiles[i.sel??"hob"]?.assistant??i.assistants.find(v=>v.id===(i.sel??"hob"));k.useEffect(()=>m(!1),[i.sel]);const g=c.kind==="routine"?i.routines.find(v=>v.id===c.id)?.name??"定时任务":d==="newRoutine"?"新建定时任务":d==="routines"?"定时任务":d==="skills"?"技能":d==="knowledge"?"知识库":d==="rules"?"执行前确认":d==="now"?"":"编辑助手";return s.jsxs("aside",{className:"panel",onScroll:v=>{if(d==="now"){const x=v.currentTarget.querySelector(".sidebar-card"),w=v.currentTarget.querySelector(".phead");m(!!x&&!!w&&x.getBoundingClientRect().bottom<=w.getBoundingClientRect().bottom)}},children:[s.jsxs(rr,{className:"phead",root:d==="now",title:s.jsx("span",{className:"t",children:d==="now"&&h&&p?s.jsxs("span",{className:"sidebar-head-identity",children:[s.jsx(ut,{sprite:p.sprite,prop:p.prop,size:24}),p.name]}):g}),children:[d==="now"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-icon-btn",title:"编辑助手",onClick:wh,children:s.jsx(Q,{name:"edit",size:17})}),s.jsx("button",{className:"hob-icon-btn panel-close",title:"收起右栏",onClick:TS,children:s.jsx(Q,{name:"dbl",size:17})})]}):null,d==="routines"?s.jsx("button",{className:"hob-icon-btn",title:"新建定时任务",onClick:bS,children:s.jsx(Q,{name:"plus",size:17})}):null,c.kind==="routine"?s.jsx("button",{className:"hob-btn hob-btn-primary hob-btn-compact",onClick:()=>void mS(c.id),children:"立即运行"}):null]}),s.jsx("div",{className:`pbody sidebar-page-${d}`,children:d==="routine"?s.jsx(AE,{id:c.kind==="routine"?c.id:""},c.kind==="routine"?c.id:""):d==="newRoutine"?s.jsx(EE,{}):d==="assistant"?s.jsx(UE,{},i.sel??"hob"):d==="routines"?s.jsx(TE,{}):d==="skills"?s.jsx(OE,{aid:i.sel??"hob"}):d==="knowledge"?s.jsx(RE,{aid:i.sel??"hob"}):d==="rules"?s.jsx(CE,{aid:i.sel??"hob"}):s.jsxs(s.Fragment,{children:[s.jsx(SE,{}),s.jsx(xE,{})]})})]})}function SE(){const n=we(),a=n.sel??"hob",i=n.profiles[a]?.assistant??n.assistants.find(ee=>ee.id===a),o=Object.values(n.jobs),{running:c,last:d}=fE(o,a),h=i?Ih(i,o,Object.values(n.approvals),Object.values(n.delegations)):"空闲",m=zk(n.routines.filter(ee=>ee.assistantId===a),n.settings.settings.general.timezone),p=yE(),g=p.profiles[n.sel??"hob"],v=!!g&&p.screens.some(ee=>ee.id===g&&ee.running),[x,w]=k.useState(null),E=v&&n.nowWide,T=k.useRef([]);c&&(T.current=c.activity);const C=(c?.activity??T.current).slice(v&&!E?-2:-8),M=fn(!!c&&!v),A=C.map(ee=>`${ee.at}|${ee.verb}|${ee.text}`),$=k.useRef(null);$.current===null&&($.current=new Set(A));const O=new Set(A.filter(ee=>!$.current.has(ee)));k.useEffect(()=>{for(const ee of A)$.current.add(ee)});const W=(ee,I,j)=>s.jsxs("button",{className:`screen ${ee}`,title:I,onClick:j,children:[C.map((y,S)=>y.verb==="$"?s.jsxs("div",{className:O.has(A[S])?"new":void 0,children:[s.jsx("span",{className:"p",children:"$"})," ",y.text]},A[S]):s.jsxs("div",{className:O.has(A[S])?"new":void 0,children:[s.jsx("span",{className:"v",children:ah(y)[0]}),ah(y)[1]]},A[S])),s.jsx("div",{children:s.jsx("span",{className:"cur"})})]});return s.jsxs("div",{className:"group-card sidebar-card",children:[i?s.jsxs("div",{className:"sidebar-identity",children:[s.jsx(ut,{sprite:i.sprite,prop:i.prop,size:44}),s.jsxs("span",{children:[s.jsx("strong",{children:i.name}),s.jsx("small",{children:i.duty})]}),s.jsx("em",{className:h!=="空闲"?"active":"",children:s.jsx("span",{children:h},h)})]}):null,v?s.jsxs("div",{className:"now-desk",children:[s.jsxs("div",{className:"now-screen",children:[s.jsx("button",{className:"now-hit",title:E?"收起":"在侧栏展开","aria-label":E?"收起":"在侧栏展开",onClick:Ef}),s.jsx(k.Suspense,{fallback:null,children:s.jsx(jE,{screen:g},g)}),s.jsx("span",{className:"now-live",children:"实时"}),s.jsxs("div",{className:"now-acts",children:[E?s.jsx("button",{className:"now-btn",title:"收起","aria-label":"收起",onClick:Ef,children:s.jsx(Q,{name:"shrink",size:15})}):null,s.jsx("button",{className:"now-btn",title:"全屏","aria-label":"全屏查看云桌面",onClick:()=>w("view"),children:s.jsx(Q,{name:"expand",size:15})}),s.jsxs("button",{className:"now-btn txt",title:"接管云桌面",onClick:()=>w("take"),children:[s.jsx(Q,{name:"pointer",size:14}),"接管"]})]})]}),c?W("strip",E?"收起":"在侧栏展开",Ef):null]}):null,x&&g?s.jsx(k.Suspense,{fallback:null,children:s.jsx(wE,{initialScreen:g,takeOver:x==="take",onClose:()=>w(null)})}):null,v?null:s.jsx("div",{className:`now-log${c?" open":""}`,inert:!c,children:s.jsx("div",{children:M.mounted&&c?W("jd-open","打开任务详情",()=>Ln(c.id)):M.mounted?W("jd-open","打开任务详情",()=>{}):null})}),c?s.jsx(s.Fragment,{children:s.jsxs("div",{className:"caprow",children:[s.jsxs("span",{className:"cap",children:[c.title,c.routineId?" · 定时执行":""," · 已进行 ",vr(c.startedAt??c.createdAt)]}),s.jsx("button",{className:"more",onClick:()=>Ln(c.id),children:"任务详情 ›"})]})}):s.jsxs("div",{className:"sidebar-facts",children:[d?s.jsxs("button",{onClick:()=>Ln(d.id),children:["上次 ",s.jsxs("span",{children:[Bh(d.status,14),s.jsx("span",{children:d.title})]}),s.jsx("small",{children:Pt(d.endedAt)})]}):null,m?s.jsxs("div",{children:["下一次 ",s.jsxs("span",{children:[s.jsx("span",{"aria-hidden":"true",children:"⏱"}),s.jsx("span",{children:m.routine.name})]}),s.jsx("small",{children:Rk(m.at,n.settings.settings.general.timezone)})]}):null]}),n.sel==="hob"?Object.values(n.delegations).filter(ee=>ee.status==="running"||ee.status==="waiting").map(ee=>{const I=n.assistants.find(j=>j.id===ee.to);return s.jsxs("button",{className:"sidebar-delegation",onClick:()=>void yh("hob",ee.id,!1),children:[I?s.jsx(ut,{sprite:I.sprite,prop:I.prop,size:22}):null,s.jsxs("span",{children:["交给「",I?.name??ee.to,"」"]}),s.jsx("small",{children:s.jsx(js,{meta:fk[ee.status]})})," ›"]},ee.id)}):null]})}function TE(){const n=we(),a=n.routines.filter(i=>i.assistantId===(n.sel??"hob"));return a.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.map(i=>s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>L0(i.id),children:[s.jsx(Q,{name:i.active?"clock":"pause",size:18}),s.jsxs("span",{children:[s.jsx("strong",{children:i.name}),s.jsx("small",{children:i.active?s.jsxs(s.Fragment,{children:[Hh(i.schedules[0]??""),i.runs[0]?s.jsxs(s.Fragment,{children:[" · 上次 ",s.jsx(js,{meta:es[i.runs[0].status]})," ",Pt(i.runs[0].at)]}):null]}):"已暂停"})]}),s.jsx("b",{children:"›"})]},i.id))}):s.jsx(ze,{children:"这个助手还没有定时任务"})}function CE({aid:n}){const a=we().profiles[n]?.rules??[];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"note",children:"标为「需确认」的事项,助手执行前会先征求你的同意。"}),a.length?null:s.jsx(ze,{children:"还没有执行前确认事项"}),s.jsxs("div",{className:"group-card sidebar-card-group card-rows",children:[a.map(i=>s.jsx(DE,{aid:n,rule:i},i.id)),s.jsx($E,{aid:n})]})]})}function Dk({value:n,onSave:a,onRemove:i}){const[o,c]=k.useState(!1),d=Lh(n);if(!o)return s.jsxs("button",{className:"w",onClick:()=>c(!0),children:[s.jsx(Q,{name:"clock",size:15}),Hh(n)]});const h=p=>{const g=d.kind==="raw"?{...d,kind:"daily"}:d;a(QT({...g,...p}))},m=`${String(d.hour).padStart(2,"0")}:${String(d.minute).padStart(2,"0")}`;return s.jsxs("div",{className:"w sched-edit",children:[s.jsxs("select",{value:d.kind,onChange:p=>h({kind:p.target.value}),children:[s.jsx("option",{value:"daily",children:"每天"}),s.jsx("option",{value:"weekly",children:"每周"}),s.jsx("option",{value:"monthly",children:"每月"}),s.jsx("option",{value:"raw",children:"自定义"})]}),d.kind==="weekly"?s.jsx("select",{value:d.weekday,onChange:p=>h({weekday:Number(p.target.value)}),children:uk.map((p,g)=>s.jsxs("option",{value:g,children:["周",p]},g))}):null,d.kind==="monthly"?s.jsx("input",{type:"number",min:1,max:28,value:d.day,onChange:p=>h({day:Number(p.target.value)||1})}):null,d.kind==="raw"?s.jsx("input",{className:"rawcron",value:d.raw,onChange:p=>a(p.target.value)}):s.jsx("input",{type:"time",value:m,onChange:p=>{const[g,v]=p.target.value.split(":").map(Number);h({hour:g||0,minute:v||0})}}),i?s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:i,children:"删除"}):null,s.jsx("button",{className:"hob-btn",onClick:()=>c(!1),children:"完成"})]})}function EE(){const n=we(),[a,i]=k.useState(""),[o,c]=k.useState(""),[d,h]=k.useState("0 9 * * *"),[m,p]=k.useState(!0),[g,v]=k.useState(""),[x,w]=k.useState(!1),E=n.sel??"hob";k.useEffect(()=>{ys(E)},[E]);const T=a.trim()!==""&&o.trim()!==""&&!x,C=async()=>{w(!0),await fS({assistantId:n.sel??"hob",name:a.trim(),instruction:o.trim(),schedules:[d],active:m,...g?{skill:g}:{}}),w(!1)};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("div",{className:"ctl",children:[s.jsx("span",{children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${m?"":" off"}`,title:m?"暂停":"启用",onClick:()=>p(!m)})]})}),s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("label",{className:"field",children:s.jsx("input",{autoFocus:!0,value:a,placeholder:"如「每日简报」",onChange:M=>i(M.target.value)})}),s.jsx("div",{className:"lbl",children:"任务内容"}),s.jsx("label",{className:"field",children:s.jsx("textarea",{rows:4,value:o,placeholder:"到点后交给后台任务执行的内容,写清楚需要什么结果",onChange:M=>c(M.target.value)})}),s.jsx("div",{className:"lbl",children:"执行时间"}),s.jsx("div",{className:"when",children:s.jsx(Dk,{value:d,onSave:h})}),s.jsx("div",{className:"lbl",children:"技能"}),n.assistantSkills[E]?.error?s.jsxs("div",{className:"badline",children:["加载失败:",n.assistantSkills[E].error," ",s.jsx("button",{onClick:()=>void ys(E),children:"重试"})]}):null,s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("select",{className:"pick","aria-label":"技能",value:g,disabled:!n.assistantSkills[E]||n.assistantSkills[E].loading||!!n.assistantSkills[E].error,onChange:M=>v(M.target.value),children:[s.jsx("option",{value:"",children:"不用技能"}),(n.assistantSkills[E]?.skills??[]).filter(M=>M.enabled).map(M=>s.jsx("option",{value:M.name,children:M.title},M.name))]})}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn",onClick:ur,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!T,onClick:()=>void C(),children:"创建"})]})]})}function AE({id:n}){const a=we(),i=a.routines.find(c=>c.id===n),o=i?.assistantId;return k.useEffect(()=>{o&&ys(o)},[o]),i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${i.active?"":" off"}`,title:i.active?"暂停":"启用",onClick:()=>void Nl(i.id,{active:!i.active})})]})}),s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("label",{className:"field",children:s.jsx("input",{defaultValue:i.name,onBlur:c=>{const d=c.target.value.trim();d&&d!==i.name&&Nl(i.id,{name:d})}})}),s.jsx("div",{className:"lbl",children:"任务内容"}),s.jsx("label",{className:"field",children:s.jsx("textarea",{rows:4,defaultValue:i.instruction,onBlur:c=>{c.target.value!==i.instruction&&Nl(i.id,{instruction:c.target.value})}})}),s.jsx("div",{className:"lbl",children:"执行时间"}),s.jsxs("div",{className:"when",children:[i.schedules.map((c,d)=>s.jsx(Dk,{value:c,onSave:h=>{const m=i.schedules.slice();m[d]=h,Nl(i.id,{schedules:m})},onRemove:i.schedules.length>1?()=>void Nl(i.id,{schedules:i.schedules.filter((h,m)=>m!==d)}):void 0},d)),s.jsxs("button",{className:"w",onClick:()=>void Nl(i.id,{schedules:[...i.schedules,"0 9 * * *"]}),children:[s.jsx(Q,{name:"plus",size:14}),"添加执行时间"]})]}),s.jsx("div",{className:"lbl",children:"技能"}),a.assistantSkills[i.assistantId]?.error?s.jsxs("div",{className:"badline",children:["加载失败:",a.assistantSkills[i.assistantId].error," ",s.jsx("button",{onClick:()=>void ys(i.assistantId),children:"重试"})]}):null,s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("select",{className:"pick","aria-label":"技能",value:i.skill??"",disabled:!a.assistantSkills[i.assistantId]||a.assistantSkills[i.assistantId].loading||!!a.assistantSkills[i.assistantId].error,onChange:c=>void Nl(i.id,{skill:c.target.value||null}),children:[s.jsx("option",{value:"",children:"不用技能"}),i.skill&&!a.assistantSkills[i.assistantId]?.skills.some(c=>c.name===i.skill&&c.enabled)?s.jsx("option",{value:i.skill,disabled:!0,children:i.skill}):null,(a.assistantSkills[i.assistantId]?.skills??[]).filter(c=>c.enabled).map(c=>s.jsx("option",{value:c.name,children:c.title},c.name))]})}),s.jsx("div",{className:"lbl",children:"运行记录"}),s.jsx("div",{className:"group-card sidebar-card-group sidebar-runs",children:i.runs.length?i.runs.map(c=>{const h=a.jobs[c.jobId]?.status??c.status,m=h==="running"||h==="queued",p=h==="failed"||h==="stuck",g=ZT(c);return s.jsxs("button",{className:`run${p?" bad":""}`,onClick:()=>void xS(i.assistantId,c.jobId),children:[s.jsxs("span",{className:"rt",children:[Pt(c.at),g?s.jsx("small",{children:g}):null]}),s.jsx(Q,{name:m?"spin":p?"close":"check",size:16,className:m?"spin":""})]},c.jobId)}):s.jsx(ze,{children:"还没有运行记录"})}),s.jsx("div",{className:"group-card sidebar-card-group sidebar-danger",style:{marginTop:18},children:s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:async()=>{window.confirm(`删除定时任务「${i.name}」?已有的运行记录会保留在对话里。`)&&(await hS(i.id),ur())},children:"删除定时任务"})})]}):s.jsx(ze,{children:"这个定时任务已不存在。"})}function xr(n){const[a,i]=k.useState(null),[o,c]=k.useState(!1);return k.useEffect(()=>{if(a!=="已保存")return;const h=setTimeout(()=>i(null),3e3);return()=>clearTimeout(h)},[a]),{save:async h=>{c(!0);const m=await kc(n,h);return c(!1),i(m??"已保存"),!m},busy:o,message:a,fail:h=>i(h)}}function br({message:n}){return n?s.jsx("div",{role:"status",className:n==="已保存"?"okline":"badline",children:n}):null}function lc({value:n,multiline:a,placeholder:i,save:o}){const[c,d]=k.useState(n);k.useEffect(()=>d(n),[n]);const h={value:c,placeholder:i,onChange:m=>d(m.target.value),onBlur:()=>{c!==n&&o(c).then(m=>{m||d(n)})},onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),m.currentTarget.blur())}};return s.jsx("label",{className:"field",children:a?s.jsx("textarea",{rows:2,...h}):s.jsx("input",{...h})})}function ME({aid:n}){const a=we(),i=xr(n),o=a.profiles[n],[c,d]=k.useState(null);k.useEffect(()=>{gh().then(d)},[]);const h=a.settings.settings.models.roster;if(!o)return null;const m=o.assistant.models??{},p=a.settings.settings.models,g=M=>c?.models.find(A=>A.ref===M)?.name??M,v=M=>h.find(A=>A.ref===M),x=M=>void i.save({models:M}),w=M=>A=>{const $={...m};if(A){const O=M==="conversation"?p.conversation.thinking:p.work.thinking;$[M]={ref:A,thinking:cr(c?.models.find(W=>W.ref===A),v(A)?.thinking??O)}}else delete $[M];x($)},E=m.allowed??[],T=M=>{const A={...m};M.length?A.allowed=M:delete A.allowed,x(A)},C=(M,A)=>s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:M}),s.jsx("div",{className:"ctl",children:s.jsxs("select",{className:"pick grow",value:m[A]?.ref??"",onChange:$=>w(A)($.target.value),children:[s.jsxs("option",{value:"",children:["跟随全局(",g(A==="conversation"?p.conversation.ref:p.work.ref),")"]}),h.map($=>s.jsx("option",{value:$.ref,children:g($.ref)},$.ref))]})})]});return s.jsxs(s.Fragment,{children:[s.jsx(br,{message:i.message}),C("对话模型","conversation"),C("默认任务模型","work"),s.jsx("div",{className:"lbl",children:"可分派的模型"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`hob-btn${E.length?"":" hob-btn-primary"}`,onClick:()=>T([]),children:"全部"}),s.jsx("button",{className:`hob-btn${E.length?" hob-btn-primary":""}`,onClick:()=>T(h.map(M=>M.ref)),children:"指定"}),s.jsx("span",{className:"note",style:{margin:0},children:E.length?`已选 ${E.length} 个`:`可用模型共 ${h.length} 个`})]}),E.length?s.jsx("div",{className:"chips",style:{marginTop:8},children:h.map(M=>{const A=E.includes(M.ref);return s.jsx("button",{className:`chip${A?" on":""}`,onClick:()=>T(A?E.filter($=>$!==M.ref):[...E,M.ref]),children:g(M.ref)},M.ref)})}):null]})}function zE({aid:n}){const a=we(),i=xr(n),o=a.profiles[n];if(!o)return null;const c=o.assistant.abilities??{exec:!0,write:!0,image:!0},d=a.settings.settings.image.source!=="off",h=p=>void i.save({abilities:{...c,...p}}),m=(p,g,v,x)=>s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:p}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${g?"":" off"}`,title:g?"关闭":"开启",onClick:v})]}),x?s.jsx("div",{className:"note",children:x}):null]});return s.jsxs(s.Fragment,{children:[s.jsx(br,{message:i.message}),m("执行命令",c.exec,()=>h({exec:!c.exec}),"开启后,任务可以运行命令,并可通过命令访问网络。"),m("修改文件",c.write,()=>h({write:!c.write}),"开启后,任务可以创建和修改文件。"),d?m("图像生成",c.image,()=>h({image:!c.image}),"开启后,任务可以生成图片,图片以缩略图显示在对话中。"):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ctl",style:{marginTop:8},children:[s.jsx("span",{style:{fontSize:14,color:"var(--text3)"},children:"图像生成"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"tog off",disabled:!0,title:"需要先在 设置 → 图像生成 中完成配置"})]}),s.jsx("div",{className:"note",children:"需要先在 设置 → 图像生成 中完成配置。"})]}),s.jsx("div",{className:"note",children:"读取文件始终可用。"})]})}function $k(){const[n,a]=k.useState(!1);return k.useEffect(()=>{const i=setTimeout(()=>a(!0),300);return()=>clearTimeout(i)},[]),s.jsx("div",{className:"sidebar-loading",role:"status",children:n?"正在加载…":null})}function RE({aid:n}){const a=we(),i=xr(n);k.useEffect(()=>{_t()},[]);const o=(a.profiles[n]?.assistant.knowledge??[]).filter(c=>a.knowledge.collections.some(d=>d.id===c));return s.jsxs(s.Fragment,{children:[s.jsx(br,{message:i.message}),a.knowledge.error?s.jsxs("div",{className:"badline",children:["加载失败:",a.knowledge.error," ",s.jsx("button",{onClick:()=>void _t(),children:"重试"})]}):null,a.knowledge.collectionsLoaded?a.knowledge.collections.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.knowledge.collections.map(c=>s.jsxs("div",{className:"ctl",children:[s.jsx("span",{children:c.name}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${o.includes(c.id)?"":" off"}`,"aria-label":c.name,"aria-pressed":o.includes(c.id),disabled:i.busy,onClick:()=>void i.save({knowledge:o.includes(c.id)?o.filter(d=>d!==c.id):[...o,c.id]})})]},c.id))}):s.jsx(ze,{action:{label:"去知识库",onClick:Nh},children:"还没有知识库"}):a.knowledge.error?null:s.jsx($k,{})]})}function OE({aid:n}){const a=we().assistantSkills[n],i=Mc();k.useEffect(()=>{a?.loading||ys(n)},[n]);const o=a?.skills.find(c=>c.name===i.menu?.id);return s.jsxs(s.Fragment,{children:[a?.error?s.jsxs("div",{className:"badline",children:["加载失败:",a.error," ",s.jsx("button",{onClick:()=>void ys(n),children:"重试"})]}):null,a?.loaded?a.skills.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.skills.map(c=>s.jsxs("div",{className:"list-row assistant-skill",children:[s.jsxs("button",{className:"assistant-skill-info",onClick:()=>zt(c.path),title:`${c.description} · ${qb(c)}`,children:[s.jsx("strong",{children:c.title}),s.jsxs("span",{children:[c.description," · ",qb(c)]})]}),s.jsx("button",{className:`tog${c.enabled?"":" off"}`,"aria-label":c.title,"aria-pressed":c.enabled,onClick:()=>void wf(n,c.name,c.enabled?"disable":"enable")}),s.jsx("button",{className:"knowledge-dots","aria-label":`${c.title}的操作`,onClick:d=>i.toggle(c.name,d.currentTarget),children:s.jsx(Q,{name:"more",size:18})})]},c.name))}):s.jsx(ze,{children:"还没有技能。助手会把做成的事沉淀成技能,你也可以在任务详情里点「沉淀成技能」。"}):a?.error?null:s.jsx($k,{}),o&&i.menu&&fr.createPortal(s.jsxs("div",{className:"amenu knowledge-popup",ref:i.box,children:[s.jsx("button",{onClick:()=>{i.close(),zt(o.path)},children:"查看"}),o.version>1?s.jsx("button",{onClick:()=>{i.close(),wf(n,o.name,"rollback")},children:"回退到上一版"}):null,s.jsx("button",{onClick:()=>{i.close(),window.confirm(`删除「${o.title}」?`)&&wf(n,o.name,"delete")},children:"删除"})]}),document.body)]})}function _E({aid:n,sprite:a,prop:i,onDone:o}){const c=xr(n),d=X0(a)??{prop:"hob",color:"slate"},h=m=>{m!==a&&c.save({sprite:m})};return s.jsxs(s.Fragment,{children:[s.jsx(br,{message:c.message}),s.jsxs("div",{className:"sprite-pick",children:[i?s.jsx("button",{className:d.prop==="custom"?"on":void 0,title:"自画道具",onClick:()=>h(Af(d.color)),children:s.jsx(ut,{sprite:Af(d.color),prop:i,size:34})}):null,qS.map(m=>s.jsx("button",{className:m===d.prop?"on":void 0,title:_l[m].label,onClick:()=>h(Mf(m,d.color)),children:s.jsx(ut,{sprite:Mf(m,d.color),size:34})},m))]}),s.jsxs("div",{className:"sprite-colors",children:[IS.map(m=>s.jsx("button",{className:m===d.color?"on":void 0,title:Ia[m].name,style:{background:Ia[m].o},onClick:()=>h(d.prop==="custom"?Af(m):Mf(d.prop,m))},m)),s.jsx("button",{className:"hob-btn",onClick:o,children:"完成"})]})]})}function DE({aid:n,rule:a}){const[i,o]=k.useState(!1),[c,d]=k.useState(a.text),[h,m]=k.useState(!1),[p,g]=k.useState(!1),[v,x]=k.useState(null),w=k.useRef(!1);k.useEffect(()=>{if(v!=="已保存")return;const C=setTimeout(()=>x(null),3e3);return()=>clearTimeout(C)},[v]);const E=async C=>{g(!0);const M=await gS(n,{id:a.id,...C});g(!1),x(M??"已保存"),M||o(!1)},T=()=>{if(w.current){w.current=!1;return}const C=c.trim();if(C===a.text){o(!1);return}if(!C){x("规则内容不能为空。");return}E({text:C})};return s.jsxs("div",{className:"rule-wrap",children:[s.jsxs("div",{className:"rule",children:[i?s.jsx("input",{className:"rule-input",autoFocus:!0,value:c,maxLength:1e3,disabled:p,onChange:C=>d(C.target.value),onBlur:T,onKeyDown:C=>{C.key==="Enter"&&C.currentTarget.blur(),C.key==="Escape"&&(w.current=!0,d(a.text),o(!1))}}):s.jsx("button",{className:"rule-text",onClick:()=>{w.current=!1,d(a.text),o(!0)},disabled:p,title:"编辑规则",children:a.text}),s.jsxs("span",{className:"v",children:[s.jsx("button",{className:`rule-mode ${a.mode}`,disabled:p,onClick:()=>void E({mode:a.mode==="ask"?"allow":"ask"}),title:"切换确认方式",children:a.mode==="ask"?"需确认":"直接执行"}),s.jsx("button",{className:"del",title:"删除这条规则",disabled:p,onClick:()=>m(!0),children:s.jsx(Q,{name:"close",size:13})})]})]}),h?s.jsxs("div",{className:"rule-confirm",children:[s.jsx("span",{children:"确定删除这条规则?"}),s.jsx("button",{className:"hob-btn",onClick:()=>m(!1),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void vS(n,a.id),children:"确认删除"})]}):null,v?s.jsx("div",{className:v==="已保存"?"okline":"badline",role:"status",children:v}):null]})}function $E({aid:n}){const[a,i]=k.useState(!1),[o,c]=k.useState(""),[d,h]=k.useState("ask"),[m,p]=k.useState(!1),[g,v]=k.useState(null);k.useEffect(()=>{if(g!=="已保存")return;const E=setTimeout(()=>v(null),3e3);return()=>clearTimeout(E)},[g]);const x=()=>{i(!1),c(""),h("ask"),v(null)},w=async()=>{if(m||!o.trim())return;p(!0),v(null);const E=await pS(n,o.trim(),d);if(p(!1),E){v(E);return}c(""),h("ask"),i(!1),v("已保存")};return s.jsxs("div",{className:"rule-wrap",children:[a?s.jsxs("form",{className:"rule-new",onSubmit:E=>{E.preventDefault(),w()},onKeyDown:E=>{E.key==="Escape"&&!m&&(E.preventDefault(),x())},children:[s.jsx("input",{className:"rule-input",autoFocus:!0,"aria-label":"规则文字",placeholder:"输入规则内容",maxLength:1e3,value:o,disabled:m,onChange:E=>c(E.target.value)}),s.jsxs("div",{className:"ctl",children:[s.jsxs("select",{className:"pick","aria-label":"规则确认方式",value:d,disabled:m,onChange:E=>h(E.target.value),children:[s.jsx("option",{value:"ask",children:"需确认"}),s.jsx("option",{value:"allow",children:"直接执行"})]}),s.jsx("span",{className:"sp"}),s.jsx("button",{type:"button",className:"hob-btn",disabled:m,onClick:x,children:"取消"}),s.jsx("button",{type:"submit",className:"hob-btn hob-btn-primary",disabled:m||!o.trim(),children:m?"正在保存…":"保存"})]})]}):s.jsx("button",{className:"rule-add",onClick:()=>{v(null),i(!0)},children:"+ 新增规则"}),g?s.jsx("div",{className:g==="已保存"?"okline":"badline",role:"status",children:g}):null]})}function UE(){const n=we(),a=n.sel??"hob",i=n.profiles[a],[o,c]=k.useState(!1),[d,h]=k.useState(!1),m=xr(a);if(!i)return s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取档案…"})});const p=i.assistant;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"bigav",children:s.jsx(ut,{sprite:p.sprite,prop:p.prop,size:96,motion:"home",onClick:()=>c(g=>!g),title:"换头像"})}),s.jsx("div",{className:"avatar-hint",children:"点头像更换"}),o?s.jsx(_E,{aid:a,sprite:p.sprite,prop:p.prop,onDone:()=>c(!1)}):null,s.jsx(br,{message:m.message}),s.jsx("div",{className:"sech",children:s.jsx("span",{children:"基本信息"})}),s.jsxs("div",{className:"group-card sidebar-card-group",children:[s.jsx("div",{className:"lbl",children:"名字"}),s.jsx(lc,{value:p.name,save:g=>g.trim()?m.save({name:g.trim()}):(m.fail("名字不能为空。"),Promise.resolve(!1))}),s.jsx("div",{className:"lbl",children:"职责简介"}),s.jsx(lc,{value:p.duty,save:g=>m.save({duty:g})}),s.jsx("div",{className:"lbl",children:"详细职责"}),s.jsx(lc,{multiline:!0,value:p.dutyLong??"",save:g=>m.save({dutyLong:g})}),s.jsx("div",{className:"lbl",children:"补充说明"}),s.jsx(lc,{multiline:!0,value:p.instructions,placeholder:"记下这个助手要知道的事实,如“周报发到团队群”",save:g=>m.save({instructions:g})})]})]}),s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"模型"})}),s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsx(ME,{aid:a})}),s.jsx("div",{className:"sech",children:s.jsx("span",{children:"能力"})}),s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsx(zE,{aid:a})})]}),s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"通知与位置"})}),s.jsxs("div",{className:"group-card sidebar-card-group",children:[s.jsx("div",{className:"lbl",children:"通知"}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"需要确认时通知我"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${p.notify?"":" off"}`,title:p.notify?"关闭通知":"开启通知",disabled:m.busy,onClick:()=>void m.save({notify:!p.notify})})]}),s.jsx("div",{className:"note",children:"要在手机上接收推送,请先在 设置 → 通知 中开启本机推送。"}),p.primary?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"位置"}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"放在顶部"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${p.pinned?"":" off"}`,title:p.pinned?"取消置顶":"放在顶部",disabled:m.busy,onClick:()=>void m.save({pinned:!p.pinned})})]})]}),p.primary?null:s.jsx("div",{className:"mergebar",children:s.jsx("button",{className:"hob-btn",onClick:()=>void m.save({hidden:!p.hidden}),children:p.hidden?"放回列表":"收起这个助手"})})]})]}),p.primary?null:s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"危险操作"})}),s.jsx("div",{className:"mergebar sidebar-group",children:d?s.jsxs("div",{className:"mergeconfirm",children:["归档「",p.name,"」?它会从列表中移除,定时任务一并停掉。对话、规则和历史任务都留着,不会转给 Hob。",s.jsxs("div",{className:"acts",children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void cS(a),children:"确认归档"}),s.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"取消"})]})]}):s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>h(!0),children:"归档这个助手"})})]})]})}function Gb(n,a){return Ih(a,Object.values(n.jobs),Object.values(n.approvals),Object.values(n.delegations))!=="空闲"}function Gh(n){const a=we();return!n||!Gb(a,n)?{busy:!1,slot:0}:{busy:!0,slot:a.assistants.filter(i=>Gb(a,i)).findIndex(i=>i.id===n.id)}}function Uk(n,a){const i=we();if(Ih(n,Object.values(i.jobs),Object.values(i.approvals),Object.values(i.delegations))==="等你确认")return"ask";const o=Object.values(i.jobs).filter(c=>c.assistantId===n.id&&c.endedAt&&(!n.readAt||c.endedAt>n.readAt)).sort((c,d)=>(d.endedAt??"").localeCompare(c.endedAt??""))[0];if(n.unread>0&&o&&(o.status==="stuck"||o.status==="failed"))return"stuck";if(a)return"busy";if(n.unread>0&&o?.status==="done")return"done"}function Lk({a:n,sel:a,size:i=52}){const o=Y0(n),{busy:c,slot:d}=Gh(n),h=Uk(n,c);return s.jsxs("button",{className:`pin${a?" sel":""}`,...o.handlers,onClick:()=>{o.takeHeld()||Jt(n.id)},children:[s.jsx(ut,{sprite:n.sprite,prop:n.prop,size:i,motion:c&&!a?"peek":void 0,slot:d,mark:h}),s.jsx("div",{className:"nm",children:n.name}),s.jsx("div",{className:"sub",children:n.duty})]})}function Hk(n){return n===1?{cls:" n1",size:72}:n===2?{cls:" n2",size:62}:{cls:"",size:52}}function Yb({a:n,sel:a,size:i=42,onClick:o}){const c=Y0(n),{busy:d,slot:h}=Gh(n),m=Uk(n,d);return s.jsxs("button",{className:`list-row home-row${a?" sel":""}`,...c.handlers,onClick:()=>{c.takeHeld()||(o?o():Jt(n.id))},children:[s.jsx(ut,{sprite:n.sprite,prop:n.prop,size:i,motion:d&&!a?"peek":void 0,slot:h,mark:m}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:n.name}),s.jsx("span",{className:"tm",children:dc(n.last?.at)})]}),s.jsx("div",{className:"pv",children:n.last?Ba(n.last.text):n.duty})]})]})}function LE(n,a){const i=n.activity.at(-1);return[a?.name,i?ah(i).join(" "):""].filter(Boolean).join(" · ")}function Kb(n,a){dr(),a&&Jt(n.assistantId),Ln(n.id)}function Zb({job:n,owner:a,time:i,text:o,size:c,onClick:d,moving:h}){return s.jsxs("button",{className:"list-row home-row job",onClick:d,children:[s.jsx(rh,{owner:a,size:c,moving:h}),s.jsxs("span",{className:"nm",children:[n.routineId?s.jsx(Q,{name:"clock",size:14}):null,n.title]}),s.jsx("span",{className:"tm",children:i}),s.jsx("span",{className:"pv",children:Ba(o)}),s.jsx(js,{meta:es[n.status]})]})}function Oa({title:n,more:a,children:i}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gt",children:[s.jsx("span",{children:n}),a]}),i]})}function rh({owner:n,size:a,moving:i}){const{slot:o}=Gh(n);return n?s.jsx(ut,{sprite:n.sprite,prop:n.prop,size:a,motion:i?"peek":void 0,slot:o}):s.jsx("span",{style:{width:a,flex:"none"}})}function Xb({title:n,text:a}){return s.jsx(Oa,{title:n,children:s.jsx(ze,{children:a})})}function Bk({size:n=42,markSel:a=!1}){const i=we(),[o,c]=k.useState(!0),d=iE(i),h=v=>i.assistants.find(x=>x.id===v),m=!o||d.searching,p=new Set,g=v=>{const x=h(v.assistantId);return!x?.hidden||m||a&&x.id===i.sel||p.has(x.id)?!1:(p.add(x.id),!0)};return s.jsxs(s.Fragment,{children:[d.asks.length?s.jsx(Oa,{title:"等你确认",children:d.asks.map(v=>s.jsxs("button",{className:"list-row home-row",onClick:()=>void Jt(v.assistantId),children:[s.jsx(rh,{owner:h(v.assistantId),size:n}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:v.title}),s.jsx("span",{className:"tm",children:dc(v.createdAt)})]}),s.jsxs("div",{className:"pv",children:[h(v.assistantId)?.name??""," · 等待你的选择"]})]})]},v.id))}):null,d.live.length?s.jsx(Oa,{title:"进行中",children:d.live.map(v=>s.jsx(Zb,{job:v,owner:h(v.assistantId),moving:g(v),time:vr(v.startedAt??v.createdAt),text:LE(v,h(v.assistantId)),size:n,onClick:()=>Kb(v,h(v.assistantId))},v.id))}):null,d.rows.length||d.hidden.length?s.jsxs(Oa,{title:"日常",children:[d.rows.map(v=>s.jsx(Yb,{a:v,size:n,sel:a&&v.id===i.sel},v.id)),d.hidden.length&&!d.searching?s.jsxs("button",{className:"fold",onClick:()=>c(v=>!v),children:[s.jsx("span",{children:"收起的助手"}),s.jsxs("span",{children:[d.hidden.length,s.jsx(Q,{name:o?"chev":"down",size:13})]})]}):null,s.jsx("div",{className:`expand${m?" open":""}`,inert:!m,children:s.jsx("div",{children:d.hidden.map(v=>s.jsx(Yb,{a:v,size:n,sel:a&&v.id===i.sel},v.id))})})]}):null,d.recent.length?s.jsx(Oa,{title:"最近任务",more:s.jsx("button",{className:"more",onClick:()=>D0(),children:"全部"}),children:d.recent.map(v=>s.jsx(Zb,{job:v,owner:h(v.assistantId),time:dc(v.endedAt??v.createdAt),text:v.summary||v.statusReason||"",size:n,onClick:()=>Kb(v,h(v.assistantId))},v.id))}):null,d.routines.length?s.jsx(Oa,{title:"定时任务",children:d.routines.map(v=>{const x=v.runs[0];return s.jsxs("button",{className:"list-row home-row",onClick:()=>{dr(),Jt(v.assistantId),L0(v.id)},children:[s.jsx(rh,{owner:h(v.assistantId),size:n}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:v.name}),s.jsx("span",{className:"tm",children:Hh(v.schedules[0]??"")})]}),s.jsx("div",{className:"pv",children:x?s.jsxs(s.Fragment,{children:["上次运行 ",dc(x.at)," · ",s.jsx(js,{meta:es[x.status]})]}):"尚未运行"})]})]},v.id)})}):null,d.empty?s.jsxs(s.Fragment,{children:[s.jsx(Xb,{title:"最近任务",text:"分派的任务会显示在这里"}),s.jsx(Xb,{title:"定时任务",text:"定时任务会显示在这里"})]}):null]})}function HE(){const n=we(),a=n.assistants.filter(o=>o.pinned&&!o.hidden&&tr(o,n.query)),i=Hk(a.length);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mhead",children:[s.jsx("button",{className:"me",title:"设置",onClick:Ac,children:s.jsx(Q,{name:"user",size:17})}),s.jsx("span",{className:"sp"}),n.search?s.jsxs("div",{className:"msearch",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{autoFocus:!0,value:n.query,placeholder:"搜索助手",onChange:o=>q0(o.target.value)}),s.jsx("button",{onClick:()=>ab(!1),title:"关闭搜索",children:s.jsx(Q,{name:"close",size:14})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-icon-btn",title:"知识库",onClick:Nh,children:s.jsx(Q,{name:"archive",size:19})}),s.jsx("button",{className:"hob-icon-btn",title:"搜索助手",onClick:()=>ab(!0),children:s.jsx(Q,{name:"search",size:19})}),s.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:U0,children:s.jsx(Q,{name:"plus",size:21})})]})]}),s.jsx("div",{className:`mpins${i.cls}`,children:a.map(o=>s.jsx(Lk,{a:o,size:i.size},o.id))}),s.jsx("div",{className:"mlist",children:s.jsx(Bk,{size:36})})]})}function Vb({leaving:n,page:a}){return s.jsx("div",{className:`mfull${n?" leaving":""}`,children:s.jsx(ih,{mobile:!0,page:a})})}const qk={smart:[{value:25,label:"一般"},{value:50,label:"较聪明"},{value:75,label:"很聪明"},{value:100,label:"最聪明"}],cost:[{value:0,label:"免费"},{value:20,label:"很低"},{value:50,label:"中等"},{value:75,label:"较高"},{value:100,label:"特别贵"}],speed:[{value:25,label:"较慢"},{value:50,label:"中等"},{value:75,label:"较快"},{value:100,label:"很快"}]};function Yh(n){const a=`${n.id} ${n.name}`;return/(?:^|[^a-z])mini|haiku|lite/i.test(a)?{smart:40,cost:10,speed:95}:/flash/i.test(a)?{smart:60,cost:20,speed:85}:/gpt[-\s]?[56](?:\D|$)|opus|pro|sol/i.test(a)?{smart:90,cost:80,speed:40}:n.reasoning?{smart:70,cost:50,speed:50}:{smart:50,cost:50,speed:60}}function Qb(n,a){return qk[n].reduce((i,o)=>Math.abs(o.value-a)<Math.abs(i.value-a)?o:i).label}function Ik(n){return`聪明 ${n.smart}% · 成本 ${n.cost}% · 速度 ${n.speed}%`}function Kh(n){if(n>=1e6){const a=n/1e6;return`${Number.isInteger(a)?a:a.toFixed(1)}M`}return`${Math.round(n/1e3)}K`}function Qe({title:n,desc:a}){return s.jsxs("div",{className:"setintro",children:[s.jsx("div",{className:"h",children:n}),s.jsx("div",{className:"d",children:a})]})}function Bn({items:n,value:a,onChange:i,disabled:o}){return s.jsx("div",{className:"seg",role:"radiogroup",style:{"--seg-count":n.length,"--seg-index":Math.max(0,n.findIndex(c=>c.key===a))},children:n.map(c=>s.jsx("button",{role:"radio","aria-checked":a===c.key,className:a===c.key?"on":void 0,onClick:()=>i(c.key),disabled:o,children:c.label},c.key))})}function ye({children:n}){return s.jsx("div",{className:"group",children:n})}const $f=[{key:"today",label:"今天",days:1},{key:"week",label:"近 7 天",days:7},{key:"month",label:"近 30 天",days:30},{key:"all",label:"全部",days:0}],BE=[{key:"requests",label:"请求"},{key:"tokens",label:"Token"},{key:"cost",label:"花费"}],qE={requests:"按请求次数着色",tokens:"按 Token 数着色",cost:"按花费着色"},Jb=[{key:"input",label:"输入"},{key:"output",label:"输出"},{key:"cacheRead",label:"缓存读"},{key:"cacheWrite",label:"缓存写"}];function IE(n){return new Intl.DateTimeFormat("sv-SE",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}function ac(n,a){const i=Date.parse(`${n}T00:00:00Z`);return Array.from({length:a},(o,c)=>new Date(i-(a-1-c)*864e5).toISOString().slice(0,10))}function GE(n){return(new Date(`${n}T00:00:00Z`).getUTCDay()+6)%7}function Pb(n){const a=new Date(`${n}T00:00:00Z`),i=new Intl.DateTimeFormat("zh-CN",{timeZone:"UTC",month:"long",day:"numeric"}).format(a),o=new Intl.DateTimeFormat("zh-CN",{timeZone:"UTC",weekday:"short"}).format(a);return`${i} ${o}`}function Fs(n){return n>=1e9?`${(n/1e9).toFixed(1)}B`:n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e4?`${Math.round(n/1e3)}K`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(Math.round(n))}function Ra(n){return`$${n.toFixed(2)}`}function ic(n){return`${Math.round(n*100)}%`}function hc(n,a){return(n.input*a.input+n.output*a.output+n.cacheRead*a.cacheRead+n.cacheWrite*a.cacheWrite)/1e6}function mc(n){return n.input+n.cacheRead+n.cacheWrite}function Fb(n,a){const i={requests:0,input:0,output:0,cacheRead:0,cost:0,unpriced:0},o=new Set;for(const c of n){i.requests+=c.requests,i.input+=mc(c),i.output+=c.output,i.cacheRead+=c.cacheRead;const d=a.models[c.model]?.price;d?i.cost+=hc(c,d):o.add(c.model)}return i.unpriced=o.size,i}function YE(n){return n.error?n.updatedAt?`价格表更新失败:${n.error},用的是 ${Pt(n.updatedAt)} 的。`:`价格表还没有拉到过:${n.error},所有模型都先按未定价算。`:n.updatedAt?null:"还没有拉到价格表,所有模型都先按未定价算。"}function KE(){const[n,a]=k.useState(null),[i,o]=k.useState(null);return k.useEffect(()=>{let c=!0;return mN().then(d=>{c&&(d.ok?a(d.view):o(d.error))}),()=>{c=!1}},[]),i?s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"消耗",desc:"对话和任务用掉的 token 和花费,按服务商返回的用量统计;花费按模型价格估算,以服务商账单为准。"}),s.jsx("div",{className:"badline",role:"status",children:i})]}):n?s.jsx(ZE,{view:n}):s.jsx(ze,{children:s.jsx(Hn,{text:"正在统计会话用量…"})})}function ZE({view:n}){const a=we(),[i,o]=k.useState(n.prices),[c,d]=k.useState("month"),[h,m]=k.useState("requests"),[p,g]=k.useState(null),v=k.useRef(null),[x,w]=k.useState(null),[E,T]=k.useState({input:"",output:"",cacheRead:"",cacheWrite:""}),[C,M]=k.useState(!1),[A,$]=k.useState(null),O=IE(n.timezone),W=k.useMemo(()=>ac(O,365),[O]),ee=$f.find(L=>L.key===c)??$f[2],I=ee.days,j=ee.label,y=k.useMemo(()=>{const L=new Map;for(const G of n.rows){const R=L.get(G.day)??{requests:0,tokens:0,cost:0};R.requests+=G.requests,R.tokens+=mc(G)+G.output;const te=i.models[G.model]?.price;te&&(R.cost+=hc(G,te)),L.set(G.day,R)}return L},[n.rows,i]),S=k.useMemo(()=>{const L=I?ac(O,I)[0]:"";return n.rows.filter(G=>!L||G.day>=L)},[n.rows,I,O]),U=k.useMemo(()=>Fb(S,i),[S,i]),Z=k.useMemo(()=>{if(!I)return null;const L=ac(O,I)[0],G=ac(O,I*2)[0];return Fb(n.rows.filter(R=>R.day>=G&&R.day<L),i)},[n.rows,i,I,O]),oe=k.useMemo(()=>{if(I)return I;const L=n.rows.reduce((G,R)=>!G||R.day<G?R.day:G,null);return L?Math.max(1,Math.round((Date.parse(`${O}T00:00:00Z`)-Date.parse(`${L}T00:00:00Z`))/864e5)+1):1},[n.rows,I,O]),ce=k.useMemo(()=>{const L=new Map;for(const G of S){const R=L.get(G.model)??{requests:0,input:0,output:0,cacheRead:0,providers:new Map,priced:!1,cost:0};R.requests+=G.requests,R.input+=mc(G),R.output+=G.output,R.cacheRead+=G.cacheRead;const te=mc(G)+G.output;R.providers.set(G.provider,(R.providers.get(G.provider)??0)+te);const ae=i.models[G.model]?.price;ae&&(R.priced=!0,R.cost+=hc(G,ae)),L.set(G.model,R)}return[...L].map(([G,R])=>({model:G,provider:[...R.providers].sort((te,ae)=>ae[1]-te[1])[0]?.[0]??"",requests:R.requests,input:R.input,output:R.output,cacheRead:R.cacheRead,cost:R.priced?R.cost:null,price:i.models[G]})).sort((G,R)=>(R.cost??-1)-(G.cost??-1)||R.requests-G.requests)},[S,i]),ke=k.useMemo(()=>{const L=new Map;for(const G of S){const R=L.get(G.assistantId)??{chat:0,job:0,requests:0},te=i.models[G.model]?.price;te&&(R[G.source==="chat"?"chat":"job"]+=hc(G,te)),R.requests+=G.requests,L.set(G.assistantId,R)}return n.assistants.map(G=>{const R=L.get(G.id)??{chat:0,job:0,requests:0};return{...G,...R,cost:R.chat+R.job}}).filter(G=>G.requests>0).sort((G,R)=>R.cost-G.cost)},[S,i,n.assistants]),Ce=k.useMemo(()=>{const L=[...Array.from({length:GE(W[0])},()=>null),...W];for(;L.length%7;)L.push(null);const G=[];for(let at=0;at<L.length;at+=7)G.push(L.slice(at,at+7));const R=at=>{const ot=y.get(at);return ot?ot[h]:0},te=Math.max(0,...W.map(R)),ae=at=>{const ot=R(at);return ot<=0?0:ot<te*.2?1:ot<te*.45?2:ot<te*.7?3:4},fe=[];let ve=0,tt=-9;return G.forEach((at,ot)=>{const Dt=[...at].reverse().find($t=>!!$t),nt=Dt?Number(Dt.slice(5,7)):ve,qe=nt!==ve&&ot-tt>2;fe.push(qe?`${nt}月`:""),qe&&(tt=ot),ve=nt}),{weeks:G,level:ae,months:fe}},[W,y,h]);k.useLayoutEffect(()=>{const L=v.current;if(!L)return;const G=()=>{L.scrollLeft=L.scrollWidth-L.clientWidth};G();const R=new ResizeObserver(G);return R.observe(L),()=>R.disconnect()},[Ce.weeks.length]);const ue=L=>i.models[L],xe=L=>{const G=a.settings.settings.providers.find(R=>R.id===L);return G?.kind==="custom"?G.name:L},ge=YE(i),Re=Math.max(0,...ce.map(L=>L.cost??0)),Te=Math.max(0,...ke.map(L=>L.cost)),pt=W.reduce((L,G)=>{const R=y.get(G);return{requests:L.requests+(R?.requests??0)}},{requests:0}),wt=L=>{const G=ue(L)?.price;w(x===L?null:L),$(null),T({input:G?String(G.input):"",output:G?String(G.output):"",cacheRead:G?String(G.cacheRead):"",cacheWrite:G?String(G.cacheWrite):""})},gt=(L,G)=>{o(R=>{const te={...R.models};return G?te[L]=G:delete te[L],{...R,models:te}}),w(null),$(null)},D=async L=>{if(C)return;const G={input:Number(E.input),output:Number(E.output),cacheRead:Number(E.cacheRead),cacheWrite:Number(E.cacheWrite)};if(Jb.some(te=>!Number.isFinite(G[te.key])||G[te.key]<0)){$("四项单价都要填大于等于 0 的数字(美元 / 百万 token)。");return}M(!0);const R=await Lx(L,G);if(M(!1),!R.ok){$(R.error);return}gt(L,R.price)},se=async L=>{if(C)return;M(!0);const G=await Lx(L,null);if(M(!1),!G.ok){$(G.error);return}gt(L,G.price)};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"消耗",desc:"对话和任务用掉的 token 和花费,按服务商返回的用量统计;花费按模型价格估算,以服务商账单为准。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"u-seg",children:s.jsx(Bn,{items:$f.map(({key:L,label:G})=>({key:L,label:G})),value:c,onChange:d})}),s.jsxs("div",{className:"group-card settings-card u-stats",children:[s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"请求"}),s.jsx("span",{className:"v",children:U.requests.toLocaleString("en-US")}),Z?Z.requests?s.jsxs("span",{className:"s",children:[c==="today"?"比昨天":`比上个 ${I} 天`," ",s.jsx("b",{children:XE(U.requests,Z.requests)})]}):s.jsxs("span",{className:"s",children:[c==="today"?"昨天":"上个时段","没有请求"]}):null]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"输入 token"}),s.jsx("span",{className:"v",children:Fs(U.input)}),U.input?s.jsxs("span",{className:"s",children:["其中缓存命中 ",ic(U.cacheRead/U.input)]}):null]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"输出 token"}),s.jsx("span",{className:"v",children:Fs(U.output)}),s.jsxs("span",{className:"s",children:["日均 ",Fs(U.output/oe)]})]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"花费"}),s.jsx("span",{className:"v",children:Ra(U.cost)}),s.jsxs("span",{className:"s",children:["日均 ",Ra(U.cost/oe)]})]})]}),ge?s.jsx("div",{className:"note",children:ge}):null,U.unpriced?s.jsxs("div",{className:"note",children:["有 ",U.unpriced," 个模型没有价格,这些模型的花费没有计入。"]}):null]}),s.jsxs(ye,{children:[s.jsxs("div",{className:"lbl",children:["最近一年 · 共 ",Fs(pt.requests)," 次请求"]}),s.jsx("div",{className:"u-seg",children:s.jsx(Bn,{items:BE,value:h,onChange:m})}),s.jsxs("div",{className:"u-heatwrap",children:[s.jsxs("div",{className:"group-card settings-card u-heat",onMouseLeave:()=>g(null),style:{"--weeks":Ce.weeks.length},children:[s.jsxs("div",{className:"u-scroll",ref:v,children:[s.jsx("div",{className:"u-months",children:Ce.months.map((L,G)=>s.jsx("span",{children:L},G))}),s.jsxs("div",{className:"u-grid",children:[s.jsxs("div",{className:"u-wd",children:[s.jsx("span",{children:"一"}),s.jsx("span",{}),s.jsx("span",{children:"三"}),s.jsx("span",{}),s.jsx("span",{children:"五"}),s.jsx("span",{}),s.jsx("span",{})]}),s.jsx("div",{className:"u-cells",children:Ce.weeks.map((L,G)=>s.jsx("div",{className:"hw",children:L.map((R,te)=>R?s.jsx("i",{className:`l${Ce.level(R)}${R===O?" today":""}`,onMouseEnter:()=>g(R),title:`${Pb(R)}:${y.get(R)?.requests??0} 次请求 · ${Fs(y.get(R)?.tokens??0)} token · ${Ra(y.get(R)?.cost??0)}`},R):s.jsx("i",{},`empty-${te}`))},G))})]})]}),s.jsxs("div",{className:"u-foot",children:[s.jsxs("span",{children:["每格一天,",qE[h]]}),s.jsxs("span",{className:"u-legend",children:["少 ",s.jsx("i",{className:"l0"}),s.jsx("i",{className:"l1"}),s.jsx("i",{className:"l2"}),s.jsx("i",{className:"l3"}),s.jsx("i",{className:"l4"})," 多"]})]})]}),p?s.jsxs("div",{className:"u-tip",children:[s.jsx("b",{children:Pb(p)}),s.jsx("br",{}),y.get(p)?.requests??0," 次请求 · ",Fs(y.get(p)?.tokens??0)," token · ",Ra(y.get(p)?.cost??0)]}):null]})]}),s.jsxs(ye,{children:[s.jsxs("div",{className:"lbl",children:["按模型 · ",j]}),ce.length?s.jsxs("div",{className:"u-mhead",children:[s.jsx("span",{children:"模型"}),s.jsx("span",{children:"花费占比"}),s.jsx("span",{children:"请求"}),s.jsx("span",{children:"输入"}),s.jsx("span",{children:"输出"}),s.jsx("span",{children:"缓存"}),s.jsx("span",{children:"花费"}),s.jsx("span",{children:"单价"})]}):null,s.jsx("div",{className:"group-card settings-card u-cards",children:ce.length?ce.map(L=>{const G=L.price,R=Re>0&&L.cost?L.cost/Re*100:0;return s.jsxs("div",{children:[s.jsxs("div",{className:"u-mrow",children:[s.jsxs("div",{className:"u-mname",children:[s.jsx("b",{title:L.model,children:L.model}),s.jsxs("span",{children:[xe(L.provider),G?.custom?s.jsx("em",{children:"自定"}):null]})]}),s.jsx("div",{className:"u-bar",children:s.jsx("i",{style:{width:`${R}%`}})}),s.jsxs("div",{className:"u-num u-req",children:[s.jsx("span",{className:"u-k",children:"请求"}),L.requests.toLocaleString("en-US")]}),s.jsxs("div",{className:"u-num u-in",children:[s.jsx("span",{className:"u-k",children:"输入"}),Fs(L.input)]}),s.jsxs("div",{className:"u-num u-out",children:[s.jsx("span",{className:"u-k",children:"输出"}),Fs(L.output)]}),s.jsxs("div",{className:"u-num u-cache",children:[s.jsx("span",{className:"u-k",children:"缓存命中"}),L.input?ic(L.cacheRead/L.input):"—"]}),s.jsx("div",{className:"u-num strong u-cost",children:L.cost===null?"—":Ra(L.cost)}),s.jsx("button",{className:`u-price${G?"":" missing"}`,onClick:()=>wt(L.model),title:"点这里改单价",children:G?VE(G.price):"未定价"})]}),x===L.model?s.jsxs("div",{className:"u-edit",children:[s.jsx("div",{className:"u-edit-fields",children:Jb.map(te=>s.jsxs("label",{children:[s.jsx("span",{children:te.label}),s.jsx("input",{value:E[te.key],inputMode:"decimal",disabled:C,onChange:ae=>T(fe=>({...fe,[te.key]:ae.target.value}))})]},te.key))}),s.jsxs("div",{className:"u-edit-actions",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void D(L.model),disabled:C,children:"保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>w(null),disabled:C,children:"取消"}),G?.custom?s.jsx("button",{className:"hob-btn",onClick:()=>void se(L.model),disabled:C,children:"恢复默认"}):null,A?s.jsx("span",{className:"badline",children:A}):null]}),s.jsx("div",{className:"note",children:"美元 / 百万 token。缓存读是命中缓存的输入,缓存写是写进缓存的输入;花费按这里算,以服务商账单为准。"})]}):null]},L.model)}):s.jsx(ze,{children:"这段时间没有用量"})}),s.jsx("div",{className:"note",children:"点单价可以改成自己的价格;改过的标「自定」,可以恢复默认。"})]}),s.jsxs(ye,{children:[s.jsxs("div",{className:"lbl",children:["按助手 · ",j]}),s.jsx("div",{className:"group-card settings-card u-cards",children:ke.length?ke.map(L=>{const G=L.chat+L.job,R=Te>0?L.cost/Te*100:0;return s.jsxs("div",{className:"u-wrow",children:[s.jsxs("b",{title:L.name,children:[L.name,L.archived?"(已归档)":""]}),s.jsx("span",{children:G?`对话 ${ic(L.chat/G)} · 任务 ${ic(L.job/G)}`:"对话 — · 任务 —"}),s.jsx("div",{className:"u-bar",children:s.jsx("i",{style:{width:`${R}%`}})}),s.jsx("div",{className:"u-num strong",children:Ra(L.cost)})]},L.id)}):s.jsx(ze,{children:"这段时间没有用量"})})]})]})}function XE(n,a){const i=(n-a)/a;return Math.round(i*100)===0?"持平":`${i>0?"+":"−"}${Math.abs(Math.round(i*100))}%`}function VE(n){return`${Wb(n.input)} / ${Wb(n.output)}`}function Wb(n){return`$${Number(n.toFixed(2))}`}const QE=k.lazy(()=>hr(()=>import("./DesktopView-A11jmUwu.js"),[]).then(n=>({default:n.DesktopView})));function qn({saved:n,error:a,children:i,lead:o}){return s.jsxs("div",{className:"sfoot",children:[o,n&&!a?s.jsx("span",{className:"okline",children:"已保存"}):null,a?s.jsx("span",{className:"badline",children:a}):null,s.jsx("span",{className:"sp"}),i]})}function La(){const[n,a]=k.useState(null),[i,o]=k.useState(!1);return k.useEffect(()=>{if(n!=="已保存")return;const d=setTimeout(()=>a(null),3e3);return()=>clearTimeout(d)},[n]),{save:async d=>{o(!0);const h=await ph(d);return o(!1),a(h?"已保存":ks().notice??"保存失败,请重试。"),h},busy:i,message:n}}function Cn({message:n,toast:a=!1}){return n?s.jsx("span",{className:`${n==="已保存"?"okline":"badline"}${a?" savetoast":""}`,role:"status",children:n}):null}function Ha({value:n,placeholder:a,multiline:i,onSave:o}){const[c,d]=k.useState(n),[h,m]=k.useState(!1);k.useEffect(()=>d(n),[n]);const p=async()=>{if(h||c===n)return;m(!0);const v=await o(c);m(!1),v||d(n)},g={value:c,placeholder:a,disabled:h,onChange:v=>d(v.target.value),onBlur:()=>void p(),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),v.currentTarget.blur())}};return s.jsx("div",{className:"field",children:i?s.jsx("textarea",{...g,rows:3}):s.jsx("input",{...g})})}const Uf=[{id:"general",label:"通用"},{id:"rules",label:"规则"},{id:"providers",label:"服务商"},{id:"models",label:"模型"},{id:"memory",label:"记忆"},{id:"image",label:"图像生成"},{id:"knowledge",label:"知识库"},{id:"search",label:"联网搜索"},{id:"skills",label:"技能"},{id:"mcp",label:"MCP"},{id:"desktop",label:"云桌面"},{id:"work",label:"任务"},{id:"usage",label:"消耗"},{id:"push",label:"通知"},{id:"about",label:"关于"}],JE=[{key:"system",label:"跟随系统"},{key:"light",label:"浅色"},{key:"dark",label:"深色"}];function PE(){return Intl.supportedValuesOf?.("timeZone")??[]}function FE({narrow:n,leaving:a}){const i=we(),o=i.section??(n?null:"general"),c=k.useRef(null);return k.useEffect(()=>{c.current?.scrollTo(0,0)},[o,i.sub]),n&&o===null?s.jsxs("div",{className:`setpage narrow${a?" leaving":""}`,children:[s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:Vf,children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:"设置"})]}),s.jsx("div",{className:"setbody",children:Uf.map(d=>s.jsxs("button",{className:"setitem",onClick:()=>Rl(d.id),children:[s.jsx("span",{children:d.label}),s.jsx(Q,{name:"chev",size:15})]},d.id))})]}):s.jsxs("div",{className:`setpage${n?" narrow":""}${a?" leaving":""}`,children:[n?s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:i.sub?Gt:()=>Rl(null),children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:i.sub?.title??Uf.find(d=>d.id===o)?.label??"设置"})]}):s.jsxs("div",{className:"setnav",children:[s.jsx("div",{className:"setnavtitle",children:"设置"}),Uf.map(d=>s.jsx("button",{className:`navrow${o===d.id?" sel":""}`,onClick:()=>Rl(d.id),children:d.label},d.id)),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"navrow",onClick:Vf,children:"返回 Hob"})]}),s.jsx("div",{className:"setmain",ref:c,children:o==="rules"?s.jsx(WE,{}):o==="providers"?s.jsx(o3,{}):o==="models"?s.jsx(g3,{}):o==="memory"?s.jsx(S3,{}):o==="image"?s.jsx(A3,{}):o==="knowledge"?s.jsx(E3,{}):o==="search"?s.jsx(G3,{}):o==="skills"?s.jsx(R3,{}):o==="mcp"?s.jsx(U3,{}):o==="desktop"?s.jsx(n3,{}):o==="work"?s.jsx(k3,{}):o==="usage"?s.jsx(KE,{}):o==="push"?s.jsx(y3,{}):o==="about"?s.jsx(K3,{}):s.jsx(s3,{})})]})}function WE(){const{rules:n,error:a,busy:i}=we().globalRules;k.useEffect(()=>{Gf()},[]);const o=c=>pN(c);return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"全局规则",desc:"所有助手和任务都遵守的规则。「执行前确认」的事项,助手执行前会征求你的确认;「一律照做」是做事的规则。每个助手自己的规则在它的档案里修改。"}),a?s.jsx("div",{className:"badline",role:"status",children:a}):null,n===null?a?s.jsx("button",{className:"hob-btn",onClick:()=>void Gf(),children:"重试"}):s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取全局规则…"})}):[{mode:"ask",label:"执行前确认"},{mode:"allow",label:"一律照做"}].map(({mode:c,label:d})=>s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:d}),s.jsxs("div",{className:"group-card settings-card rules-card",children:[n.filter(h=>h.mode===c).map(h=>s.jsx(e3,{rule:h,busy:i,onSave:m=>o(n.map(p=>p.id===h.id?{...p,text:m}:p)),onDelete:()=>void o(n.filter(m=>m.id!==h.id))},h.id)),s.jsx(t3,{label:d,busy:i,onAdd:h=>o([...n,{text:h,mode:c}])})]})]},c))]})}function e3({rule:n,busy:a,onSave:i,onDelete:o}){const[c,d]=k.useState(!1),[h,m]=k.useState(n.text),p=k.useRef(!1),g=()=>{if(p.current){p.current=!1;return}const x=h.trim();if(!x||x===n.text){d(!1);return}i(x).then(w=>{w&&d(!1)})},v=Date.now()-Date.parse(n.changedAt);return s.jsxs("div",{className:"rule",children:[c?s.jsx("input",{className:"rule-input","aria-label":"编辑规则",autoFocus:!0,maxLength:1e3,value:h,disabled:a,onChange:x=>m(x.target.value),onBlur:g,onKeyDown:x=>{x.key==="Enter"&&x.currentTarget.blur(),x.key==="Escape"&&(p.current=!0,m(n.text),d(!1))}}):s.jsx("button",{className:"rule-text",title:"编辑规则",disabled:a,onClick:()=>{p.current=!1,m(n.text),d(!0)},children:n.text}),s.jsxs("span",{className:"v",children:[v>=0&&v<864e5?s.jsx("span",{className:"rule-recent",children:"最近修改"}):null,s.jsx("button",{className:"del","aria-label":`删除规则:${n.text}`,title:"删除这条规则",disabled:a,onClick:o,children:s.jsx(Q,{name:"close",size:13})})]})]})}function t3({label:n,busy:a,onAdd:i}){const[o,c]=k.useState("");return s.jsxs("form",{className:"rule-add-form",onSubmit:d=>{d.preventDefault();const h=o.trim();h&&!a&&i(h).then(m=>{m&&c("")})},children:[s.jsx("input",{className:"rule-input","aria-label":`${n}添加规则`,placeholder:"+ 添加规则",maxLength:1e3,value:o,disabled:a,onChange:d=>c(d.target.value)}),s.jsx("button",{className:"hob-btn",type:"submit",disabled:a||!o.trim(),children:"添加"})]})}function n3(){const[n,a]=k.useState(null),[i,o]=k.useState(""),[c,d]=k.useState(""),[h,m]=k.useState(!1),[p,g]=k.useState(null),[v,x]=k.useState(null),[w,E]=k.useState(!1),[T,C]=k.useState(null),[M,A]=k.useState([]),$=we().assistants;k.useEffect(()=>{EN().then(S=>{a(S),o(S.url),m(S.enabled),A(S.publicAssistants)}).catch(S=>x({ok:!1,text:`无法读取云桌面配置:${S.message}`}))},[]);const O=n?.deployed??!1,W=n!==null&&h!==n.enabled;async function ee(){if(n){E(!0),x(null);try{const S=await AN({revision:n.revision,url:i,enabled:h,...c?{token:c}:{}});a(S),d(""),x({ok:!0,text:"已保存"})}catch(S){x({ok:!1,text:S instanceof Error?S.message:String(S)})}finally{E(!1)}}}async function I(){if(n){E(!0),x(null);try{const S=await MN(n.revision,M);a(S),A(S.publicAssistants),x({ok:!0,text:"已保存",public:!0})}catch(S){x({ok:!1,text:S instanceof Error?S.message:String(S),public:!0})}finally{E(!1)}}}async function j(){E(!0),g(null);try{const S=await zN();if(!S.ok){g({ok:!1,text:S.error});return}const U=S.health.screens.filter(Z=>Z.browserRunning).map(Z=>Z.id).join("、");g({ok:!0,text:`已连接 · ${S.health.display.width}×${S.health.display.height} · 浏览器:${U||"无"}`})}catch(S){g({ok:!1,text:S instanceof Error?S.message:String(S)})}finally{E(!1)}}const y=p?s.jsx("span",{className:p.ok?"okline":"badline",style:p.ok?void 0:{color:"var(--danger)"},role:"status",children:p.text}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"云桌面",desc:"云桌面需要单独部署。登录 Hob 的人可以观看和接管桌面。"}),O?s.jsxs(ye,{children:[s.jsx("div",{className:"note",children:"由部署配置(compose 的 desktop 服务)"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"地址"}),s.jsx("div",{className:"sline mono",children:n?.url||"未配置"}),s.jsx("div",{className:"lbl sub",children:"令牌"}),s.jsx("div",{className:"sline",children:n?.tokenConfigured?"已设置":"未设置"}),s.jsx("div",{className:"lbl sub",children:"启用"}),s.jsx("div",{className:"sline",children:n?.enabled?"已启用":"未启用"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",disabled:w||!n,onClick:()=>void j(),children:"测试连接"}),s.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>C("hob"),children:"打开桌面"}),y]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"启用"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`tog${h?"":" off"}`,"aria-label":"启用云桌面","aria-pressed":h,disabled:!n,onClick:()=>m(!h)}),s.jsx("span",{className:"note",children:(h?"已启用。登录 Hob 的人可以观看桌面,接管后可以操作。":"未启用。界面不打开桌面,任务也不能使用桌面。")+(W?"(保存后生效)":"")})]})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:i,disabled:!n||w,onChange:S=>o(S.target.value),placeholder:"http://127.0.0.1:6080"})}),s.jsx("div",{className:"lbl",children:"令牌"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:c,disabled:!n||w,onChange:S=>d(S.target.value),placeholder:n?.tokenConfigured?"已保存,留空不变":"云桌面的访问令牌"})}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:w||!n,onClick:()=>void j(),children:"测试连接"}),s.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>C("hob"),children:"打开桌面"}),y,v&&!v.public?s.jsx("span",{className:v.ok?"okline":"badline",role:"status",children:v.text}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w||!n,onClick:()=>void ee(),children:"保存"})]})]}),s.jsxs("div",{className:"note",children:["部署说明见 ",s.jsx("a",{href:"https://github.com/FFatTiger/hob#云桌面",target:"_blank",rel:"noreferrer",children:"云桌面文档"}),"。测试连接会检查地址、令牌和云桌面是否可用。"]})]})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"公共屏幕"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"plist",children:$.map(S=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:M.includes(S.id),disabled:w||!n,onChange:U=>A(Z=>U.target.checked?[...Z,S.id]:Z.filter(oe=>oe!==S.id))}),s.jsx("span",{children:S.name})]},S.id))}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:!n?.enabled||w,onClick:()=>C("public"),children:"打开公共屏幕"}),v?.public?s.jsx("span",{className:v.ok?"okline":"badline",role:"status",children:v.text}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!n||w,onClick:()=>void I(),children:"保存"})]})]}),s.jsx("div",{className:"note",children:"用于登录你自己的账号,勾选的助手可以使用。受 Google 限制,目前无法登录 Google 账号。"})]}),T?s.jsx(k.Suspense,{fallback:null,children:s.jsx(QE,{initialScreen:T,takeOver:T==="public",onClose:()=>C(null)})}):null]})}function s3(){const n=we(),a=n.settings.settings.general.aboutYou,i=La(),o=La(),c=La(),[d,h]=k.useState(null);return k.useEffect(()=>{if(!d)return;const m=setTimeout(()=>h(null),4e3);return()=>clearTimeout(m)},[d]),s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"通用",desc:"主题、时区、个人信息、登录密码。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"主题"}),s.jsx(Bn,{items:JE,value:n.theme,disabled:i.busy,onChange:m=>void i.save({general:{theme:m}})}),s.jsx(Cn,{message:i.message})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"时区"}),s.jsx(l3,{value:n.settings.settings.general.timezone,onSave:m=>o.save({general:{timezone:m}})}),s.jsx(Cn,{message:o.message}),s.jsx("div",{className:"note",children:"助手的「现在时间」和定时任务都按这个时区算。"})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"展示页面"}),s.jsx("button",{className:`tog${n.settings.settings.general.showPage===!1?" off":""}`,"aria-label":"展示页面","aria-pressed":n.settings.settings.general.showPage!==!1,disabled:i.busy,onClick:()=>void i.save({general:{showPage:n.settings.settings.general.showPage===!1}})}),s.jsx(Cn,{message:i.message}),s.jsx("div",{className:"note",children:"允许助手把适合可视化的内容展示为页面。"})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"个人信息"}),s.jsx("div",{className:"lbl sub",children:"称呼"}),s.jsx(Ha,{placeholder:"如「王先生」",value:a.name,onSave:m=>c.save({general:{aboutYou:{name:m.trim()}}})}),s.jsx("div",{className:"lbl sub",children:"语言"}),s.jsx(Ha,{placeholder:"如「中文」",value:a.language,onSave:m=>c.save({general:{aboutYou:{language:m.trim()}}})}),s.jsx("div",{className:"lbl sub",children:"其他"}),s.jsx(Ha,{multiline:!0,placeholder:"如「不要看融资新闻」",value:a.notes,onSave:m=>c.save({general:{aboutYou:{notes:m}}})}),s.jsx(Cn,{message:c.message}),s.jsx("div",{className:"note",children:"所有助手都会参考这些信息;未填写的项不使用。"})]}),s.jsx(ye,{children:s.jsxs("div",{className:"formcard",children:[s.jsx(a3,{onDone:h}),d?s.jsx("div",{className:"note",children:d}):null]})})]})}function l3({value:n,onSave:a}){const i=PE(),[o,c]=k.useState(n),[d,h]=k.useState(!1),[m,p]=k.useState(null),g=k.useRef(null);k.useEffect(()=>c(n),[n]),k.useEffect(()=>{if(!d)return;const w=E=>{g.current?.contains(E.target)||h(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]);const v=i.filter(w=>w.toLowerCase().includes(o.trim().toLowerCase())).slice(0,40),x=w=>{h(!1),p(null),c(w),w!==n&&a(w).then(E=>{E||c(n)})};return s.jsxs("div",{className:"tz",ref:g,children:[s.jsx("label",{className:"field",children:s.jsx("input",{value:o,placeholder:"搜索时区,如 Berlin",onFocus:()=>h(!0),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),w.currentTarget.blur())},onChange:w=>{c(w.target.value),h(!0)},onBlur:()=>{o.trim()!==n&&(i.includes(o.trim())?x(o.trim()):(c(n),p("时区无效,请从列表中选择。")))}})}),m?s.jsx("div",{className:"badline",role:"status",children:m}):null,d&&v.length?s.jsx("div",{className:"tzlist",children:v.map(w=>s.jsx("button",{className:w===n?"sel":"",onMouseDown:()=>x(w),children:w},w))}):null]})}function a3({onDone:n}){const[a,i]=k.useState(""),[o,c]=k.useState(""),[d,h]=k.useState(""),[m,p]=k.useState(!1),g=async()=>{if(m)return;if(!a||!o){n("请填写旧密码和新密码。");return}if(o!==d){n("两次输入的新密码不一致。");return}p(!0);const v=await fN(a,o);if(p(!1),v){n(`修改失败:${v}`);return}i(""),c(""),h(""),n("密码已修改。")};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"登录密码"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"旧密码",value:a,onChange:v=>i(v.target.value)})}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"新密码",value:o,onChange:v=>c(v.target.value)})}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"再次输入新密码",value:d,onChange:v=>h(v.target.value)})}),s.jsxs(qn,{saved:!1,error:null,children:[a||o||d?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",disabled:m||!(a||o||d),onClick:()=>{i(""),c(""),h(""),n("")},children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void g(),disabled:m||!a||!o||!d,children:m?"正在验证…":"保存"})]})]})}function Gk({value:n,options:a,label:i,icon:o,onChange:c}){return s.jsxs("span",{className:"ctl",children:[o?s.jsx(Q,{name:o,size:14}):null,s.jsx("select",{className:"pick","aria-label":i,value:n,onChange:d=>c(d.target.value),children:a.map(d=>s.jsx("option",{value:d.value,children:d.text},d.value))})]})}function Yk({value:n,model:a,onChange:i}){const o=_k(a);return o.length===1?null:s.jsx(Gk,{value:n,label:"思考强度",icon:"bulb",options:o.map(c=>({value:c,text:oc[c]})),onChange:i})}function e0({modelRef:n,info:a,disabled:i,onSaved:o}){const[c,d]=k.useState(!1),[h,m]=k.useState(null),[p,g]=k.useState(""),[v,x]=k.useState(!1),[w,E]=k.useState(null),[T,C]=k.useState(!1);k.useEffect(()=>{if(!T)return;const I=setTimeout(()=>C(!1),3e3);return()=>clearTimeout(I)},[T]);const M=h??a.levels,A=Da.filter(I=>!M.some(j=>j.level===I)),$=h!==null,O=I=>{m(I.slice().sort((j,y)=>Da.indexOf(j.level)-Da.indexOf(y.level))),E(null),C(!1)},W=async I=>{x(!0),E(null);const j=await bN(n,I);if(x(!1),!j.ok){m(null),E(j.error);return}m(null),C(!0),o(j.thinking,j.settings)},ee=(I=M)=>{const j={};for(const y of Da){const S=I.find(U=>U.level===y);j[y]=S?S.text.trim():null}W(j)};return s.jsxs("div",{className:"think-levels",children:[s.jsxs("button",{className:"thinkhead",onClick:()=>d(I=>!I),disabled:v,children:[s.jsx("span",{className:"lbl sub",children:"思考档"}),s.jsxs("span",{className:"note",children:[M.length," 档",a.custom?" · 有自定义":" · 默认"]}),s.jsx(Q,{name:c?"down":"chev",size:14})]}),s.jsx("div",{className:`expand${c?" open":""}`,inert:!c,children:s.jsxs("div",{children:[s.jsx("div",{className:"thinkrows",children:M.map(I=>s.jsxs("div",{className:"thinkrow",children:[s.jsx("span",{className:"tname",children:oc[I.level]}),s.jsx("input",{className:"ttext",value:I.text,placeholder:"默认",title:"留空就按服务商协议的默认值发",onChange:j=>O(M.map(y=>y.level===I.level?{...y,text:j.target.value}:y)),onBlur:()=>{$&&ee()},onKeyDown:j=>{j.key==="Enter"&&j.currentTarget.blur()},disabled:v||i}),I.level==="off"?s.jsx("span",{className:"rremove still",title:"关闭这一档不能删","aria-hidden":!0}):s.jsx("button",{className:"rremove",title:`删掉「${oc[I.level]}」`,onClick:()=>ee(M.filter(j=>j.level!==I.level)),disabled:v||i,children:s.jsx(Q,{name:"close",size:13})})]},I.level))}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[s.jsxs("select",{className:"pick",value:p,onChange:I=>g(I.target.value),disabled:v||i||!A.length,"aria-label":"添加思考档",children:[s.jsx("option",{value:"",children:A.length?"选择档位":"七个档都用上了"}),A.map(I=>s.jsx("option",{value:I,children:oc[I]},I))]}),s.jsx("button",{className:"hob-btn",onClick:()=>{p&&(ee([...M,{level:p,text:""}]),g(""))},disabled:v||i||!p,children:"添加思考档"}),s.jsx("span",{className:"sp"}),a.custom?s.jsx("button",{className:"hob-btn",onClick:()=>void W(null),disabled:v||i,children:"恢复默认"}):null]}),s.jsx("div",{className:"note",children:"留空就按服务商协议的默认值发;填了才按你写的发(例如 DeepSeek 的「中」填 high)。 关闭这一档不能删,其余档删掉后不再出现在思考强度里。"}),w?s.jsx("div",{className:"badline",children:w}):null,T?s.jsx("div",{className:"okline",children:"已保存思考档"}):null]})})]})}function Kk({info:n}){const a=Kh(n.contextWindow);return s.jsxs("span",{className:"caps",children:[n.input.includes("image")?s.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:s.jsx(Q,{name:"image",size:14})}):null,n.reasoning?s.jsx("span",{title:"支持推理","aria-label":"支持推理",children:s.jsx(Q,{name:"bulb",size:14})}):null,s.jsx("span",{className:"ctx",title:`上下文 ${a}`,children:a})]})}const Zk=[{key:"openai-completions",label:"OpenAI 兼容"},{key:"openai-responses",label:"OpenAI Responses 兼容"},{key:"anthropic-messages",label:"Anthropic 兼容"},{key:"google-generative-ai",label:"Google 兼容"}],i3=Object.fromEntries(Zk.map(n=>[n.key,n.label])),rc=128e3,Lf=n=>n.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),r3={literal:"包含 Key",env:"包含 Key",command:"需手动填写",none:"无 Key"};function o3(){const a=we().sub,[i,o]=k.useState(null),[c,d]=k.useState(null),[h,m]=k.useState(null),[p,g]=k.useState({}),v=(E,T)=>g(C=>({...C,[E]:T}));if(k.useEffect(()=>{xN().then(E=>E.ok?o(E.view):d(E.error))},[]),k.useEffect(()=>{a&&m(null)},[a]),k.useEffect(()=>{i&&g(E=>Object.fromEntries(Object.entries(E).filter(([T])=>i.providers.some(C=>C.id===T))))},[i]),c)return s.jsx("div",{className:"note",children:c});if(!i)return s.jsx(ze,{children:"正在读取服务商…"});const x=(E,T)=>{T.startsWith("已导入")&&g({}),o(E),m(T),Gt()},w=(E,T,C)=>{o(M=>M&&{...M,settings:C,models:{...M.models,[E]:(M.models[E]??[]).map(A=>A.ref===T.ref?T:A)}})};return a?.kind==="provider"?s.jsx(d3,{id:a.id,view:i,onView:o,onSaved:x,onThinking:w,onConnection:v}):a?.kind==="addProvider"?s.jsx(f3,{view:i,onSaved:x,onConnection:v}):a?.kind==="importProviders"?s.jsx(h3,{onSaved:x}):s.jsx(c3,{view:i,notice:h,connectionStatus:p})}function c3({view:n,notice:a,connectionStatus:i}){const o=d=>n.builtin.find(h=>h.id===d)?.name??d,c=d=>d.kind==="builtin"?o(d.id):d.name;return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"服务商",desc:"模型服务商与 API Key。内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。API Key 只保存在本机,保存后不再显示。"}),s.jsx(u3,{}),s.jsxs(ye,{children:[s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>En({kind:"addProvider",title:"添加服务商"}),children:"添加服务商"})}),s.jsx("div",{className:"lbl",children:"已配置的服务商"}),s.jsxs("div",{className:"group-card settings-card",children:[n.providers.map(d=>s.jsxs("button",{className:"list-row setting-row",onClick:()=>En({kind:"provider",id:d.id,title:c(d)}),children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname",children:c(d)}),s.jsx("div",{className:"rprov",children:d.kind==="builtin"?"内置服务商":"兼容接口"})]}),s.jsx("span",{className:d.keyConfigured&&i[d.id]!=="failed"?"note":"badline",children:d.keyConfigured?`${i[d.id]==="connected"?"已连接":i[d.id]==="failed"?"连接失败":"未验证"} · ${n.models[d.id]?.length??0} 个模型`:"未填 Key"}),s.jsx(Q,{name:"chev",size:15,className:"rgo"})]},d.id)),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"importProviders",title:"从本机导入"}),children:[s.jsx(Q,{name:"doc",size:16}),"从本机导入"]})]}),n.providers.length?null:s.jsx(ze,{children:"尚未添加其他服务商。"}),s.jsx("div",{className:"note",children:"从本机导入会只读本机配置并一次性复制到 Hob,不会修改来源。"}),a?s.jsx("div",{className:"okline",children:a}):null]})]})}function u3(){const[n,a]=k.useState(null),[i,o]=k.useState({enabled:!1,plan:"pro",executable:""}),[c,d]=k.useState(!1),[h,m]=k.useState("");async function p(x=!1){d(!0),m("");try{const w=await gN();a(w),x&&o(w.settings.settings.claude??{enabled:!1,plan:"pro",executable:""})}catch(w){m(w instanceof Error?w.message:String(w))}finally{d(!1)}}k.useEffect(()=>{p(!0)},[]);async function g(){d(!0),m("");try{a(await vN(i)),m("已保存")}catch(x){m(x instanceof Error?x.message:String(x))}finally{d(!1)}}const v=n?.status;return s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"Claude 订阅(经本机 Claude Code)"}),s.jsxs("div",{className:"formcard",children:[s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`tog${i.enabled?"":" off"}`,"aria-label":"启用 Claude 订阅","aria-pressed":i.enabled,disabled:!n||c,onClick:()=>o({...i,enabled:!i.enabled})}),s.jsxs("span",{className:"note",children:[i.enabled?"已启用":"未启用",n&&i.enabled!==(n.settings.settings.claude?.enabled??!1)?"(保存后生效)":""]})]}),s.jsx("div",{className:"lbl sub",children:"状态"}),s.jsx("div",{className:v?.loggedIn?"okline":"badline",role:"status",children:v?v.found?v.error?v.error:v.loggedIn?`已登录${v.version?` · ${v.version}`:""}${v.plan?` · ${v.plan}`:""}${v.email?` · ${v.email}`:""}`:`未登录${v.version?` · ${v.version}`:""},当前不可用。`:"未找到 Claude Code,当前不可用。":"正在检测…"}),v?.found&&!v.loggedIn?s.jsxs("div",{className:"note",children:["请在终端执行 ",s.jsx("code",{children:"claude auth login"}),",然后重新检测。"]}):null,s.jsx("div",{className:"lbl sub",children:"套餐"}),s.jsxs("select",{className:"pick",value:i.plan,disabled:c||!n,onChange:x=>o({...i,plan:x.target.value}),children:[s.jsx("option",{value:"pro",children:"Pro"}),s.jsx("option",{value:"max",children:"Max"})]}),s.jsx("div",{className:"lbl sub",children:"Claude Code 程序路径"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:i.executable,disabled:c||!n,onChange:x=>o({...i,executable:x.target.value}),placeholder:v?.executable||"留空时自动查找"})}),s.jsx("div",{className:"note",children:"用量计入你的 Claude 订阅额度,与 Claude Code 共用。Docker 镜像不支持此功能。"}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:c,onClick:()=>void p(),children:"重新检测"}),h?s.jsx("span",{className:"note",role:"status",children:h}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:c||!n,onClick:()=>void g(),children:"保存"})]})]})]})}function d3({id:n,view:a,onView:i,onSaved:o,onThinking:c,onConnection:d}){const h=a.providers.find(p=>p.id===n);if(k.useEffect(()=>{h||Gt()},[h]),!h)return null;const m=h.kind==="builtin"?{kind:"builtin",isNew:!1,id:h.id,key:""}:{kind:"custom",isNew:!1,id:h.id,name:h.name,api:h.api,baseUrl:h.baseUrl,key:"",models:h.models};return s.jsx(Xk,{view:a,initial:m,onSaved:o,onView:i,onConnection:d,onThinking:(p,g)=>c(n,p,g),extra:s.jsx(m3,{view:a,provider:h,onDeleted:p=>{i(p),Gt()}})})}function f3({view:n,onSaved:a,onConnection:i}){const[o,c]=k.useState(null),[d,h]=k.useState(null),m=n.builtin.filter(g=>!n.providers.some(v=>v.id===g.id));if(o===null)return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:"添加服务商",desc:"内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。"}),s.jsx(ye,{children:s.jsxs("div",{className:"group-card settings-card",children:[s.jsxs("button",{className:"list-row model-row",onClick:()=>c("builtin"),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:"内置服务商"}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"提供完整的模型目录,填写 API Key 即可。"})]}),s.jsxs("button",{className:"list-row model-row",onClick:()=>c("custom"),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:"兼容接口"}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"填写服务地址、协议与模型;模型列表可从接口获取。"})]})]})})]});if(o==="builtin"&&d===null)return s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"subback",onClick:()=>c(null),children:[s.jsx(Q,{name:"left",size:15}),"添加服务商"]}),s.jsx(Qe,{title:"选择内置服务商",desc:"选择服务商后填写 API Key。"}),s.jsx(ye,{children:s.jsx("div",{className:"group-card settings-card",children:m.length?m.map(g=>s.jsxs("button",{className:"list-row model-row",onClick:()=>h(g.id),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:g.name}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"内置服务商"})]},g.id)):s.jsx(ze,{children:"所有内置服务商均已添加。"})})})]});const p=o==="builtin"?{kind:"builtin",isNew:!0,id:d??"",key:""}:{kind:"custom",isNew:!0,id:"",name:"",api:"openai-completions",baseUrl:"",key:"",models:[]};return s.jsx(Xk,{view:n,initial:p,onSaved:a,onConnection:i,onThinking:()=>{}})}function h3({onSaved:n}){const[a,i]=k.useState(null),[o,c]=k.useState(new Set),[d,h]=k.useState(!1),[m,p]=k.useState(null);k.useEffect(()=>{jN().then(x=>{if(!x.ok){p(x.error);return}i(x.view),c(new Set(x.view.items.filter(w=>w.selectable&&!w.exists).map(w=>w.id)))})},[]);const g=x=>c(w=>{const E=new Set(w);return E.has(x)?E.delete(x):E.add(x),E}),v=async()=>{if(d||!o.size)return;h(!0),p(null);const x=[...o],w=await wN(x);if(h(!1),!w.ok){p(w.error);return}n(w.view,`已导入 ${x.length} 个服务商`)};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:"从本机导入",desc:"读取本机其他客户端保存的服务商配置。来源文件只读,导入后 Key 存入 Hob,不再显示。"}),a===null?m?null:s.jsx(ze,{children:"正在读取…"}):s.jsxs(ye,{children:[s.jsxs("div",{className:"sline",children:["来源:",a.source]}),a.items.length?s.jsx("div",{className:"group-card settings-card",style:{marginTop:8},children:a.items.map(x=>s.jsxs("label",{className:`list-row setting-row${x.selectable?"":" gone"}`,children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:o.has(x.id),disabled:!x.selectable||d,onChange:()=>g(x.id)}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[x.id,s.jsxs("span",{className:"rtags",children:[s.jsx("span",{className:"rtag",children:x.kind==="builtin"?"内置服务商":`兼容接口${x.api?` · ${i3[x.api]}`:""}`}),x.models?s.jsxs("span",{className:"rtag",children:[x.models," 个模型"]}):null,x.exists?s.jsx("span",{className:"rtag",children:"将覆盖"}):null]})]}),x.baseUrl?s.jsx("div",{className:"rprov",children:x.baseUrl}):null,s.jsx("div",{className:"rfoot",children:s.jsx("span",{className:x.key==="none"&&!x.note?"rtag bad":"rtag",children:r3[x.key]})}),x.note?s.jsx("div",{className:"note",children:x.note}):null]})]},x.id))}):s.jsx(ze,{children:"未找到可导入的配置。"}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void v(),disabled:d||!o.size,children:d?"正在导入…":"导入所选"}),s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:d,children:"取消"})]})]}),m?s.jsx("div",{className:"badline",children:m}):null]})}function m3({view:n,provider:a,onDeleted:i}){const[o,c]=k.useState(!1),[d,h]=k.useState(null),[m,p]=k.useState(!1),g=["conversation","work"].filter(w=>n.settings.settings.models[w].ref.startsWith(`${a.id}/`)),v=a.kind==="builtin"?n.builtin.find(w=>w.id===a.id)?.name??a.id:a.name,x=async()=>{if(o)return;c(!0),h(null);const w=await kN(a.id);if(c(!1),!w.ok){h(w.error);return}i(w.view)};return s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"危险操作"}),s.jsx("div",{className:"group-card settings-card",children:m?s.jsxs("div",{className:"ctl",style:{padding:12,gap:8,flexWrap:"wrap"},children:[s.jsxs("span",{children:["删除「",v,"」后,该服务商的模型将不可用。",g.length?`受影响的默认模型:${g.map(w=>w==="conversation"?"对话":"任务执行").join("、")}。`:"当前默认模型不受影响。"]}),s.jsx("button",{className:"hob-btn",onClick:()=>p(!1),disabled:o,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void x(),disabled:o,children:"确认删除"})]}):s.jsx("button",{className:"mline danger",onClick:()=>p(!0),disabled:o,children:"删除服务商"})}),d?s.jsx("div",{className:"badline",children:d}):null]})}function Xk({view:n,initial:a,onSaved:i,onView:o,onConnection:c,onThinking:d,extra:h}){const m=we(),[p,g]=k.useState(a),[v,x]=k.useState(!1),[w,E]=k.useState(null);k.useEffect(()=>{if(!w||w!=="已保存")return;const R=setTimeout(()=>E(null),3e3);return()=>clearTimeout(R)},[w]);const[T,C]=k.useState([]),[M,A]=k.useState(a.isNew||!n.providers.find(R=>R.id===a.id)?.keyConfigured),[$,O]=k.useState(null),[W,ee]=k.useState(null),[I,j]=k.useState(null),[y,S]=k.useState(!1),U=new Set(n.providers.map(R=>R.id)),Z=R=>n.builtin.find(te=>te.id===R)?.name??R,oe=R=>n.models[p.id]?.find(te=>te.id===R),ce=R=>g(te=>({...te,...R})),ke=p.isNew||JSON.stringify(p)!==JSON.stringify(a),Ce=p.kind==="builtin"?{kind:"builtin",id:p.id,...p.key.trim()?{apiKey:p.key.trim()}:{}}:{kind:"custom",...p.id?{id:p.id}:{},api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{}},ue=JSON.stringify(Ce),xe=async()=>{if(y)return;S(!0),j(null),ee(null);const R=await Bx(Ce);if(S(!1),!ke&&p.id&&c(p.id,R?"failed":"connected"),R){O(null),j(R);return}O(ue),ee("连接成功")},ge=R=>{const te=`${p.id}/${R.id}`,ae=m.settings.settings.models,fe=ae.roster.some(tt=>tt.ref===te),ve=ae.conversation.ref===te||ae.work.ref===te;return s.jsxs("label",{className:"ctl",children:[s.jsx("input",{type:"checkbox",checked:fe,disabled:p.isNew||!oe(R.id)||v||y||ve,onChange:()=>{const tt=fe?ae.roster.filter(at=>at.ref!==te):[...ae.roster,{ref:te,note:"",scores:Yh({id:R.id,name:R.name??R.id,reasoning:!!R.reasoning}),scoresConfirmed:!1}];x(!0),E(null),ph({models:{roster:tt}}).then(at=>{x(!1),E(at?"已保存":"保存失败,请重试。")})}}),s.jsx("span",{children:ve?"默认模型已加入":"加入可用模型"})]})},Re=async()=>{if(p.kind!=="custom"||y)return;S(!0),j(null);const R=await yN({api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{},...p.id?{id:p.id}:{}});if(S(!1),!R.ok){j(R.error),C([]);return}C(R.models)},Te=async R=>{if(p.kind!=="custom")return;if(p.isNew){ce({models:R});return}const te=n.providers.find(at=>at.id===p.id);if(!te||te.kind!=="custom")return;S(!0),j(null);const{id:ae,keyConfigured:fe,...ve}=te,tt=await Hx(ae,{...ve,models:R});if(S(!1),!tt.ok){j(tt.error);return}ce({models:R}),o?.(tt.view),E("已保存")},pt=R=>{if(p.kind!=="custom")return;const te=p.models.some(ae=>ae.id===R.id);Te(te?p.models.filter(ae=>ae.id!==R.id):[...p.models,{id:R.id,...R.name?{name:R.name}:{}}])},wt=R=>{if(p.kind!=="custom")return;const te=R.trim();!te||p.models.some(ae=>ae.id===te)||Te([...p.models,{id:te}])},gt=(R,te)=>{p.kind==="custom"&&Te(p.models.map(ae=>ae.id===R?{...ae,...te}:ae))},D=R=>{const te=n.models[R]??[];return te.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"模型"}),s.jsx("div",{className:"group-card settings-card",children:te.map(ae=>s.jsx("div",{className:"list-row setting-row",children:s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[ae.name,s.jsx("span",{className:"rtags",children:s.jsx("span",{className:"rtag mono",children:ae.id})})]}),s.jsxs("div",{className:"caps",children:[ae.input?.includes("image")?s.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:s.jsx(Q,{name:"image",size:14})}):null,ae.reasoning?s.jsx("span",{title:"支持推理","aria-label":"支持推理",children:s.jsx(Q,{name:"bulb",size:14})}):null,ae.contextWindow?s.jsx("span",{className:"ctx",children:Kh(ae.contextWindow)}):null]}),ge(ae),ae.reasoning?s.jsx(e0,{modelRef:ae.ref,info:ae,disabled:y,onSaved:d}):s.jsx("div",{className:"note",children:"不推理,没有思考档。"})]})},ae.id))}),s.jsx("div",{className:"note",children:"模型由服务商提供。会推理的模型可以改每个思考档发给服务商的字符。"})]}):null},se=async()=>{if(y)return;S(!0),j(null);const R=n.providers.find(ve=>ve.id===p.id),te=p.kind==="builtin"?{kind:"builtin",...p.key.trim()?{key:p.key.trim()}:{}}:{kind:"custom",name:p.name.trim(),api:p.api,baseUrl:p.baseUrl.trim(),models:p.models,...R?.kind==="custom"&&R.extra?{extra:R.extra}:{},...p.key.trim()?{key:p.key.trim()}:{}},ae=p.kind==="custom"&&p.isNew?p.id.trim()||Lf(p.name):p.id;if(!ae){S(!1),j("保存失败:请填写标识。模型引用使用该标识,只能包含小写字母、数字、点和短横线,例如 my-proxy。");return}if(p.isNew&&U.has(ae)){S(!1),j("该服务商标识已存在,请使用其他标识。");return}if($!==ue){ee("正在验证连接…");const ve=await Bx(Ce);if(ee(null),ve){S(!1),j(`测试连接失败:${ve}`);return}}const fe=await Hx(ae,te);if(S(!1),!fe.ok){j(fe.error);return}c(ae,"connected"),i(fe.view,"已保存")},L=p.kind==="builtin"?p.isNew?"添加内置服务商":Z(p.id):p.isNew?"添加兼容接口":p.name||"兼容接口",G=p.kind==="builtin"?p.id:p.id||Lf(p.name);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:L,desc:G?s.jsx("span",{className:"mono",children:G}):null}),p.kind==="builtin"?s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"服务商"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick grow",value:p.id,onChange:R=>ce({id:R.target.value}),disabled:!0,children:n.builtin.filter(R=>!p.isNew||!U.has(R.id)).map(R=>s.jsxs("option",{value:R.id,children:[R.name,U.has(R.id)?"(已配置)":""]},R.id))})}),s.jsx("div",{className:"lbl sub",children:"API Key"}),M?s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(R=>R.id===p.id)?.keyConfigured?"已保存,留空不变":"sk-…",onChange:R=>ce({key:R.target.value}),disabled:y})}):s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:"已保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>A(!0),children:"更换"})]}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",disabled:y,onClick:()=>void xe(),children:"测试连接"}),s.jsx("span",{className:"note",children:"测试会请求模型,可能产生费用。"}),W&&$===ue?s.jsx("span",{className:"okline",children:W}):null]}),s.jsx(t0,{busy:y,error:I,dirty:ke,onCancel:Gt,onSave:()=>void se()})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.name,placeholder:"如「我的代理」",onChange:R=>ce({name:R.target.value}),disabled:y})}),p.isNew?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl sub",children:"标识"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.id,placeholder:Lf(p.name)||"my-proxy",onChange:R=>ce({id:R.target.value}),disabled:y})}),s.jsx("div",{className:"note",children:"模型引用使用该标识,例如 my-proxy/gpt-x。留空则按名称自动生成。"})]}):s.jsxs("div",{className:"note mono",children:["标识:",p.id]}),s.jsx("div",{className:"lbl sub",children:"协议"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick grow",value:p.api,onChange:R=>ce({api:R.target.value}),disabled:y,children:Zk.map(R=>s.jsx("option",{value:R.key,children:R.label},R.key))})}),s.jsx("div",{className:"lbl sub",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.baseUrl,placeholder:"http://127.0.0.1:8080/v1",onChange:R=>ce({baseUrl:R.target.value}),disabled:y})}),s.jsx("div",{className:"lbl sub",children:"API Key"}),M?s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(R=>R.id===p.id)?.keyConfigured?"已保存,留空不变":"sk-…",onChange:R=>ce({key:R.target.value}),disabled:y})}):s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:"已保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>A(!0),children:"更换"})]}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap"},children:[s.jsx("button",{className:"hob-btn",disabled:y||!p.baseUrl.trim(),onClick:()=>void xe(),children:"测试连接"}),W&&$===ue?s.jsx("span",{className:"okline",children:W}):null,s.jsx("button",{className:"hob-btn",onClick:()=>void Re(),disabled:y||!p.baseUrl.trim(),children:y?"正在获取…":"获取模型列表"}),s.jsx("span",{className:"note",children:"从接口获取模型列表,选择需要使用的模型。"})]}),s.jsx(t0,{busy:y,error:I,dirty:ke,onCancel:Gt,onSave:()=>void se()})]})]}),T.length?s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"接口上的模型"}),s.jsx("div",{className:"chips",children:T.map(R=>{const te=p.models.some(ae=>ae.id===R.id);return s.jsx("button",{className:`chip${te?" on":""}`,onClick:()=>pt(R),disabled:y,children:R.name??R.id},R.id)})}),s.jsx("div",{className:"note",children:"点击添加或移除,添加后可在下方修改模型能力。"})]}):null,s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"模型"}),p.models.length?s.jsx("div",{className:"group-card settings-card",children:p.models.map(R=>s.jsxs("div",{className:"list-row setting-row",children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname mono",children:R.id}),s.jsxs("div",{className:"rfoot",children:[s.jsx("button",{className:`chip${R.input?.includes("image")?" on":""}`,onClick:()=>gt(R.id,{input:R.input?.includes("image")?["text"]:["text","image"]}),disabled:y,children:"支持图片输入"}),s.jsx("button",{className:`chip${R.reasoning?" on":""}`,onClick:()=>gt(R.id,{reasoning:!R.reasoning}),disabled:y,children:"支持推理"}),s.jsx("span",{className:"rtag",children:"上下文"}),s.jsx("input",{className:"pmctx",type:"number",min:1,defaultValue:R.contextWindow??rc,title:"上下文窗口(token)",onBlur:te=>{const ae=Number(te.target.value)||rc;ae!==(R.contextWindow??rc)&>(R.id,{contextWindow:ae})},onKeyDown:te=>{te.key==="Enter"&&te.currentTarget.blur()},disabled:y},`${R.id}:${R.contextWindow??rc}`)]}),ge(R),R.reasoning?oe(R.id)?s.jsx(e0,{modelRef:`${p.id}/${R.id}`,info:oe(R.id),disabled:y,onSaved:d}):s.jsx("div",{className:"note",children:"保存服务商后可以设置思考档。"}):null]}),s.jsx("button",{className:"rremove",title:"移除该模型",disabled:y,onClick:()=>void Te(p.models.filter(te=>te.id!==R.id)),children:s.jsx(Q,{name:"close",size:13})})]},R.id))}):s.jsx(ze,{children:"尚未添加模型。可获取模型列表后勾选,或手动填写模型 ID。"}),s.jsx(p3,{disabled:y,onAdd:wt})]})]}),p.kind==="builtin"&&!p.isNew?s.jsx(ye,{children:D(p.id)}):null,w?s.jsx("div",{className:w==="已保存"?"okline":"badline",role:"status",children:w}):null,h]})}function p3({disabled:n,onAdd:a}){const[i,o]=k.useState(""),c=()=>{i.trim()&&(a(i),o(""))};return s.jsxs("div",{className:"ctl",style:{gap:8,marginTop:10},children:[s.jsx("div",{className:"field",style:{flex:1},children:s.jsx("input",{value:i,placeholder:"手动填写模型 ID,如 gpt-4o-mini",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c()},disabled:n})}),s.jsx("button",{className:"hob-btn",onClick:c,disabled:n||!i.trim(),children:"添加"})]})}function t0({busy:n,error:a,dirty:i,onCancel:o,onSave:c}){return s.jsxs(qn,{saved:!1,error:a,children:[!a&&i?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",onClick:o,disabled:n,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:c,disabled:n||!i,children:n?"正在验证…":"保存"})]})}function g3(){const n=we(),[a,i]=k.useState(null);return k.useEffect(()=>{gh().then(i)},[]),a?n.sub?.kind==="model"?s.jsx(x3,{view:a,modelRef:n.sub.ref}):n.sub?.kind==="addModels"?s.jsx(b3,{view:a}):s.jsx(v3,{view:a}):s.jsx(ze,{children:"正在读取模型列表…"})}function oh(n,a){return{scores:n.scores??Yh(a??{id:n.ref.split("/").at(-1)??n.ref,name:"",reasoning:!1}),unconfirmed:!n.scores||n.scoresConfirmed!==!0}}function Vk({entry:n,info:a,update:i,collapsible:o=!1}){const c=oh(n,a),[d,h]=k.useState(!o||c.unconfirmed),[m,p]=k.useState(c.scores),[g,v]=k.useState(n.note),x=k.useRef(!1),w=k.useRef(m);w.current=m,k.useEffect(()=>{x.current||p(oh(n,a).scores)},[n.scores,a]),k.useEffect(()=>v(n.note),[n.note]);const E=M=>i({scores:M,scoresConfirmed:!0}),T=()=>{if(!x.current)return;x.current=!1;const M=n.scores,A=w.current;(!M||n.scoresConfirmed!==!0||M.smart!==A.smart||M.cost!==A.cost||M.speed!==A.speed)&&E(A)};if(!d)return s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:Ik(n.scores??m)}),s.jsx("button",{className:"hob-btn",onClick:()=>h(!0),children:"修改"})]});const C={smart:"聪明程度",cost:"成本",speed:"速度"};return s.jsxs("div",{className:"group",children:[s.jsxs("div",{className:"note",children:["Hob 按用途选择分派任务的模型。",c.unconfirmed?"数值按模型名称推测,请确认。":""]}),Object.keys(C).map(M=>s.jsxs("div",{className:"score-row",children:[s.jsxs("div",{className:"score-head",children:[s.jsx("label",{htmlFor:`${n.ref}-${M}`,children:C[M]}),s.jsxs("span",{children:[Qb(M,m[M])," · ",m[M],"%"]})]}),s.jsx("input",{id:`${n.ref}-${M}`,className:"score-range",type:"range",min:"0",max:"100",step:"5",value:m[M],onChange:A=>{x.current=!0,p({...w.current,[M]:Number(A.target.value)})},onPointerUp:T,onTouchEnd:T,onKeyUp:T,onBlur:T}),s.jsx("div",{className:"score-ticks",children:qk[M].map(A=>s.jsx("button",{style:{left:`${A.value}%`},className:A.value===0?"first":A.value===100?"last":void 0,"aria-pressed":A.label===Qb(M,m[M]),onClick:()=>{const $={...w.current,[M]:A.value};p($),E($)},children:A.label},A.value))})]},M)),s.jsx("div",{className:"field",children:s.jsx("input",{value:g,onChange:M=>v(M.target.value),onBlur:()=>{g!==n.note&&i({note:g})},onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur()},placeholder:"补充说明(选填),如「中文写作特别好」"})}),o?s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"收起"})}):null]})}function Zh(){const a=we().settings.settings.models,i=La(),o=m=>void i.save({models:m});return{models:a,save:o,setRoster:m=>o({roster:m}),update:(m,p)=>void i.save(g=>({models:{roster:g.models.roster.map(v=>v.ref===m?{...v,...p}:v)}})),roles:m=>[a.conversation.ref===m?"对话":null,a.work.ref===m?"任务执行":null].filter(p=>p!==null),feedback:i}}function hn({label:n="模型"}){return s.jsxs("button",{className:"subback",onClick:Gt,children:[s.jsx(Q,{name:"left",size:15}),n]})}function v3({view:n}){const{models:a,save:i,roles:o,feedback:c}=Zh(),d=new Map(n.models.map(p=>[p.ref,p])),h=p=>[...a.roster.length?[]:[{value:"",text:"未设置"}],...a.roster.filter(g=>d.has(g.ref)||g.ref===p).map(g=>({value:g.ref,text:d.get(g.ref)?.name??g.ref}))],m=(p,g,v)=>s.jsxs("div",{className:"mline",children:[s.jsx("span",{className:"k",children:g}),s.jsxs("span",{className:"vals",children:[s.jsx(Gk,{value:a[p].ref,label:v,options:h(a[p].ref),onChange:x=>i({[p]:{ref:x,thinking:cr(d.get(x),a[p].thinking)}})}),s.jsx(Yk,{value:cr(d.get(a[p].ref),a[p].thinking),model:d.get(a[p].ref),onChange:x=>i({[p]:{...a[p],thinking:x}})})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"模型",desc:"可用模型来自「服务商」,默认模型从可用模型中选择。"}),s.jsx(Cn,{message:c.message,toast:!0}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"默认模型"}),s.jsxs("div",{className:"group-card settings-card",children:[m("conversation","对话","对话模型"),m("work","任务执行","默认任务模型")]}),s.jsx("div",{className:"note",children:"助手分派任务时未指定模型,使用任务执行的模型。"}),s.jsx("div",{className:"lbl",children:"任务的思考档"}),s.jsx(Bn,{items:[{key:"auto",label:"助手按任务选择"},{key:"fixed",label:"固定使用默认档"}],value:a.thinkingChoice??"auto",disabled:c.busy,onChange:p=>i({thinkingChoice:p})}),s.jsx("div",{className:"note",children:"按任务选择时,助手会给简单的活用低档、复杂的活用高档;固定时一律使用上面设置的默认档。"})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"可用模型"}),s.jsxs("div",{className:"group-card settings-card",children:[a.roster.map(p=>{const g=d.get(p.ref),v=g?.name??p.ref,x=oh(p,g);return s.jsxs("button",{className:`list-row model-row${g?"":" gone"}`,onClick:()=>En({kind:"model",ref:p.ref,title:v}),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:v}),s.jsx("span",{className:"sp"}),g?s.jsx(Kk,{info:g}):s.jsx("span",{className:"mbad",children:"不可用"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsxs("span",{className:"mprev",children:[o(p.ref).map(w=>s.jsx("span",{className:"mrole",children:w},w)),Ik(x.scores),x.unconfirmed?s.jsx("span",{className:"model-use-warning",children:"请确认用途"}):null,g?null:" · 该模型的服务商已删除或未配置 Key"]})]},p.ref)}),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"addModels",title:"添加模型"}),children:[s.jsx(Q,{name:"plus",size:16}),"添加模型"]})]}),s.jsx("div",{className:"note",children:"助手分派任务时,按用途说明在可用模型中选择。"})]})]})}function x3({view:n,modelRef:a}){const{models:i,setRoster:o,update:c,roles:d,feedback:h}=Zh(),[m,p]=k.useState(!1),g=i.roster.find(w=>w.ref===a);if(k.useEffect(()=>{g||Gt()},[g]),!g)return null;const v=n.models.find(w=>w.ref===a),x=d(a);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{}),s.jsx(Qe,{title:v?.name??a,desc:s.jsx("span",{className:"mono",children:a})}),s.jsx(Cn,{message:h.message,toast:!0}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"用途说明"}),s.jsx(Vk,{entry:g,info:v,update:w=>c(a,w)})]}),v?.reasoning?s.jsxs(ye,{children:[s.jsx("div",{className:"group-card settings-card",children:s.jsxs("div",{className:"mline",children:[s.jsx("span",{className:"k",children:"分派时的思考强度"}),s.jsx(Yk,{value:cr(v,g.thinking??i.work.thinking),model:v,onChange:w=>c(a,{thinking:w})})]})}),s.jsx("div",{className:"note",children:"助手把任务分派给这个模型时使用。作为默认模型时,以「默认模型」中的设置为准。"})]}):null,s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"信息"}),s.jsxs("div",{className:"kvcard",children:[s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:"服务商"}),s.jsx("span",{className:"v",children:v?.provider??"不可用"})]}),v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"kvrow",children:[s.jsxs("span",{className:"k kicon",children:[s.jsx(Q,{name:"image",size:14}),"图片输入"]}),s.jsx("span",{className:"v",children:v.input.includes("image")?"支持":"不支持"})]}),s.jsxs("div",{className:"kvrow",children:[s.jsxs("span",{className:"k kicon",children:[s.jsx(Q,{name:"bulb",size:14}),"推理"]}),s.jsx("span",{className:"v",children:v.reasoning?"支持":"不支持"})]}),s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:"上下文"}),s.jsx("span",{className:"v",children:Kh(v.contextWindow)})]})]}):null]})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"危险操作"}),s.jsx("div",{className:"group-card settings-card",children:m?s.jsxs("div",{className:"ctl",style:{flexWrap:"wrap",padding:12},children:[s.jsx("span",{children:"确定从可用模型中移除?"}),s.jsx("button",{className:"hob-btn",onClick:()=>p(!1),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>o(i.roster.filter(w=>w.ref!==a)),children:"确认移除"})]}):s.jsx("button",{className:"mline danger",disabled:x.length>0,onClick:()=>p(!0),children:"从可用模型中移除"})}),x.length?s.jsxs("div",{className:"note",children:["这是",x.join("和"),"的默认模型。要移除,请先在「默认模型」中更换。"]}):null]})]})}function b3({view:n}){const{models:a,setRoster:i,roles:o,update:c,feedback:d}=Zh(),[h,m]=k.useState(""),p=new Set(a.roster.map(C=>C.ref)),[g,v]=k.useState(()=>[...new Set(n.models.filter(C=>p.has(C.ref)).map(C=>C.provider))]),x=kE(bE(n.models,h)),w=h.trim().length>0,E=C=>v(M=>M.includes(C)?M.filter(A=>A!==C):[...M,C]),T=C=>i(p.has(C.ref)?a.roster.filter(M=>M.ref!==C.ref):[...a.roster,{ref:C.ref,scores:Yh(C),note:"",scoresConfirmed:!1,...C.reasoning?{thinking:cr(C,"medium")}:{}}]);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{}),s.jsx(Qe,{title:"添加模型",desc:"「服务商」提供的全部模型,打勾的已在可用模型中。"}),s.jsx(Cn,{message:d.message,toast:!0}),n.models.length===0?s.jsxs(ye,{children:[s.jsx(ze,{children:"尚无可用模型。请先在「服务商」中配置服务商并填写 API Key。"}),s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>Rl("providers"),children:"配置服务商"})})]}):s.jsxs("div",{className:"group-card settings-card",children:[s.jsxs("label",{className:"mfind",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{value:h,placeholder:"搜索名称或引用,如 claude",onChange:C=>m(C.target.value)})]}),x.length===0?s.jsx(ze,{children:"没有匹配的模型。"}):x.map(C=>{const M=w||g.includes(C.provider),A=C.models.filter($=>p.has($.ref)).length;return s.jsxs(k.Fragment,{children:[s.jsxs("button",{className:"mgroup","aria-expanded":M,onClick:()=>E(C.provider),children:[s.jsx("span",{className:"n",children:C.provider}),s.jsx("span",{className:"c",children:A?`已加入 ${A} / ${C.models.length}`:C.models.length}),s.jsx(Q,{name:M?"down":"chev",size:14})]}),M?C.models.map($=>{const O=p.has($.ref),W=o($.ref).length>0,ee=a.roster.find(I=>I.ref===$.ref);return s.jsxs("div",{children:[s.jsxs("button",{className:`madd${O?" on":""}`,disabled:W,title:W?"默认模型不能在这里移除":O?"从可用模型中移除":"加入可用模型",onClick:()=>T($),children:[s.jsx("span",{className:"mname",children:$.name}),s.jsx(Kk,{info:$}),s.jsx(Q,{name:O?"check":"plus",size:16,className:"mtog"})]}),ee?s.jsx("div",{className:"model-use-inline",children:s.jsx(Vk,{entry:ee,info:$,collapsible:!0,update:I=>c($.ref,I)})}):null]},$.ref)}):null]},C.provider)})]})]})}function k3(){const a=we().settings.settings.work,i=La(),o=c=>i.save({work:c});return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"任务",desc:"任务并行数、无响应判定时间,以及全部任务的任务记录。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"最大并行任务数"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick",value:a.maxJobs,disabled:i.busy,onChange:c=>void o({maxJobs:Number(c.target.value)}),children:[1,2,3,4,5,6,7,8].map(c=>s.jsx("option",{value:c,children:c},c))})}),s.jsx("div",{className:"note",children:"同时运行的最大任务数,超出后排队。"}),s.jsx(Cn,{message:i.message})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"无响应判定时间"}),s.jsx("div",{className:"lbl sub",children:"任务"}),s.jsxs("div",{className:"ctl",children:[s.jsx(Ha,{value:String(a.jobStallMinutes),onSave:c=>o({jobStallMinutes:Number(c)})}),s.jsx("span",{className:"note",children:"分钟"})]}),s.jsx("div",{className:"lbl sub",children:"助手回复"}),s.jsxs("div",{className:"ctl",children:[s.jsx(Ha,{value:String(a.routerStallMinutes),onSave:c=>o({routerStallMinutes:Number(c)})}),s.jsx("span",{className:"note",children:"分钟"})]}),s.jsx(Cn,{message:i.message}),s.jsx("div",{className:"note",children:"修改后立即生效,无需重启。"})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"任务记录"}),s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>D0(),children:"查看全部任务"})}),s.jsx("div",{className:"note",children:"可查看每个任务的完整执行过程。"})]})]})}function y3(){const n=we(),a=La(),[i,o]=k.useState(null),[c,d]=k.useState(null),[h,m]=k.useState(null),[p,g]=k.useState(null),[v,x]=k.useState(!1),[w,E]=k.useState(null),[T,C]=k.useState(null),M=dh(),A=()=>void fh().then(j=>m(j?.endpoint??null));if(k.useEffect(()=>{sr().then(j=>j.ok?o(j.view):d(j.error)),A()},[]),c)return s.jsx("div",{className:"note",children:c});if(!i)return s.jsx(ze,{children:"正在读取推送设置…"});const $=typeof Notification<"u"&&Notification.permission==="denied",O=!!(h&&i.devices.some(j=>j.endpoint===h)),W=async()=>{if(!v){x(!0),E(null),C(null);try{const j=O?await JN():await QN();if(!j.ok){E(j.error);return}o(j.view),A(),C(O?"此设备将不再接收推送":"此设备将接收推送")}finally{x(!1)}}},ee=async j=>{const y=await N0(j);if(!y.ok){E(y.error);return}o(y.view),g(null),A()},I=async()=>{if(!v){x(!0),E(null),C(null);try{const j=await FN();if(!j.ok){E(j.error);return}j.sent?C("测试通知已发送"):j.removed?(E("这台设备的订阅已失效,已移除;请重新开启本机推送"),sr().then(y=>y.ok&&o(y.view))):C("未发送:这台设备尚未订阅")}finally{x(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"通知",desc:"本机推送与已订阅的设备。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"本机推送"}),M?s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"需要确认或任务受阻时推送给我"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${O?"":" off"}`,title:O?"关闭本机推送":"开启本机推送",onClick:()=>void W(),disabled:v})]}):s.jsx("div",{className:"note",children:"这个浏览器不支持推送:请使用 Chrome、Edge、Safari 16.4+,或在 iPhone 上将 Hob 添加到主屏幕。"}),$?s.jsx("div",{className:"note",children:"浏览器已拒绝通知权限:点击地址栏左侧的图标 → 通知 → 允许,然后刷新本页并重新开启。"}):null,s.jsx("div",{className:"note",children:"页面在前台时不推送,页面不在前台或锁屏时才推送。各助手还需在助手设置中开启「需要确认时通知我」。"}),s.jsx("div",{className:"note",children:"在 iPhone 上需先将 Hob 添加到主屏幕,再从主屏幕打开才能接收推送。"})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"已订阅的设备"}),i.devices.length?i.devices.map(j=>s.jsxs("div",{className:"dev",children:[s.jsx("span",{className:"n",children:j.label}),s.jsx("span",{className:"tm",children:Pt(j.createdAt)}),s.jsx("span",{className:"sp"}),p===j.endpoint?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"note",children:"确认删除?"}),s.jsx("button",{className:"hob-btn",onClick:()=>g(null),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void ee(j.endpoint),children:"确认删除"})]}):s.jsx("button",{className:"del",title:"删除这台设备",onClick:()=>g(j.endpoint),children:"删除"})]},j.endpoint)):s.jsx(ze,{children:"暂无已订阅的设备"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void I(),disabled:v||!i.devices.length,children:"发送测试通知"}),T&&!w?s.jsx("span",{className:"okline",children:T}):null,w?s.jsx("span",{className:"badline",children:w}):null]})]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"推送服务联系邮箱(选填)"}),s.jsx(Ha,{placeholder:"name@example.com",value:n.settings.settings.push.email,onSave:j=>a.save({push:{email:j.trim()}})}),s.jsx(Cn,{message:a.message}),s.jsx("div",{className:"note",children:"推送服务使用此地址联系你;留空使用 Hob 的项目主页。"})]})]})}const Fi="https://api.loremem.com",j3={saas:"https://app.loremem.com/login"},w3=[{key:"saas",label:"Lore 云服务"},{key:"self",label:"自部署"}],N3=[{key:"local",label:"本地记忆"},{key:"lore",label:"Lore"},{key:"off",label:"关闭"}],n0={invalid_url:"服务地址无效。",insecure_http:"公网地址必须使用 https,明文 http 仅允许本机或局域网地址。",missing_token:"缺少 API Token。",unauthorized:"API Token 被拒绝。",unreachable:"无法连接该地址。"},ch=n=>n.trim().replace(/\/+$/,"");function s0(n){return n===null||ch(n)===Fi?"saas":"self"}function S3(){const[n,a]=k.useState(null),[i,o]=k.useState(null),[c,d]=k.useState(null),[h,m]=k.useState("saas"),[p,g]=k.useState(Fi),[v,x]=k.useState(""),[w,E]=k.useState(!1),[T,C]=k.useState(!1),[M,A]=k.useState(null),[$,O]=k.useState(!1),[W,ee]=k.useState(null),[I,j]=k.useState(!1),[y,S]=k.useState(null),[U,Z]=k.useState(null),[oe,ce]=k.useState(!1);k.useEffect(()=>{if(!I)return;const L=setTimeout(()=>j(!1),3e3);return()=>clearTimeout(L)},[I]);const ke=L=>{a(L),o(null),d(null),m(s0(L.lore.baseUrl)),g(L.lore.baseUrl??Fi),x(""),E(!1),C(!1),A(null),ee(null),j(!1)};if(k.useEffect(()=>{jf().then(L=>{L.ok?ke(L.config):o(L.error)})},[]),i)return s.jsx("div",{className:"note",children:i});if(!n)return s.jsx(ze,{children:"正在读取记忆设置…"});const Ce=c??n.provider,ue=n.lore.tokenConfigured&&ch(p)===ch(n.lore.baseUrl??""),xe=c==="lore"&&!w?n.lore.configured:T,ge=c!==null||w,Re=async L=>{if($)return;if(L===n.provider){d(null);return}if(ee(null),j(!1),L==="lore"&&!n.lore.configured){d("lore");return}O(!0);const G=await Yx(n.revision,L);if(O(!1),!G.ok){ee(G.error);return}ke(G.config),j(!0)},Te=L=>{$||(L(),E(!0),C(!1),A(null),ee(null),j(!1))},pt=L=>Te(()=>{m(L),g(L==="saas"?Fi:s0(n.lore.baseUrl)==="self"?n.lore.baseUrl??"":"")}),wt=async()=>{if($)return;O(!0),Z(null),ce(!1);const L=await XN();if(!L.ok){O(!1),Z(L.error);return}if(S({source:L.view.source,found:L.view.found}),!L.view.found){O(!1);return}const G=await VN();if(O(!1),!G.ok){Z(G.error);return}ke(G.config),d("lore"),ce(!0)},gt=async()=>{if($)return;O(!0),A(null);const L={baseUrl:p.trim(),...v?{token:v}:{}},G=await Kx(L);if(O(!1),!G.ok){A({ok:!1,text:G.error});return}G.result.ok?(C(!0),A({ok:!0,text:"已连接"})):A({ok:!1,text:n0[G.result.reason]})},D=async()=>{if($||!ge)return;if(O(!0),ee(null),Ce==="lore"&&!xe){const R=await Kx({baseUrl:p.trim(),...v?{token:v}:{}});if(!R.ok){O(!1),ee(R.error);return}if(!R.result.ok){O(!1),ee(n0[R.result.reason]);return}C(!0)}let L=n;if(Ce==="lore"&&w){const R=await ZN({baseUrl:p.trim(),...v?{token:v}:{}});if(!R.ok){O(!1),ee(R.error);return}L=R.config}const G=await Yx(L.revision,Ce);if(O(!1),!G.ok){ee(G.error),/已刷新/.test(G.error)&&jf().then(R=>R.ok&&ke(R.config));return}ke(G.config),j(!0)},se=n.provider==="lore"?n.lore.configured?`Lore · 已连接 · 插件 ${n.lorePlugin}`:"Lore · 尚未配置完成:请填写服务地址与 API Token 后保存":n.provider==="local"?"本地记忆 · 已启用":"关闭 · 助手不使用长期记忆";return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"记忆",desc:"所有助手共用同一份长期记忆。各助手需要知道的专属事实写在助手设置的「补充说明」中。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"提供者"}),s.jsx(Bn,{items:N3,value:Ce,onChange:L=>void Re(L),disabled:$}),s.jsx("div",{className:"sline",children:se}),s.jsx(Cn,{message:W??(I?"已保存":null)})]}),Ce==="lore"?s.jsxs(s.Fragment,{children:[s.jsx(ye,{children:s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"部署方式"}),s.jsx(Bn,{items:w3,value:h,onChange:pt,disabled:$}),s.jsx("div",{className:"lbl",children:"服务地址"}),h==="saas"?s.jsx("div",{className:"field ro",children:Fi}):s.jsx("div",{className:"field",children:s.jsx("input",{value:p,placeholder:"http://192.168.1.10:18901",onChange:L=>Te(()=>g(L.target.value)),disabled:$})}),s.jsxs("div",{className:"lblrow",children:[s.jsx("span",{className:"lbl",children:"Token"}),s.jsx("a",{className:"link",href:j3.saas,target:"_blank",rel:"noreferrer",children:"注册 / 登录 Lore"})]}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:v,placeholder:ue?"已保存,留空不变":"lm_…",onChange:L=>Te(()=>x(L.target.value)),disabled:$})}),s.jsxs(qn,{saved:I&&!ge,error:W,lead:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-btn",onClick:()=>void gt(),disabled:$||p.trim()==="",children:"测试连接"}),M?s.jsx("span",{className:M.ok?"okline":"badline",children:M.text}):null]}),children:[!W&&ge?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",onClick:()=>void jf().then(L=>L.ok?ke(L.config):o(L.error)),disabled:$||!ge,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void D(),disabled:$||!ge,children:$?"正在验证…":"保存"})]})]})}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"本机配置"}),s.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[s.jsx("button",{className:"hob-btn",onClick:()=>void wt(),disabled:$,children:$?"正在导入…":"从本机导入"}),oe?s.jsx("span",{className:"okline",children:"已导入本机的连接"}):null]}),s.jsx("div",{className:"note",children:"读取这台电脑上已保存的 Lore 连接,导入后无需重新填写。"}),y?s.jsxs("div",{className:"sline",children:["来源:",y.source]}):null,y&&!y.found?s.jsx("div",{className:"note",children:"未找到可导入的配置。"}):null,U?s.jsx("div",{className:"badline",children:U}):null]})]}):null]})}const T3=[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],C3=["1024x1024","1536x1024","1024x1536","512x512"],Qk=n=>n.trim().replace(/\/+$/,"");function E3(){const a=we().settings.settings.knowledge?.embedding??{source:"off"},[i,o]=k.useState(a.source),[c,d]=k.useState(a.source==="openai"?a.baseUrl:""),[h,m]=k.useState(a.source==="openai"?a.model:""),[p,g]=k.useState(""),[v,x]=k.useState(!1),[w,E]=k.useState(!1),[T,C]=k.useState(null);k.useEffect(()=>{BN().then($=>x($.keyConfigured)).catch($=>C({ok:!1,text:`读取设置失败:${$ instanceof Error?$.message:String($)}`}))},[]);const M=i==="off"?{source:"off"}:{source:"openai",baseUrl:Qk(c),model:h.trim()},A=async $=>{E(!0),C(null);try{if($){const O=await IN(M,p.trim()||void 0);x(O.keyConfigured),g(""),C({ok:!0,text:"已保存"})}else{const O=await qN({embedding:M,...p.trim()?{apiKey:p.trim()}:{}});C(O.ok?{ok:!0,text:`连接成功 · ${O.dims} 维`}:{ok:!1,text:O.error})}}catch(O){C({ok:!1,text:O instanceof Error?O.message:String(O)})}finally{E(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"知识库",desc:"配置向量模型,关闭时只按关键词查找。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"向量模型"}),s.jsx(Bn,{items:[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],value:i,onChange:o,disabled:w})]}),i==="openai"?s.jsxs(ye,{children:[s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"服务地址",value:c,onChange:$=>d($.target.value),disabled:w,placeholder:"http://127.0.0.1:8080/v1"})}),s.jsx("div",{className:"lbl",children:"模型名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"模型名称",value:h,onChange:$=>m($.target.value),disabled:w})}),s.jsx("div",{className:"lbl",children:"API Key"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"API Key",type:"password",value:p,onChange:$=>g($.target.value),disabled:w,placeholder:v?"已保存,留空不变":"请输入 API Key"})}),s.jsx(qn,{saved:T?.text==="已保存",error:null,lead:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-btn",disabled:w,onClick:()=>void A(!1),children:"测试连接"}),T&&T.text!=="已保存"?s.jsx("span",{className:T.ok?"okline":"badline",role:"status",children:T.text}):null]}),children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w,onClick:()=>void A(!0),children:"保存"})})]}),s.jsx("div",{className:"note",children:"建索引和查询时,文件内容和问题会发给这个接口。"})]}):s.jsx(qn,{saved:T?.text==="已保存",error:T?.ok===!1?T.text:null,children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w,onClick:()=>void A(!0),children:"保存"})})]})}function A3(){const a=we().settings.settings.image,[i,o]=k.useState(a.source),[c,d]=k.useState(a.source==="openai"?a.baseUrl:""),[h,m]=k.useState(a.source==="openai"?a.model:""),[p,g]=k.useState(a.source==="openai"?a.size??"":""),[v,x]=k.useState(""),[w,E]=k.useState(!1),[T,C]=k.useState(null),[M,A]=k.useState(null),[$,O]=k.useState(!1),[W,ee]=k.useState(null),[I,j]=k.useState(null);k.useEffect(()=>{if(!W)return;const ce=setTimeout(()=>ee(null),3e3);return()=>clearTimeout(ce)},[W]),k.useEffect(()=>{KN().then(ce=>{ce&&E(ce.keyConfigured)})},[]);const y=i==="openai"?{source:"openai",baseUrl:Qk(c),model:h.trim(),...p?{size:p}:{}}:{source:"off"},S=JSON.stringify(y)!==JSON.stringify(a)||v.trim()!=="",U=JSON.stringify({form:y,apiKey:v.trim()});k.useEffect(()=>{C(null),A(null)},[U]);const Z=async()=>{if($)return;O(!0),C(null);const ce=await Gx({image:y,...v.trim()?{apiKey:v.trim()}:{}});O(!1),ce.ok?(A(U),C({ok:!0,text:"生成成功",path:ce.path})):(A(null),C({ok:!1,text:ce.error}))},oe=async()=>{if($||!S)return;if(O(!0),j(null),ee(null),y.source==="openai"&&M!==U){const ke=await Gx({image:y,...v.trim()?{apiKey:v.trim()}:{}});if(!ke.ok){O(!1),A(null),j(`测试连接失败:${ke.error}`);return}A(U),C({ok:!0,text:"生成成功",path:ke.path})}const ce=await Ix(y,v.trim()||void 0);if(O(!1),!ce.ok){j(ce.error);return}y.source==="openai"&&(d(y.baseUrl),m(y.model)),x(""),E(ce.keyConfigured),C(null),ee("已保存")};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"图像生成",desc:"选择图像生成方式:关闭,或使用 OpenAI 兼容接口。配置完成后,开启了图像生成能力的助手可以在任务中生成图片。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"生成方式"}),s.jsx(Bn,{items:T3,value:i,onChange:ce=>{C(null),j(null),ee(null),ce==="off"&&a.source!=="off"?(O(!0),Ix({source:"off"}).then(ke=>{if(O(!1),!ke.ok){j(ke.error);return}o("off"),x(""),ee("已保存")})):o(ce)},disabled:$})]}),i==="openai"?s.jsx(ye,{children:s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:c,placeholder:"http://127.0.0.1:8080/v1",onChange:ce=>d(ce.target.value),disabled:$})}),s.jsx("div",{className:"lbl",children:"模型名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:h,placeholder:"gpt-image-1",onChange:ce=>m(ce.target.value),disabled:$})}),s.jsx("div",{className:"lbl",children:"默认尺寸"}),s.jsx("div",{className:"ctl",children:s.jsxs("select",{className:"pick grow",value:p,onChange:ce=>g(ce.target.value),disabled:$,children:[s.jsx("option",{value:"",children:"不指定,使用接口默认值"}),C3.map(ce=>s.jsx("option",{value:ce,children:ce},ce))]})}),s.jsx("div",{className:"lbl",children:"API Key"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:v,placeholder:w?"已保存,留空不变":"sk-…",onChange:ce=>x(ce.target.value),disabled:$})}),s.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。保存前会生成测试图片,可能产生费用。"}),T?s.jsx("div",{className:"testrow",children:T?s.jsxs("div",{className:"testout",children:[s.jsx("span",{className:T.ok?"okline":"badline",children:T.text}),T.ok&&T.path?s.jsx("button",{className:"imgcard testshot",onClick:()=>window.open(It(T.path),"_blank","noopener"),title:"查看原图",children:s.jsx("img",{src:It(T.path),alt:"生成的图片"})}):null]}):null}):null,s.jsxs(qn,{saved:W!==null&&!S,error:I,lead:s.jsx("button",{className:"hob-btn",onClick:()=>void Z(),disabled:$,children:$?"正在生成…":"生成测试图片"}),children:[!I&&S?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",disabled:$||!S,onClick:()=>{o(a.source),d(a.source==="openai"?a.baseUrl:""),m(a.source==="openai"?a.model:""),g(a.source==="openai"?a.size??"":""),x(""),C(null),A(null),j(null)},children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void oe(),disabled:$||!S,children:$?"正在验证…":"保存"})]})]})}):s.jsx(Cn,{message:I??W})]})}const M3={hob:"Hob 的技能",common:"通用技能 · ~/.agents/skills",lore:"Lore 技能"},z3=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"pi",label:"pi"}],Hf=n=>`${n.source}:${n.id}`,Ft=n=>n instanceof Error?n.message:String(n);function R3(){const n=we(),a=n.sub,[i,o]=k.useState(null),[c,d]=k.useState(null),[h,m]=k.useState(null),p=async()=>{try{o(await NN()),d(null)}catch(E){d(Ft(E))}};k.useEffect(()=>{p()},[]),k.useEffect(()=>{a&&m(null)},[a]);const g=async E=>{const T=`${E.source}:${E.name}`,C=n.settings.settings.skills?.disabled??[],M=E.enabled?[...C,T]:C.filter(A=>A!==T);await ph({skills:{disabled:M}})?await p():d(ks().notice??"保存失败")},v=E=>{p(),m(E),Gt()};if(!i)return c?s.jsx("div",{className:"badline",children:c}):s.jsx(ze,{children:"正在读取技能…"});if(a?.kind==="skill")return s.jsx(O3,{skill:i.skills.find(E=>Hf(E)===a.key),onDeleted:v});if(a?.kind==="importSkills")return s.jsx(_3,{onDone:v});const x=(E,T)=>E.length?E.map(C=>s.jsxs("div",{className:`list-row setting-row${C.enabled?"":" gone"}`,children:[s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"skill",key:Hf(C),title:C.name}),children:[s.jsxs("div",{className:"rname",children:[C.name,C.overridden?s.jsx("span",{className:"rtag",children:"被同名技能覆盖"}):null]}),s.jsx("div",{className:"rprov rclamp",children:C.description})]}),s.jsx("button",{className:`tog${C.enabled?"":" off"}`,"aria-label":`${C.name}启用`,"aria-pressed":C.enabled,onClick:()=>void g(C)})]},Hf(C))):s.jsx(ze,{children:T}),w=i.skills.filter(E=>E.source==="hob");return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"技能",desc:"技能是写好的做法说明,任务按需读取。同名时 Hob 的技能优先,其次是 Lore,最后是通用技能。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"Hob 的技能"}),s.jsxs("div",{className:"group-card settings-card",children:[x(w,"还没有技能,可以从其他工具导入"),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"importSkills",title:"导入技能"}),children:[s.jsx(Q,{name:"plus",size:16}),"从 Claude Code、Codex、pi 导入"]})]}),h?s.jsx("div",{className:"okline",children:h}):null]}),s.jsxs(ye,{children:[s.jsxs("div",{className:"lbl",children:["通用技能 ",s.jsx("span",{className:"lbl-aside",children:"~/.agents/skills"})]}),s.jsx("div",{className:"group-card settings-card",children:x(i.skills.filter(E=>E.source==="common"),"目录中没有技能")})]}),s.jsxs(ye,{children:[s.jsxs("div",{className:"lbl",children:["Lore 技能",i.loreActive&&i.loreUrl?s.jsx("a",{className:"lbl-aside",href:i.loreUrl,target:"_blank",rel:"noreferrer",children:"在 Lore 控制台管理"}):null]}),i.loreError?s.jsxs("div",{className:"badline",role:"alert",children:[i.loreError," ",s.jsx("button",{onClick:()=>void p(),children:"重试"})]}):i.loreActive?s.jsx("div",{className:"group-card settings-card",children:x(i.skills.filter(E=>E.source==="lore"),"Lore 中没有技能")}):s.jsx("div",{className:"note",children:"在 设置 → 记忆 中连接 Lore 后,这里会列出 Lore 中的技能。"})]}),c?s.jsx("div",{className:"badline",role:"alert",children:c}):null]})}function O3({skill:n,onDeleted:a}){const[i,o]=k.useState(null);if(!n)return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx("div",{className:"note",children:"技能不存在或已删除。"})]});const c=async()=>{if(window.confirm(`删除技能「${n.name}」?此操作不能撤销。`))try{await CN(n.id),a(`已删除「${n.name}」`)}catch(d){o(Ft(d))}};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx(Qe,{title:n.name,desc:n.description}),s.jsxs("div",{className:"sline",children:[M3[n.source],n.overridden?" · 被优先级更高的同名技能覆盖":"",n.enabled?"":" · 已停用"]}),s.jsx(Ka,{className:"skill-doc fp-md markdown-body",text:n.content}),n.source==="hob"?s.jsx(qn,{saved:!1,error:i,children:s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void c(),children:"删除技能"})}):null]})}function _3({onDone:n}){const[a,i]=k.useState("claude"),[o,c]=k.useState(null),[d,h]=k.useState([]),[m,p]=k.useState(!1),[g,v]=k.useState(!1),[x,w]=k.useState(null);k.useEffect(()=>{let T=!0;return c(null),h([]),w(null),SN(a).then(C=>{T&&c(C)}).catch(C=>{T&&w(Ft(C))}),()=>{T=!1}},[a]);const E=async()=>{v(!0),w(null);try{const T=await TN(a,d,m),C=[...T.skipped,...T.errors];C.length?w(C.join(";")):n(`已导入 ${T.imported.length} 个技能`)}catch(T){w(Ft(T))}finally{v(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx(Qe,{title:"导入技能",desc:"从其他工具的技能目录复制到 Hob,来源只读。"}),s.jsx(ye,{children:s.jsx(Bn,{items:z3,value:a,onChange:i,disabled:g})}),s.jsxs(ye,{children:[o===null?x?null:s.jsx(ze,{children:"正在读取…"}):o.found?s.jsx("div",{className:"group-card settings-card",children:o.skills.length?o.skills.map(T=>s.jsxs("label",{className:"list-row setting-row",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:d.includes(T.id),disabled:g,onChange:C=>h(C.target.checked?[...d,T.id]:d.filter(M=>M!==T.id))}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[T.name,T.exists?s.jsx("span",{className:"rtag",children:"已存在"}):null]}),s.jsx("div",{className:"rprov rclamp",children:T.description})]})]},T.id)):s.jsx(ze,{children:"目录中没有技能"})}):s.jsx(ze,{children:"未找到这个工具的技能目录。"}),o?.skipped.map(T=>s.jsx("div",{className:"note",children:T},T))]}),o?.skills.some(T=>T.exists)?s.jsxs("label",{className:"ctl skill-overwrite",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:m,onChange:T=>p(T.target.checked)}),"覆盖已存在的同名技能"]}):null,s.jsxs(qn,{saved:!1,error:x,children:[s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:g,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:g||!d.length,onClick:()=>void E(),children:g?"正在导入…":d.length?`导入 ${d.length} 个`:"导入所选"})]})]})}const D3={pi:"pi",claude:"Claude Code",cursor:"Cursor"};function $3(n,a){return n.valid?n.enabled?a?a.state==="probing"?"检测中…":a.state==="connected"?a.tools?.length?`已连接 · ${a.tools.length} 个工具`:"已连接 · 没有工具":a.state==="needs_auth"?"需要登录,暂不支持":"连接失败":"未测试":"已停用":"配置无效"}function U3(){const n=we().sub,[a,i]=k.useState(null),[o,c]=k.useState(null),[d,h]=k.useState(null),[m,p]=k.useState({}),g=k.useRef(new Set);k.useEffect(()=>{qx().then(i).catch(T=>c(Ft(T)))},[]),k.useEffect(()=>{n&&h(null)},[n]);const v=async(T,C=!1)=>{if(T.valid){p(M=>({...M,[T.name]:{state:"probing"}}));try{const M=await _N(T.name,C);p(A=>({...A,[T.name]:M.ok?{state:"connected",tools:M.tools}:{state:M.state,error:M.error,stderrTail:M.stderrTail}}))}catch{p(M=>({...M,[T.name]:{state:"failed",error:"无法测试连接"}}))}}};k.useEffect(()=>{if(a)for(const T of a.servers)!T.valid||!T.enabled||g.current.has(T.name)||(g.current.add(T.name),v(T))},[a]);const x=T=>{qx().then(i).catch(()=>{}),h(T),Gt()};if(o)return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具。"}),s.jsx("div",{className:"badline",role:"alert",children:o}),s.jsx("div",{className:"note",children:"请修复数据目录 engine/mcp.json 后重试;修复前任务不会加载 MCP 服务。"})]});if(!a)return s.jsx(ze,{children:"正在读取 MCP 服务…"});if(n?.kind==="mcpServer")return s.jsx(q3,{server:a.servers.find(T=>T.name===n.name),setView:i,probe:m[n.name],onProbe:v,onDone:x});if(n?.kind==="addMcp")return s.jsx(B3,{onDone:x});if(n?.kind==="importMcp")return s.jsx(I3,{onDone:x});const w=T=>T.kind==="http"?"远程地址":"本地命令",E=async T=>{try{const C=await w0(T.name,{enabled:!T.enabled});if(i(C),!T.enabled)for(const M of C.servers)M.name===T.name&&M.valid&&v(M,!0)}catch(C){h(Ft(C))}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具,所有助手派出的任务共用这份配置;对话不直接使用。配置改动对之后新开的任务生效,进行中的任务不受影响。"}),s.jsxs(ye,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>En({kind:"addMcp",title:"添加 MCP 服务"}),children:"添加服务"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn",onClick:()=>En({kind:"importMcp",title:"从本机导入 MCP 服务"}),children:"从本机导入"})]}),s.jsx("div",{className:"lbl",children:"已配置的服务"}),s.jsxs("div",{className:"group-card settings-card",children:[a.servers.map(T=>s.jsxs("div",{className:`list-row setting-row${T.enabled&&T.valid?"":" gone"}`,children:[s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"mcpServer",name:T.name,title:T.name}),children:[s.jsxs("div",{className:"rname",children:[T.name,T.valid?null:s.jsx("span",{className:"rtag",children:"配置无效"})]}),s.jsx("div",{className:"rprov rclamp",children:T.valid?T.kind==="http"?T.url:[T.command,...T.args??[]].join(" "):T.invalidReason})]}),s.jsx("span",{className:"note",style:{flex:"none"},children:`${w(T)} · ${$3(T,m[T.name])}`}),T.valid?s.jsx("button",{className:`tog${T.enabled?"":" off"}`,"aria-label":`${T.name}启用`,"aria-pressed":T.enabled,onClick:()=>void E(T)}):null]},T.name)),a.servers.length?null:s.jsx(ze,{children:"还没有配置 MCP 服务"})]}),d?s.jsx("div",{className:d.startsWith("已")?"okline":"badline",role:"status",children:d}):null,s.jsx("div",{className:"note",children:"环境变量和请求头的值只保存在本机,保存后不再显示。远程服务需要 OAuth 登录时这版暂不支持。"})]})]})}function l0(n){return Object.entries(n??{}).map(([a,i])=>({key:a,value:i.redacted?"":i.value??"",secret:i.redacted}))}function a0(n,a){const i={},o=new Set(a.filter(c=>c.key.trim()).map(c=>c.key.trim()));for(const c of Object.keys(n??{}))o.has(c)||(i[c]={mode:"remove"});for(const c of a){const d=c.key.trim();d&&(c.value===""&&c.secret?i[d]={mode:"preserve"}:c.value!==""&&(i[d]={mode:"replace",value:c.value}))}return Object.keys(i).length?i:void 0}function i0({rows:n,onChange:a,keyLabel:i,valueLabel:o}){const c=(d,h)=>a(n.map((m,p)=>p===d?{...m,...h}:m));return s.jsxs("div",{className:"pairlist",children:[n.map((d,h)=>s.jsxs("div",{className:"pairrow",children:[s.jsx("label",{className:"field",children:s.jsx("input",{className:"mono",value:d.key,placeholder:i,onChange:m=>c(h,{key:m.target.value})})}),s.jsx("label",{className:"field",children:s.jsx("input",{className:"mono",type:"password",value:d.value,placeholder:d.secret&&d.value===""?"已保存,留空不变":o,onChange:m=>c(h,{value:m.target.value})})}),s.jsx("button",{className:"hob-icon-btn",title:"删除这一项",onClick:()=>a(n.filter((m,p)=>p!==h)),children:s.jsx(Q,{name:"close",size:15})})]},h)),s.jsx("div",{children:s.jsx("button",{className:"hob-btn",onClick:()=>a([...n,{key:"",value:"",secret:!1}]),children:"添加一项"})})]})}const L3={kind:"stdio",command:"",args:"",env:[],cwd:"",url:"",headers:[],description:""};function H3(n){return{kind:n.kind??"stdio",command:n.command??"",args:(n.args??[]).join(`
|
|
267
|
+
`),env:l0(n.env),cwd:n.cwd??"",url:n.url??"",headers:l0(n.headers),description:n.description??""}}function Jk({initial:n,name:a,onName:i,fixedName:o,onSaved:c,saveLabel:d}){const[h,m]=k.useState(n),[p,g]=k.useState(!1),[v,x]=k.useState(null),w=T=>m(C=>({...C,...T})),E=async()=>{x(null);const T=a.trim();if(!/^[A-Za-z0-9_-]{1,64}$/.test(T)){x("名称只能用字母、数字、_ 和 -,最长 64 字符。");return}const C=Object.fromEntries(n.env.map(O=>[O.key,O.secret?{redacted:!0}:{redacted:!1,value:O.value}])),M=Object.fromEntries(n.headers.map(O=>[O.key,O.secret?{redacted:!0}:{redacted:!1,value:O.value}])),A=a0(n.env.length?C:void 0,h.env),$=a0(n.headers.length?M:void 0,h.headers);g(!0);try{await RN(T,{kind:h.kind,...h.kind==="stdio"?{command:h.command.trim(),...h.args.trim()?{args:h.args.split(/\r?\n/).map(O=>O.trim()).filter(Boolean)}:{},...h.cwd.trim()?{cwd:h.cwd.trim()}:{},...A?{env:A}:{}}:{url:h.url.trim(),...$?{headers:$}:{}},...h.description.trim()?{description:h.description.trim()}:{}}),c(o?`已保存「${T}」`:`已添加「${T}」`)}catch(O){x(Ft(O))}finally{g(!1)}};return s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:a,readOnly:o,placeholder:"如 filesystem",onChange:T=>i?.(T.target.value)})}),o?null:s.jsx("div",{className:"note",children:"字母、数字、_ 和 -;- 和 _ 视为同名。改名请删除后重新添加。"}),s.jsx("div",{className:"lbl",children:"类型"}),s.jsx(Bn,{items:[{key:"stdio",label:"本地命令"},{key:"http",label:"远程地址"}],value:h.kind,onChange:T=>w({kind:T}),disabled:p}),s.jsx("div",{className:`expand settings-motion${h.kind==="stdio"?" open":""}`,inert:h.kind!=="stdio",children:s.jsxs("div",{children:[s.jsx("div",{className:"lbl",children:"命令"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.command,placeholder:"如 npx 或 uvx(一个可执行文件,不是整条命令行)",onChange:T=>w({command:T.target.value})})}),s.jsx("div",{className:"lbl",children:"参数"}),s.jsx("div",{className:"field",children:s.jsx("textarea",{className:"mono",rows:3,value:h.args,placeholder:`-y
|
|
268
|
+
@modelcontextprotocol/server-filesystem
|
|
269
|
+
.`,onChange:T=>w({args:T.target.value})})}),s.jsx("div",{className:"note",children:"一行一个参数。"}),s.jsx("div",{className:"lbl",children:"环境变量"}),s.jsx(i0,{rows:h.env,onChange:T=>w({env:T}),keyLabel:"变量名",valueLabel:"值"}),s.jsx("div",{className:"lbl",children:"工作目录"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.cwd,placeholder:"可空;相对路径按任务的工作目录解析",onChange:T=>w({cwd:T.target.value})})})]})}),s.jsx("div",{className:`expand settings-motion${h.kind==="http"?" open":""}`,inert:h.kind!=="http",children:s.jsxs("div",{children:[s.jsx("div",{className:"lbl",children:"地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.url,placeholder:"https://example.com/mcp(streamable HTTP,不支持 /sse 结尾)",onChange:T=>w({url:T.target.value})})}),s.jsx("div",{className:"lbl",children:"请求头"}),s.jsx(i0,{rows:h.headers,onChange:T=>w({headers:T}),keyLabel:"名称",valueLabel:"值"})]})}),s.jsx("div",{className:"lbl",children:"说明"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:h.description,placeholder:"这个服务提供什么,一句话(可空)",onChange:T=>w({description:T.target.value})})}),v?s.jsx("div",{className:"badline",role:"alert",children:v}):null,s.jsx(qn,{saved:!1,error:null,children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:p,onClick:()=>void E(),children:p?"正在保存…":d})})]})}function B3({onDone:n}){const[a,i]=k.useState("");return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:"添加 MCP 服务",desc:"本地命令(stdio)或远程地址(streamable HTTP)。保存后可以在详情里测试连接并开关单个工具。"}),s.jsx(ye,{children:s.jsx(Jk,{initial:L3,name:a,onName:i,fixedName:!1,onSaved:n,saveLabel:"添加"})})]})}function q3({server:n,setView:a,probe:i,onProbe:o,onDone:c}){const[d,h]=k.useState(null),[m,p]=k.useState(!1),[g,v]=k.useState(!1),[x,w]=k.useState(null);if(k.useEffect(()=>{n||Gt()},[n]),!n)return null;const E=x??n.hiddenTools??[],T=i?.state==="connected"?i.tools??[]:void 0,C=async O=>{p(!0),h(null);try{const W=await w0(n.name,O);return a(W),W}catch(W){return h(Ft(W)),null}finally{p(!1)}},M=async()=>{v(!0);try{await o(n,!0)}finally{v(!1)}},A=async()=>{if(window.confirm(`删除 MCP 服务「${n.name}」?此操作不能撤销。`))try{a(await ON(n.name)),c(`已删除「${n.name}」`)}catch(O){h(Ft(O))}},$=n.kind==="http"?"远程地址":"本地命令";return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:n.name,desc:n.description??(n.valid?`${$}的 MCP 服务`:n.invalidReason)}),n.valid?s.jsxs(ye,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${n.name}启用`,"aria-pressed":n.enabled,disabled:m,onClick:()=>void C({enabled:!n.enabled})})]}),s.jsx("div",{className:"lbl",children:"提供方式"}),s.jsx(Bn,{items:[{key:"direct",label:"直接提供"},{key:"deferred",label:"按需搜索"}],value:n.exposure,disabled:m,onChange:O=>void C({exposure:O})}),s.jsx("div",{className:"note",children:"直接提供:工具和内置工具一样声明给模型,适合工具少的服务。按需搜索:模型先搜索再调用,适合工具多的服务。"})]}):s.jsxs(ye,{children:[s.jsxs("div",{className:"badline",role:"alert",children:["配置无效:",n.invalidReason]}),s.jsx("div",{className:"note",children:"删除后重新添加,或在下方按表单保存一次即可修复。"})]}),n.valid?s.jsxs(ye,{children:[s.jsxs("div",{className:"testrow",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void M(),disabled:g,children:g?"正在测试…":"测试连接"}),i?s.jsx("span",{className:i.state==="connected"?"okline":"badline",children:i.state==="connected"?`已连接 · ${i.tools?.length??0} 个工具`:i.state==="needs_auth"?"需要登录,暂不支持":i.error??"连接失败"}):s.jsx("span",{className:"note",children:"连接后列出服务提供的工具"})]}),i&&i.state!=="connected"&&i.stderrTail?.length?s.jsx("div",{className:"note mono",children:i.stderrTail.join(`
|
|
270
|
+
`)}):null,T?T.length?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"lbl",children:["工具(",T.length,")"]}),s.jsx("div",{className:"group-card settings-card",children:T.map(O=>{const W=E.includes(O.name);return s.jsxs("div",{className:`list-row setting-row${W?" gone":""}`,children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname mono",children:O.name}),s.jsx("div",{className:"rprov rclamp",children:O.description||"(没有说明)"})]}),s.jsx("button",{className:`tog${W?" off":""}`,"aria-label":`${O.name}启用`,"aria-pressed":!W,disabled:m,onClick:()=>{const ee=W?E.filter(I=>I!==O.name):[...E,O.name];w(ee),C({hiddenTools:ee})}})]},O.name)})}),s.jsx("div",{className:"note",children:"关掉的工具不声明给模型;改动对之后新开的任务生效。"})]}):s.jsx("div",{className:"note",children:"服务已连接,但没有提供工具。"}):s.jsx("div",{className:"note",children:"先测试连接,取得服务的工具列表后可以单独开关每个工具。"})]}):null,s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:n.valid?"编辑":"重新保存"}),s.jsx(Jk,{initial:H3(n),name:n.name,fixedName:!0,onSaved:c,saveLabel:"保存"})]}),s.jsxs(ye,{children:[s.jsx("button",{className:"hob-btn hob-btn-danger",disabled:m,onClick:()=>void A(),children:"删除服务"}),d?s.jsx("div",{className:"badline",role:"alert",children:d}):null]}),s.jsx("div",{className:"note",children:"环境变量和请求头的值不回显;留空表示沿用已保存的值。删除整行表示删掉这个值。"})]})}function I3({onDone:n}){const[a,i]=k.useState(null),[o,c]=k.useState([]),[d,h]=k.useState(!1),[m,p]=k.useState(null);k.useEffect(()=>{let x=!0;return DN().then(w=>{x&&i(w)}).catch(w=>{x&&p(Ft(w))}),()=>{x=!1}},[]);const g=async()=>{h(!0),p(null);try{const x=await $N(o),w=x.skipped.length?`,跳过 ${x.skipped.length} 个(同名)`:"";n(`已导入 ${x.imported.length} 个服务${w}`)}catch(x){p(Ft(x))}finally{h(!1)}},v=a?.items??[];return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:"从本机导入 MCP 服务",desc:"读取本机 pi、Claude Code、Cursor 里已配置的 MCP 服务,复制到 Hob;来源只读,同名跳过。"}),s.jsxs(ye,{children:[a?.sources.length?s.jsxs("div",{className:"note",children:["读取位置:",a.sources.join(";")]}):null,s.jsx("div",{className:"group-card settings-card",children:v.length?v.map(x=>s.jsxs("label",{className:"list-row setting-row",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:o.includes(x.id),disabled:d||!x.selectable,onChange:w=>c(w.target.checked?[...o,x.id]:o.filter(E=>E!==x.id))}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[x.name,s.jsx("span",{className:"rtag",children:D3[x.source]}),x.exists?s.jsx("span",{className:"rtag",children:"同名跳过"}):null]}),s.jsxs("div",{className:"rprov rclamp",children:[x.kind==="http"?"远程地址":"本地命令",x.note?` · ${x.note}`:""]})]})]},x.id)):s.jsx(ze,{children:"没有找到可导入的 MCP 服务"})}),s.jsxs(qn,{saved:!1,error:m,children:[s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:d,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:d||!o.length,onClick:()=>void g(),children:d?"正在导入…":o.length?`导入 ${o.length} 个`:"导入所选"})]})]})]})}const Tl={searxng:{label:"SearXNG",desc:"自建的元搜索服务,填写服务地址即可",url:!0,keyOptional:!0},exa:{label:"Exa",desc:"语义搜索,适合查找技术资料"},tavily:{label:"Tavily",desc:"面向 AI 的搜索接口"},brave:{label:"Brave Search",desc:"Brave 的独立网页索引"},serper:{label:"Serper",desc:"Google 搜索结果"},jina:{label:"Jina",desc:"搜索并读取网页正文"},firecrawl:{label:"Firecrawl",desc:"搜索并抓取网页正文"},perplexity:{label:"Perplexity",desc:"带摘要的搜索结果"},youcom:{label:"You.com",desc:"You.com 搜索接口"},ollama:{label:"Ollama",desc:"Ollama 的网页搜索",url:!0}};function G3(){const n=we(),a=n.sub,i=n.settings.settings.search,[o,c]=k.useState(null),[d,h]=k.useState(null),[m,p]=k.useState(!1),g=async()=>c(await UN());k.useEffect(()=>{g().catch(C=>h(Ft(C)))},[]),k.useEffect(()=>{a&&h(null)},[a]);const v=C=>o?.providers.find(M=>M.name===C)?.keyConfigured??!1,x=async(C,M)=>{p(!0);try{const A=await HN(C,M);return A?(h(A),A):(await g(),null)}catch(A){const $=Ft(A);return h($),$}finally{p(!1)}},w=i.filter(C=>C.enabled),E=(C,M)=>{const A=w.map(W=>W.name),$=A.indexOf(C),O=$+M;O<0||O>=A.length||([A[$],A[O]]=[A[O],A[$]],x([...A.map(W=>i.find(ee=>ee.name===W)),...i.filter(W=>!W.enabled)]))};if(a?.kind==="searchProvider"){const C=i.find(M=>M.name===a.name);return C?s.jsx(Y3,{provider:C,configured:v(C.name),busy:m,save:(M,A)=>x(i.map($=>$.name===M.name?M:$),A===void 0?void 0:{[M.name]:A})}):s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"联网搜索"}),s.jsx("div",{className:"note",children:"没有这个服务商。"})]})}const T=C=>v(C.name)?"已配置 Key":C.baseUrl?"已填服务地址":"未配置";return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"联网搜索",desc:"助手和任务通过这里的服务商搜索网页、读取正文。可以启用多个,按顺序使用,前一个失败时自动换下一个。"}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:"已启用"}),w.length?s.jsx("div",{className:"group-card settings-card",children:w.map((C,M)=>s.jsxs("div",{className:"list-row setting-row",children:[s.jsx("span",{className:"rorder",children:M+1}),s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"searchProvider",name:C.name,title:Tl[C.name].label}),children:[s.jsx("div",{className:"rname",children:Tl[C.name].label}),s.jsx("div",{className:"rprov",children:Tl[C.name].desc})]}),s.jsx("button",{className:"hob-icon-btn rmove",title:"上移",disabled:m||M===0,onClick:()=>E(C.name,-1),children:s.jsx(Q,{name:"down",size:15,className:"up"})}),s.jsx("button",{className:"hob-icon-btn rmove",title:"下移",disabled:m||M===w.length-1,onClick:()=>E(C.name,1),children:s.jsx(Q,{name:"down",size:15})})]},C.name))}):s.jsx("div",{className:"note",children:"尚未启用服务商,助手和任务暂时不能联网搜索。"}),d?s.jsx("div",{className:"badline",children:d}):null]}),s.jsxs(ye,{children:[s.jsx("div",{className:"lbl",children:w.length?"其他服务商":"选择服务商"}),s.jsx("div",{className:"group-card settings-card",children:i.filter(C=>!C.enabled).map(C=>s.jsxs("button",{className:"list-row setting-row",onClick:()=>En({kind:"searchProvider",name:C.name,title:Tl[C.name].label}),children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname",children:Tl[C.name].label}),s.jsx("div",{className:"rprov",children:Tl[C.name].desc})]}),s.jsx("span",{className:"note",children:T(C)}),s.jsx(Q,{name:"chev",size:15,className:"rgo"})]},C.name))})]})]})}function Y3({provider:n,configured:a,busy:i,save:o}){const c=Tl[n.name],[d,h]=k.useState(n.baseUrl??""),[m,p]=k.useState(""),[g,v]=k.useState(null),[x,w]=k.useState(!1),[E,T]=k.useState(null),[C,M]=k.useState(!1);k.useEffect(()=>h(n.baseUrl??""),[n.baseUrl]);const A=d.trim()!==(n.baseUrl??"")||!!m.trim(),$=a||!!m.trim()||c.keyOptional&&!!d.trim(),O=async()=>{w(!0),v(null);try{const I=await LN(n.name,d.trim(),m.trim()||void 0);return v({ok:I.ok,text:I.ok?`搜索成功,返回 ${I.count} 条结果`:I.error??"搜索失败"}),I.ok}catch(I){return v({ok:!1,text:Ft(I)}),!1}finally{w(!1)}},W=async(I,j)=>{T(null),M(!1);const y=await o(I,j);return y?(T(y),!1):(M(!0),!0)},ee=async()=>{await O()&&await W({...n,baseUrl:d.trim()||void 0},m.trim()||void 0)&&p("")};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"联网搜索"}),s.jsx(Qe,{title:c.label,desc:c.desc}),s.jsxs(ye,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${c.label}启用`,"aria-pressed":n.enabled,disabled:i||!n.enabled&&!$,onClick:()=>void W({...n,enabled:!n.enabled})})]}),!n.enabled&&!$?s.jsxs("div",{className:"note",children:[c.url?"填写服务地址":"填写 API Key","并保存后即可启用。"]}):null]}),s.jsx(ye,{children:s.jsxs("div",{className:"formcard",children:[c.url?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:d,onChange:I=>{h(I.target.value),v(null)},placeholder:"http://127.0.0.1:8888",disabled:i})})]}):null,s.jsxs("div",{className:"lbl",children:["API Key",c.keyOptional?"(可选)":""]}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:m,onChange:I=>{p(I.target.value),v(null)},placeholder:a?"已保存,留空不变":"填写 API Key",disabled:i})}),s.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。"}),s.jsxs("div",{className:"testrow",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void O(),disabled:i||x,children:x?"正在搜索…":"测试搜索"}),g?s.jsx("span",{className:g.ok?"okline":"badline",children:g.text}):null]}),s.jsxs(qn,{saved:C&&!A,error:E,children:[a?s.jsx("button",{className:"hob-btn",disabled:i,onClick:()=>void W(n,""),children:"删除 Key"}):null,s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:i||x||!A,onClick:()=>void ee(),children:"保存"})]})]})})]})}function K3(){const[n,a]=k.useState(null);if(k.useEffect(()=>{hN().then(a)},[]),!n)return s.jsx(ze,{children:"正在读取版本信息…"});const i=[["Hob 版本",n.version],["数据目录",n.home]];return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"关于",desc:"Hob 的版本与数据目录。"}),s.jsx("div",{className:"kvcard",children:i.map(([o,c])=>s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:o}),s.jsx("span",{className:"v",children:c})]},o))})]})}const Z3=n=>n.id;function X3(){const n=we(),a=n.assistants.filter(c=>c.pinned&&!c.hidden&&tr(c,n.query)),i=xw(a,Z3),o=Hk(a.length);return s.jsxs("aside",{className:"side",children:[s.jsxs("div",{className:"side-top",children:[s.jsxs("div",{className:"search",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{value:n.query,placeholder:"搜索助手",onChange:c=>q0(c.target.value)})]}),s.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:U0,children:s.jsx(Q,{name:"plus",size:18})})]}),s.jsxs("div",{className:"side-scroll",children:[s.jsx("div",{className:`pins${o.cls}`,children:i.map(c=>s.jsx("div",{className:`srow${c.state==="still"?"":` ${c.state}`}`,children:s.jsx("div",{className:"srowclip",children:s.jsx(Lk,{a:c.item,sel:c.item.id===n.sel,size:o.size})})},c.key))}),s.jsx(Bk,{size:42,markSel:!0})]}),s.jsxs("div",{className:"side-foot",children:[s.jsxs("button",{className:"frow",onClick:Nh,children:[s.jsx(Q,{name:"archive",size:18}),s.jsx("span",{className:"sp",children:"知识库"})]}),s.jsxs("button",{className:"frow",onClick:Ac,children:[s.jsx(Q,{name:"gear",size:18}),s.jsx("span",{className:"sp",children:"设置"})]})]})]})}function V3(){"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(n=>{const a=i=>{i&&i.addEventListener("statechange",()=>{i.state==="installed"&&navigator.serviceWorker.controller&&MS()})};a(n.installing),n.addEventListener("updatefound",()=>a(n.installing))}).catch(()=>{})})}async function Q3(){if(!("serviceWorker"in navigator)){location.reload();return}let n=!1;const a=()=>{n||(n=!0,location.reload())};navigator.serviceWorker.addEventListener("controllerchange",a,{once:!0}),(await navigator.serviceWorker.getRegistration())?.waiting?.postMessage("skip-waiting"),setTimeout(a,1200)}function J3(n,a){const[i,o]=k.useState({stack:n,owner:a}),[c,d]=k.useState([]);if(i.stack!==n||i.owner!==a){const h=new Set(n.map(qa));d(i.owner!==a?[]:[...c.filter(m=>!h.has(qa(m.page))),...sN(i.stack,n)]),o({stack:n,owner:a})}return k.useEffect(()=>{if(!c.length)return;const h=setTimeout(()=>d([]),240);return()=>clearTimeout(h)},[c]),lN(n,c)}function P3(n){return n.replace(/^无法连接 Hob:/,"")}function F3(){const n=we(),[a,i]=k.useState(()=>window.innerWidth<768),o=fn(n.mobile==="chat"&&!!n.sel,240),c=fn(n.page==="settings",180),d=fn(n.page==="knowledge",180),h=fn(n.sheet,180),m=n.panelStack.at(-1),p=J3(n.panelStack,n.sel),g=p.map(({page:w,leaving:E})=>s.jsx("div",{className:`mlayer${E?" leaving":""}`,children:w.kind==="file"?s.jsx(fc,{page:w}):w.kind==="job"||w.kind==="jobs"?s.jsx(Of,{page:w}):s.jsx(Vb,{page:w,leaving:!1})},qa(w)));if(k.useLayoutEffect(()=>{g0(n,a)},[n.phase,n.page,n.mobile,n.sheet,n.panelStack,n.theme,a]),k.useEffect(()=>{WN()},[]),k.useEffect(()=>{if(!n.panelStack.length)return;const w=E=>{E.key==="Escape"&&!E.defaultPrevented&&ur()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[n.panelStack]),k.useEffect(()=>{const w=()=>i(window.innerWidth<768);return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),k.useEffect(()=>{const w=setInterval(()=>zS(),3e4);return()=>clearInterval(w)},[]),k.useEffect(()=>{const w=n.assistants.reduce((E,T)=>E+T.unread,0);document.title=w>0?`(${w}) Hob`:"Hob"},[n.assistants]),k.useEffect(()=>{if(!n.notice)return;const w=setTimeout(()=>AS(),6e3);return()=>clearTimeout(w)},[n.notice]),n.phase==="login")return s.jsx(GC,{});if(n.phase==="error")return s.jsx("div",{className:"boot",children:s.jsxs("div",{className:"boot-card",children:[s.jsx("div",{className:"t",children:"无法连接 Hob"}),s.jsx("div",{className:"d",children:"请检查网络,或确认 Hob 服务已启动。"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>location.reload(),children:"重试"}),n.error?s.jsx("div",{className:"raw",children:P3(n.error)}):null]})});if(n.phase==="loading")return s.jsx("div",{className:"boot",children:s.jsxs("div",{className:"boot-loading",children:[s.jsx(ut,{sprite:"hob",size:92,motion:"think"}),s.jsx("span",{className:"activity-shimmer",children:"正在连接 Hob…"})]})});const v=n.notice?s.jsx("div",{className:"toast",children:n.notice}):n.updateReady?s.jsx("button",{className:"upd",onClick:()=>void Q3(),children:"有新版本,点击更新"}):null;if(c.mounted)return s.jsxs(s.Fragment,{children:[s.jsx(FE,{narrow:a,leaving:c.leaving}),a?g:s.jsxs(s.Fragment,{children:[s.jsx(Of,{}),s.jsx(fc,{})]}),v]});if(d.mounted)return s.jsxs(s.Fragment,{children:[s.jsx(tE,{narrow:a,leaving:d.leaving}),a?g:null,v]});const x=m?.kind==="file"?m:null;return a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mapp",children:[s.jsx("div",{className:`mpane list${n.mobile==="chat"?" back":""}`,children:s.jsx(HE,{})}),o.mounted?s.jsx("div",{className:`mpane chat${o.leaving?" out":""}`,children:s.jsx(dC,{})}):null,h.mounted?s.jsx(Vb,{leaving:h.leaving,page:null}):null,g]}),s.jsx(rb,{}),v]}):s.jsxs("div",{className:`app${x?.full?" preview-full":""}`,children:[s.jsx(X3,{}),s.jsx(uC,{}),s.jsxs("div",{className:`panelwrap${x?.full?" full":n.collapsed?" off":n.nowWide?" wide":""}`,children:[s.jsx(ih,{page:null}),p.map(({page:w,leaving:E})=>s.jsx("div",{className:`panel-layer${w.kind==="file"||w.kind==="job"||w.kind==="jobs"?" wide":""}${E?" leaving":""}`,children:w.kind==="file"?s.jsx(fc,{embedded:!0,page:w}):w.kind==="job"||w.kind==="jobs"?s.jsx(Of,{embedded:!0,page:w}):s.jsx(ih,{page:w})},qa(w)))]}),s.jsx(rb,{}),n.offline?s.jsx("div",{className:"toast",children:n.offline}):null,v]})}function Bf(n,a){if(!a)return[];const i=[];n.page==="knowledge"?i.push("knowledge"):n.page==="settings"?(i.push("settings"),n.section&&i.push("section"),n.sub&&i.push("sub")):(n.mobile==="chat"&&n.sel&&i.push("chat"),n.sheet&&i.push("sheet"));for(const o of n.panelStack)i.push("panelPage");return i}const W3={panelPage:ur,sheet:I0,knowledge:()=>{ar(),Qf("list")},chat:()=>Qf("list"),sub:Gt,section:()=>Rl(null),settings:Vf};function eA(n=()=>window.innerWidth<768){let a=0,i=0,o=!1;const c=()=>location.pathname+location.search+iw(ks(),n());history.replaceState({hobDepth:0},"",c());const d=()=>{if(o||i>0)return;const h=Bf(ks(),n()).length;if(a>h){i++,history.go(h-a),a=h;return}for(;a<h;)history.pushState({hobDepth:++a},"",c());c()!==location.pathname+location.search+location.hash&&history.replaceState(history.state,"",c())};window.addEventListener("popstate",h=>{if(i>0){i--,d();return}const m=Number(h.state?.hobDepth??0);a=m,o=!0;for(let p=0;p<10;p++){const g=Bf(ks(),n()).at(-1);if(!g||Bf(ks(),n()).length<=m)break;W3[g]()}o=!1,d()}),j0(d),d()}tw.createRoot(document.getElementById("root")).render(s.jsx(F3,{}));eA();document.addEventListener("gesturestart",n=>n.preventDefault());V3();export{Q as I,Ol as M,yE as a,fr as b,gc as d,s as j,k as r,nA as s,we as u};
|