hob-bot 1.0.4 → 1.1.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 +75 -5
- package/README.zh-CN.md +75 -5
- package/dist/web/assets/DesktopView-rVxacveF.js +5 -0
- package/dist/web/assets/index-B-8ISOr1.js +267 -0
- package/dist/web/assets/index-Cu1Pf8yX.css +1 -0
- package/dist/web/assets/{math-zZ4JA8eM.js → math-weKGDUmL.js} +2 -2
- package/dist/web/index.html +2 -2
- package/dist/web/mock/desktop.jpg +0 -0
- package/dist/web/mock/photo.jpg +0 -0
- package/dist/web/mock/photo2.jpg +0 -0
- package/dist/web/mock/sunset.html +90 -0
- package/package.json +7 -1
- package/server/src/actions.ts +16 -56
- package/server/src/assistant-skills.ts +201 -0
- package/server/src/boot.ts +1 -0
- package/server/src/claude-status.ts +47 -0
- package/server/src/config.ts +3 -1
- package/server/src/delegations.ts +21 -11
- package/server/src/desktop-control.ts +152 -0
- package/server/src/desktop-events.ts +63 -0
- package/server/src/desktop-public.ts +43 -0
- package/server/src/desktop-tools.ts +161 -0
- package/server/src/desktop.ts +76 -0
- package/server/src/embedding.ts +52 -0
- package/server/src/files.ts +63 -43
- package/server/src/http.ts +325 -13
- package/server/src/jobs.ts +280 -41
- package/server/src/knowledge-index.ts +123 -0
- package/server/src/knowledge-tools.ts +94 -0
- package/server/src/knowledge.ts +451 -0
- package/server/src/lore-entry.ts +10 -0
- package/server/src/main.ts +6 -0
- package/server/src/mcp.ts +745 -0
- package/server/src/memory.ts +11 -4
- package/server/src/now.ts +33 -0
- package/server/src/overview.ts +1 -1
- package/server/src/pages.ts +1 -1
- package/server/src/pi.ts +92 -16
- package/server/src/prompt.ts +46 -156
- package/server/src/providers.ts +3 -2
- package/server/src/push.ts +39 -5
- package/server/src/router-activity.ts +4 -0
- package/server/src/router-tools.ts +132 -38
- package/server/src/router.ts +153 -17
- package/server/src/routines.ts +14 -4
- package/server/src/runtime.ts +15 -0
- package/server/src/settings.ts +43 -1
- package/server/src/store.ts +4 -3
- package/server/src/transcript.ts +57 -4
- package/server/src/worker-tools.ts +14 -12
- package/shared/knowledge.ts +92 -0
- package/shared/mcp.ts +91 -0
- package/shared/skills.ts +18 -0
- package/shared/types.ts +103 -20
- package/vendor/claude-bridge/HOB-PATCH.md +10 -0
- package/vendor/claude-bridge/LICENSE +21 -0
- package/vendor/claude-bridge/package.json +62 -0
- package/vendor/claude-bridge/src/agents-md.ts +14 -0
- package/vendor/claude-bridge/src/askclaude-schema.ts +92 -0
- package/vendor/claude-bridge/src/askclaude-ui.ts +90 -0
- package/vendor/claude-bridge/src/attachments.ts +135 -0
- package/vendor/claude-bridge/src/config.ts +105 -0
- package/vendor/claude-bridge/src/convert.ts +222 -0
- package/vendor/claude-bridge/src/extract-tool-results.ts +47 -0
- package/vendor/claude-bridge/src/index.ts +2503 -0
- package/vendor/claude-bridge/src/log-paths.ts +19 -0
- package/vendor/claude-bridge/src/mcp-server.ts +169 -0
- package/vendor/claude-bridge/src/models.ts +164 -0
- package/vendor/claude-bridge/src/prompt-capture.ts +420 -0
- package/vendor/claude-bridge/src/prompt-stream.ts +102 -0
- package/vendor/claude-bridge/src/query-state.ts +118 -0
- package/vendor/claude-bridge/src/rate-limit.ts +48 -0
- package/vendor/claude-bridge/src/session-cwd.ts +38 -0
- package/vendor/claude-bridge/src/session-verify.ts +38 -0
- package/vendor/claude-bridge/src/skills.ts +20 -0
- package/vendor/claude-bridge/src/transcript.ts +86 -0
- package/vendor/claude-bridge/src/usage.ts +53 -0
- package/vendor/lore-pi-extension/package.json +1 -1
- package/vendor/lore-pi-extension/tools.ts +8 -5
- package/dist/web/assets/index-BCGEZvgg.css +0 -1
- package/dist/web/assets/index-BqkIAlk9.js +0 -258
|
@@ -0,0 +1,267 @@
|
|
|
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 f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();var Qd={exports:{}},Ri={};/**
|
|
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 Zv;function o1(){if(Zv)return Ri;Zv=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(o,c,f){var h=null;if(f!==void 0&&(h=""+f),c.key!==void 0&&(h=""+c.key),"key"in c){f={};for(var m in c)m!=="key"&&(f[m]=c[m])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:h,ref:c!==void 0?c:null,props:f}}return Ri.Fragment=a,Ri.jsx=r,Ri.jsxs=r,Ri}var Qv;function c1(){return Qv||(Qv=1,Qd.exports=o1()),Qd.exports}var l=c1(),Jd={exports:{}},Di={},Pd={exports:{}},Fd={};/**
|
|
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 Jv;function u1(){return Jv||(Jv=1,(function(n){function a(se,ve){var me=se.length;se.push(ve);e:for(;0<me;){var Me=me-1>>>1,Ae=se[Me];if(0<c(Ae,ve))se[Me]=ve,se[me]=Ae,me=Me;else break e}}function r(se){return se.length===0?null:se[0]}function o(se){if(se.length===0)return null;var ve=se[0],me=se.pop();if(me!==ve){se[0]=me;e:for(var Me=0,Ae=se.length,xt=Ae>>>1;Me<xt;){var Mt=2*(Me+1)-1,Ct=se[Mt],D=Mt+1,J=se[D];if(0>c(Ct,me))D<Ae&&0>c(J,Ct)?(se[Me]=J,se[D]=me,Me=D):(se[Me]=Ct,se[Mt]=me,Me=Mt);else if(D<Ae&&0>c(J,me))se[Me]=J,se[D]=me,Me=D;else break e}}return ve}function c(se,ve){var me=se.sortIndex-ve.sortIndex;return me!==0?me:se.id-ve.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],v=[],x=1,b=null,N=3,w=!1,T=!1,E=!1,A=!1,z=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function j(se){for(var ve=r(v);ve!==null;){if(ve.callback===null)o(v);else if(ve.startTime<=se)o(v),ve.sortIndex=ve.expirationTime,a(p,ve);else break;ve=r(v)}}function C(se){if(E=!1,j(se),!T)if(r(p)!==null)T=!0,S||(S=!0,Ee());else{var ve=r(v);ve!==null&&Oe(C,ve.startTime-se)}}var S=!1,O=-1,R=5,q=-1;function F(){return A?!0:!(n.unstable_now()-q<R)}function W(){if(A=!1,S){var se=n.unstable_now();q=se;var ve=!0;try{e:{T=!1,E&&(E=!1,U(O),O=-1),w=!0;var me=N;try{t:{for(j(se),b=r(p);b!==null&&!(b.expirationTime>se&&F());){var Me=b.callback;if(typeof Me=="function"){b.callback=null,N=b.priorityLevel;var Ae=Me(b.expirationTime<=se);if(se=n.unstable_now(),typeof Ae=="function"){b.callback=Ae,j(se),ve=!0;break t}b===r(p)&&o(p),j(se)}else o(p);b=r(p)}if(b!==null)ve=!0;else{var xt=r(v);xt!==null&&Oe(C,xt.startTime-se),ve=!1}}break e}finally{b=null,N=me,w=!1}ve=void 0}}finally{ve?Ee():S=!1}}}var Ee;if(typeof $=="function")Ee=function(){$(W)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,we=he.port2;he.port1.onmessage=W,Ee=function(){we.postMessage(null)}}else Ee=function(){z(W,0)};function Oe(se,ve){O=z(function(){se(n.unstable_now())},ve)}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(se){se.callback=null},n.unstable_forceFrameRate=function(se){0>se||125<se?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<se?Math.floor(1e3/se):5},n.unstable_getCurrentPriorityLevel=function(){return N},n.unstable_next=function(se){switch(N){case 1:case 2:case 3:var ve=3;break;default:ve=N}var me=N;N=ve;try{return se()}finally{N=me}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(se,ve){switch(se){case 1:case 2:case 3:case 4:case 5:break;default:se=3}var me=N;N=se;try{return ve()}finally{N=me}},n.unstable_scheduleCallback=function(se,ve,me){var Me=n.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Me+me:Me):me=Me,se){case 1:var Ae=-1;break;case 2:Ae=250;break;case 5:Ae=1073741823;break;case 4:Ae=1e4;break;default:Ae=5e3}return Ae=me+Ae,se={id:x++,callback:ve,priorityLevel:se,startTime:me,expirationTime:Ae,sortIndex:-1},me>Me?(se.sortIndex=me,a(v,se),r(p)===null&&se===r(v)&&(E?(U(O),O=-1):E=!0,Oe(C,me-Me))):(se.sortIndex=Ae,a(p,se),T||w||(T=!0,S||(S=!0,Ee()))),se},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(se){var ve=N;return function(){var me=N;N=ve;try{return se.apply(this,arguments)}finally{N=me}}}})(Fd)),Fd}var Pv;function d1(){return Pv||(Pv=1,Pd.exports=u1()),Pd.exports}var Wd={exports:{}},Ne={};/**
|
|
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 Fv;function f1(){if(Fv)return Ne;Fv=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),N=Symbol.for("react.view_transition"),w=Symbol.iterator;function T(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,z={};function U(D,J,te){this.props=D,this.context=J,this.refs=z,this.updater=te||E}U.prototype.isReactComponent={},U.prototype.setState=function(D,J){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,J,"setState")},U.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=U.prototype;function j(D,J,te){this.props=D,this.context=J,this.refs=z,this.updater=te||E}var C=j.prototype=new $;C.constructor=j,A(C,U.prototype),C.isPureReactComponent=!0;var S=Array.isArray;function O(){}var R={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function F(D,J,te){var re=te.ref;return{$$typeof:n,type:D,key:J,ref:re!==void 0?re:null,props:te}}function W(D,J){return F(D.type,J,D.props)}function Ee(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function he(D){var J={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(te){return J[te]})}var we=/\/+/g;function Oe(D,J){return typeof D=="object"&&D!==null&&D.key!=null?he(""+D.key):J.toString(36)}function se(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(O,O):(D.status="pending",D.then(function(J){D.status==="pending"&&(D.status="fulfilled",D.value=J)},function(J){D.status==="pending"&&(D.status="rejected",D.reason=J)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ve(D,J,te,re,K){var ae=typeof D;(ae==="undefined"||ae==="boolean")&&(D=null);var le=!1;if(D===null)le=!0;else switch(ae){case"bigint":case"string":case"number":le=!0;break;case"object":switch(D.$$typeof){case n:case a:le=!0;break;case x:return le=D._init,ve(le(D._payload),J,te,re,K)}}if(le)return K=K(D),le=re===""?"."+Oe(D,0):re,S(K)?(te="",le!=null&&(te=le.replace(we,"$&/")+"/"),ve(K,J,te,"",function(nt){return nt})):K!=null&&(Ee(K)&&(K=W(K,te+(K.key==null||D&&D.key===K.key?"":(""+K.key).replace(we,"$&/")+"/")+le)),J.push(K)),1;le=0;var oe=re===""?".":re+":";if(S(D))for(var xe=0;xe<D.length;xe++)re=D[xe],ae=oe+Oe(re,xe),le+=ve(re,J,te,ae,K);else if(xe=T(D),typeof xe=="function")for(D=xe.call(D),xe=0;!(re=D.next()).done;)re=re.value,ae=oe+Oe(re,xe++),le+=ve(re,J,te,ae,K);else if(ae==="object"){if(typeof D.then=="function")return ve(se(D),J,te,re,K);throw J=String(D),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return le}function me(D,J,te){if(D==null)return D;var re=[],K=0;return ve(D,re,"","",function(ae){return J.call(te,ae,K++)}),re}function Me(D){if(D._status===-1){var J=D._result,te=J();te.then(function(re){(D._status===0||D._status===-1)&&(D._status=1,D._result=re,te.status===void 0&&(te.status="fulfilled",te.value=re))},function(re){(D._status===0||D._status===-1)&&(D._status=2,D._result=re,te.status===void 0&&(te.status="rejected",te.reason=re))}),D._status===-1&&(D._status=0,D._result=te)}if(D._status===1)return D._result.default;throw D._result}var Ae=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=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(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function xt(D){var J=R.T,te={};te.types=J!==null?J.types:null,R.T=te;try{var re=D(),K=R.S;K!==null&&K(te,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(O,Ae)}catch(ae){Ae(ae)}finally{J!==null&&te.types!==null&&(J.types=te.types),R.T=J}}function Mt(D){var J=R.T;if(J!==null){var te=J.types;te===null?J.types=[D]:te.indexOf(D)===-1&&te.push(D)}else xt(Mt.bind(null,D))}var Ct={map:me,forEach:function(D,J,te){me(D,function(){J.apply(this,arguments)},te)},count:function(D){var J=0;return me(D,function(){J++}),J},toArray:function(D){return me(D,function(J){return J})||[]},only:function(D){if(!Ee(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ne.Activity=b,Ne.Children=Ct,Ne.Component=U,Ne.Fragment=r,Ne.Profiler=c,Ne.PureComponent=j,Ne.StrictMode=o,Ne.Suspense=p,Ne.ViewTransition=N,Ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Ne.__COMPILER_RUNTIME={__proto__:null,c:function(D){return R.H.useMemoCache(D)}},Ne.addTransitionType=Mt,Ne.cache=function(D){return function(){return D.apply(null,arguments)}},Ne.cacheSignal=function(){return null},Ne.cloneElement=function(D,J,te){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var re=A({},D.props),K=D.key;if(J!=null)for(ae in J.key!==void 0&&(K=""+J.key),J)!q.call(J,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&J.ref===void 0||(re[ae]=J[ae]);var ae=arguments.length-2;if(ae===1)re.children=te;else if(1<ae){for(var le=Array(ae),oe=0;oe<ae;oe++)le[oe]=arguments[oe+2];re.children=le}return F(D.type,K,re)},Ne.createContext=function(D){return D={$$typeof:h,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:f,_context:D},D},Ne.createElement=function(D,J,te){var re,K={},ae=null;if(J!=null)for(re in J.key!==void 0&&(ae=""+J.key),J)q.call(J,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(K[re]=J[re]);var le=arguments.length-2;if(le===1)K.children=te;else if(1<le){for(var oe=Array(le),xe=0;xe<le;xe++)oe[xe]=arguments[xe+2];K.children=oe}if(D&&D.defaultProps)for(re in le=D.defaultProps,le)K[re]===void 0&&(K[re]=le[re]);return F(D,ae,K)},Ne.createRef=function(){return{current:null}},Ne.forwardRef=function(D){return{$$typeof:m,render:D}},Ne.isValidElement=Ee,Ne.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:Me}},Ne.memo=function(D,J){return{$$typeof:v,type:D,compare:J===void 0?null:J}},Ne.startTransition=xt,Ne.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Ne.use=function(D){return R.H.use(D)},Ne.useActionState=function(D,J,te){return R.H.useActionState(D,J,te)},Ne.useCallback=function(D,J){return R.H.useCallback(D,J)},Ne.useContext=function(D){return R.H.useContext(D)},Ne.useDebugValue=function(){},Ne.useDeferredValue=function(D,J){return R.H.useDeferredValue(D,J)},Ne.useEffect=function(D,J){return R.H.useEffect(D,J)},Ne.useEffectEvent=function(D){return R.H.useEffectEvent(D)},Ne.useId=function(){return R.H.useId()},Ne.useImperativeHandle=function(D,J,te){return R.H.useImperativeHandle(D,J,te)},Ne.useInsertionEffect=function(D,J){return R.H.useInsertionEffect(D,J)},Ne.useLayoutEffect=function(D,J){return R.H.useLayoutEffect(D,J)},Ne.useMemo=function(D,J){return R.H.useMemo(D,J)},Ne.useOptimistic=function(D,J){return R.H.useOptimistic(D,J)},Ne.useReducer=function(D,J,te){return R.H.useReducer(D,J,te)},Ne.useRef=function(D){return R.H.useRef(D)},Ne.useState=function(D){return R.H.useState(D)},Ne.useSyncExternalStore=function(D,J,te){return R.H.useSyncExternalStore(D,J,te)},Ne.useTransition=function(){return R.H.useTransition()},Ne.version="19.3.1",Ne}var Wv;function Yf(){return Wv||(Wv=1,Wd.exports=f1()),Wd.exports}var ef={exports:{}},St={};/**
|
|
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 ex;function h1(){if(ex)return St;ex=1;var n=Yf();function a(x){var b="https://react.dev/errors/"+x;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var N=2;N<arguments.length;N++)b+="&args[]="+encodeURIComponent(arguments[N])}return"Minified React error #"+x+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var o={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal"),f=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function m(x,b,N){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:w==null?null:w===h?h:""+w,children:x,containerInfo:b,implementation:N}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function v(x,b){if(x==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return St.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,St.browser=function(x){return{$$typeof:f,_reason:x}},St.createPortal=function(x,b){var N=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(a(299));return m(x,b,null,N)},St.flushSync=function(x){var b=p.T,N=o.p;try{if(p.T=null,o.p=2,x)return x()}finally{p.T=b,o.p=N,o.d.f()}},St.preconnect=function(x,b){typeof x=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,o.d.C(x,b))},St.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},St.preinit=function(x,b){if(typeof x=="string"&&b&&typeof b.as=="string"){var N=b.as,w=v(N,b.crossOrigin),T=typeof b.integrity=="string"?b.integrity:void 0,E=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;N==="style"?o.d.S(x,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:w,integrity:T,fetchPriority:E}):N==="script"&&o.d.X(x,{crossOrigin:w,integrity:T,fetchPriority:E,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},St.preinitModule=function(x,b){if(typeof x=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var N=v(b.as,b.crossOrigin);o.d.M(x,{crossOrigin:N,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&o.d.M(x)},St.preload=function(x,b){if(typeof x=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var N=b.as,w=v(N,b.crossOrigin);o.d.L(x,N,{crossOrigin:w,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},St.preloadModule=function(x,b){if(typeof x=="string")if(b){var N=v(b.as,b.crossOrigin);o.d.m(x,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:N,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else o.d.m(x)},St.requestFormReset=function(x){o.d.r(x)},St.unstable_batchedUpdates=function(x,b){return x(b)},St.useFormState=function(x,b,N){return p.H.useFormState(x,b,N)},St.useFormStatus=function(){return p.H.useHostTransitionStatus()},St.version="19.3.1",St}var tx;function Eb(){if(tx)return ef.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(),ef.exports=h1(),ef.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 nx;function m1(){if(nx)return Di;nx=1;var n=d1(),a=Yf(),r=Eb();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){for(var t=e,s=t;s&&!s.alternate;)t=s,(t.flags&4098)!==0&&(e=t.return),s=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(f(e)!==e)throw Error(o(188))}function v(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var s=e,i=t;;){var u=s.return;if(u===null)break;var d=u.alternate;if(d===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===s)return p(u),e;if(d===i)return p(u),t;d=d.sibling}throw Error(o(188))}if(s.return!==i.return)s=u,i=d;else{for(var g=!1,k=u.child;k;){if(k===s){g=!0,s=u,i=d;break}if(k===i){g=!0,i=u,s=d;break}k=k.sibling}if(!g){for(k=d.child;k;){if(k===s){g=!0,s=d,i=u;break}if(k===i){g=!0,i=d,s=u;break}k=k.sibling}if(!g)throw Error(o(189))}}if(s.alternate!==i)throw Error(o(190))}if(s.tag!==3)throw Error(o(188));return s.stateNode.current===s?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}function b(e,t,s,i,u,d){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&s(e,i,u,d)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,s,i,u,d))return!0;e=e.sibling}return!1}function N(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 w(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],s=N(e);return s===null||E(t,e,s.child,{foundSelf:!1}),t}function E(e,t,s,i){for(;s!==null;){if(s===t)i.foundSelf=!0;else if(s.tag===5||s.tag===27||s.tag===6){if(i.foundSelf)return e[1]=s,!0;e[0]=s}else if((s.tag!==22||s.memoizedState===null)&&E(e,t,s.child,i))return!0;s=s.sibling}return!1}function A(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 z=null,U=null;function $(e,t,s){return e===s?!0:e===t?(z=e,!0):!1}function j(e,t,s){return e===s?(U=e,!1):e===t?(U!==null&&(z=e),!0):!1}function C(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 S(e,t,s){for(var i=0,u=e;u;u=s(u))i++;u=0;for(var d=t;d;d=s(d))u++;for(;0<i-u;)e=s(e),i--;for(;0<u-i;)t=s(t),u--;for(;i--;){if(e===t||t!==null&&e===t.alternate)return e;e=s(e),t=s(t)}return null}var O=Object.assign,R=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),we=Symbol.for("react.consumer"),Oe=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),Me=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),xt=Symbol.for("react.activity"),Mt=Symbol.for("react.legacy_hidden"),Ct=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),te=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var K=Symbol.for("react.client.reference");function ae(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case W:return"Fragment";case he:return"Profiler";case Ee:return"StrictMode";case ve:return"Suspense";case me:return"SuspenseList";case xt:return"Activity";case D:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case F:return"Portal";case Oe:return e.displayName||"Context";case we:return(e._context.displayName||"Context")+".Consumer";case se:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Me:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case Ae:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var le=Array.isArray,oe=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nt={pending:!1,data:null,method:null,action:null},Sn=[],Ln=-1;function cn(e){return{current:e}}function rt(e){0>Ln||(e.current=Sn[Ln],Sn[Ln]=null,Ln--)}function Ye(e,t){Ln++,Sn[Ln]=e.current,e.current=t}var Zt=cn(null),Ot=cn(null),Tn=cn(null),Zs=cn(null);function ur(e,t){switch(Ye(Tn,t),Ye(Ot,e),Ye(Zt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sv(t),e=lv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}rt(Zt),Ye(Zt,e)}function Rl(){rt(Zt),rt(Ot),rt(Tn)}function pc(e){var t=e.memoizedState;t!==null&&(ka._currentValue=t.memoizedState,Ye(Zs,e)),t=Zt.current;var s=lv(t,e.type);t!==s&&(Ye(Ot,e),Ye(Zt,s))}function dr(e){Ot.current===e&&(rt(Zt),rt(Ot)),Zs.current===e&&(rt(Zs),ka._currentValue=nt)}var gc,Nh;function xs(e){if(gc===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);gc=t&&t[1]||"",Nh=-1<s.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+gc+e+Nh}var vc=!1;function xc(e,t){if(!e||vc)return"";vc=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(ie){var L=ie}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(ie){L=ie}Q=!1;try{var Y=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Q=!0,new e}finally{Q&&(Y!==void 0?Object.defineProperty(e.prototype,"props",Y):delete e.prototype.props)}}}else{try{throw Error()}catch(ie){L=ie}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(ie){if(ie&&L&&typeof ie.stack=="string")return[ie.stack,L.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=i.DetermineComponentFrameRoot(),g=d[0],k=d[1];if(g&&k){var M=g.split(`
|
|
45
|
+
`),B=k.split(`
|
|
46
|
+
`);for(u=i=0;i<M.length&&!M[i].includes("DetermineComponentFrameRoot");)i++;for(;u<B.length&&!B[u].includes("DetermineComponentFrameRoot");)u++;if(i===M.length||u===B.length)for(i=M.length-1,u=B.length-1;1<=i&&0<=u&&M[i]!==B[u];)u--;for(;1<=i&&0<=u;i--,u--)if(M[i]!==B[u]){if(i!==1||u!==1)do if(i--,u--,0>u||M[i]!==B[u]){var G=`
|
|
47
|
+
`+M[i].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=i&&0<=u);break}}}finally{vc=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?xs(s):""}function fy(e,t){switch(e.tag){case 26:case 27:case 5:return xs(e.type);case 16:return xs("Lazy");case 13:return e.child!==t&&t!==null?xs("Suspense Fallback"):xs("Suspense");case 19:return xs("SuspenseList");case 0:case 15:return xc(e.type,!1);case 11:return xc(e.type.render,!1);case 1:return xc(e.type,!0);case 31:return xs("Activity");case 30:return xs("ViewTransition");default:return""}}function Sh(e){try{var t="",s=null;do t+=fy(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
|
|
48
|
+
Error generating stack: `+i.message+`
|
|
49
|
+
`+i.stack}}var bc=Object.prototype.hasOwnProperty,yc=n.unstable_scheduleCallback,kc=n.unstable_cancelCallback,hy=n.unstable_shouldYield,my=n.unstable_requestPaint,Qt=n.unstable_now,py=n.unstable_getCurrentPriorityLevel,Th=n.unstable_ImmediatePriority,Ch=n.unstable_UserBlockingPriority,fr=n.unstable_NormalPriority,gy=n.unstable_LowPriority,Eh=n.unstable_IdlePriority,vy=n.log,xy=n.unstable_setDisableYieldValue,qa=null,Jt=null;function bs(e){if(typeof vy=="function"&&xy(e),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(qa,e)}catch{}}var Pt=Math.clz32?Math.clz32:ky,by=Math.log,yy=Math.LN2;function ky(e){return e>>>=0,e===0?32:31-(by(e)/yy|0)|0}var hr=256,mr=262144,pr=4194304;function Qs(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 gr(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,d=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var k=i&134217727;return k!==0?(i=k&~d,i!==0?u=Qs(i):(g&=k,g!==0?u=Qs(g):s||(s=k&~e,s!==0&&(u=Qs(s))))):(k=i&~d,k!==0?u=Qs(k):g!==0?u=Qs(g):s||(s=i&~e,s!==0&&(u=Qs(s)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,s=t&-t,d>=s||d===32&&(s&4194048)!==0)?t:u}function Ia(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ah(e,t){(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var i=31-Pt(s),u=1<<i;t|=e[i],s&=~u}return t}function jy(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 zh(){var e=pr;return pr<<=1,(pr&62914560)===0&&(pr=4194304),e}function jc(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Ya(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wy(e,t,s,i,u,d){var g=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var k=e.entanglements,M=e.expirationTimes,B=e.hiddenUpdates;for(s=g&~s;0<s;){var G=31-Pt(s),Q=1<<G;k[G]=0,M[G]=-1;var L=B[G];if(L!==null)for(B[G]=null,G=0;G<L.length;G++){var Y=L[G];Y!==null&&(Y.lane&=-536870913)}s&=~Q}i!==0&&Mh(e,i,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(g&~t))}function Mh(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Pt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function Oh(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-Pt(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function _h(e,t){var s=t&-t;return s=(s&42)!==0?1:wc(s),(s&(e.suspendedLanes|t))!==0?0:s}function wc(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 Nc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rh(){var e=xe.p;return e!==0?e:(e=window.event,e===void 0?32:qv(e.type))}function Dh(e,t){var s=xe.p;try{return xe.p=e,t()}finally{xe.p=s}}var Wn=Math.random().toString(36).slice(2),bt="__reactFiber$"+Wn,Ht="__reactProps$"+Wn,Dl="__reactContainer$"+Wn,$h="__reactEvents$"+Wn,Ny="__reactListeners$"+Wn,Sy="__reactHandles$"+Wn,Uh="__reactResources$"+Wn,Ga="__reactMarker$"+Wn,vr="__reactLoad$"+Wn;function xr(e){delete e[bt],delete e[Ht],delete e[Ny],delete e[Sy]}function Js(e){var t;if(t=e[bt])return t;for(var s=e.parentNode;s;){if(t=s[Dl]||s[bt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=kv(e);e!==null;){if(s=e[bt])return s;e=kv(e)}return t}e=s,s=e.parentNode}return null}function $l(e){if(e=e[bt]||e[Dl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ka(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Ul(e){var t=e[Uh];return t||(t=e[Uh]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function mt(e){e[Ga]=!0}function Lh(e){e[vr]=void 0}var Hh=new Set,Bh={};function Ps(e,t){Ll(e,t),Ll(e+"Capture",t)}function Ll(e,t){for(Bh[e]=t,e=0;e<t.length;e++)Hh.add(t[e])}var Ty=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]*$"),qh={},Ih={};function Cy(e){return bc.call(Ih,e)?!0:bc.call(qh,e)?!1:Ty.test(e)?Ih[e]=!0:(qh[e]=!0,!1)}var Be=!1;function Yh(){var e=Be;return Be=!1,e}function br(e,t,s){if(Cy(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,s)}}function yr(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,s)}}function es(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,i)}}function Ft(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ey(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,d=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(g){s=""+g,d.call(this,g)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(g){s=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sc(e){if(!e._valueTracker){var t=Gh(e)?"checked":"value";e._valueTracker=Ey(e,t,""+e[t])}}function Kh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=Gh(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}var Ay=/[\n"\\]/g;function un(e){return e.replace(Ay,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Tc(e,t,s,i,u,d,g,k){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ft(t)):e.value!==""+Ft(t)&&(e.value=""+Ft(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?g==="number"&&e.value==t?Cc(e,Ft(e.value)):Cc(e,Ft(t)):s!=null?Cc(e,Ft(s)):i!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+Ft(k):e.removeAttribute("name")}function Xh(e,t,s,i,u,d,g,k){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||s!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Sc(e);return}s=s!=null?""+Ft(s):"",t=t!=null?""+Ft(t):s,k||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=k?e.checked:!!i,e.defaultChecked=!!i,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),Sc(e)}function Cc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Hl(e,t,s,i){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Ft(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Vh(e,t,s){if(t!=null&&(t=""+Ft(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Ft(s):""}function Zh(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(o(92));if(le(i)){if(1<i.length)throw Error(o(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Ft(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),Sc(e)}function Bl(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var zy=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 Qh(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||zy.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Jh(e,t,s){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="",Be=!0);for(var u in t)i=t[u],t.hasOwnProperty(u)&&s[u]!==i&&(Qh(e,u,i),Be=!0)}else for(var d in t)t.hasOwnProperty(d)&&Qh(e,d,t[d])}function Ec(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 My=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"]]),Oy=/^[\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 kr(e){return Oy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Hn(){}var Ac=null;function zc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ql=null,Il=null;function Ph(e){var t=$l(e);if(t&&(e=t.stateNode)){var s=e[Ht]||null;e:switch(e=t.stateNode,t.type){case"input":if(Tc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+un(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var u=i[Ht]||null;if(!u)throw Error(o(90));Tc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&Kh(i)}break e;case"textarea":Vh(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Hl(e,!!s.multiple,t,!1)}}}var Mc=!1;function Fh(e,t,s){if(Mc)return e(t,s);Mc=!0;try{var i=e(t);return i}finally{if(Mc=!1,(ql!==null||Il!==null)&&(jo(),ql&&(t=ql,e=Il,Il=ql=null,Ph(t),e)))for(t=0;t<e.length;t++)Ph(e[t])}}function Xa(e,t){var s=e.stateNode;if(s===null)return null;var i=s[Ht]||null;if(i===null)return null;s=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(o(231,t,typeof s));return s}var ts=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oc=!1;if(ts)try{var Va={};Object.defineProperty(Va,"passive",{get:function(){Oc=!0}}),window.addEventListener("test",Va,Va),window.removeEventListener("test",Va,Va)}catch{Oc=!1}var ys=null,_c=null,jr=null;function Wh(){if(jr)return jr;var e,t=_c,s=t.length,i,u="value"in ys?ys.value:ys.textContent,d=u.length;for(e=0;e<s&&t[e]===u[e];e++);var g=s-e;for(i=1;i<=g&&t[s-i]===u[d-i];i++);return jr=u.slice(e,1<i?1-i:void 0)}function wr(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 Nr(){return!0}function em(){return!1}function _t(e){function t(s,i,u,d,g){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=d,this.target=g,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(s=e[k],this[k]=s?s(d):d[k]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Nr:em,this.isPropagationStopped=em,this}return O(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Nr)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Nr)},persist:function(){},isPersistent:Nr}),t}var ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sr=_t(ks),Za=O({},ks,{view:0,detail:0}),_y=_t(Za),Rc,Dc,Qa,Tr=O({},Za,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uc,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!==Qa&&(Qa&&e.type==="mousemove"?(Rc=e.screenX-Qa.screenX,Dc=e.screenY-Qa.screenY):Dc=Rc=0,Qa=e),Rc)},movementY:function(e){return"movementY"in e?e.movementY:Dc}}),tm=_t(Tr),Ry=O({},Tr,{dataTransfer:0}),Dy=_t(Ry),$y=O({},Za,{relatedTarget:0}),$c=_t($y),Uy=O({},ks,{animationName:0,elapsedTime:0,pseudoElement:0}),Ly=_t(Uy),Hy=O({},ks,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),By=_t(Hy),qy=O({},ks,{data:0}),nm=_t(qy),Iy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yy={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"},Gy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ky(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gy[e])?!!t[e]:!1}function Uc(){return Ky}var Xy=O({},Za,{key:function(e){if(e.key){var t=Iy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Yy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uc,charCode:function(e){return e.type==="keypress"?wr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vy=_t(Xy),Zy=O({},Tr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sm=_t(Zy),Qy=O({},ks,{submitter:0}),Jy=_t(Qy),Py=O({},Za,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uc}),Fy=_t(Py),Wy=O({},ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),ek=_t(Wy),tk=O({},Tr,{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}),nk=_t(tk),sk=O({},ks,{newState:0,oldState:0,source:0}),lk=_t(sk),ak=[9,13,27,32],Lc=ts&&"CompositionEvent"in window,Ja=null;ts&&"documentMode"in document&&(Ja=document.documentMode);var ik=ts&&"TextEvent"in window&&!Ja,lm=ts&&(!Lc||Ja&&8<Ja&&11>=Ja),am=" ",im=!1;function rm(e,t){switch(e){case"keyup":return ak.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function om(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yl=!1;function rk(e,t){switch(e){case"compositionend":return om(t);case"keypress":return t.which!==32?null:(im=!0,am);case"textInput":return e=t.data,e===am&&im?null:e;default:return null}}function ok(e,t){if(Yl)return e==="compositionend"||!Lc&&rm(e,t)?(e=Wh(),jr=_c=ys=null,Yl=!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 lm&&t.locale!=="ko"?null:t.data;default:return null}}var ck={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 cm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ck[e.type]:t==="textarea"}function um(e,t,s,i){ql?Il?Il.push(i):Il=[i]:ql=i,t=Eo(t,"onChange"),0<t.length&&(s=new Sr("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Pa=null,Fa=null;function uk(e){Pg(e,0)}function Cr(e){var t=Ka(e);if(Kh(t))return e}function dm(e,t){if(e==="change")return t}var fm=!1;if(ts){var Hc;if(ts){var Bc="oninput"in document;if(!Bc){var hm=document.createElement("div");hm.setAttribute("oninput","return;"),Bc=typeof hm.oninput=="function"}Hc=Bc}else Hc=!1;fm=Hc&&(!document.documentMode||9<document.documentMode)}function mm(){Pa&&(Pa.detachEvent("onpropertychange",pm),Fa=Pa=null)}function pm(e){if(e.propertyName==="value"&&Cr(Fa)){var t=[];um(t,Fa,e,zc(e)),Fh(uk,t)}}function dk(e,t,s){e==="focusin"?(mm(),Pa=t,Fa=s,Pa.attachEvent("onpropertychange",pm)):e==="focusout"&&mm()}function fk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Cr(Fa)}function hk(e,t){if(e==="click")return Cr(t)}function mk(e,t){if(e==="input"||e==="change")return Cr(t)}function pk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wt=typeof Object.is=="function"?Object.is:pk;function Wa(e,t){if(Wt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var u=s[i];if(!bc.call(t,u)||!Wt(e[u],t[u]))return!1}return!0}function qc(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 gm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vm(e,t){var s=gm(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=gm(s)}}function xm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qc(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=qc(e.document)}return t}function Ic(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 gk=ts&&"documentMode"in document&&11>=document.documentMode,Gl=null,Yc=null,ei=null,Gc=!1;function ym(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Gc||Gl==null||Gl!==qc(i)||(i=Gl,"selectionStart"in i&&Ic(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ei&&Wa(ei,i)||(ei=i,i=Eo(Yc,"onSelect"),0<i.length&&(t=new Sr("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=Gl)))}function Fs(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Kl={animationend:Fs("Animation","AnimationEnd"),animationiteration:Fs("Animation","AnimationIteration"),animationstart:Fs("Animation","AnimationStart"),transitionrun:Fs("Transition","TransitionRun"),transitionstart:Fs("Transition","TransitionStart"),transitioncancel:Fs("Transition","TransitionCancel"),transitionend:Fs("Transition","TransitionEnd")},Kc={},km={};ts&&(km=document.createElement("div").style,"AnimationEvent"in window||(delete Kl.animationend.animation,delete Kl.animationiteration.animation,delete Kl.animationstart.animation),"TransitionEvent"in window||delete Kl.transitionend.transition);function Ws(e){if(Kc[e])return Kc[e];if(!Kl[e])return e;var t=Kl[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in km)return Kc[e]=t[s];return e}var jm=Ws("animationend"),wm=Ws("animationiteration"),Nm=Ws("animationstart"),vk=Ws("transitionrun"),xk=Ws("transitionstart"),bk=Ws("transitioncancel"),Sm=Ws("transitionend"),Tm=new Map,Xc="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(" ");Xc.push("scrollEnd");function Cn(e,t){Tm.set(e,t),Ps(t,[e])}var yk=0;function ns(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Mn.identifierPrefix;var s=yk++;return e="_"+e+"t_"+s.toString(32)+"_",t.autoName=e}function Cm(e){if(e==null||typeof e=="string")return e;var t=null,s=da;if(s!==null)for(var i=0;i<s.length;i++){var u=e[s[i]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function ss(e,t){return e=Cm(e),t=Cm(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Er=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)},dn=[],Xl=0,Vc=0;function Ar(){for(var e=Xl,t=Vc=Xl=0;t<e;){var s=dn[t];dn[t++]=null;var i=dn[t];dn[t++]=null;var u=dn[t];dn[t++]=null;var d=dn[t];if(dn[t++]=null,i!==null&&u!==null){var g=i.pending;g===null?u.next=u:(u.next=g.next,g.next=u),i.pending=u}d!==0&&Em(s,u,d)}}function zr(e,t,s,i){dn[Xl++]=e,dn[Xl++]=t,dn[Xl++]=s,dn[Xl++]=i,Vc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Zc(e,t,s,i){return zr(e,t,s,i),Mr(e)}function el(e,t){return zr(e,null,null,t),Mr(e)}function Em(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var u=!1,d=e.return;d!==null;)d.childLanes|=s,i=d.alternate,i!==null&&(i.childLanes|=s),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-Pt(s),e=d.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),d):null}function Mr(e){if(50<ji)throw ji=0,ko=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vl={};function kk(e,t,s,i){this.tag=e,this.key=s,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bt(e,t,s,i){return new kk(e,t,s,i)}function Qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ls(e,t){var s=e.alternate;return s===null?(s=Bt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&1206910976,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Am(e,t){e.flags&=1206910978;var s=e.alternate;return s===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=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Or(e,t,s,i,u,d){var g=0;if(i=e,typeof i=="function")Qc(i)&&(g=1);else if(typeof i=="string")g=Qj(e,s,Zt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(i){case xt:return e=Bt(31,s,t,u),e.elementType=xt,e.lanes=d,e;case W:return tl(s.children,u,d,t);case Ee:g=8,u|=24;break;case he:return e=Bt(12,s,t,u|2),e.elementType=he,e.lanes=d,e;case ve:return e=Bt(13,s,t,u),e.elementType=ve,e.lanes=d,e;case me:return e=Bt(19,s,t,u),e.elementType=me,e.lanes=d,e;case Mt:case D:return e=u|32,e=Bt(30,s,t,e),e.elementType=D,e.lanes=d,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case Oe:g=10;break e;case we:g=9;break e;case se:g=11;break e;case Me:g=14;break e;case Ae:g=16,i=null;break e}g=29,s=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=Bt(g,s,t,u),t.elementType=e,t.type=i,t.lanes=d,t}function tl(e,t,s,i){return e=Bt(7,e,i,t),e.lanes=s,e}function Jc(e,t,s){return e=Bt(6,e,null,t),e.lanes=s,e}function zm(e){var t=Bt(18,null,null,0);return t.stateNode=e,t}function Pc(e,t,s){return t=Bt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Mm=new WeakMap;function fn(e,t){if(typeof e=="object"&&e!==null){var s=Mm.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Sh(t)},Mm.set(e,t),t)}return{value:e,source:t,stack:Sh(t)}}var Zl=[],Ql=0,_r=null,ti=0,hn=[],mn=0,js=null,Bn=1,qn="";function as(e,t){Zl[Ql++]=ti,Zl[Ql++]=_r,_r=e,ti=t}function Om(e,t,s){hn[mn++]=Bn,hn[mn++]=qn,hn[mn++]=js,js=e;var i=Bn;e=qn;var u=32-Pt(i)-1;i&=~(1<<u),s+=1;var d=32-Pt(t)+u;if(30<d){var g=u-u%5;d=(i&(1<<g)-1).toString(32),i>>=g,u-=g,Bn=1<<32-Pt(t)+u|s<<u|i,qn=d+e}else Bn=1<<d|s<<u|i,qn=e}function Rr(e){e.return!==null&&(as(e,1),Om(e,1,0))}function Fc(e){for(;e===_r;)_r=Zl[--Ql],Zl[Ql]=null,ti=Zl[--Ql],Zl[Ql]=null;for(;e===js;)js=hn[--mn],hn[mn]=null,qn=hn[--mn],hn[mn]=null,Bn=hn[--mn],hn[mn]=null}function _m(e,t){hn[mn++]=Bn,hn[mn++]=qn,hn[mn++]=js,Bn=t.id,qn=t.overflow,js=e}var pt=null,Pe=null,ze=!1,ws=null,pn=!1,Wc=Error(o(519));function Ns(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ni(fn(t,e)),Wc}function Rm(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[bt]=e,t[Ht]=i,s){case"dialog":Re("cancel",t),Re("close",t);break;case"iframe":case"object":case"embed":Re("load",t);break;case"video":case"audio":for(s=0;s<Ni.length;s++)Re(Ni[s],t);break;case"source":Re("error",t);break;case"img":case"image":case"link":Re("error",t),Re("load",t);break;case"details":Re("toggle",t);break;case"input":Re("invalid",t),Xh(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Re("invalid",t);break;case"textarea":Re("invalid",t),Zh(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||tv(t.textContent,s)?(i.popover!=null&&(Re("beforetoggle",t),Re("toggle",t)),i.onScroll!=null&&Re("scroll",t),i.onScrollEnd!=null&&Re("scrollend",t),i.onClick!=null&&(t.onclick=Hn),t=!0):t=!1,t||Ns(e,!0)}function Dr(e){for(pt=e.return;pt;)switch(pt.tag){case 5:case 31:case 13:pn=!1;return;case 27:case 3:pn=!0;return;default:pt=pt.return}}function Jl(e){if(e!==pt)return!1;if(!ze)return Dr(e),ze=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Ad(e.type,e.memoizedProps)),s=!s),s&&Pe&&Ns(e),Dr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Pe=yv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Pe=yv(e)}else t===27?(t=Pe,Bs(e.type)?(e=Ld,Ld=null,Pe=e):Pe=t):Pe=pt?vn(e.stateNode.nextSibling):null;return!0}function nl(){Pe=pt=null,ze=!1}function eu(){var e=ws;return e!==null&&(Yt===null?Yt=e:Yt.push.apply(Yt,e),ws=null),e}function ni(e){ws===null?ws=[e]:ws.push(e)}var tu=cn(null),sl=null,is=null;function Ss(e,t,s){Ye(tu,t._currentValue),t._currentValue=s}function rs(e){e._currentValue=tu.current,rt(tu)}function $r(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function nu(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var g=u.child;d=d.firstContext;e:for(;d!==null;){var k=d;d=u;for(var M=0;M<t.length;M++)if(k.context===t[M]){d.lanes|=s,k=d.alternate,k!==null&&(k.lanes|=s),$r(d.return,s,e),i||(g=null);break e}d=k.next}}else if(u.tag===18){if(g=u.return,g===null)throw Error(o(341));g.lanes|=s,d=g.alternate,d!==null&&(d.lanes|=s),$r(g,s,e),g=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=s,g=u.alternate,g!==null&&(g.lanes|=s),$r(u.return,s,e),g=u.child,g=g!==null?g.sibling:null):g=u.child;if(g!==null)g.return=u;else for(g=u;g!==null;){if(g===e){g=null;break}if(u=g.sibling,u!==null){u.return=g.return,g=u;break}g=g.return}u=g}}function ll(e,t,s,i){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var g=u.alternate;if(g===null)throw Error(o(387));if(g=g.memoizedProps,g!==null){var k=u.type;Wt(u.pendingProps.value,g.value)||(e!==null?e.push(k):e=[k])}}else if(u===Zs.current){if(g=u.alternate,g===null)throw Error(o(387));g.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(ka):e=[ka])}u=u.return}return e!==null&&nu(t,e,s,i),t.flags|=262144,e!==null}function Ur(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function al(e){sl=e,is=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Dm(sl,e)}function Lr(e,t){return sl===null&&al(e),Dm(e,t)}function Dm(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},is===null){if(e===null)throw Error(o(308));is=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else is=is.next=t;return s}var jk=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},wk=n.unstable_scheduleCallback,Nk=n.unstable_NormalPriority,ot={$$typeof:Oe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function su(){return{controller:new jk,data:new Map,refCount:0}}function si(e){e.refCount--,e.refCount===0&&wk(Nk,function(){e.controller.abort()})}function $m(e,t){if((e.pendingLanes&4194048)!==0){var s=e.transitionTypes;for(s===null&&(s=e.transitionTypes=[]),e=0;e<t.length;e++){var i=t[e];s.indexOf(i)===-1&&s.push(i)}}}var li=null;function Sk(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ai=null,lu=0,il=0,Pl=null;function Tk(e,t){if(ai===null){var s=ai=[];lu=0,il=yd(),Pl={status:"pending",value:void 0,then:function(i){s.push(i)}}}return lu++,t.then(Um,Um),t}function Um(){if(--lu===0&&(li=null,ai!==null)){Pl!==null&&(Pl.status="fulfilled");var e=ai;ai=null,il=0,Pl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ck(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),i}var Lm=oe.S;oe.S=function(e,t){if(zg=Qt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Tk(e,t),li!==null)for(var s=pa;s!==null;)$m(s,li),s=s.next;if(s=e.types,s!==null){for(var i=pa;i!==null;)$m(i,s),i=i.next;if(il!==0){i=li,i===null&&(i=li=[]);for(var u=0;u<s.length;u++){var d=s[u];i.indexOf(d)===-1&&i.push(d)}}}Lm!==null&&Lm(e,t)};var rl=cn(null);function au(){var e=rl.current;return e!==null?e:Qe.pooledCache}function Hr(e,t){t===null?Ye(rl,rl.current):Ye(rl,t.pool)}function Hm(){var e=au();return e===null?null:{parent:ot._currentValue,pool:e}}var Fl=Error(o(460)),iu=Error(o(474)),Br=Error(o(542)),qr={then:function(){}};function Bm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function qm(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Hn,Hn),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ym(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(Hn,Hn);else{if(e=Qe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ym(e),e}throw cl=t,Fl}}function ol(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(cl=s,Fl):s}}var cl=null;function Im(){if(cl===null)throw Error(o(459));var e=cl;return cl=null,e}function Ym(e){if(e===Fl||e===Br)throw Error(o(483))}var Wl=null,ii=0;function Ir(e){var t=ii;return ii+=1,Wl===null&&(Wl=[]),qm(Wl,e,t)}function Ts(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Yr(e,t){throw t.$$typeof===R?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Gm(e){function t(H,_){if(e){var I=H.deletions;I===null?(H.deletions=[_],H.flags|=16):I.push(_)}}function s(H,_){if(!e)return null;for(;_!==null;)t(H,_),_=_.sibling;return null}function i(H){for(var _=new Map;H!==null;)H.key===null?_.set(H.index,H):_.set(H.key,H),H=H.sibling;return _}function u(H,_){return H=ls(H,_),H.index=0,H.sibling=null,H}function d(H,_,I){return H.index=I,e?(I=H.alternate,I!==null?(I=I.index,I<_?(H.flags|=2,_):I):(H.flags|=134217730,_)):(H.flags|=1048576,_)}function g(H){return e&&H.alternate===null&&(H.flags|=134217730),H}function k(H,_,I,Z){return _===null||_.tag!==6?(_=Jc(I,H.mode,Z),_.return=H,_):(_=u(_,I),_.return=H,_)}function M(H,_,I,Z){var fe=I.type;return fe===W?(H=G(H,_,I.props.children,Z,I.key),Ts(H,I),H):_!==null&&(_.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&ol(fe)===_.type)?(_=u(_,I.props),Ts(_,I),_.return=H,_):(_=Or(I.type,I.key,I.props,null,H.mode,Z),Ts(_,I),_.return=H,_)}function B(H,_,I,Z){return _===null||_.tag!==4||_.stateNode.containerInfo!==I.containerInfo||_.stateNode.implementation!==I.implementation?(_=Pc(I,H.mode,Z),_.return=H,_):(_=u(_,I.children||[]),_.return=H,_)}function G(H,_,I,Z,fe){return _===null||_.tag!==7?(_=tl(I,H.mode,Z,fe),_.return=H,_):(_=u(_,I),_.return=H,_)}function Q(H,_,I){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Jc(""+_,H.mode,I),_.return=H,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case q:return I=Or(_.type,_.key,_.props,null,H.mode,I),Ts(I,_),I.return=H,I;case F:return _=Pc(_,H.mode,I),_.return=H,_;case Ae:return _=ol(_),Q(H,_,I)}if(le(_)||re(_))return _=tl(_,H.mode,I,null),_.return=H,_;if(typeof _.then=="function")return Q(H,Ir(_),I);if(_.$$typeof===Oe)return Q(H,Lr(H,_),I);Yr(H,_)}return null}function L(H,_,I,Z){var fe=_!==null?_.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return fe!==null?null:k(H,_,""+I,Z);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case q:return I.key===fe?M(H,_,I,Z):null;case F:return I.key===fe?B(H,_,I,Z):null;case Ae:return I=ol(I),L(H,_,I,Z)}if(le(I)||re(I))return fe!==null?null:G(H,_,I,Z,null);if(typeof I.then=="function")return L(H,_,Ir(I),Z);if(I.$$typeof===Oe)return L(H,_,Lr(H,I),Z);Yr(H,I)}return null}function Y(H,_,I,Z,fe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return H=H.get(I)||null,k(_,H,""+Z,fe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case q:return H=H.get(Z.key===null?I:Z.key)||null,M(_,H,Z,fe);case F:return H=H.get(Z.key===null?I:Z.key)||null,B(_,H,Z,fe);case Ae:return Z=ol(Z),Y(H,_,I,Z,fe)}if(le(Z)||re(Z))return H=H.get(I)||null,G(_,H,Z,fe,null);if(typeof Z.then=="function")return Y(H,_,I,Ir(Z),fe);if(Z.$$typeof===Oe)return Y(H,_,I,Lr(_,Z),fe);Yr(_,Z)}return null}function ie(H,_,I,Z){for(var fe=null,$e=null,ye=_,ke=_=0,dt=null;ye!==null&&ke<I.length;ke++){ye.index>ke?(dt=ye,ye=null):dt=ye.sibling;var He=L(H,ye,I[ke],Z);if(He===null){ye===null&&(ye=dt);break}e&&ye&&He.alternate===null&&t(H,ye),_=d(He,_,ke),$e===null?fe=He:$e.sibling=He,$e=He,ye=dt}if(ke===I.length)return s(H,ye),ze&&as(H,ke),fe;if(ye===null){for(;ke<I.length;ke++)ye=Q(H,I[ke],Z),ye!==null&&(_=d(ye,_,ke),$e===null?fe=ye:$e.sibling=ye,$e=ye);return ze&&as(H,ke),fe}for(ye=i(ye);ke<I.length;ke++)dt=Y(ye,H,ke,I[ke],Z),dt!==null&&(e&&(He=dt.alternate,He!==null&&ye.delete(He.key===null?ke:He.key)),_=d(dt,_,ke),$e===null?fe=dt:$e.sibling=dt,$e=dt);return e&&ye.forEach(function(Ks){return t(H,Ks)}),ze&&as(H,ke),fe}function pe(H,_,I,Z){if(I==null)throw Error(o(151));for(var fe=null,$e=null,ye=_,ke=_=0,dt=null,He=I.next();ye!==null&&!He.done;ke++,He=I.next()){ye.index>ke?(dt=ye,ye=null):dt=ye.sibling;var Ks=L(H,ye,He.value,Z);if(Ks===null){ye===null&&(ye=dt);break}e&&ye&&Ks.alternate===null&&t(H,ye),_=d(Ks,_,ke),$e===null?fe=Ks:$e.sibling=Ks,$e=Ks,ye=dt}if(He.done)return s(H,ye),ze&&as(H,ke),fe;if(ye===null){for(;!He.done;ke++,He=I.next())He=Q(H,He.value,Z),He!==null&&(_=d(He,_,ke),$e===null?fe=He:$e.sibling=He,$e=He);return ze&&as(H,ke),fe}for(ye=i(ye);!He.done;ke++,He=I.next())He=Y(ye,H,ke,He.value,Z),He!==null&&(e&&(dt=He.alternate,dt!==null&&ye.delete(dt.key===null?ke:dt.key)),_=d(He,_,ke),$e===null?fe=He:$e.sibling=He,$e=He);return e&&ye.forEach(function(r1){return t(H,r1)}),ze&&as(H,ke),fe}function Ce(H,_,I,Z){if(typeof I=="object"&&I!==null&&I.type===W&&I.key===null&&I.props.ref===void 0&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case q:e:{for(var fe=I.key;_!==null;){if(_.key===fe){if(fe=I.type,fe===W){if(_.tag===7){s(H,_.sibling),Z=u(_,I.props.children),Ts(Z,I),Z.return=H,H=Z;break e}}else if(_.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&ol(fe)===_.type){s(H,_.sibling),Z=u(_,I.props),Ts(Z,I),Z.return=H,H=Z;break e}s(H,_);break}else t(H,_);_=_.sibling}I.type===W?(Z=tl(I.props.children,H.mode,Z,I.key),Ts(Z,I),Z.return=H,H=Z):(Z=Or(I.type,I.key,I.props,null,H.mode,Z),Ts(Z,I),Z.return=H,H=Z)}return g(H);case F:e:{for(fe=I.key;_!==null;){if(_.key===fe)if(_.tag===4&&_.stateNode.containerInfo===I.containerInfo&&_.stateNode.implementation===I.implementation){s(H,_.sibling),Z=u(_,I.children||[]),Z.return=H,H=Z;break e}else{s(H,_);break}else t(H,_);_=_.sibling}Z=Pc(I,H.mode,Z),Z.return=H,H=Z}return g(H);case Ae:return I=ol(I),Ce(H,_,I,Z)}if(le(I))return ie(H,_,I,Z);if(re(I)){if(fe=re(I),typeof fe!="function")throw Error(o(150));return I=fe.call(I),pe(H,_,I,Z)}if(typeof I.then=="function")return Ce(H,_,Ir(I),Z);if(I.$$typeof===Oe)return Ce(H,_,Lr(H,I),Z);Yr(H,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,_!==null&&_.tag===6?(s(H,_.sibling),Z=u(_,I),Z.return=H,H=Z):(s(H,_),Z=Jc(I,H.mode,Z),Z.return=H,H=Z),g(H)):s(H,_)}return function(H,_,I,Z){try{ii=0;var fe=Ce(H,_,I,Z);return Wl=null,fe}catch(ye){if(ye===Fl||ye===Br)throw ye;var $e=Bt(29,ye,null,H.mode);return $e.lanes=Z,$e.return=H,$e}finally{}}}var ul=Gm(!0),Km=Gm(!1),Cs=!1;function ru(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ou(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 Es(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function As(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(qe&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=Mr(e),Em(e,null,s),t}return zr(e,i,t,s),Mr(e)}function ri(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Oh(e,s)}}function cu(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var u=null,d=null;if(s=s.firstBaseUpdate,s!==null){do{var g={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};d===null?u=d=g:d=d.next=g,s=s.next}while(s!==null);d===null?u=d=t:d=d.next=t}else u=d=t;s={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var uu=!1;function oi(){if(uu){var e=Pl;if(e!==null)throw e}}function ci(e,t,s,i){uu=!1;var u=e.updateQueue;Cs=!1;var d=u.firstBaseUpdate,g=u.lastBaseUpdate,k=u.shared.pending;if(k!==null){u.shared.pending=null;var M=k,B=M.next;M.next=null,g===null?d=B:g.next=B,g=M;var G=e.alternate;G!==null&&(G=G.updateQueue,k=G.lastBaseUpdate,k!==g&&(k===null?G.firstBaseUpdate=B:k.next=B,G.lastBaseUpdate=M))}if(d!==null){var Q=u.baseState;g=0,G=B=M=null,k=d;do{var L=k.lane&-536870913,Y=L!==k.lane;if(Y?(De&L)===L:(i&L)===L){L!==0&&L===il&&(uu=!0),G!==null&&(G=G.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var ie=e,pe=k;L=t;var Ce=s;switch(pe.tag){case 1:if(ie=pe.payload,typeof ie=="function"){Q=ie.call(Ce,Q,L);break e}Q=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=pe.payload,L=typeof ie=="function"?ie.call(Ce,Q,L):ie,L==null)break e;Q=O({},Q,L);break e;case 2:Cs=!0}}L=k.callback,L!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=u.callbacks,Y===null?u.callbacks=[L]:Y.push(L))}else Y={lane:L,tag:k.tag,payload:k.payload,callback:k.callback,next:null},G===null?(B=G=Y,M=Q):G=G.next=Y,g|=L;if(k=k.next,k===null){if(k=u.shared.pending,k===null)break;Y=k,k=Y.next,Y.next=null,u.lastBaseUpdate=Y,u.shared.pending=null}}while(!0);G===null&&(M=Q),u.baseState=M,u.firstBaseUpdate=B,u.lastBaseUpdate=G,d===null&&(u.shared.lanes=0),$s|=g,e.lanes=g,e.memoizedState=Q}}function Xm(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Vm(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Xm(s[e],t)}var zs=cn(null),Gr=cn(0);function Zm(e,t){e=fs,Ye(Gr,e),Ye(zs,t),fs=e|t.baseLanes}function du(){Ye(Gr,fs),Ye(zs,zs.current)}function fu(){fs=Gr.current,rt(zs),rt(Gr)}var kt=cn(null),Et=null;function Ms(e){var t=e.alternate;Ye(jt,jt.current&1),Ye(kt,e),Et===null&&(t===null||zs.current!==null||t.memoizedState!==null)&&(Et=e)}function hu(e){Ye(jt,jt.current),Ye(kt,e),Et===null&&(Et=e)}function Qm(e){e.tag===22?(Ye(jt,jt.current),Ye(kt,e),Et===null&&(Et=e)):Os()}function Os(){Ye(jt,jt.current),Ye(kt,kt.current)}function en(e){rt(kt),Et===e&&(Et=null),rt(jt)}var jt=cn(0);function ui(e,t){Ye(kt,kt.current),Ye(jt,t)}function mu(e){rt(jt),rt(kt),Et===e&&(Et=null)}function Kr(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||$d(s)||Ud(s)))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 os=0,Te=null,Ze=null,ct=null,Xr=!1,ea=!1,dl=!1,Vr=0,di=0,ta=null,Ek=0;function st(){throw Error(o(321))}function pu(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Wt(e[s],t[s]))return!1;return!0}function gu(e,t,s,i,u,d){return os=d,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oe.H=e===null||e.memoizedState===null?Op:_p,dl=!1,d=s(i,u),dl=!1,ea&&(d=Pm(t,s,i,u)),Jm(e),d}function Jm(e){oe.H=eo;var t=Ze!==null&&Ze.next!==null;if(os=0,ct=Ze=Te=null,Xr=!1,di=0,ta=null,t)throw Error(o(300));e===null||ut||(e=e.dependencies,e!==null&&Ur(e)&&(ut=!0))}function Pm(e,t,s,i){Te=e;var u=0;do{if(ea&&(ta=null),di=0,ea=!1,25<=u)throw Error(o(301));if(u+=1,ct=Ze=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}oe.H=$k,d=t(s,i)}while(ea);return d}function Ak(){var e=oe.H,t=e.useState()[0];return t=typeof t.then=="function"?fi(t):t,e=e.useState()[0],(Ze!==null?Ze.memoizedState:null)!==e&&(Te.flags|=1024),t}function vu(){var e=Vr!==0;return Vr=0,e}function xu(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function bu(e){if(Xr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Xr=!1}os=0,ct=Ze=Te=null,ea=!1,di=Vr=0,ta=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?Te.memoizedState=ct=e:ct=ct.next=e,ct}function at(){if(Ze===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Ze.next;var t=ct===null?Te.memoizedState:ct.next;if(t!==null)ct=t,Ze=e;else{if(e===null)throw Te.alternate===null?Error(o(467)):Error(o(310));Ze=e,e={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},ct===null?Te.memoizedState=ct=e:ct=ct.next=e}return ct}function Zr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fi(e){var t=di;return di+=1,ta===null&&(ta=[]),e=qm(ta,e,t),t=Te,(ct===null?t.memoizedState:ct.next)===null&&(t=t.alternate,oe.H=t===null||t.memoizedState===null?Op:_p),e}function Qr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return fi(e);if(e.$$typeof===J)return;if(e.$$typeof===Oe)return yt(e)}throw Error(o(438,String(e)))}function yu(e){var t=null,s=Te.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=Te.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Zr(),Te.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=Ct;return t.index++,s}function cs(e,t){return typeof t=="function"?t(e):t}function Jr(e){var t=at();return ku(t,Ze,e)}function ku(e,t,s){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=s;var u=e.baseQueue,d=i.pending;if(d!==null){if(u!==null){var g=u.next;u.next=d.next,d.next=g}t.baseQueue=u=d,i.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var k=g=null,M=null,B=t,G=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?(De&Q)===Q:(os&Q)===Q){var L=B.revertLane;if(L===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),Q===il&&(G=!0);else if((os&L)===L){B=B.next,L===il&&(G=!0);continue}else Q={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},M===null?(k=M=Q,g=d):M=M.next=Q,Te.lanes|=L,$s|=L;Q=B.action,dl&&s(d,Q),d=B.hasEagerState?B.eagerState:s(d,Q)}else L={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},M===null?(k=M=L,g=d):M=M.next=L,Te.lanes|=Q,$s|=Q;B=B.next}while(B!==null&&B!==t);if(M===null?g=d:M.next=k,!Wt(d,e.memoizedState)&&(ut=!0,G&&(s=Pl,s!==null)))throw s;e.memoizedState=d,e.baseState=g,e.baseQueue=M,i.lastRenderedState=d}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function ju(e){var t=at(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var i=s.dispatch,u=s.pending,d=t.memoizedState;if(u!==null){s.pending=null;var g=u=u.next;do d=e(d,g.action),g=g.next;while(g!==u);Wt(d,t.memoizedState)||(ut=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),s.lastRenderedState=d}return[d,i]}function Fm(e,t,s){var i=Te,u=at(),d=ze;if(d){if(s===void 0)throw Error(o(407));s=s()}else s=t();var g=!Wt((Ze||u).memoizedState,s);if(g&&(u.memoizedState=s,ut=!0),u=u.queue,Su(tp.bind(null,i,u,e),[e]),e=u.getSnapshot!==t||g||ct!==null&&(ct.memoizedState.tag&1)!==0,na(e?9:8,{destroy:void 0},ep.bind(null,i,u,s,t),null),e){if(i.flags|=2048,Qe===null)throw Error(o(349));d||(os&127)!==0||Wm(i,t,s)}return s}function Wm(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Te.updateQueue,t===null?(t=Zr(),Te.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function ep(e,t,s,i){t.value=s,t.getSnapshot=i,np(t)&&sp(e)}function tp(e,t,s){return s(function(){np(t)&&sp(e)})}function np(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Wt(e,s)}catch{return!0}}function sp(e){var t=el(e,2);t!==null&&Gt(t,e,2)}function wu(e){var t=Rt();if(typeof e=="function"){var s=e;if(e=s(),dl){bs(!0);try{s()}finally{bs(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:e},t}function lp(e,t,s,i){return e.baseState=s,ku(e,Ze,typeof i=="function"?i:cs)}function zk(e,t,s,i,u){if(Wr(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){d.listeners.push(g)}};oe.T!==null?s(!0):d.isTransition=!1,i(d),s=t.pending,s===null?(d.next=t.pending=d,ap(t,d)):(d.next=s.next,t.pending=s.next=d)}}function ap(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var d=oe.T,g={};g.types=d!==null?d.types:null,oe.T=g;try{var k=s(u,i),M=oe.S;M!==null&&M(g,k),ip(e,t,k)}catch(B){Nu(e,t,B)}finally{d!==null&&g.types!==null&&(d.types=g.types),oe.T=d}}else try{d=s(u,i),ip(e,t,d)}catch(B){Nu(e,t,B)}}function ip(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){rp(e,t,i)},function(i){return Nu(e,t,i)}):rp(e,t,s)}function rp(e,t,s){t.status="fulfilled",t.value=s,op(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,ap(e,s)))}function Nu(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,op(t),t=t.next;while(t!==i)}e.action=null}function op(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function cp(e,t){return t}function up(e,t){if(ze){var s=Qe.formState;if(s!==null){e:{var i=Te;if(ze){if(Pe){t:{for(var u=Pe,d=pn;u.nodeType!==8;){if(!d){u=null;break t}if(u=vn(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Pe=vn(u.nextSibling),i=u.data==="F!";break e}}Ns(i)}i=!1}i&&(t=s[0])}}return s=Rt(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:t},s.queue=i,s=Ap.bind(null,Te,i),i.dispatch=s,i=wu(!1),d=zu.bind(null,Te,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=zk.bind(null,Te,u,d,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function dp(e){var t=at();return fp(t,Ze,e)}function fp(e,t,s){if(t=ku(e,t,cp)[0],e=Jr(cs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=fi(t)}catch(g){throw g===Fl?Br:g}else i=t;t=at();var u=t.queue,d=u.dispatch;return s!==t.memoizedState&&(Te.flags|=2048,na(9,{destroy:void 0},Mk.bind(null,u,s),null)),[i,d,e]}function Mk(e,t){e.action=t}function hp(e){var t=at(),s=Ze;if(s!==null)return fp(t,s,e);at(),t=t.memoizedState,s=at();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function na(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=Te.updateQueue,t===null&&(t=Zr(),Te.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function mp(){return at().memoizedState}function Pr(e,t,s,i){var u=Rt();Te.flags|=e,u.memoizedState=na(1|t,{destroy:void 0},s,i===void 0?null:i)}function Fr(e,t,s,i){var u=at();i=i===void 0?null:i;var d=u.memoizedState.inst;Ze!==null&&i!==null&&pu(i,Ze.memoizedState.deps)?u.memoizedState=na(t,d,s,i):(Te.flags|=e,u.memoizedState=na(1|t,d,s,i))}function pp(e,t){Pr(8390656,8,e,t)}function Su(e,t){Fr(2048,8,e,t)}function Ok(e){Te.flags|=4;var t=Te.updateQueue;if(t===null)t=Zr(),Te.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function gp(e){var t=at().memoizedState;return Ok({ref:t,nextImpl:e}),function(){if((qe&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function vp(e,t){return Fr(4,2,e,t)}function xp(e,t){return Fr(4,4,e,t)}function bp(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yp(e,t,s){s=s!=null?s.concat([e]):null,Fr(4,4,bp.bind(null,t,e),s)}function Tu(){}function kp(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&pu(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function jp(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&pu(t,i[1]))return i[0];if(i=e(),dl){bs(!0);try{e()}finally{bs(!1)}}return s.memoizedState=[i,t],i}function Cu(e,t,s){return s===void 0||(os&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Og(),Te.lanes|=e,$s|=e,s)}function wp(e,t,s,i){return Wt(s,t)?s:zs.current!==null?(e=Cu(e,s,i),Wt(e,t)||(ut=!0),e):(os&106)===0||(os&1073741824)!==0&&(De&261930)===0?(ut=!0,e.memoizedState=s):(e=Og(),Te.lanes|=e,$s|=e,t)}function Np(e,t,s,i,u){var d=xe.p;xe.p=d!==0&&8>d?d:8;var g=oe.T,k={};k.types=g!==null?g.types:null,oe.T=k,zu(e,!1,t,s);try{var M=u(),B=oe.S;if(B!==null&&B(k,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var G=Ck(M,i);hi(e,t,G,ln(e))}else hi(e,t,i,ln(e))}catch(Q){hi(e,t,{then:function(){},status:"rejected",reason:Q},ln())}finally{xe.p=d,g!==null&&k.types!==null&&(g.types=k.types),oe.T=g}}function _k(){}function Eu(e,t,s,i){if(e.tag!==5)throw Error(o(476));var u=Sp(e).queue;Np(e,u,t,nt,s===null?_k:function(){return Tp(e),s(i)})}function Sp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:nt,baseState:nt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:nt},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Tp(e){var t=Sp(e);t.next===null&&(t=e.alternate.memoizedState),hi(e,t.next.queue,{},ln())}function Au(){return yt(ka)}function Cp(){return at().memoizedState}function Ep(){return at().memoizedState}function Rk(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=ln();e=Es(s);var i=As(t,e,s);i!==null&&(Gt(i,t,s),ri(i,t,s)),t={cache:su()},e.payload=t;return}t=t.return}}function Dk(e,t,s){var i=ln();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Wr(e)?zp(t,s):(s=Zc(e,t,s,i),s!==null&&(Gt(s,e,i),Mp(s,t,i)))}function Ap(e,t,s){var i=ln();hi(e,t,s,i)}function hi(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Wr(e))zp(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var g=t.lastRenderedState,k=d(g,s);if(u.hasEagerState=!0,u.eagerState=k,Wt(k,g))return zr(e,t,u,0),Qe===null&&Ar(),!1}catch{}finally{}if(s=Zc(e,t,u,i),s!==null)return Gt(s,e,i),Mp(s,t,i),!0}return!1}function zu(e,t,s,i){if(i={lane:2,revertLane:yd(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Wr(e)){if(t)throw Error(o(479))}else t=Zc(e,s,i,2),t!==null&&Gt(t,e,2)}function Wr(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function zp(e,t){ea=Xr=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Mp(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Oh(e,s)}}var eo={readContext:yt,use:Qr,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st,useEffectEvent:st},Op={readContext:yt,use:Qr,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:pp,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Pr(4194308,4,bp.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Pr(4194308,4,e,t)},useInsertionEffect:function(e,t){Pr(4,2,e,t)},useMemo:function(e,t){var s=Rt();t=t===void 0?null:t;var i=e();if(dl){bs(!0);try{e()}finally{bs(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Rt();if(s!==void 0){var u=s(t);if(dl){bs(!0);try{s(t)}finally{bs(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Dk.bind(null,Te,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=wu(e);var t=e.queue,s=Ap.bind(null,Te,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Tu,useDeferredValue:function(e,t){var s=Rt();return Cu(s,e,t)},useTransition:function(){var e=wu(!1);return e=Np.bind(null,Te,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=Te,u=Rt();if(ze){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),Qe===null)throw Error(o(349));(De&127)!==0||Wm(i,t,s)}u.memoizedState=s;var d={value:s,getSnapshot:t};return u.queue=d,pp(tp.bind(null,i,d,e),[e]),i.flags|=2048,na(9,{destroy:void 0},ep.bind(null,i,d,s,t),null),s},useId:function(){var e=Rt(),t=Qe.identifierPrefix;if(ze){var s=qn,i=Bn;s=(i&~(1<<32-Pt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Vr++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Ek++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Au,useFormState:up,useActionState:up,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=zu.bind(null,Te,!0,s),s.dispatch=t,[e,t]},useMemoCache:yu,useCacheRefresh:function(){return Rt().memoizedState=Rk.bind(null,Te)},useEffectEvent:function(e){var t=Rt(),s={impl:e};return t.memoizedState=s,function(){if((qe&2)!==0)throw Error(o(440));return s.impl.apply(void 0,arguments)}}},_p={readContext:yt,use:Qr,useCallback:kp,useContext:yt,useEffect:Su,useImperativeHandle:yp,useInsertionEffect:vp,useLayoutEffect:xp,useMemo:jp,useReducer:Jr,useRef:mp,useState:function(){return Jr(cs)},useDebugValue:Tu,useDeferredValue:function(e,t){var s=at();return wp(s,Ze.memoizedState,e,t)},useTransition:function(){var e=Jr(cs)[0],t=at().memoizedState;return[typeof e=="boolean"?e:fi(e),t]},useSyncExternalStore:Fm,useId:Cp,useHostTransitionStatus:Au,useFormState:dp,useActionState:dp,useOptimistic:function(e,t){var s=at();return lp(s,Ze,e,t)},useMemoCache:yu,useCacheRefresh:Ep,useEffectEvent:gp},$k={readContext:yt,use:Qr,useCallback:kp,useContext:yt,useEffect:Su,useImperativeHandle:yp,useInsertionEffect:vp,useLayoutEffect:xp,useMemo:jp,useReducer:ju,useRef:mp,useState:function(){return ju(cs)},useDebugValue:Tu,useDeferredValue:function(e,t){var s=at();return Ze===null?Cu(s,e,t):wp(s,Ze.memoizedState,e,t)},useTransition:function(){var e=ju(cs)[0],t=at().memoizedState;return[typeof e=="boolean"?e:fi(e),t]},useSyncExternalStore:Fm,useId:Cp,useHostTransitionStatus:Au,useFormState:hp,useActionState:hp,useOptimistic:function(e,t){var s=at();return Ze!==null?lp(s,Ze,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:yu,useCacheRefresh:Ep,useEffectEvent:gp};function Mu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:O({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Ou={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=ln(),u=Es(i);u.payload=t,s!=null&&(u.callback=s),t=As(e,u,i),t!==null&&(Gt(t,e,i),ri(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=ln(),u=Es(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=As(e,u,i),t!==null&&(Gt(t,e,i),ri(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=ln(),i=Es(s);i.tag=2,t!=null&&(i.callback=t),t=As(e,i,s),t!==null&&(Gt(t,e,s),ri(t,e,s))}};function Rp(e,t,s,i,u,d,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,d,g):t.prototype&&t.prototype.isPureReactComponent?!Wa(s,i)||!Wa(u,d):!0}function Dp(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&Ou.enqueueReplaceState(t,t.state,null)}function fl(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=O({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function $p(e){Er(e)}function Up(e){console.error(e)}function Lp(e){Er(e)}function to(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Hp(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function _u(e,t,s){return s=Es(s),s.tag=3,s.payload={element:null},s.callback=function(){to(e,t)},s}function Bp(e){return e=Es(e),e.tag=3,e}function qp(e,t,s,i){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var d=i.value;e.payload=function(){return u(d)},e.callback=function(){Hp(t,s,i)}}var g=s.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Hp(t,s,i),typeof u!="function"&&(Us===null?Us=new Set([this]):Us.add(this));var k=i.stack;this.componentDidCatch(i.value,{componentStack:k!==null?k:""})})}function Uk(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&ll(t,s,u,!0),s=kt.current,s!==null){switch(s.tag){case 31:case 13:case 19:return Et===null?wo():s.alternate===null&<===0&&(lt=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===qr?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),vd(e,i,u)),!1;case 22:return s.flags|=65536,i===qr?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),vd(e,i,u)),!1}throw Error(o(435,s.tag))}return vd(e,i,u),wo(),!1}if(ze)return t=kt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Wc&&(e=Error(o(422),{cause:i}),ni(fn(e,s)))):(i!==Wc&&(t=Error(o(423),{cause:i}),ni(fn(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=fn(i,s),u=_u(e.stateNode,i,u),cu(e,u),lt!==4&&(lt=2)),!1;var d=Error(o(520),{cause:i});if(d=fn(d,s),ki===null?ki=[d]:ki.push(d),lt!==4&&(lt=2),t===null)return!0;i=fn(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=_u(s.stateNode,i,e),cu(s,e),!1;case 1:if(t=s.type,d=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Us===null||!Us.has(d))))return s.flags|=65536,u&=-u,s.lanes|=u,u=Bp(u),qp(u,e,s,i),cu(s,u),!1;break;case 22:if(s.memoizedState!==null)return s.flags|=65536,!1}s=s.return}while(s!==null);return!1}var Ru=Error(o(461)),ut=!1;function ft(e,t,s,i){t.child=e===null?Km(t,null,s,i):ul(t,e.child,s,i)}function Ip(e,t,s,i,u){s=s.render;var d=t.ref;if("ref"in i){var g={};for(var k in i)k!=="ref"&&(g[k]=i[k])}else g=i;return al(t),i=gu(e,t,s,g,d,u),k=vu(),e!==null&&!ut?(xu(e,t,u),us(e,t,u)):(ze&&k&&Rr(t),t.flags|=1,ft(e,t,i,u),t.child)}function Yp(e,t,s,i,u){if(e===null){var d=s.type;return typeof d=="function"&&!Qc(d)&&d.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=d,Gp(e,t,d,i,u)):(e=Or(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Iu(e,u)){var g=d.memoizedProps;if(s=s.compare,s=s!==null?s:Wa,s(g,i)&&e.ref===t.ref)return us(e,t,u)}return t.flags|=1,e=ls(d,i),e.ref=t.ref,e.return=t,t.child=e}function Gp(e,t,s,i,u){if(e!==null){var d=e.memoizedProps;if(Wa(d,i)&&e.ref===t.ref)if(ut=!1,t.pendingProps=i=d,Iu(e,u))(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,us(e,t,u)}return Du(e,t,s,i,u)}function Kp(e,t,s,i){var u=i.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|s:s,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~d}else i=0,t.child=null;return Xp(e,t,d,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Hr(t,d!==null?d.cachePool:null),d!==null?Zm(t,d):du(),Qm(t);else return i=t.lanes=536870912,Xp(e,t,d!==null?d.baseLanes|s:s,s,i)}else d!==null?(Hr(t,d.cachePool),Zm(t,d),Os(),t.memoizedState=null):(e!==null&&Hr(t,null),du(),Os());return ft(e,t,u,s),t.child}function mi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Xp(e,t,s,i,u){var d=au();return d=d===null?null:{parent:ot._currentValue,pool:d},t.memoizedState={baseLanes:s,cachePool:d},e!==null&&Hr(t,null),du(),Qm(t),e!==null&&ll(e,t,i,!0),t.childLanes=u,null}function no(e,t){return t=so({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Vp(e,t,s){return ul(t,e.child,null,s),e=no(t,t.pendingProps),e.flags|=2,en(t),t.memoizedState=null,e}function Lk(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(i.mode==="hidden")return e=no(t,i),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},mi(null,e);if(hu(t),(e=Pe)?(e=bv(e,pn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:js!==null?{id:Bn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},s=zm(e),s.return=t,t.child=s,pt=t,Pe=null)):e=null,e===null)throw Ns(t);return t.lanes=536870912,null}return no(t,i)}var d=e.memoizedState;if(d!==null){var g=d.dehydrated;if(hu(t),u)if(t.flags&256)t.flags&=-257,t=Vp(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ut||ll(e,t,s,!1),u=(s&e.childLanes)!==0,ut||u){if(zs.current===null){if(i=Qe,i!==null&&(g=_h(i,s),g!==0&&g!==d.retryLane))throw d.retryLane=g,el(e,g),Gt(i,e,g),Ru;wo()}t=Vp(e,t,s)}else e=d.treeContext,Pe=vn(g.nextSibling),pt=t,ze=!0,ws=null,pn=!1,e!==null&&_m(t,e),t=no(t,i),t.flags|=134221824;return t}return e=ls(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sa(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(o(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function Du(e,t,s,i,u){return al(t),s=gu(e,t,s,i,void 0,u),i=vu(),e!==null&&!ut?(xu(e,t,u),us(e,t,u)):(ze&&i&&Rr(t),t.flags|=1,ft(e,t,s,u),t.child)}function Zp(e,t,s,i,u,d){return al(t),t.updateQueue=null,s=Pm(t,i,s,u),Jm(e),i=vu(),e!==null&&!ut?(xu(e,t,d),us(e,t,d)):(ze&&i&&Rr(t),t.flags|=1,ft(e,t,s,d),t.child)}function Qp(e,t,s,i,u){if(al(t),t.stateNode===null){var d=Vl,g=s.contextType;typeof g=="object"&&g!==null&&(d=yt(g)),d=new s(i,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Ou,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=i,d.state=t.memoizedState,d.refs={},ru(t),g=s.contextType,d.context=typeof g=="object"&&g!==null?yt(g):Vl,d.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(Mu(t,s,g,i),d.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(g=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),g!==d.state&&Ou.enqueueReplaceState(d,d.state,null),ci(t,i,d,u),oi(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){d=t.stateNode;var k=t.memoizedProps,M=fl(s,k);d.props=M;var B=d.context,G=s.contextType;g=Vl,typeof G=="object"&&G!==null&&(g=yt(G));var Q=s.getDerivedStateFromProps;G=typeof Q=="function"||typeof d.getSnapshotBeforeUpdate=="function",k=t.pendingProps!==k,G||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(k||B!==g)&&Dp(t,d,i,g),Cs=!1;var L=t.memoizedState;d.state=L,ci(t,i,d,u),oi(),B=t.memoizedState,k||L!==B||Cs?(typeof Q=="function"&&(Mu(t,s,Q,i),B=t.memoizedState),(M=Cs||Rp(t,s,M,i,L,B,g))?(G||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=B),d.props=i,d.state=B,d.context=g,i=M):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{d=t.stateNode,ou(e,t),g=t.memoizedProps,G=fl(s,g),d.props=G,Q=t.pendingProps,L=d.context,B=s.contextType,M=Vl,typeof B=="object"&&B!==null&&(M=yt(B)),k=s.getDerivedStateFromProps,(B=typeof k=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==Q||L!==M)&&Dp(t,d,i,M),Cs=!1,L=t.memoizedState,d.state=L,ci(t,i,d,u),oi();var Y=t.memoizedState;g!==Q||L!==Y||Cs||e!==null&&e.dependencies!==null&&Ur(e.dependencies)?(typeof k=="function"&&(Mu(t,s,k,i),Y=t.memoizedState),(G=Cs||Rp(t,s,G,i,L,Y,M)||e!==null&&e.dependencies!==null&&Ur(e.dependencies))?(B||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(i,Y,M),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(i,Y,M)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=Y),d.props=i,d.state=Y,d.context=M,i=G):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),i=!1)}return d=i,sa(e,t),i=(t.flags&128)!==0,d||i?(d=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&i?(t.child=ul(t,e.child,null,u),t.child=ul(t,null,s,u)):ft(e,t,s,u),t.memoizedState=d.state,e=t.child):e=us(e,t,u),e}function Jp(e,t,s,i){return nl(),t.flags|=256,ft(e,t,s,i),t.child}var $u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uu(e){return{baseLanes:e,cachePool:Hm()}}function Lu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=sn),e}function Pp(e,t,s){var i=t.pendingProps,u=!1,d=(t.flags&128)!==0,g;if((g=d)||(g=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),g&&(u=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(u?Ms(t):Os(),(e=Pe)?(e=bv(e,pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:js!==null?{id:Bn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},s=zm(e),s.return=t,t.child=s,pt=t,Pe=null)):e=null,e===null)throw Ns(t);return Ud(e)?t.lanes=32:t.lanes=536870912,null}return d=i.children,i=i.fallback,u?(Os(),u=t.mode,d=so({mode:"hidden",children:d},u),i=tl(i,u,s,null),d.return=t,i.return=t,d.sibling=i,t.child=d,i=t.child,i.memoizedState=Uu(s),i.childLanes=Lu(e,g,s),t.memoizedState=$u,mi(null,i)):(Ms(t),Hu(t,d))}var k=e.memoizedState;if(k!==null){var M=k.dehydrated;if(M!==null)return Hk(e,t,d,g,i,M,k,s)}return u?(Os(),u=i.fallback,d=t.mode,k=e.child,M=k.sibling,i=ls(k,{mode:"hidden",children:i.children}),i.subtreeFlags=k.subtreeFlags&1206910976,M!==null?u=ls(M,u):(u=tl(u,d,s,null),u.flags|=2),u.return=t,i.return=t,i.sibling=u,t.child=i,mi(null,i),i=t.child,u=e.child.memoizedState,u===null?u=Uu(s):(d=u.cachePool,d!==null?(k=ot._currentValue,d=d.parent!==k?{parent:k,pool:k}:d):d=Hm(),u={baseLanes:u.baseLanes|s,cachePool:d}),i.memoizedState=u,i.childLanes=Lu(e,g,s),t.memoizedState=$u,mi(e.child,i)):(Ms(t),s=e.child,e=s.sibling,s=ls(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=s,t.memoizedState=null,s)}function Hu(e,t){return t=so({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function so(e,t){return e=Bt(22,e,null,t),e.lanes=0,e}function lo(e,t,s){return ul(t,e.child,null,s),e=Hu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hk(e,t,s,i,u,d,g,k){if(s)return t.flags&256?(Ms(t),t.flags&=-257,lo(e,t,k)):t.memoizedState!==null?(Os(),t.child=e.child,t.flags|=128,null):(Os(),d=u.fallback,g=t.mode,u=so({mode:"visible",children:u.children},g),d=tl(d,g,k,null),d.flags|=2,u.return=t,d.return=t,u.sibling=d,t.child=u,ul(t,e.child,null,k),u=t.child,u.memoizedState=Uu(k),u.childLanes=Lu(e,i,k),t.memoizedState=$u,mi(null,u));if(Ms(t),Ud(d)){if(i=d.nextSibling&&d.nextSibling.dataset,i)var M=i.dgst;return i=M,i!==""&&(u=Error(o(419)),u.stack="",u.digest=i,ni({value:u,source:null,stack:null})),lo(e,t,k)}if(ut||ll(e,t,k,!1),i=(k&e.childLanes)!==0,ut||i){if(zs.current!==null)return lo(e,t,k);if(i=Qe,i!==null&&(u=_h(i,k),u!==0&&u!==g.retryLane))throw g.retryLane=u,el(e,u),Gt(i,e,u),Ru;return $d(d)||wo(),lo(e,t,k)}return $d(d)?(t.flags|=192,t.child=e.child,null):(e=g.treeContext,Pe=vn(d.nextSibling),pt=t,ze=!0,ws=null,pn=!1,e!==null&&_m(t,e),t=Hu(t,u.children),t.flags|=134221824,t)}function Fp(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),$r(e.return,t,s)}function Wp(e){for(var t=null;e!==null;){var s=e.alternate;s!==null&&Kr(s)===null&&(t=e),e=e.sibling}return t}function ao(e,t,s,i,u,d){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:d}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=i,g.tail=s,g.tailMode=u,g.treeForkCount=d)}function Bu(e){var t=e.child;for(e.child=null;t!==null;){var s=t.sibling;t.sibling=e.child,e.child=t,t=s}}function qu(e,t,s){var i=t.pendingProps,u=i.revealOrder,d=i.tail;i=i.children;var g=jt.current;if(t.flags&128)return ui(t,g),null;var k=(g&2)!==0;if(k?(g=g&1|2,t.flags|=128):g&=1,ui(t,g),u==="backwards"&&e!==null?(Bu(e),ft(e,t,i,s),Bu(e)):ft(e,t,i,s),i=ze?ti:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fp(e,s,t);else if(e.tag===19)Fp(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"backwards":s=Wp(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null,Bu(t)),ao(t,!0,u,null,d,i);break;case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Kr(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}ao(t,!0,s,null,d,i);break;case"together":ao(t,!1,null,null,void 0,i);break;case"independent":t.memoizedState=null;break;default:s=Wp(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),ao(t,!1,u,s,d,i)}return t.child}function eg(e,t,s){var i=t.pendingProps;return Ss(t,t.type,i.value),ft(e,t,i.children,s),t.child}function us(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),$s|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(ll(e,t,s,!1),(s&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,s=ls(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=ls(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Iu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ur(e)))}function Bk(e,t,s){switch(t.tag){case 3:ur(t,t.stateNode.containerInfo),Ss(t,ot,e.memoizedState.cache),nl();break;case 27:case 5:pc(t);break;case 4:ur(t,t.stateNode.containerInfo);break;case 10:Ss(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,hu(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return Ms(t),t.flags|=128,null;i=ll(e,t,s,!1);var u=t.child.childLanes;return i||(s&u)!==0?Pp(e,t,s):(Ms(t),e=us(e,t,s),e!==null?e.sibling:null)}Ms(t);break;case 19:if(t.flags&128)return qu(e,t,s);if(u=(e.flags&128)!==0,i=(s&t.childLanes)!==0,i||(ll(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return qu(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ui(t,jt.current),i)break;return null;case 22:return t.lanes=0,Kp(e,t,s,t.pendingProps);case 24:Ss(t,ot,e.memoizedState.cache)}return us(e,t,s)}function tg(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)ut=!0;else{if(!Iu(e,s)&&(t.flags&128)===0)return ut=!1,Bk(e,t,s);ut=(e.flags&131072)!==0}else ut=!1,ze&&(t.flags&1048576)!==0&&Om(t,ti,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=ol(t.elementType),t.type=e,typeof e=="function")Qc(e)?(i=fl(e,i),t.tag=1,t=Qp(null,t,e,i,s)):(t.tag=0,t=Du(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===se){t.tag=11,t=Ip(null,t,e,i,s);break e}else if(u===Me){t.tag=14,t=Yp(null,t,e,i,s);break e}else if(u===Oe){t.tag=10,t.type=e,t=eg(null,t,s);break e}}throw t=ae(e)||e,Error(o(306,t,""))}}return t;case 0:return Du(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=fl(i,t.pendingProps),Qp(e,t,i,u,s);case 3:e:{if(ur(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var d=t.memoizedState;u=d.element,ou(e,t),ci(t,i,null,s);var g=t.memoizedState;if(i=g.cache,Ss(t,ot,i),i!==d.cache&&nu(t,[ot],s,!0),oi(),i=g.element,d.isDehydrated)if(d={element:i,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=Jp(e,t,i,s);break e}else if(i!==u){u=fn(Error(o(424)),t),ni(u),t=Jp(e,t,i,s);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(Pe=vn(e.firstChild),pt=t,ze=!0,ws=null,pn=!0,s=Km(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|134221824,s=s.sibling}else{if(nl(),i===u){t=us(e,t,s);break e}ft(e,t,i,s)}t=t.child}return t;case 26:return sa(e,t),e===null?(s=Tv(t.type,null,t.pendingProps,null))?t.memoizedState=s:ze||(t.stateNode=av(t.type,t.pendingProps,Tn.current,t)):t.memoizedState=Tv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pc(t),e===null&&ze&&(i=t.stateNode=jv(t.type,t.pendingProps,Tn.current),pt=t,pn=!0,u=Pe,Bs(t.type)?(Ld=u,Pe=vn(i.firstChild)):Pe=u),ft(e,t,t.pendingProps.children,s),sa(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((u=i=Pe)&&(i=Rj(i,t.type,t.pendingProps,pn),i!==null?(t.stateNode=i,pt=t,Pe=vn(i.firstChild),pn=!1,u=!0):u=!1),u||Ns(t)),pc(t),u=t.type,d=t.pendingProps,g=e!==null?e.memoizedProps:null,i=d.children,Ad(u,d)?i=null:g!==null&&Ad(u,g)&&(t.flags|=32),t.memoizedState!==null&&(u=gu(e,t,Ak,null,null,s),ka._currentValue=u),sa(e,t),ft(e,t,i,s),t.child;case 6:return e===null&&ze&&((e=s=Pe)&&(s=Dj(s,t.pendingProps,pn),s!==null?(t.stateNode=s,pt=t,Pe=null,e=!0):e=!1),e||Ns(t)),null;case 13:return Pp(e,t,s);case 4:return ur(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=ul(t,null,i,s):ft(e,t,i,s),t.child;case 11:return Ip(e,t,t.type,t.pendingProps,s);case 7:return i=t.pendingProps,sa(e,t),ft(e,t,i,s),t.child;case 8:return ft(e,t,t.pendingProps.children,s),t.child;case 12:return ft(e,t,t.pendingProps.children,s),t.child;case 10:return eg(e,t,s);case 9:return u=t.type._context,i=t.pendingProps.children,al(t),u=yt(u),i=i(u),t.flags|=1,ft(e,t,i,s),t.child;case 14:return Yp(e,t,t.type,t.pendingProps,s);case 15:return Gp(e,t,t.type,t.pendingProps,s);case 19:return qu(e,t,s);case 31:return Lk(e,t,s);case 22:return Kp(e,t,s,t.pendingProps);case 24:return al(t),i=yt(ot),e===null?(u=au(),u===null&&(u=Qe,d=su(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=s),u=d),t.memoizedState={parent:i,cache:u},ru(t),Ss(t,ot,u)):((e.lanes&s)!==0&&(ou(e,t),ci(t,null,null,s),oi()),u=e.memoizedState,d=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Ss(t,ot,i)):(i=d.cache,Ss(t,ot,i),i!==u.cache&&nu(t,[ot],s,!0))),ft(e,t,t.pendingProps.children,s),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),i=t.pendingProps,i.name!=null&&i.name!=="auto"?t.flags|=e===null?18882560:18874368:ze&&Rr(t),e!==null&&e.memoizedProps.name!==i.name?t.flags|=4194816:sa(e,t),ft(e,t,i.children,s),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ds(e){e.flags|=4}function Yu(e,t,s,i,u){var d;if((d=(e.mode&32)!==0)&&(d=s===null?zv(t,i):zv(t,i)&&(i.src!==s.src||i.srcSet!==s.srcSet)),d){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if($g())e.flags|=8192;else throw cl=qr,iu}else e.flags&=-16777217}function ng(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Mv(t))if($g())e.flags|=8192;else throw cl=qr,iu}function io(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?zh():536870912,e.lanes|=t,oa|=t)}function pi(e,t){if(!ze)switch(e.tailMode){case"visible":break;case"collapsed":for(var s=e.tail,i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null;break;default:for(t=e.tail,s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null}}function Fe(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags&1206910976,i|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function qk(e,t,s){var i=t.pendingProps;switch(Fc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fe(t),null;case 1:return Fe(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),rs(ot),Rl(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Jl(t)?ds(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,eu())),Fe(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(ds(t),d!==null?(Fe(t),ng(t,d)):(Fe(t),Yu(t,u,null,i,s))):d?d!==e.memoizedState?(ds(t),Fe(t),ng(t,d)):(Fe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ds(t),Fe(t),Yu(t,u,e,i,s)),null;case 27:if(dr(t),s=Tn.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ds(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return Fe(t),t.subtreeFlags&=-33554433,null}e=Zt.current,Jl(t)?Rm(t):(e=jv(u,i,s),t.stateNode=e,ds(t))}return Fe(t),t.subtreeFlags&=-33554433,null;case 5:if(dr(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ds(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return Fe(t),t.subtreeFlags&=-33554433,null}if(d=Zt.current,Jl(t))Rm(t);else{var g=Ti(Tn.current);switch(d){case 1:d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=g.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof i.is=="string"?g.createElement("select",{is:i.is}):g.createElement("select"),i.multiple?d.multiple=!0:i.size&&(d.size=i.size);break;default:d=typeof i.is=="string"?g.createElement(u,{is:i.is}):g.createElement(u)}}d[bt]=t,d[Ht]=i;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)d.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=d;e:switch(Nt(d,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ds(t)}}return Fe(t),t.subtreeFlags&=-33554433,Yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ds(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=Tn.current,Jl(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=pt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[bt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||tv(e.nodeValue,s)),e||Ns(t,!0)}else e=Ti(e).createTextNode(i),e[bt]=t,t.stateNode=e}return Fe(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Jl(t),s!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[bt]=t}else nl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),e=!1}else s=eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(en(t),t):(en(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Fe(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Jl(t),i!==null&&i.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[bt]=t}else nl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),u=!1}else u=eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(en(t),t):(en(t),null)}return en(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),io(t,t.updateQueue),Fe(t),null);case 4:return Rl(),e===null&&Nd(t.stateNode.containerInfo),t.flags|=67108864,Fe(t),null;case 10:return rs(t.type),Fe(t),null;case 19:if(mu(t),i=t.memoizedState,i===null)return Fe(t),null;if(u=(t.flags&128)!==0,d=i.rendering,d===null)if(u)pi(i,!1);else{if(lt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Kr(e),d!==null){for(t.flags|=128,pi(i,!1),e=d.updateQueue,t.updateQueue=e,io(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Am(s,e),s=s.sibling;return ui(t,jt.current&1|2),ze&&as(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Qt()>bo&&(t.flags|=128,u=!0,pi(i,!1),t.lanes=4194304)}else{if(!u)if(e=Kr(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,io(t,e),pi(i,!0),i.tail===null&&i.tailMode!=="collapsed"&&i.tailMode!=="visible"&&!d.alternate&&!ze)return Fe(t),null}else 2*Qt()-i.renderingStartTime>bo&&s!==536870912&&(t.flags|=128,u=!0,pi(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(e=i.last,e!==null?e.sibling=d:t.child=d,i.last=d)}if(i.tail!==null){e=i.tail;e:{for(s=e;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Qt(),e.sibling=null,d=jt.current,d=u?d&1|2:d&1,i.tailMode==="visible"||i.tailMode==="collapsed"||!s||ze?ui(t,d):(s=d,Ye(kt,t),Ye(jt,s),Et===null&&(Et=t)),ze&&as(t,i.treeForkCount),e}return Fe(t),null;case 22:case 23:return en(t),fu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(Fe(t),t.subtreeFlags&6&&(t.flags|=8192)):Fe(t),s=t.updateQueue,s!==null&&io(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&rt(rl),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),rs(ot),Fe(t),null;case 25:return null;case 30:return t.flags|=33554432,Fe(t),null}throw Error(o(156,t.tag))}function Ik(e,t){switch(Fc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(ot),Rl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dr(t),null;case 31:if(t.memoizedState!==null){if(en(t),t.alternate===null)throw Error(o(340));nl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(en(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));nl()}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 Rl(),null;case 10:return rs(t.type),null;case 22:case 23:return en(t),fu(),e!==null&&rt(rl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return rs(ot),null;case 25:return null;default:return null}}function sg(e,t){switch(Fc(t),t.tag){case 3:rs(ot),Rl();break;case 26:case 27:case 5:dr(t);break;case 4:Rl();break;case 31:t.memoizedState!==null&&en(t);break;case 13:en(t);break;case 19:mu(t);break;case 10:rs(t.type);break;case 22:case 23:en(t),fu(),e!==null&&rt(rl);break;case 24:rs(ot)}}function gi(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var u=i.next;s=u;do{if((s.tag&e)===e){i=void 0;var d=s.create,g=s.inst;i=d(),g.destroy=i}s=s.next}while(s!==u)}}catch(k){Ke(t,t.return,k)}}function _s(e,t,s){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var d=u.next;i=d;do{if((i.tag&e)===e){var g=i.inst,k=g.destroy;if(k!==void 0){g.destroy=void 0,u=t;var M=s,B=k;try{B()}catch(G){Ke(u,M,G)}}}i=i.next}while(i!==d)}}catch(G){Ke(t,t.return,G)}}function lg(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Vm(t,s)}catch(i){Ke(e,e.return,i)}}}function ag(e,t,s){s.props=fl(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Ke(e,t,i)}}function In(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:var u=e.stateNode,d=ns(e.memoizedProps,u);(u.ref===null||u.ref.name!==d)&&(u.ref=fv(d)),i=u.ref;break;case 7:if(e.stateNode===null){var g=new an(e);b(e.child,!1,Oj,g,void 0,void 0),e.stateNode=g}i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(k){Ke(e,t,k)}}function wt(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(u){Ke(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Ke(e,t,u)}else s.current=null}function ro(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var s=0;s<t.length;s++)xv(e.stateNode,t[s])}function ig(e){for(var t=e.return;t!==null&&(Ku(t)&&xv(e.stateNode,t.stateNode),!Gu(t));)t=t.return}function vi(e){for(var t=e.return;t!==null&&(Ku(t)&&_j(e.stateNode,t.stateNode),!Gu(t));)t=t.return}function Gu(e){return e.tag===5||e.tag===3||e.tag===27}function Ku(e){return e&&e.tag===7&&e.stateNode!==null}function Xu(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(u){Ke(e,e.return,u)}}function Vu(e,t,s){try{var i=e.stateNode;mj(i,e.type,s,t),i[Ht]=t}catch(u){Ke(e,e.return,u)}}function rg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function Zu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rg(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&&Bs(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 Qu(e,t,s,i){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(u,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(u),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Hn)),ro(e,i),Be=!0;else if(u!==4&&(u===27&&(ro(e,i),i=null,Bs(e.type)&&(s=e.stateNode,t=null)),e=e.child,e!==null))for(Qu(e,t,s,i),e=e.sibling;e!==null;)Qu(e,t,s,i),e=e.sibling}function oo(e,t,s,i){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?s.insertBefore(u,t):s.appendChild(u),ro(e,i),Be=!0;else if(u!==4&&(u===27&&(ro(e,i),i=null,Bs(e.type)&&(s=e.stateNode)),e=e.child,e!==null))for(oo(e,t,s,i),e=e.sibling;e!==null;)oo(e,t,s,i),e=e.sibling}function og(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,s),t[bt]=e,t[Ht]=s}catch(d){Ke(e,e.return,d)}}var co=!1,tn=null;function cg(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(co=!0)}var Yn=null;function ug(){var e=Yn;return Yn=null,e}var qt=0;function la(e,t,s,i,u){return qt=0,dg(e.child,t,s,i,u)}function dg(e,t,s,i,u){for(var d=!1;e!==null;){if(e.tag===5){var g=e.stateNode;if(i!==null){var k=Od(g);i.push(k),k.view&&(d=!0)}else d||Od(g).view&&(d=!0);co=!0,uv(g,qt===0?t:t+"_"+qt,s),qt++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||dg(e.child,t,s,i,u)&&(d=!0));e=e.sibling}return d}function Gn(e,t){for(;e!==null;)e.tag===5?dv(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Gn(e.child,t)),e=e.sibling}function uo(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(uo(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 s=t.name;t=ss(t.default,t.share),t!=="none"&&(la(e,s,t,null,!1)||Gn(e.child,!1))}e=e.sibling}}function Ju(e,t){if(e.tag===30){var s=e.stateNode,i=e.memoizedProps,u=ns(i,s),d=ss(i.default,s.paired?i.share:i.enter);d!=="none"?la(e,u,d,null,!1)?(uo(e),s.paired||t||fa(e,i.onEnter)):Gn(e.child,!1):uo(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Ju(e,t),e=e.sibling;else uo(e)}function Pu(e){if(tn!==null&&tn.size!==0){var t=tn;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 s=e.memoizedProps,i=s.name;if(i!=null&&i!=="auto"){var u=t.get(i);if(u!==void 0){var d=ss(s.default,s.share);if(d!=="none"&&(la(e,i,d,null,!1)?(d=e.stateNode,u.paired=d,d.paired=u,fa(e,s.onShare)):Gn(e.child,!1)),t.delete(i),t.size===0)break}}}Pu(e)}e=e.sibling}}}function Fu(e){if(e.tag===30){var t=e.memoizedProps,s=ns(t,e.stateNode),i=tn!==null?tn.get(s):void 0,u=ss(t.default,i!==void 0?t.share:t.exit);u!=="none"&&(la(e,s,u,null,!1)?i!==void 0?(u=e.stateNode,i.paired=u,u.paired=i,tn.delete(s),fa(e,t.onShare)):fa(e,t.onExit):Gn(e.child,!1)),tn!==null&&Pu(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Fu(e),e=e.sibling;else tn!==null&&Pu(e)}function fg(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,s=ns(t,e.stateNode);t=ss(t.default,t.update),e.flags&=-5,t!=="none"&&la(e,s,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&fg(e);e=e.sibling}}function Wu(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,Gn(e.child,!1))}Wu(e)}e=e.sibling}}function fo(e){if(e.tag===30)e.stateNode.paired=null,Gn(e.child,!1),Wu(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)fo(e),e=e.sibling;else Wu(e)}function hg(e){for(e=e.child;e!==null;)e.tag===30?Gn(e.child,!1):(e.subtreeFlags&33554432)!==0&&hg(e),e=e.sibling}function ed(e,t,s,i,u,d,g){for(var k=!1;t!==null;){if(t.tag===5){var M=t.stateNode;if(d!==null&&qt<d.length){var B=d[qt],G=Od(M);(B.view||G.view)&&(k=!0);var Q;if(Q=(e.flags&4)===0)if(G.clip)Q=!0;else{Q=B.rect;var L=G.rect;Q=Q.y!==L.y||Q.x!==L.x||Q.height!==L.height||Q.width!==L.width}Q&&(e.flags|=4),G.abs?G=!B.abs:(B=B.rect,G=G.rect,G=B.height!==G.height||B.width!==G.width),G&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&uv(M,qt===0?s:s+"_"+qt,u),k&&(e.flags&4)!==0||(Yn===null&&(Yn=[]),Yn.push(M,qt===0?i:i+"_"+qt,t.memoizedProps)),qt++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&g?e.flags|=t.flags&32:ed(e,t.child,s,i,u,d,g)&&(k=!0));t=t.sibling}return k}function mg(e,t){for(e=e.child;e!==null;){if(e.tag===30){var s=e.memoizedProps,i=e.stateNode,u=ns(s,i),d=ss(s.default,s.update),g;g=e.memoizedState,e.memoizedState=null,i=e;var k=e.child;qt=0,u=ed(i,k,u,u,d,g,!1),(e.flags&4)!==0&&u&&fa(e,s.onUpdate)}else(e.subtreeFlags&33554432)!==0&&mg(e);e=e.sibling}}var gt=!1,Ie=!1,Kn=!1,td=!1,pg=typeof WeakSet=="function"?WeakSet:Set,vt=null,Xn=!1,xi=!1,ho=!1,nd=!1;function Yk(e,t,s){if(e=e.containerInfo,Cd=ja,e=bm(e),Ic(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var d=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var k=0,M=-1,B=-1,G=0,Q=0,L=e,Y=null;t:for(;;){for(var ie;L!==i||d!==0&&L.nodeType!==3||(M=k+d),L!==g||u!==0&&L.nodeType!==3||(B=k+u),L.nodeType===3&&(k+=L.nodeValue.length),(ie=L.firstChild)!==null;)Y=L,L=ie;for(;;){if(L===e)break t;if(Y===i&&++G===d&&(M=k),Y===g&&++Q===u&&(B=k),(ie=L.nextSibling)!==null)break;L=Y,Y=L.parentNode}L=ie}i=M===-1||B===-1?null:{start:M,end:B}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ed={focusedElem:e,selectionRange:i},ja=!1,s=(s&335544064)===s,vt=t,t=s?9270:1024;vt!==null;){if(e=vt,s&&(i=e.deletions,i!==null))for(d=0;d<i.length;d++)s&&Fu(i[d]);if(e.alternate===null&&(e.flags&2)!==0)s&&cg(e),mo(s);else{if(e.tag===22){if(i=e.alternate,e.memoizedState!==null){i!==null&&i.memoizedState===null&&s&&Fu(i),mo(s);continue}else if(i!==null&&i.memoizedState!==null){s&&cg(e),mo(s);continue}}i=e.child,(e.subtreeFlags&t)!==0&&i!==null?(i.return=e,vt=i):(s&&fg(e),mo(s))}}tn=null}function mo(e){for(;vt!==null;){var t=vt,s=e,i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&i!==null){s=void 0,u=i.memoizedProps,i=i.memoizedState;var d=t.stateNode;try{var g=fl(t.type,u);s=d.getSnapshotBeforeUpdate(g,i),d.__reactInternalSnapshotBeforeUpdate=s}catch(k){Ke(t,t.return,k)}}break;case 3:if((u&1024)!==0){if(i=t.stateNode.containerInfo,s=i.nodeType,s===9)Dd(i);else if(s===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dd(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:s&&i!==null&&(s=ns(i.memoizedProps,i.stateNode),u=t.memoizedProps,u=ss(u.default,u.update),u!=="none"&&la(i,s,u,i.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(i=t.sibling,i!==null){i.return=t.return,vt=i;break}vt=t.return}}function gg(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Vn(e,s),i&4&&gi(5,s);break;case 1:if(Vn(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(g){Ke(s,s.return,g)}else{var u=fl(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){Ke(s,s.return,g)}}i&64&&lg(s),i&512&&In(s,s.return);break;case 3:if(Vn(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Vm(e,t)}catch(g){Ke(s,s.return,g)}}break;case 27:t===null&&i&4&&og(s);case 26:case 5:Vn(e,s),t===null&&i&4&&Xu(s),i&512&&In(s,s.return);break;case 12:Vn(e,s);break;case 31:Vn(e,s),i&4&&yg(e,s);break;case 13:Vn(e,s),i&4&&kg(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=tj.bind(null,s),$j(e,s))));break;case 22:if(i=s.memoizedState!==null||gt,!i){var d=t!==null&&t.memoizedState!==null||Ie;t=gt,u=Ie,gt=i,(Ie=d)&&!u?(i=2,(s.subtreeFlags&8772)!==0&&(i|=1),zn(e,s,i)):Vn(e,s),gt=t,Ie=u}break;case 30:Vn(e,s),i&512&&In(s,s.return);break;case 7:i&512&&In(s,s.return);default:Vn(e,s)}}function sd(e,t){for(e=e.child;e!==null;)vg(e,t),e=e.sibling}function vg(e,t){switch(e.tag){case 5:case 26:try{var s=e.stateNode;if(t){var i=s.style;typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"}else{var u=e.stateNode,d=e.memoizedProps.style,g=d!=null&&d.hasOwnProperty("display")?d.display:null;u.style.display=g==null||typeof g=="boolean"?"":(""+g).trim()}}catch(M){Ke(e,e.return,M)}ld(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Be=!0}catch(M){Ke(e,e.return,M)}break;case 18:try{var k=e.stateNode;t?cv(k,!0):cv(e.stateNode,!1)}catch(M){Ke(e,e.return,M)}break;case 22:case 23:e.memoizedState===null&&sd(e,t);break;default:sd(e,t)}}function ld(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var s=e,i=t;switch(s.tag){case 4:vg(s,i);break e;case 22:s.memoizedState===null&&ld(s,i);break e;default:ld(s,i)}}e=e.sibling}}function xg(e){var t=e.alternate;t!==null&&(e.alternate=null,xg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xr(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 et=null,It=!1;function En(e,t,s){for(s=s.child;s!==null;)bg(e,t,s),s=s.sibling}function bg(e,t,s){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(qa,s)}catch{}switch(s.tag){case 26:Ie||wt(s,t),En(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&!Ie&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Ie||wt(s,t),vi(s);var i=et,u=It;Bs(s.type)&&(et=s.stateNode,It=!1),En(e,t,s),wv(s.stateNode,s.type,s.memoizedProps),et=i,It=u;break;case 5:Ie||wt(s,t),vi(s);case 6:if(s.tag===6&&vi(s),i=et,u=It,et=null,En(e,t,s),et=i,It=u,et!==null)if(It)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(s.stateNode),Be=!0}catch(d){Ke(s,t,d)}else try{et.removeChild(s.stateNode),Be=!0}catch(d){Ke(s,t,d)}break;case 18:et!==null&&(It?(e=et,ov(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),wa(e)):ov(et,s.stateNode));break;case 4:i=et,u=It,et=s.stateNode.containerInfo,It=!0,En(e,t,s),et=i,It=u;break;case 0:case 11:case 14:case 15:_s(2,s,t),Ie||_s(4,s,t),En(e,t,s);break;case 1:Ie||(wt(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&ag(s,t,i)),En(e,t,s);break;case 21:En(e,t,s);break;case 22:Ie=(i=Ie)||s.memoizedState!==null,En(e,t,s),Ie=i;break;case 30:wt(s,t),En(e,t,s);break;case 7:Ie||wt(s,t),En(e,t,s);break;default:En(e,t,s)}}function yg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{wa(e)}catch(s){Ke(t,t.return,s)}}}function kg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{wa(e)}catch(s){Ke(t,t.return,s)}}function Gk(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new pg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new pg),t;default:throw Error(o(435,e.tag))}}function po(e,t){var s=Gk(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=nj.bind(null,e,i);i.then(u,u)}})}function Dt(e,t,s){var i=t.deletions;if(i!==null)for(var u=0;u<i.length;u++){var d=i[u],g=e,k=t,M=k;e:for(;M!==null;){switch(M.tag){case 27:if(Bs(M.type)){et=M.stateNode,It=!1;break e}break;case 5:et=M.stateNode,It=!1;break e;case 3:case 4:et=M.stateNode.containerInfo,It=!0;break e}M=M.return}if(et===null)throw Error(o(160));bg(g,k,d),et=null,It=!1,g=d.alternate,g!==null&&(g.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)jg(t,e,s),t=t.sibling}var An=null;function jg(e,t,s){var i=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(i=e.updateQueue,i=i!==null?i.events:null,i!==null))for(var d=0;d<i.length;d++){var g=i[d];g.ref.impl=g.nextImpl}Dt(t,e,s),$t(e),u&4&&(_s(3,e,e.return),gi(3,e),_s(5,e,e.return));break;case 1:Dt(t,e,s),$t(e),u&512&&(Ie||i===null||wt(i,i.return)),u&64&>&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?t:s.concat(t))));break;case 26:if(d=An,Dt(t,e,s),$t(e),u&512&&(Ie||i===null||wt(i,i.return)),u&4)if(u=i!==null?i.memoizedState:null,s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null)if(gt)e.stateNode=av(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,s=e.memoizedProps,u=d.ownerDocument||d;t:switch(t){case"title":i=u.getElementsByTagName("title")[0],(!i||i[Ga]||i[bt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=u.createElement(t),u.head.insertBefore(i,u.querySelector("head > title"))),Nt(i,t,s),i[bt]=e,mt(i),t=i;break e;case"link":if(d=Av("link","href",u).get(t+(s.href||""))){for(g=0;g<d.length;g++)if(i=d[g],i.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&i.getAttribute("rel")===(s.rel==null?null:s.rel)&&i.getAttribute("title")===(s.title==null?null:s.title)&&i.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){d.splice(g,1);break t}}i=u.createElement(t),Nt(i,t,s),u.head.appendChild(i);break;case"meta":if(d=Av("meta","content",u).get(t+(s.content||""))){for(g=0;g<d.length;g++)if(i=d[g],i.getAttribute("content")===(s.content==null?null:""+s.content)&&i.getAttribute("name")===(s.name==null?null:s.name)&&i.getAttribute("property")===(s.property==null?null:s.property)&&i.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&i.getAttribute("charset")===(s.charSet==null?null:s.charSet)){d.splice(g,1);break t}}i=u.createElement(t),Nt(i,t,s),u.head.appendChild(i);break;default:throw Error(o(468,t))}i[bt]=e,mt(i),t=i}e.stateNode=t}else gt||Id(d,e.type,e.stateNode);else e.stateNode=Ev(d,s,e.memoizedProps);else u!==s?(u===null?(t=i.stateNode,t===null||Ie||t.parentNode.removeChild(t)):u.count--,s===null?gt||Id(d,e.type,e.stateNode):Ev(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Vu(e,e.memoizedProps,i.memoizedProps);break;case 27:Dt(t,e,s),$t(e),u&512&&(Ie||i===null||wt(i,i.return)),i!==null&&u&4&&Vu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(d=Kn,Kn=!1,Dt(t,e,s),Kn=d,$t(e),u&512&&(Ie||i===null||wt(i,i.return)),e.flags&32){t=e.stateNode;try{Bl(t,""),Be=!0}catch(G){Ke(e,e.return,G)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,Vu(e,t,i!==null?i.memoizedProps:t)),u&1024&&(td=!0);break;case 6:if(Dt(t,e,s),$t(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,s=e.stateNode;try{s.nodeValue=t,Be=!0}catch(G){Ke(e,e.return,G)}}break;case 3:if(Be=!1,zo=null,d=An,An=Ci(t.containerInfo),Dt(t,e,s),An=d,$t(e),u&4&&i!==null&&i.memoizedState.isDehydrated)try{wa(t.containerInfo)}catch(G){Ke(e,e.return,G)}td&&(td=!1,wg(e)),Be=!1;break;case 4:u=Kn,Kn=gt,i=Yh(),d=An,An=Ci(e.stateNode.containerInfo),Dt(t,e,s),$t(e),An=d,Be&&xi&&(ho=!0),Be=i,Kn=u;break;case 12:Dt(t,e,s),$t(e);break;case 31:Dt(t,e,s),$t(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,po(e,t)));break;case 13:Dt(t,e,s),$t(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(xo=Qt()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,po(e,t)));break;case 22:d=e.memoizedState!==null,g=i!==null&&i.memoizedState!==null;var k=gt,M=Ie,B=Kn;gt=k||d,Kn=B||d,Ie=M||g,Dt(t,e,s),Ie=M,Kn=B,gt=k,$t(e),u&8192&&(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,!d||i===null||g||gt||Ie||(t=g||Ie,s=gt,i=Ie,gt=d||gt,Ie=t,Rs(e,2),gt=s,Ie=i),!d&&Kn||sd(e,d)),u&4&&(t=e.updateQueue,t!==null&&(s=t.retryQueue,s!==null&&(t.retryQueue=null,po(e,s))));break;case 19:Dt(t,e,s),$t(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,po(e,t)));break;case 30:u&512&&(Ie||i===null||wt(i,i.return)),u=Yh(),d=xi,g=(s&335544064)===s,k=e.memoizedProps,xi=g&&ss(k.default,k.update)!=="none",Dt(t,e,s),$t(e),g&&i!==null&&Be&&(e.flags|=4),xi=d,Be=u;break;case 21:break;case 7:u&512&&(Ie||i===null||wt(i,i.return)),i&&i.stateNode!==null&&(i.stateNode._fragmentFiber=e);default:Dt(t,e,s),$t(e)}}function $t(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(rg(i)){s=i;break}i=i.return}i=null;for(var u=e.return;u!==null;){if(Ku(u)){var d=u.stateNode;i===null?i=[d]:i.push(d)}if(Gu(u))break;u=u.return}var g=i;if(s==null)throw Error(o(160));switch(s.tag){case 27:var k=s.stateNode,M=Zu(e);oo(e,M,k,g);break;case 5:var B=s.stateNode;s.flags&32&&(Bl(B,""),s.flags&=-33);var G=Zu(e);oo(e,G,B,g);break;case 3:case 4:var Q=s.stateNode.containerInfo,L=Zu(e);Qu(e,L,Q,g);break;default:throw Error(o(161))}}catch(Y){Ke(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,ja=!0,t.reset(),ja=!1),e=e.sibling}}function aa(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ng(t,e),t=t.sibling;else mg(t)}function Ng(e,t){var s=e.alternate;if(s===null)Ju(e,!1);else switch(e.tag){case 3:if(nd=Xn=!1,ug(),aa(t,e),!Xn&&!ho){if(e=Yn,e!==null)for(var i=0;i<e.length;i+=3){s=e[i];var u=e[i+1];dv(s,e[i+2]),s=s.ownerDocument.documentElement,s!==null&&s.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"})),nd=!0}Yn=null;break;case 5:aa(t,e);break;case 4:i=Xn,Xn=!1,aa(t,e),Xn&&(ho=!0),Xn=i;break;case 22:e.memoizedState===null&&(s.memoizedState!==null?Ju(e,!1):aa(t,e));break;case 30:i=Xn,u=ug(),Xn=!1,aa(t,e),Xn&&(e.flags|=4);var d=e.memoizedProps,g=e.stateNode;t=ns(d,g),g=ns(s.memoizedProps,g);var k=ss(d.default,d.update);k==="none"?t=!1:(d=s.memoizedState,s.memoizedState=null,s=e.child,qt=0,t=ed(e,s,t,g,k,d,!0),qt!==(d===null?0:d.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(fa(e,e.memoizedProps.onUpdate),Yn=u):u!==null&&(u.push.apply(u,Yn),Yn=u),Xn=(e.flags&32)!==0?!0:i;break;default:aa(t,e)}}function Vn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gg(e,t.alternate,t),t=t.sibling}function Rs(e,t){for(e=e.child;e!==null;){var s=e,i=t;switch(s.tag){case 0:case 11:case 14:case 15:_s(4,s,s.return),Rs(s,i);break;case 1:wt(s,s.return);var u=s.stateNode;typeof u.componentWillUnmount=="function"&&ag(s,s.return,u),Rs(s,i);break;case 27:(i&2)!==0&&wv(s.stateNode,s.type,s.memoizedProps);case 5:wt(s,s.return),s.tag!==5&&s.tag!==27||vi(s),Rs(s,i);break;case 6:vi(s);break;case 26:wt(s,s.return),u=s.stateNode,s.memoizedState!==null||u===null||Ie||u.parentNode.removeChild(u),Rs(s,i);break;case 22:s.memoizedState===null&&Rs(s,i);break;case 30:wt(s,s.return),Rs(s,i);break;case 7:wt(s,s.return);default:Rs(s,i)}e=e.sibling}}function zn(e,t,s){for(s=(t.subtreeFlags&8772)!==0?s:s&-2,t=t.child;t!==null;){var i=t.alternate,u=e,d=t,g=d.flags,k=(s&1)!==0;switch(d.tag){case 0:case 11:case 15:zn(u,d,s),gi(4,d);break;case 1:if(zn(u,d,s),i=d,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Ke(i,i.return,G)}if(i=d,u=i.updateQueue,u!==null){var M=i.stateNode;try{var B=u.shared.hiddenCallbacks;if(B!==null)for(u.shared.hiddenCallbacks=null,u=0;u<B.length;u++)Xm(B[u],M)}catch(G){Ke(i,i.return,G)}}k&&g&64&&lg(d),In(d,d.return);break;case 27:(s&2)!==0&&og(d);case 5:d.tag!==5&&d.tag!==27||ig(d),zn(u,d,s),k&&i===null&&g&4&&Xu(d),In(d,d.return);break;case 6:ig(d);break;case 26:M=d.stateNode,d.memoizedState!==null||M===null||gt||Id(Ci(M.ownerDocument),d.type,M),zn(u,d,s),k&&i===null&&g&4&&Xu(d),In(d,d.return);break;case 12:zn(u,d,s);break;case 31:zn(u,d,s),k&&g&4&&yg(u,d);break;case 13:zn(u,d,s),k&&g&4&&kg(u,d);break;case 22:d.memoizedState===null&&zn(u,d,s),In(d,d.return);break;case 30:zn(u,d,s),In(d,d.return);break;case 7:In(d,d.return);default:zn(u,d,s)}t=t.sibling}}function ad(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&si(s))}function id(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&si(e))}function gn(e,t,s,i){var u=(s&335544064)===s;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)Sg(e,t,s,i),t=t.sibling;else u&&hg(t)}function Sg(e,t,s,i){var u=(s&335544064)===s;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&fo(t);var d=t.flags;switch(t.tag){case 0:case 11:case 15:gn(e,t,s,i),d&2048&&gi(9,t);break;case 1:gn(e,t,s,i);break;case 3:gn(e,t,s,i),u&&nd&&(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="")),d&2048&&(d=null,t.alternate!==null&&(d=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==d&&(t.refCount++,d!=null&&si(d)));break;case 12:if(d&2048){gn(e,t,s,i),d=t.stateNode;try{var g=t.memoizedProps,k=g.id,M=g.onPostCommit;typeof M=="function"&&M(k,t.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(B){Ke(t,t.return,B)}}else gn(e,t,s,i);break;case 31:gn(e,t,s,i);break;case 13:gn(e,t,s,i);break;case 23:break;case 22:g=t.stateNode,k=t.alternate,t.memoizedState!==null?(u&&k!==null&&k.memoizedState===null&&fo(k),g._visibility&2?gn(e,t,s,i):bi(e,t)):(u&&k!==null&&k.memoizedState!==null&&fo(t),g._visibility&2?gn(e,t,s,i):(g._visibility|=2,ia(e,t,s,i,(t.subtreeFlags&10256)!==0||!1))),d&2048&&ad(k,t);break;case 24:gn(e,t,s,i),d&2048&&id(t.alternate,t);break;case 30:u&&(d=t.alternate,d!==null&&(Gn(d.child,!0),Gn(t.child,!0))),gn(e,t,s,i);break;default:gn(e,t,s,i)}}function ia(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,g=t,k=s,M=i,B=g.flags;switch(g.tag){case 0:case 11:case 15:ia(d,g,k,M,u),gi(8,g);break;case 23:break;case 22:var G=g.stateNode;g.memoizedState!==null?G._visibility&2?ia(d,g,k,M,u):bi(d,g):(G._visibility|=2,ia(d,g,k,M,u)),u&&B&2048&&ad(g.alternate,g);break;case 24:ia(d,g,k,M,u),u&&B&2048&&id(g.alternate,g);break;default:ia(d,g,k,M,u)}t=t.sibling}}function bi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,u=i.flags;switch(i.tag){case 22:bi(s,i),u&2048&&ad(i.alternate,i);break;case 24:bi(s,i),u&2048&&id(i.alternate,i);break;default:bi(s,i)}t=t.sibling}}var hl=8192;function ml(e,t,s){if(e.subtreeFlags&hl)for(e=e.child;e!==null;)Tg(e,t,s),e=e.sibling}function Tg(e,t,s){switch(e.tag){case 26:ml(e,t,s),e.flags&hl&&(e.memoizedState!==null?Jj(s,An,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&_v(s,e)));break;case 5:ml(e,t,s),e.flags&hl&&(e=e.stateNode,(t&335544128)===t&&_v(s,e));break;case 3:case 4:var i=An;An=Ci(e.stateNode.containerInfo),ml(e,t,s),An=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=hl,hl=16777216,ml(e,t,s),hl=i):ml(e,t,s));break;case 30:if((e.flags&hl)!==0&&(i=e.memoizedProps.name,i!=null&&i!=="auto")){var u=e.stateNode;u.paired=null,tn===null&&(tn=new Map),tn.set(i,u)}ml(e,t,s);break;default:ml(e,t,s)}}function Cg(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 yi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];vt=i,Ag(i,e)}Cg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Eg(e),e=e.sibling}function Eg(e){switch(e.tag){case 0:case 11:case 15:yi(e),e.flags&2048&&_s(9,e,e.return);break;case 3:yi(e);break;case 12:yi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,go(e)):yi(e);break;default:yi(e)}}function go(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];vt=i,Ag(i,e)}Cg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:_s(8,t,t.return),go(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,go(t));break;default:go(t)}e=e.sibling}}function Ag(e,t){for(;vt!==null;){var s=vt;switch(s.tag){case 0:case 11:case 15:_s(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:si(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,vt=i;else e:for(s=e;vt!==null;){i=vt;var u=i.sibling,d=i.return;if(xg(i),i===s){vt=null;break e}if(u!==null){u.return=d,vt=u;break e}vt=d}}}var Kk={getCacheForType:function(e){var t=yt(ot),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return yt(ot).controller.signal}},Xk=typeof WeakMap=="function"?WeakMap:Map,qe=0,Qe=null,_e=null,De=0,Ge=0,nn=null,Ds=!1,ra=!1,rd=!1,fs=0,lt=0,$s=0,pl=0,vo=0,sn=0,oa=0,ki=null,Yt=null,od=!1,xo=0,zg=0,bo=1/0,yo=null,Us=null,tt=0,Mn=null,gl=null,Zn=0,cd=0,ud=null,Mg=null,ca=null,ua=null,da=null,ji=0,ko=null;function ln(){return(qe&2)!==0&&De!==0?De&-De:oe.T!==null?yd():Rh()}function Og(){if(sn===0)if((De&536870912)===0||ze){var e=mr;mr<<=1,(mr&3932160)===0&&(mr=262144),sn=e}else sn=536870912;return e=kt.current,e!==null&&(e.flags|=32),sn}function fa(e,t){if(t!=null){var s=e.stateNode,i=s.ref;i===null&&(i=s.ref=fv(ns(e.memoizedProps,s))),ua===null&&(ua=[]),ua.push(t.bind(null,i))}}function Gt(e,t,s){(e===Qe&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(ha(e,0),Ls(e,De,sn,!1)),Ya(e,s),((qe&2)===0||e!==Qe)&&(e===Qe&&((qe&2)===0&&(pl|=s),lt===4&&Ls(e,De,sn,!1)),Qn(e))}function _g(e,t,s){if((qe&6)!==0)throw Error(o(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Ia(e,t),u=i?Qk(e,t):fd(e,t,!0),d=i;do{if(u===0){ra&&!i&&Ls(e,t,0,!1);break}else{if(s=e.current.alternate,d&&!Vk(s)){u=fd(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var k=e;u=ki;var M=k.current.memoizedState.isDehydrated;if(M&&(ha(k,g).flags|=256),g=fd(k,g,!1),g!==2&&g!==6){if(rd&&!M){k.errorRecoveryDisabledLanes|=d,pl|=d,u=4;break e}d=Yt,Yt=u,d!==null&&(Yt===null?Yt=d:Yt.push.apply(Yt,d))}u=g}if(d=!1,u!==2)continue}}if(u===1){ha(e,0),Ls(e,t,0,!0);break}e:{switch(i=e,d=u,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Ls(i,t,sn,!Ds);break e;case 2:Yt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=xo+300-Qt(),10<u)){if(Ls(i,t,sn,!Ds),gr(i,0,!0)!==0)break e;Zn=t,i.timeoutHandle=Md(Rg.bind(null,i,s,Yt,yo,od,t,sn,pl,oa,Ds,d,"Throttled",-0,0),u);break e}Rg(i,s,Yt,yo,od,t,sn,pl,oa,Ds,d,null,-0,0)}}break}while(!0);Qn(e)}function Rg(e,t,s,i,u,d,g,k,M,B,G,Q,L,Y){e.timeoutHandle=-1;var ie=t.subtreeFlags,pe=(d&335544064)===d;if(Q=null,(pe||ie&8192||(ie&16785408)===16785408)&&(Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hn},tn=null,Tg(t,d,Q),pe&&(ie=Q,pe=e.containerInfo,pe=(pe.nodeType===9?pe:pe.ownerDocument).__reactViewTransition,pe!=null&&(ie.count++,ie.waitingForViewTransition=!0,ie=zi.bind(ie),pe.finished.then(ie,ie))),ie=(d&62914560)===d?xo-Qt():(d&4194048)===d?zg-Qt():0,ie=Pj(Q,ie),ie!==null)){Zn=d,e.cancelPendingCommit=ie(Ig.bind(null,e,t,d,s,i,u,g,k,M,B,G,Q,null,L,Y)),Ls(e,d,g,!B);return}Ig(e,t,d,s,i,u,g,k,M,B,G,Q)}function Vk(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var u=s[i],d=u.getSnapshot;u=u.value;try{if(!Wt(d(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ls(e,t,s,i){t=Ah(e,t),t&=~vo,t&=~pl,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var d=31-Pt(u),g=1<<d;i[d]=-1,u&=~g}s!==0&&Mh(e,s,t)}function jo(){return(qe&6)===0?(wi(0),!1):!0}function dd(){if(_e!==null){if(Ge===0)var e=_e.return;else e=_e,is=sl=null,bu(e),Wl=null,ii=0,e=_e;for(;e!==null;)sg(e.alternate,e),e=e.return;_e=null}}function ha(e,t){var s=e.timeoutHandle;return s!==-1&&(e.timeoutHandle=-1,vj(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Zn=0,dd(),Qe=e,_e=s=ls(e.current,null),De=t,Ge=0,nn=null,Ds=!1,ra=Ia(e,t),rd=!1,oa=sn=vo=pl=$s=lt=0,Yt=ki=null,od=!1,fs=Ah(e,t),Ar(),s}function Dg(e,t){Te=null,oe.H=eo,t===Fl||t===Br?(t=Im(),Ge=3):t===iu?(t=Im(),Ge=4):Ge=t===Ru?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,nn=t,_e===null&&(lt=1,to(e,fn(t,e.current)))}function $g(){var e=kt.current;return e===null?!0:(De&4194048)===De?Et===null:(De&62914560)===De||(De&536870912)!==0?e===Et:!1}function Ug(){var e=oe.H;return oe.H=eo,e===null?eo:e}function Lg(){var e=oe.A;return oe.A=Kk,e}function wo(){lt=4,Ds||(De&4194048)!==De&&kt.current!==null||(ra=!0),($s&134217727)===0&&(pl&134217727)===0||Qe===null||Ls(Qe,De,sn,!1)}function fd(e,t,s){var i=qe;qe|=2;var u=Ug(),d=Lg();(Qe!==e||De!==t)&&(yo=null,ha(e,t)),t=!1;var g=lt;e:do try{if(Ge!==0&&_e!==null){var k=_e,M=nn;switch(Ge){case 8:dd(),g=6;break e;case 3:case 2:case 9:case 6:kt.current===null&&(t=!0);var B=Ge;if(Ge=0,nn=null,ma(e,k,M,B),s&&ra){g=0;break e}break;default:B=Ge,Ge=0,nn=null,ma(e,k,M,B)}}Zk(),g=lt;break}catch(G){Dg(e,G)}while(!0);return t&&e.shellSuspendCounter++,is=sl=null,qe=i,oe.H=u,oe.A=d,_e===null&&(Qe=null,De=0,Ar()),g}function Zk(){for(;_e!==null;)Hg(_e)}function Qk(e,t){var s=qe;qe|=2;var i=Ug(),u=Lg();Qe!==e||De!==t?(yo=null,bo=Qt()+500,ha(e,t)):ra=Ia(e,t);e:do try{if(Ge!==0&&_e!==null){t=_e;var d=nn;t:switch(Ge){case 1:Ge=0,nn=null,ma(e,t,d,1);break;case 2:case 9:if(Bm(d)){Ge=0,nn=null,Bg(t);break}t=function(){Ge!==2&&Ge!==9||Qe!==e||(Ge=7),Qn(e)},d.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:Bm(d)?(Ge=0,nn=null,Bg(t)):(Ge=0,nn=null,ma(e,t,d,7));break;case 5:var g=null;switch(_e.tag){case 26:g=_e.memoizedState;case 5:case 27:var k=_e;if(g?Mv(g):k.stateNode.complete){Ge=0,nn=null;var M=k.sibling;if(M!==null)_e=M;else{var B=k.return;B!==null?(_e=B,No(B)):_e=null}break t}}Ge=0,nn=null,ma(e,t,d,5);break;case 6:Ge=0,nn=null,ma(e,t,d,6);break;case 8:dd(),lt=6;break e;default:throw Error(o(462))}}Jk();break}catch(G){Dg(e,G)}while(!0);return is=sl=null,oe.H=i,oe.A=u,qe=s,_e!==null?0:(Qe=null,De=0,Ar(),lt)}function Jk(){for(;_e!==null&&!hy();)Hg(_e)}function Hg(e){var t=tg(e.alternate,e,fs);e.memoizedProps=e.pendingProps,t===null?No(e):_e=t}function Bg(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Zp(s,t,t.pendingProps,t.type,void 0,De);break;case 11:t=Zp(s,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:bu(t);var i=t;i===pt&&(ze?(Dr(i),i.tag===5&&i.stateNode!=null&&(Pe=i.stateNode)):(Dr(i),ze=!0));default:sg(s,t),t=_e=Am(t,fs),t=tg(s,t,fs)}e.memoizedProps=e.pendingProps,t===null?No(e):_e=t}function ma(e,t,s,i){is=sl=null,bu(t),Wl=null,ii=0;var u=t.return;try{if(Uk(e,u,t,s,De)){lt=1,to(e,fn(s,e.current)),_e=null;return}}catch(d){if(u!==null)throw _e=u,d;lt=1,to(e,fn(s,e.current)),_e=null;return}t.flags&32768?(ze||i===1?e=!0:ra||(De&536870912)!==0?e=!1:(Ds=e=!0,(i===2||i===9||i===3||i===6)&&(i=kt.current,i!==null&&i.tag===13&&(i.flags|=16384))),qg(t,e)):No(t)}function No(e){var t=e;do{if((t.flags&32768)!==0){qg(t,Ds);return}e=t.return;var s=qk(t.alternate,t,fs);if(s!==null){_e=s;return}if(t=t.sibling,t!==null){_e=t;return}_e=t=e}while(t!==null);lt===0&&(lt=5)}function qg(e,t){do{var s=Ik(e.alternate,e);if(s!==null){s.flags&=32767,_e=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){_e=e;return}_e=e=s}while(e!==null);lt=6,_e=null}function Ig(e,t,s,i,u,d,g,k,M,B,G,Q){e.cancelPendingCommit=null;do So();while(tt!==0);if((qe&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Qe&&(_e=Qe=null,De=0),gl=t,Mn=e,Zn=s,ud=u,Mg=i,Pk(e,t,s,g,k,M,Q)}}function Pk(e,t,s,i,u,d,g){var k=t.lanes|t.childLanes;if(cd=k,k|=Vc,wy(e,s,k,i,u,d),ua=null,(s&335544064)===s?(da=Sk(e),i=10262):(da=null,i=10256),(t.subtreeFlags&i)!==0||(t.flags&i)!==0?(e.callbackNode=null,e.callbackPriority=0,sj(fr,function(){return gd(),null})):(e.callbackNode=null,e.callbackPriority=0),co=!1,i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=oe.T,oe.T=null,u=xe.p,xe.p=2,d=qe,qe|=4;try{Yk(e,t,s)}finally{qe=d,xe.p=u,oe.T=i}}tt=1,co?ca=wj(g,e.containerInfo,da,hd,md,Wk,pd,gd,Fk):(hd(),md(),pd())}function Fk(e){if(tt!==0){var t=Mn.onRecoverableError;t(e,{componentStack:null})}}function Wk(){tt===3&&(tt=0,Ng(gl,Mn),tt=4)}function hd(){if(tt===1){tt=0;var e=Mn,t=gl,s=Zn,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=oe.T,oe.T=null;var u=xe.p;xe.p=2;var d=qe;qe|=4;try{xi=ho=!1,jg(t,e,s),s=Ed;var g=bm(e.containerInfo),k=s.focusedElem,M=s.selectionRange;if(g!==k&&k&&k.ownerDocument&&xm(k.ownerDocument.documentElement,k)){if(M!==null&&Ic(k)){var B=M.start,G=M.end;if(G===void 0&&(G=B),"selectionStart"in k)k.selectionStart=B,k.selectionEnd=Math.min(G,k.value.length);else{var Q=k.ownerDocument||document,L=Q&&Q.defaultView||window;if(L.getSelection){var Y=L.getSelection(),ie=k.textContent.length,pe=Math.min(M.start,ie),Ce=M.end===void 0?pe:Math.min(M.end,ie);!Y.extend&&pe>Ce&&(g=Ce,Ce=pe,pe=g);var H=vm(k,pe),_=vm(k,Ce);if(H&&_&&(Y.rangeCount!==1||Y.anchorNode!==H.node||Y.anchorOffset!==H.offset||Y.focusNode!==_.node||Y.focusOffset!==_.offset)){var I=Q.createRange();I.setStart(H.node,H.offset),Y.removeAllRanges(),pe>Ce?(Y.addRange(I),Y.extend(_.node,_.offset)):(I.setEnd(_.node,_.offset),Y.addRange(I))}}}}for(Q=[],Y=k;Y=Y.parentNode;)Y.nodeType===1&&Q.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<Q.length;k++){var Z=Q[k];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}ja=!!Cd,Ed=Cd=null}finally{qe=d,xe.p=u,oe.T=i}}e.current=t,tt=2}}function md(){if(tt===2){tt=0;var e=Mn,t=gl,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=oe.T,oe.T=null;var i=xe.p;xe.p=2;var u=qe;qe|=4;try{gg(e,t.alternate,t)}finally{qe=u,xe.p=i,oe.T=s}}tt=3}}function pd(){if(tt===4||tt===3){tt=0;var e=ca;ca=null,my();var t=Mn,s=gl,i=Zn,u=Mg,d=(i&335544064)===i?10262:10256;if((s.subtreeFlags&d)!==0||(s.flags&d)!==0?tt=5:(tt=0,gl=Mn=null,Yg(t,t.pendingLanes)),d=t.pendingLanes,d===0&&(Us=null),Nc(i),s=s.stateNode,Jt&&typeof Jt.onCommitFiberRoot=="function")try{Jt.onCommitFiberRoot(qa,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=oe.T,d=xe.p,xe.p=2,oe.T=null;try{for(var g=t.onRecoverableError,k=0;k<u.length;k++){var M=u[k];g(M.value,{componentStack:M.stack})}}finally{oe.T=s,xe.p=d}}if(u=ua,g=da,da=null,u!==null&&(ua=null,g===null&&(g=[]),e!==null))for(M=0;M<u.length;M++)s=(0,u[M])(g),s!==void 0&&e.finished.finally(s);(Zn&3)!==0&&So(),Qn(t),d=t.pendingLanes,(i&261930)!==0&&(d&42)!==0?t===ko?ji++:(ji=0,ko=t):(ji=0,ko=null),wi(0)}}function Yg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,si(t)))}function So(){return ca!==null&&(ca.skipTransition(),ca=null),hd(),md(),pd(),gd()}function gd(){if(tt!==5)return!1;var e=Mn,t=cd;cd=0;var s=Nc(Zn),i=oe.T,u=xe.p;try{xe.p=32>s?32:s,oe.T=null,s=ud,ud=null;var d=Mn,g=Zn;if(tt=0,gl=Mn=null,Zn=0,(qe&6)!==0)throw Error(o(331));var k=qe;if(qe|=4,Eg(d.current),Sg(d,d.current,g,s),qe=k,wi(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(qa,d)}catch{}return!0}finally{xe.p=u,oe.T=i,Yg(e,t)}}function Gg(e,t,s){t=fn(s,t),t=_u(e.stateNode,t,2),e=As(e,t,2),e!==null&&(Ya(e,2),Qn(e))}function Ke(e,t,s){if(e.tag===3)Gg(e,e,s);else for(;t!==null;){if(t.tag===3){Gg(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Us===null||!Us.has(i))){e=fn(s,e),s=Bp(2),i=As(t,s,2),i!==null&&(qp(s,i,t,e),Ya(i,2),Qn(i));break}}t=t.return}}function vd(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new Xk;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(s)||(rd=!0,u.add(s),e=ej.bind(null,e,t,s),t.then(e,e))}function ej(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Qe===e&&(De&s)===s&&((lt===4||lt===3&&(De&62914560)===De&&300>Qt()-xo)&&(qe&2)===0?ha(e,0):vo|=s,oa===De&&(oa=0)),Qn(e)}function Kg(e,t){t===0&&(t=zh()),e=el(e,t),e!==null&&(Ya(e,t),Qn(e))}function tj(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Kg(e,s)}function nj(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Kg(e,s)}function sj(e,t){return yc(e,t)}var pa=null,ga=null,xd=!1,To=!1,bd=!1,Hs=0;function Qn(e){e!==ga&&e.next===null&&(ga===null?pa=ga=e:ga=ga.next=e),To=!0,xd||(xd=!0,aj())}function wi(e,t){if(!bd&&To){bd=!0;do for(var s=!1,i=pa;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var d=0;else{var g=i.suspendedLanes,k=i.pingedLanes;d=(1<<31-Pt(42|e)+1)-1,d&=u&~(g&~k),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(s=!0,Qg(i,d))}else d=De,d=gr(i,i===Qe?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(d&3)===0||Ia(i,d)||(s=!0,Qg(i,d));i=i.next}while(s);bd=!1}}function lj(){Xg()}function Xg(){To=xd=!1;var e=0;Hs!==0&&gj()&&(e=Hs);for(var t=Qt(),s=null,i=pa;i!==null;){var u=i.next,d=Vg(i,t);d===0?(i.next=null,s===null?pa=u:s.next=u,u===null&&(ga=s)):(s=i,(e!==0||(d&3)!==0)&&(To=!0)),i=u}tt!==0&&tt!==5||wi(e),Hs!==0&&(Hs=0)}function Vg(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var g=31-Pt(d),k=1<<g,M=u[g];M===-1?((k&s)===0||(k&i)!==0)&&(u[g]=jy(k,t)):M<=t&&(e.expiredLanes|=k),d&=~k}if(t=Qe,s=De,s=gr(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&kc(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Ia(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&kc(i),Nc(s)){case 2:case 8:s=Ch;break;case 32:s=fr;break;case 268435456:s=Eh;break;default:s=fr}return i=Zg.bind(null,e),s=yc(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&kc(i),e.callbackPriority=2,e.callbackNode=null,2}function Zg(e,t){if(tt!==0&&tt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(So()&&e.callbackNode!==s)return null;var i=De;return i=gr(e,e===Qe?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(_g(e,i,t),Vg(e,Qt()),e.callbackNode!=null&&e.callbackNode===s?Zg.bind(null,e):null)}function Qg(e,t){if(So())return null;_g(e,t,!0)}function aj(){xj(function(){(qe&6)!==0?yc(Th,lj):Xg()})}function yd(){if(Hs===0){var e=il;e===0&&(e=hr,hr<<=1,(hr&261888)===0&&(hr=256)),Hs=e}return Hs}function Jg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:kr(e)}function ij(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var d=Jg((u[Ht]||null).action),g=i.submitter;g&&(t=(t=g[Ht]||null)?Jg(t.formAction):g.getAttribute("formAction"),t!==null&&(d=t,g=null));var k=new Sr("action","action",null,i,u);e.push({event:k,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Hs!==0){var M=new FormData(u,g);Eu(s,{pending:!0,data:M,method:u.method,action:d},null,M)}}else typeof d=="function"&&(k.preventDefault(),M=new FormData(u,g),Eu(s,{pending:!0,data:M,method:u.method,action:d},d,M))},currentTarget:u}]})}}for(var kd=0;kd<Xc.length;kd++){var jd=Xc[kd],rj=jd.toLowerCase(),oj=jd[0].toUpperCase()+jd.slice(1);Cn(rj,"on"+oj)}Cn(jm,"onAnimationEnd"),Cn(wm,"onAnimationIteration"),Cn(Nm,"onAnimationStart"),Cn("dblclick","onDoubleClick"),Cn("focusin","onFocus"),Cn("focusout","onBlur"),Cn(vk,"onTransitionRun"),Cn(xk,"onTransitionStart"),Cn(bk,"onTransitionCancel"),Cn(Sm,"onTransitionEnd"),Ll("onMouseEnter",["mouseout","mouseover"]),Ll("onMouseLeave",["mouseout","mouseover"]),Ll("onPointerEnter",["pointerout","pointerover"]),Ll("onPointerLeave",["pointerout","pointerover"]),Ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ni="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(" "),cj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ni));function Pg(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],u=i.event;i=i.listeners;e:{var d=void 0;if(t)for(var g=i.length-1;0<=g;g--){var k=i[g],M=k.instance,B=k.currentTarget;if(k=k.listener,M!==d&&u.isPropagationStopped())break e;d=k,u.currentTarget=B;try{d(u)}catch(G){Er(G)}u.currentTarget=null,d=M}else for(g=0;g<i.length;g++){if(k=i[g],M=k.instance,B=k.currentTarget,k=k.listener,M!==d&&u.isPropagationStopped())break e;d=k,u.currentTarget=B;try{d(u)}catch(G){Er(G)}u.currentTarget=null,d=M}}}}function Re(e,t){var s=t[$h];s===void 0&&(s=t[$h]=new Set);var i=e+"__bubble";s.has(i)||(Fg(t,e,2,!1),s.add(i))}function wd(e,t,s){var i=0;t&&(i|=4),Fg(s,e,i,t)}var Co="_reactListening"+Math.random().toString(36).slice(2);function Nd(e){if(!e[Co]){e[Co]=!0,Hh.forEach(function(s){s!=="selectionchange"&&(cj.has(s)||wd(s,!1,e),wd(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Co]||(t[Co]=!0,wd("selectionchange",!1,t))}}function Fg(e,t,s,i){switch(qv(t)){case 2:var u=t1;break;case 8:u=n1;break;default:u=Gd}s=u.bind(null,t,s,e),u=void 0,!Oc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function Sd(e,t,s,i,u){var d=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var g=i.tag;if(g===3||g===4){var k=i.stateNode.containerInfo;if(k===u)break;if(g===4)for(g=i.return;g!==null;){var M=g.tag;if((M===3||M===4)&&g.stateNode.containerInfo===u)return;g=g.return}for(;k!==null;){if(g=Js(k),g===null)return;if(M=g.tag,M===5||M===6||M===26||M===27){i=d=g;continue e}k=k.parentNode}}i=i.return}Fh(function(){var B=d,G=zc(s),Q=[];e:{var L=Tm.get(e);if(L!==void 0){var Y=Sr,ie=e;switch(e){case"keypress":if(wr(s)===0)break e;case"keydown":case"keyup":Y=Vy;break;case"focusin":ie="focus",Y=$c;break;case"focusout":ie="blur",Y=$c;break;case"beforeblur":case"afterblur":Y=$c;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=tm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=Dy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=Fy;break;case jm:case wm:case Nm:Y=Ly;break;case Sm:Y=ek;break;case"scroll":case"scrollend":Y=_y;break;case"wheel":Y=nk;break;case"copy":case"cut":case"paste":Y=By;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=sm;break;case"submit":Y=Jy;break;case"toggle":case"beforetoggle":Y=lk}var pe=(t&4)!==0,Ce=!pe&&(e==="scroll"||e==="scrollend"),H=pe?L!==null?L+"Capture":null:L;pe=[];for(var _=B,I;_!==null;){var Z=_;if(I=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||I===null||H===null||(Z=Xa(_,H),Z!=null&&pe.push(Si(_,Z,I))),Ce)break;_=_.return}0<pe.length&&(L=new Y(L,ie,null,s,G),Q.push({event:L,listeners:pe}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",Y&&s!==Ac&&(ie=s.relatedTarget||s.fromElement)&&(Js(ie)||ie[Dl]))break e;(L||Y)&&(ie=G.window===G?G:(Y=G.ownerDocument)?Y.defaultView||Y.parentWindow:window,L?(Y=s.relatedTarget||s.toElement,L=B,Y=Y?Js(Y):null,Y!==null&&(Ce=f(Y),pe=Y.tag,Y!==Ce||pe!==5&&pe!==27&&pe!==6)&&(Y=null)):(L=null,Y=B),L!==Y&&(pe=tm,Z="onMouseLeave",H="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(pe=sm,Z="onPointerLeave",H="onPointerEnter",_="pointer"),Ce=L==null?ie:Ka(L),I=Y==null?ie:Ka(Y),ie=new pe(Z,_+"leave",L,s,G),ie.target=Ce,ie.relatedTarget=I,Z=null,Js(G)===B&&(pe=new pe(H,_+"enter",Y,s,G),pe.target=I,pe.relatedTarget=Ce,Z=pe),Ce=Z,pe=L&&Y?S(L,Y,uj):null,L!==null&&Wg(Q,ie,L,pe,!1),Y!==null&&Ce!==null&&Wg(Q,Ce,Y,pe,!0)))}e:{if(L=B?Ka(B):window,Y=L.nodeName&&L.nodeName.toLowerCase(),Y==="select"||Y==="input"&&L.type==="file")var fe=dm;else if(cm(L))if(fm)fe=mk;else{fe=fk;var $e=dk}else Y=L.nodeName,!Y||Y.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&Ec(B.elementType)&&(fe=dm):fe=hk;if(fe&&(fe=fe(e,B))){um(Q,fe,s,G);break e}$e&&$e(e,L,B)}switch($e=B?Ka(B):window,e){case"focusin":(cm($e)||$e.contentEditable==="true")&&(Gl=$e,Yc=B,ei=null);break;case"focusout":ei=Yc=Gl=null;break;case"mousedown":Gc=!0;break;case"contextmenu":case"mouseup":case"dragend":Gc=!1,ym(Q,s,G);break;case"selectionchange":if(gk)break;case"keydown":case"keyup":ym(Q,s,G)}var ye;if(Lc)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Yl?rm(e,s)&&(ke="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(ke="onCompositionStart");ke&&(lm&&s.locale!=="ko"&&(Yl||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Yl&&(ye=Wh()):(ys=G,_c="value"in ys?ys.value:ys.textContent,Yl=!0)),$e=Eo(B,ke),0<$e.length&&(ke=new nm(ke,e,null,s,G),Q.push({event:ke,listeners:$e}),ye?ke.data=ye:(ye=om(s),ye!==null&&(ke.data=ye)))),(ye=ik?rk(e,s):ok(e,s))&&(ke=Eo(B,"onBeforeInput"),0<ke.length&&($e=new nm("onBeforeInput","beforeinput",null,s,G),Q.push({event:$e,listeners:ke}),$e.data=ye)),ij(Q,e,B,s,G)}Pg(Q,t)})}function Si(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Eo(e,t){for(var s=t+"Capture",i=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=Xa(e,s),u!=null&&i.unshift(Si(e,u,d)),u=Xa(e,t),u!=null&&i.push(Si(e,u,d))),e.tag===3)return i;e=e.return}return[]}function uj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Wg(e,t,s,i,u){for(var d=t._reactName,g=[];s!==null&&s!==i;){var k=s,M=k.alternate,B=k.stateNode;if(k=k.tag,M!==null&&M===i)break;k!==5&&k!==26&&k!==27||B===null||(M=B,u?(B=Xa(s,d),B!=null&&g.unshift(Si(s,B,M))):u||(B=Xa(s,d),B!=null&&g.push(Si(s,B,M)))),s=s.return}g.length!==0&&e.push({event:t,listeners:g})}var dj=/\r\n?/g,fj=/\u0000|\uFFFD/g;function ev(e){return(typeof e=="string"?e:""+e).replace(dj,`
|
|
50
|
+
`).replace(fj,"")}function tv(e,t){return t=ev(t),ev(e)===t}function Xe(e,t,s,i,u,d){switch(s){case"children":if(typeof i=="string")t==="body"||t==="textarea"&&i===""||Bl(e,i);else if(typeof i=="number"||typeof i=="bigint")t!=="body"&&Bl(e,""+i);else return;break;case"className":yr(e,"class",i);break;case"tabIndex":yr(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":yr(e,s,i);break;case"style":Jh(e,i,d);return;case"data":if(t!=="object"){yr(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=kr(i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"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 d=="function"&&(s==="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(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=kr(i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=Hn);return;case"onScroll":i!=null&&Re("scroll",e);return;case"onScrollEnd":i!=null&&Re("scrollend",e);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(o(60));d?.__html!==s&&(e.innerHTML=s)}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=kr(i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":Re("beforetoggle",e),Re("toggle",e),br(e,"popover",i);break;case"xlinkActuate":es(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":es(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":es(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":es(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":es(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":es(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":es(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":es(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":es(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":br(e,"is",i);break;case"innerText":case"textContent":return;default:if(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")s=My.get(s)||s,br(e,s,i);else return}Be=!0}function Td(e,t,s,i,u,d){switch(s){case"style":Jh(e,i,d);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(o(60));d?.__html!==s&&(e.innerHTML=s)}}break;case"children":if(typeof i=="string")Bl(e,i);else if(typeof i=="number"||typeof i=="bigint")Bl(e,""+i);else return;break;case"onScroll":i!=null&&Re("scroll",e);return;case"onScrollEnd":i!=null&&Re("scrollend",e);return;case"onClick":i!=null&&(e.onclick=Hn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Bh.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),d=s.slice(2,u?s.length-7:void 0),t=e[Ht]||null,t=t!=null?t[s]:null,typeof t=="function"&&e.removeEventListener(d,t,u),typeof i=="function")){typeof t!="function"&&t!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(d,i,u);break e}Be=!0,s in e?e[s]=i:i===!0?e.setAttribute(s,""):br(e,s,i)}return}Be=!0}function Nt(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Re("error",e),Re("load",e);var i=!1,u=!1,d;for(d in s)if(s.hasOwnProperty(d)){var g=s[d];if(g!=null)switch(d){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,d,g,s,null)}}u&&Xe(e,t,"srcSet",s.srcSet,s,null),i&&Xe(e,t,"src",s.src,s,null);return;case"input":Re("invalid",e);var k=d=g=u=null,M=null,B=null;for(i in s)if(s.hasOwnProperty(i)){var G=s[i];if(G!=null)switch(i){case"name":u=G;break;case"type":g=G;break;case"checked":M=G;break;case"defaultChecked":B=G;break;case"value":d=G;break;case"defaultValue":k=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,t));break;default:Xe(e,t,i,G,s,null)}}Xh(e,d,k,M,B,g,u,!1);return;case"select":Re("invalid",e),i=g=d=null;for(u in s)if(s.hasOwnProperty(u)&&(k=s[u],k!=null))switch(u){case"value":d=k;break;case"defaultValue":g=k;break;case"multiple":i=k;default:Xe(e,t,u,k,s,null)}t=d,s=g,e.multiple=!!i,t!=null?Hl(e,!!i,t,!1):s!=null&&Hl(e,!!i,s,!0);return;case"textarea":Re("invalid",e),d=u=i=null;for(g in s)if(s.hasOwnProperty(g)&&(k=s[g],k!=null))switch(g){case"value":i=k;break;case"defaultValue":u=k;break;case"children":d=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:Xe(e,t,g,k,s,null)}Zh(e,i,u,d);return;case"option":for(M in s)if(s.hasOwnProperty(M)&&(i=s[M],i!=null))switch(M){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Xe(e,t,M,i,s,null)}return;case"dialog":Re("beforetoggle",e),Re("toggle",e),Re("cancel",e),Re("close",e);break;case"iframe":case"object":Re("load",e);break;case"video":case"audio":for(i=0;i<Ni.length;i++)Re(Ni[i],e);break;case"image":Re("error",e),Re("load",e);break;case"details":Re("toggle",e);break;case"embed":case"source":case"link":Re("error",e),Re("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(B in s)if(s.hasOwnProperty(B)&&(i=s[B],i!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,B,i,s,null)}return;default:if(Ec(t)){for(G in s)s.hasOwnProperty(G)&&(i=s[G],i!==void 0&&Td(e,t,G,i,s,void 0));return}}for(k in s)s.hasOwnProperty(k)&&(i=s[k],i!=null&&Xe(e,t,k,i,s,null))}var hj={};function mj(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,g=null,k=null,M=null,B=null,G=null;for(Y in s){var Q=s[Y];if(s.hasOwnProperty(Y)&&Q!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":M=Q;default:i.hasOwnProperty(Y)||Xe(e,t,Y,null,i,Q)}}for(var L in i){var Y=i[L];if(Q=s[L],i.hasOwnProperty(L)&&(Y!=null||Q!=null))switch(L){case"type":Y!==Q&&(Be=!0),d=Y;break;case"name":Y!==Q&&(Be=!0),u=Y;break;case"checked":Y!==Q&&(Be=!0),B=Y;break;case"defaultChecked":Y!==Q&&(Be=!0),G=Y;break;case"value":Y!==Q&&(Be=!0),g=Y;break;case"defaultValue":Y!==Q&&(Be=!0),k=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Y!==Q&&Xe(e,t,L,Y,i,Q)}}Tc(e,g,k,M,B,G,d,u);return;case"select":Y=g=k=L=null;for(d in s)if(M=s[d],s.hasOwnProperty(d)&&M!=null)switch(d){case"value":break;case"multiple":Y=M;default:i.hasOwnProperty(d)||Xe(e,t,d,null,i,M)}for(u in i)if(d=i[u],M=s[u],i.hasOwnProperty(u)&&(d!=null||M!=null))switch(u){case"value":d!==M&&(Be=!0),L=d;break;case"defaultValue":d!==M&&(Be=!0),k=d;break;case"multiple":d!==M&&(Be=!0),g=d;default:d!==M&&Xe(e,t,u,d,i,M)}t=k,s=g,i=Y,L!=null?Hl(e,!!s,L,!1):!!i!=!!s&&(t!=null?Hl(e,!!s,t,!0):Hl(e,!!s,s?[]:"",!1));return;case"textarea":Y=L=null;for(k in s)if(u=s[k],s.hasOwnProperty(k)&&u!=null&&!i.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Xe(e,t,k,null,i,u)}for(g in i)if(u=i[g],d=s[g],i.hasOwnProperty(g)&&(u!=null||d!=null))switch(g){case"value":u!==d&&(Be=!0),L=u;break;case"defaultValue":u!==d&&(Be=!0),Y=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==d&&Xe(e,t,g,u,i,d)}Vh(e,L,Y);return;case"option":for(var ie in s)if(L=s[ie],s.hasOwnProperty(ie)&&L!=null&&!i.hasOwnProperty(ie))switch(ie){case"selected":e.selected=!1;break;default:Xe(e,t,ie,null,i,L)}for(M in i)if(L=i[M],Y=s[M],i.hasOwnProperty(M)&&L!==Y&&(L!=null||Y!=null))switch(M){case"selected":L!==Y&&(Be=!0),e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Xe(e,t,M,L,i,Y)}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 pe in s)L=s[pe],s.hasOwnProperty(pe)&&L!=null&&!i.hasOwnProperty(pe)&&Xe(e,t,pe,null,i,L);for(B in i)if(L=i[B],Y=s[B],i.hasOwnProperty(B)&&L!==Y&&(L!=null||Y!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:Xe(e,t,B,L,i,Y)}return;default:if(Ec(t)){for(var Ce in s)L=s[Ce],s.hasOwnProperty(Ce)&&L!==void 0&&!i.hasOwnProperty(Ce)&&Td(e,t,Ce,void 0,i,L);for(G in i)L=i[G],Y=s[G],!i.hasOwnProperty(G)||L===Y||L===void 0&&Y===void 0||Td(e,t,G,L,i,Y);return}}for(var H in s)L=s[H],s.hasOwnProperty(H)&&L!=null&&!i.hasOwnProperty(H)&&Xe(e,t,H,null,i,L);for(Q in i)L=i[Q],Y=s[Q],!i.hasOwnProperty(Q)||L===Y||L==null&&Y==null||Xe(e,t,Q,L,i,Y)}function nv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pj(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var u=s[i],d=u.transferSize,g=u.initiatorType,k=u.duration;if(d&&k&&nv(g)){for(g=0,k=u.responseEnd,i+=1;i<s.length;i++){var M=s[i],B=M.startTime;if(B>k)break;var G=M.transferSize,Q=M.initiatorType;G&&nv(Q)&&(M=M.responseEnd,g+=G*(M<k?1:(k-B)/(M-B)))}if(--i,t+=8*(d+g)/(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 Cd=null,Ed=null;function Ti(e){return e.nodeType===9?e:e.ownerDocument}function sv(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 lv(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 av(e,t,s,i){return s=Ti(s).createElement(e),s[bt]=i,s[Ht]=t,Nt(s,e,t),mt(s),s}function Ad(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 gj(){var e=window.event;return e&&e.type==="popstate"?e===zd?!1:(zd=e,!0):(zd=null,!1)}var Md=typeof setTimeout=="function"?setTimeout:void 0,vj=typeof clearTimeout=="function"?clearTimeout:void 0,iv=typeof Promise=="function"?Promise:void 0,rv=typeof requestAnimationFrame=="function"?requestAnimationFrame:Md,xj=typeof queueMicrotask=="function"?queueMicrotask:typeof iv<"u"?function(e){return iv.resolve(null).then(e).catch(bj)}:Md;function bj(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function ov(e,t){var s=t,i=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(u),wa(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")Hd(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Hd(s);for(var d=s.firstChild;d;){var g=d.nextSibling,k=d.nodeName;d[Ga]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&d.rel.toLowerCase()==="stylesheet"||s.removeChild(d),d=g}}else s==="body"&&Hd(e.ownerDocument.body);s=u}while(s);wa(t)}function cv(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function uv(e,t,s){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,s!=null&&(e.style.viewTransitionClass=s),s=getComputedStyle(e),s.display==="inline"){if(t=e.getClientRects(),t.length===1)var i=1;else for(var u=i=0;u<t.length;u++){var d=t[u];0<d.width&&0<d.height&&i++}i===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+s.paddingTop,e.marginBottom="-"+s.paddingBottom)}}function dv(e,t){e=e.style,t=t.style;var s=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=s==null||typeof s=="boolean"?"":(""+s).trim(),s=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=s==null||typeof s=="boolean"?"":(""+s).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(s=t.display,e.display=s==null||typeof s=="boolean"?"":s,s=t.margin,s!=null?e.margin=s:(s=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=s==null||typeof s=="boolean"?"":s,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function yj(e,t,s){return s=s.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<=s.innerHeight&&e.left<=s.innerWidth}}function Od(e){var t=e.getBoundingClientRect(),s=getComputedStyle(e);return yj(t,s,e)}function kj(e){return e.documentElement.clientHeight}function jj(e){this.addEventListener("load",e),this.addEventListener("error",e)}function wj(e,t,s,i,u,d,g,k,M){var B=t.nodeType===9?t:t.ownerDocument;try{var G=B.startViewTransition({update:function(){var L=B.defaultView,Y=L.navigation&&L.navigation.transition,ie=B.fonts.status;i();var pe=[];if(ie==="loaded"&&(kj(B),B.fonts.status==="loading"&&pe.push(B.fonts.ready)),ie=pe.length,e!==null)for(var Ce=e.suspenseyImages,H=0,_=0;_<Ce.length;_++){var I=Ce[_];if(!I.complete){var Z=I.getBoundingClientRect();if(0<Z.bottom&&0<Z.right&&Z.top<L.innerHeight&&Z.left<L.innerWidth){if(H+=Ov(I),H>Mo){pe.length=ie;break}I=new Promise(jj.bind(I)),pe.push(I)}}}if(0<pe.length)return L=Promise.race([Promise.all(pe),new Promise(function(fe){return setTimeout(fe,500)})]).then(u,u),(Y?Promise.allSettled([Y.finished,L]):L).then(d,d);if(u(),Y)return Y.finished.then(d,d);d()},types:s});B.__reactViewTransition=G;var Q=[];return G.ready.then(function(){for(var L=B.documentElement.getAnimations({subtree:!0}),Y=0;Y<L.length;Y++){var ie=L[Y],pe=ie.effect,Ce=pe.pseudoElement;if(Ce!=null&&Ce.startsWith("::view-transition")){Q.push(ie),ie=pe.getKeyframes();for(var H=Ce=void 0,_=!0,I=0;I<ie.length;I++){var Z=ie[I],fe=Z.width;if(Ce===void 0)Ce=fe;else if(Ce!==fe){_=!1;break}if(fe=Z.height,H===void 0)H=fe;else if(H!==fe){_=!1;break}delete Z.width,delete Z.height,Z.transform==="none"&&delete Z.transform}_&&Ce!==void 0&&H!==void 0&&(pe.setKeyframes(ie),_=getComputedStyle(pe.target,pe.pseudoElement),_.width!==Ce||_.height!==H)&&(_=ie[0],_.width=Ce,_.height=H,_=ie[ie.length-1],_.width=Ce,_.height=H,pe.setKeyframes(ie))}}g()},function(L){B.__reactViewTransition===G&&(B.__reactViewTransition=null);try{if(typeof L=="object"&&L!==null)switch(L.name){case"InvalidStateError":(L.message==="View transition was skipped because document visibility state is hidden."||L.message==="Skipping view transition because document visibility state has become hidden."||L.message==="Skipping view transition because viewport size changed."||L.message==="Transition was aborted because of invalid state")&&(L=null)}L!==null&&M(L)}finally{i(),u(),g()}}),G.finished.finally(function(){for(var L=0;L<Q.length;L++)Q[L].cancel();B.__reactViewTransition===G&&(B.__reactViewTransition=null),k()}),G}catch{return i(),u(),g(),null}}function vl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}vl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:O({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},vl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,s=e.getAnimations({subtree:!0}),i=[],u=0;u<s.length;u++){var d=s[u].effect;d!==null&&d.target===e&&d.pseudoElement===t&&i.push(s[u])}return i},vl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function fv(e){return{name:e,group:new vl("group",e),imagePair:new vl("image-pair",e),old:new vl("old",e),new:new vl("new",e)}}function an(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}an.prototype.addEventListener=function(e,t,s){var i=null,u=null;if(!(s!=null&&typeof s!="boolean"&&(i=s.signal||null,i!==null&&i.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var d=this._eventListeners;if(mv(d,e,t,s)===-1){var g=this,k=t;s!=null&&typeof s!="boolean"&&s.once===!0&&(k=function(M){g.removeEventListener(e,t,s),typeof t=="function"?t.call(this,M):t.handleEvent(M)}),i!==null&&(u=g.removeEventListener.bind(g,e,t,s),i.addEventListener("abort",u,{once:!0}),u=i.removeEventListener.bind(i,"abort",u)),i=va(s),d.push({type:e,listener:t,optionsOrUseCapture:s,attachedListener:k,cleanup:u}),b(this._fragmentFiber.child,!1,Nj,e,k,i)}this._eventListeners=d}};function Nj(e,t,s,i){return A(e).addEventListener(t,s,i),!1}an.prototype.removeEventListener=function(e,t,s){var i=this._eventListeners;if(i!==null&&(t=mv(i,e,t,s),t!==-1)){var u=i[t];s=u.attachedListener;var d=u.cleanup;u=va(u.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Sj,e,s,u),i.splice(t,1),d!==null&&d()}};function Sj(e,t,s,i){return A(e).removeEventListener(t,s,i),!1}function va(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function hv(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function mv(e,t,s,i){if(e.length===0)return-1;i=hv(i);for(var u=0;u<e.length;u++){var d=e[u];if(d.type===t&&d.listener===s&&hv(d.optionsOrUseCapture)===i)return u}return-1}an.prototype.dispatchEvent=function(e){var t=N(this._fragmentFiber);if(t===null)return!0;t=A(t);var s=this._eventListeners;if(s!==null&&0<s.length||!e.bubbles){var i=t.nodeType===9?t.createComment(""):document.createTextNode("");if(s)for(var u=0;u<s.length;u++){var d=s[u];i.addEventListener(d.type,d.attachedListener,va(d.optionsOrUseCapture))}if(t.appendChild(i),e=i.dispatchEvent(e),s)for(u=0;u<s.length;u++)d=s[u],i.removeEventListener(d.type,d.attachedListener,va(d.optionsOrUseCapture));return t.removeChild(i),e}return t.dispatchEvent(e)},an.prototype.focus=function(e){b(this._fragmentFiber.child,!0,pv,e,void 0,void 0)};function pv(e,t){return e.tag===6?!1:(e=A(e),Uj(e,t))}an.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,_d,t,void 0,void 0);for(var s=t.length-1;0<=s&&!pv(t[s],e);s--);};function _d(e,t){return t.push(e),!1}an.prototype.blur=function(){var e=N(this._fragmentFiber);e!==null&&(e=A(e),e=Ti(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Tj,e,void 0,void 0))};function Tj(e,t){return e.tag===6?!1:(e=A(e),e===t||e.contains(t)?(t.blur(),!0):!1)}an.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,Cj,e,void 0,void 0)};function Cj(e,t){return e.tag===6||(e=A(e),t.observe(e)),!1}an.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Ej,e,void 0,void 0);for(var s=t=0;s<On.length;s++){var i=On[s];i.fragmentInstance===this&&i.observer===e?e.unobserve(i.instance):On[t++]=i}On.length=t}};function Ej(e,t){return e.tag===6||(e=A(e),t.unobserve(e)),!1}var On=[],Rd=!1;function Aj(e,t,s){On.push({fragmentInstance:e,observer:t,instance:s}),Rd||(Rd=!0,Lj(function(){Rd=!1;var i=On;On=[];for(var u=0;u<i.length;u++){var d=i[u];d.observer.unobserve(d.instance)}}))}an.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,zj,e,void 0,void 0),e};function zj(e,t){if(e.tag===6){e=e.stateNode;var s=e.ownerDocument.createRange();s.selectNodeContents(e),t.push.apply(t,s.getClientRects())}else e=A(e),t.push.apply(t,e.getClientRects());return!1}an.prototype.getRootNode=function(e){var t=N(this._fragmentFiber);return t===null?this:A(t).getRootNode(e)},an.prototype.compareDocumentPosition=function(e){var t=N(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var s=[];b(this._fragmentFiber.child,!1,_d,s,void 0,void 0);var i=A(t);if(s.length===0){if(s=i,w(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&&(s=t)}t=this._fragmentFiber;var u=i=s.compareDocumentPosition(e);return s===e?u=Node.DOCUMENT_POSITION_CONTAINS:i&Node.DOCUMENT_POSITION_CONTAINED_BY&&(s=T(t)[1],s===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=A(s).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=A(s[0]),u=A(s[s.length-1]);var d=w(this._fragmentFiber)?t.parentElement:i;if(d==null)return Node.DOCUMENT_POSITION_DISCONNECTED;i=d.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,d=d.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var g=t.compareDocumentPosition(e),k=u.compareDocumentPosition(e),M=g&Node.DOCUMENT_POSITION_CONTAINED_BY||k&Node.DOCUMENT_POSITION_CONTAINED_BY;return k=i&&d&&g&Node.DOCUMENT_POSITION_FOLLOWING&&k&Node.DOCUMENT_POSITION_PRECEDING,t=i&&t===e||d&&u===e||M||k?Node.DOCUMENT_POSITION_CONTAINED_BY:!i&&t===e||!d&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:g,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Mj(t,this._fragmentFiber,s[0],s[s.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Mj(e,t,s,i,u){var d=Js(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(s=!!d)e:{for(;d!==null;){if(d.tag===7&&(d===t||d.alternate===t)){s=!0;break e}d=d.return}s=!1}return s}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(d===null)return d=u.ownerDocument,u===d||u===d.documentElement||u===d.body;e:{for(d=t,t=N(t);d!==null;){if(!(d.tag!==5&&d.tag!==3&&d.tag!==27||d!==t&&d.alternate!==t)){d=!0;break e}d=d.return}d=!1}return d}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!d)&&!(t=d===s)&&(t=S(s,d,C),t===null?t=!1:(b(t,!0,$,d,s),d=z,z=null,t=d!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!d)&&!(t=d===i)&&(t=S(i,d,C),t===null?t=!1:(b(t,!0,j,d,i),d=z,U=z=null,t=d!==null)),t):!1}function gv(e,t){var s=e.ownerDocument.createRange();s.selectNodeContents(e),e=s.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}an.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];b(this._fragmentFiber.child,!1,_d,t,void 0,void 0);var s=e!==!1;if(t.length===0){var i=T(this._fragmentFiber);if(i=s?i[1]||i[0]||N(this._fragmentFiber):i[0]||i[1],i===null)return;if(i.tag===6){e=A(i),gv(e,s);return}if(i=A(i),i.nodeType!==9){if(i.nodeType===11){s="host"in i?i.host:null,s!==null&&s.scrollIntoView(e);return}i.scrollIntoView(e)}}for(i=s?t.length-1:0;i!==(s?-1:t.length);){var u=t[i];u.tag===6?(u=A(u),gv(u,s)):A(u).scrollIntoView(e),i+=s?-1:1}};function Oj(e,t){return e=A(e),vv(e,t),!1}function vv(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function xv(e,t){var s=t._eventListeners;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];e.addEventListener(u.type,u.attachedListener,va(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){for(var g=0,k=0;k<On.length;k++){var M=On[k];(M.fragmentInstance!==t||M.observer!==d||M.instance!==e)&&(On[g++]=M)}On.length=g,d.observe(e)}),vv(e,t))}function _j(e,t){var s=t._eventListeners;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];e.removeEventListener(u.type,u.attachedListener,va(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){typeof d.rootMargin=="string"?Aj(t,d,e):d.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Dd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Dd(s),xr(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Rj(e,t,s,i){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ga])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==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(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=vn(e.nextSibling),e===null)break}return null}function Dj(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=vn(e.nextSibling),e===null))return null;return e}function bv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=vn(e.nextSibling),e===null))return null;return e}function $d(e){return e.data==="$?"||e.data==="$~"}function Ud(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function $j(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function vn(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 Ld=null;function yv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return vn(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function kv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function Uj(e,t){function s(){i=!0}if(e.ownerDocument.activeElement===e)return!0;var i=!1;try{e.ownerDocument.addEventListener("focus",s,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",s,!0)}return i}function Lj(e){rv(function(){rv(function(t){return e(t)})})}function jv(e,t,s){switch(t=Ti(s),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 wv(e,t,s){for(var i in s){var u=s[i];s.hasOwnProperty(i)&&u!=null&&Xe(e,t,i,null,hj,u)}s.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Hn&&(e.onclick=null),xr(e)}function Hd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xr(e)}var xn=new Map,Nv=new Set;function Ci(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 hs=xe.d;xe.d={f:Hj,r:Bj,D:qj,C:Ij,L:Yj,m:Gj,X:Xj,S:Kj,M:Vj};function Hj(){var e=hs.f(),t=jo();return e||t}function Bj(e){var t=$l(e);t!==null&&t.tag===5&&t.type==="form"?Tp(t):hs.r(e)}var xa=typeof document>"u"?null:document;function Sv(e,t,s){var i=xa;if(i&&typeof t=="string"&&t){var u=un(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Nv.has(u)||(Nv.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),mt(t),i.head.appendChild(t)))}}function qj(e){hs.D(e),Sv("dns-prefetch",e,null)}function Ij(e,t){hs.C(e,t),Sv("preconnect",e,t)}function Yj(e,t,s){hs.L(e,t,s);var i=xa;if(i&&e&&t){var u='link[rel="preload"][as="'+un(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+un(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+un(s.imageSizes)+'"]')):u+='[href="'+un(e)+'"]';var d=u;switch(t){case"style":d=ba(e);break;case"script":d=ya(e)}if(!(xn.has(d)||(e=O({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),xn.set(d,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ei(d))||t==="script"&&i.querySelector(Ai(d))))){var g=i.createElement("link");Nt(g,"link",e),t==="style"&&(g[vr]=!0,g.onload=g.onerror=function(){Lh(g)}),mt(g),i.head.appendChild(g)}}}function Gj(e,t){hs.m(e,t);var s=xa;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+un(i)+'"][href="'+un(e)+'"]',d=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ya(e)}if(!xn.has(d)&&(e=O({rel:"modulepreload",href:e},t),xn.set(d,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ai(d)))return}i=s.createElement("link"),Nt(i,"link",e),mt(i),s.head.appendChild(i)}}}function Kj(e,t,s){hs.S(e,t,s);var i=xa;if(i&&e){var u=Ul(i).hoistableStyles,d=ba(e);t=t||"default";var g=u.get(d);if(!g){var k={loading:0,preload:null};if(g=i.querySelector(Ei(d)))k.loading=5;else{e=O({rel:"stylesheet",href:e,"data-precedence":t},s),(s=xn.get(d))&&Bd(e,s);var M=g=i.createElement("link");mt(M),Nt(M,"link",e),M._p=new Promise(function(B,G){M.onload=B,M.onerror=G}),M.addEventListener("load",function(){k.loading|=1}),M.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ao(g,t,i)}g={type:"stylesheet",instance:g,count:1,state:k},u.set(d,g)}}}function Xj(e,t){hs.X(e,t);var s=xa;if(s&&e){var i=Ul(s).hoistableScripts,u=ya(e),d=i.get(u);d||(d=s.querySelector(Ai(u)),d||(e=O({src:e,async:!0},t),(t=xn.get(u))&&qd(e,t),d=s.createElement("script"),mt(d),Nt(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(u,d))}}function Vj(e,t){hs.M(e,t);var s=xa;if(s&&e){var i=Ul(s).hoistableScripts,u=ya(e),d=i.get(u);d||(d=s.querySelector(Ai(u)),d||(e=O({src:e,async:!0,type:"module"},t),(t=xn.get(u))&&qd(e,t),d=s.createElement("script"),mt(d),Nt(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(u,d))}}function Tv(e,t,s,i){var u=(u=Tn.current)?Ci(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=ba(s.href),t=Ul(u).hoistableStyles,i=t.get(s),i||(i={type:"style",instance:null,count:0,state:null},t.set(s,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=ba(s.href);var d=Ul(u).hoistableStyles,g=d.get(e);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,g),(d=u.querySelector(Ei(e)))?d._p||(g.instance=d,g.state.loading=5):(d=xn.get(e),d||(d={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},xn.set(e,d)),Zj(u,e,d,g.state))),t&&i===null)throw Error(o(528,""));return g}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(s=ya(s),t=Ul(u).hoistableScripts,i=t.get(s),i||(i={type:"script",instance:null,count:0,state:null},t.set(s,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function ba(e){return'href="'+un(e)+'"'}function Ei(e){return'link[rel="stylesheet"]['+e+"]"}function Cv(e){return O({},e,{"data-precedence":e.precedence,precedence:null})}function Zj(e,t,s,i){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[vr]!==!0){i.loading=1;return}}else t=e.createElement("link"),t[vr]=!0,t.onload=t.onerror=Lh.bind(null,t),Nt(t,"link",s),mt(t),e.head.appendChild(t);i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2})}function ya(e){return'[src="'+un(e)+'"]'}function Ai(e){return"script[async]"+e}function Ev(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+un(s.href)+'"]');if(i)return t.instance=i,mt(i),i;var u=O({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),mt(i),Nt(i,"style",u),Ao(i,s.precedence,e),t.instance=i;case"stylesheet":u=ba(s.href);var d=e.querySelector(Ei(u));if(d)return t.state.loading|=4,t.instance=d,mt(d),d;i=Cv(s),(u=xn.get(u))&&Bd(i,u),d=(e.ownerDocument||e).createElement("link"),mt(d);var g=d;return g._p=new Promise(function(k,M){g.onload=k,g.onerror=M}),Nt(d,"link",i),t.state.loading|=4,Ao(d,s.precedence,e),t.instance=d;case"script":return d=ya(s.src),(u=e.querySelector(Ai(d)))?(t.instance=u,mt(u),u):(i=s,(u=xn.get(d))&&(i=O({},s),qd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),mt(u),Nt(u,"link",i),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&&(i=t.instance,t.state.loading|=4,Ao(i,s.precedence,e));return t.instance}function Ao(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,d=u,g=0;g<i.length;g++){var k=i[g];if(k.dataset.precedence===t)d=k;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Bd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function qd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zo=null;function Av(e,t,s){if(zo===null){var i=new Map,u=zo=new Map;u.set(s,i)}else u=zo,i=u.get(s),i||(i=new Map,u.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var d=s[u];if(!(d[Ga]||d[bt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var g=d.getAttribute(t)||"";g=e+g;var k=i.get(g);k?k.push(d):i.set(g,[d])}}return i}function Id(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Qj(e,t,s){if(s===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 zv(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Mv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function _v(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Ov(t),e.suspenseyImages.push(t)),e=Fj.bind(e),t.decode().then(e,e))}function Jj(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=ba(i.href),d=t.querySelector(Ei(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zi.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=d,mt(d);return}d=t.ownerDocument||t,i=Cv(i),(u=xn.get(u))&&Bd(i,u),d=d.createElement("link"),mt(d);var g=d;g._p=new Promise(function(k,M){g.onload=k,g.onerror=M}),Nt(d,"link",i),s.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=zi.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Mo=0;function Pj(e,t){return e.stylesheets&&e.count===0&&_o(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Mo===0&&(Mo=62500*pj());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Mo?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Rv(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)_o(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function zi(){this.count--,Rv(this)}function Fj(){this.imgCount--,Rv(this)}var Oo=null;function _o(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Oo=new Map,t.forEach(Wj,e),Oo=null,zi.call(e))}function Wj(e,t){if(!(t.state.loading&4)){var s=Oo.get(e);if(s)var i=s.get(null);else{s=new Map,Oo.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var g=u[d];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(s.set(g.dataset.precedence,g),i=g)}i&&s.set(null,i)}u=t.instance,g=u.getAttribute("data-precedence"),d=s.get(g)||i,d===i&&s.set(null,u),s.set(g,u),this.count++,i=zi.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var ka={$$typeof:Oe,Provider:null,Consumer:null,_currentValue:nt,_currentValue2:nt,_threadCount:0};function e1(e,t,s,i,u,d,g,k,M){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=jc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jc(0),this.hiddenUpdates=jc(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.transitionTypes=null,this.incompleteTransitions=new Map}function Dv(e,t,s,i,u,d,g,k,M,B,G,Q){return e=new e1(e,t,s,g,M,B,G,Q,k),t=1,d===!0&&(t|=24),d=Bt(3,null,null,t),e.current=d,d.stateNode=e,t=su(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:i,isDehydrated:s,cache:t},ru(d),e}function $v(e){return e?(e=Vl,e):Vl}function Uv(e,t,s,i,u,d){u=$v(u),i.context===null?i.context=u:i.pendingContext=u,i=Es(t),i.payload={element:s},d=d===void 0?null:d,d!==null&&(i.callback=d),s=As(e,i,t),s!==null&&(Gt(s,e,t),ri(s,e,t))}function Lv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Yd(e,t){Lv(e,t),(e=e.alternate)&&Lv(e,t)}function Hv(e){if(e.tag===13||e.tag===31){var t=el(e,67108864);t!==null&&Gt(t,e,67108864),Yd(e,67108864)}}function Bv(e){if(e.tag===13||e.tag===31){var t=ln();t=wc(t);var s=el(e,t);s!==null&&Gt(s,e,t),Yd(e,t)}}var ja=!0;function t1(e,t,s,i){var u=oe.T;oe.T=null;var d=xe.p;try{xe.p=2,Gd(e,t,s,i)}finally{xe.p=d,oe.T=u}}function n1(e,t,s,i){var u=oe.T;oe.T=null;var d=xe.p;try{xe.p=8,Gd(e,t,s,i)}finally{xe.p=d,oe.T=u}}function Gd(e,t,s,i){if(ja){var u=Kd(i);if(u===null)Sd(e,t,i,Ro,s),Iv(e,i);else if(l1(u,e,t,s,i))i.stopPropagation();else if(Iv(e,i),t&4&&-1<s1.indexOf(e)){for(;u!==null;){var d=$l(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var g=Qs(d.pendingLanes);if(g!==0){var k=d;for(k.pendingLanes|=2,k.entangledLanes|=2;g;){var M=1<<31-Pt(g);k.entanglements[1]|=M,g&=~M}Qn(d),(qe&6)===0&&(bo=Qt()+500,wi(0))}}break;case 31:case 13:k=el(d,2),k!==null&&Gt(k,d,2),jo(),Yd(d,2)}if(d=Kd(i),d===null&&Sd(e,t,i,Ro,s),d===u)break;u=d}u!==null&&i.stopPropagation()}else Sd(e,t,i,null,s)}}function Kd(e){return e=zc(e),Xd(e)}var Ro=null;function Xd(e){if(Ro=null,e=Js(e),e!==null){var t=f(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ro=e,null}function qv(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(py()){case Th:return 2;case Ch:return 8;case fr:case gy:return 32;case Eh:return 268435456;default:return 32}default:return 32}}var Vd=!1,qs=null,Is=null,Ys=null,Mi=new Map,Oi=new Map,Gs=[],s1="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 Iv(e,t){switch(e){case"focusin":case"focusout":qs=null;break;case"dragenter":case"dragleave":Is=null;break;case"mouseover":case"mouseout":Ys=null;break;case"pointerover":case"pointerout":Mi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oi.delete(t.pointerId)}}function _i(e,t,s,i,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:d,targetContainers:[u]},t!==null&&(t=$l(t),t!==null&&Hv(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function l1(e,t,s,i,u){switch(t){case"focusin":return qs=_i(qs,e,t,s,i,u),!0;case"dragenter":return Is=_i(Is,e,t,s,i,u),!0;case"mouseover":return Ys=_i(Ys,e,t,s,i,u),!0;case"pointerover":var d=u.pointerId;return Mi.set(d,_i(Mi.get(d)||null,e,t,s,i,u)),!0;case"gotpointercapture":return d=u.pointerId,Oi.set(d,_i(Oi.get(d)||null,e,t,s,i,u)),!0}return!1}function Yv(e){var t=Js(e.target);if(t!==null){var s=f(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,Dh(e.priority,function(){Bv(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,Dh(e.priority,function(){Bv(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Do(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Kd(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);Ac=i,s.target.dispatchEvent(i),Ac=null}else return t=$l(s),t!==null&&Hv(t),e.blockedOn=s,!1;t.shift()}return!0}function Gv(e,t,s){Do(e)&&s.delete(t)}function a1(){Vd=!1,qs!==null&&Do(qs)&&(qs=null),Is!==null&&Do(Is)&&(Is=null),Ys!==null&&Do(Ys)&&(Ys=null),Mi.forEach(Gv),Oi.forEach(Gv)}function $o(e,t){e.blockedOn===t&&(e.blockedOn=null,Vd||(Vd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,a1)))}var Uo=null;function Kv(e){Uo!==e&&(Uo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Uo===e&&(Uo=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Xd(i||s)===null)continue;break}var d=$l(s);d!==null&&(e.splice(t,3),t-=3,Eu(d,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function wa(e){function t(M){return $o(M,e)}qs!==null&&$o(qs,e),Is!==null&&$o(Is,e),Ys!==null&&$o(Ys,e),Mi.forEach(t),Oi.forEach(t);for(var s=0;s<Gs.length;s++){var i=Gs[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Gs.length&&(s=Gs[0],s.blockedOn===null);)Yv(s),s.blockedOn===null&&Gs.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var u=s[i],d=s[i+1],g=u[Ht]||null;if(typeof d=="function")g||Kv(s);else if(g){var k=null;if(d&&d.hasAttribute("formAction")){if(u=d,g=d[Ht]||null)k=g.formAction;else if(Xd(u)!==null)continue}else k=g.action;typeof k=="function"?s[i+1]=k:(s.splice(i,3),i-=3),Kv(s)}}}function Xv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(g){return u=g})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Zd(e){this._internalRoot=e}Lo.prototype.render=Zd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var s=t.current,i=ln();Uv(s,i,e,t,null,null)},Lo.prototype.unmount=Zd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Uv(e.current,2,null,e,null,null),jo(),t[Dl]=null}};function Lo(e){this._internalRoot=e}Lo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rh();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Gs.length&&t!==0&&t<Gs[s].priority;s++);Gs.splice(s,0,e),s===0&&Yv(e)}};var Vv=a.version;if(Vv!=="19.3.1")throw Error(o(527,Vv,"19.3.1"));xe.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=v(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var i1={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:oe,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ho.isDisabled&&Ho.supportsFiber)try{qa=Ho.inject(i1),Jt=Ho}catch{}}return Di.createRoot=function(e,t){if(!c(e))throw Error(o(299));var s=!1,i="",u=$p,d=Up,g=Lp;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=Dv(e,1,!1,null,null,s,i,null,u,d,g,Xv),e[Dl]=t.current,Nd(e),new Zd(t)},Di.hydrateRoot=function(e,t,s){if(!c(e))throw Error(o(299));var i=!1,u="",d=$p,g=Up,k=Lp,M=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(g=s.onCaughtError),s.onRecoverableError!==void 0&&(k=s.onRecoverableError),s.formState!==void 0&&(M=s.formState)),t=Dv(e,1,!0,t,s??null,i,u,M,d,g,k,Xv),t.context=$v(null),s=t.current,i=ln(),i=wc(i),u=Es(i),u.callback=null,As(s,u,i),s=i,t.current.lanes=s,Ya(t,s),Qn(t),e[Dl]=t.current,Nd(e),new Lo(t)},Di.version="19.3.1",Di}var sx;function p1(){if(sx)return Jd.exports;sx=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(),Jd.exports=m1(),Jd.exports}var g1=p1(),y=Yf();const v1=["general","providers","models","memory","image","knowledge","search","skills","mcp","desktop","work","push","about"];function x1(n){const[a,r]=n.replace(/^#\/?/,"").split("/");let o=null;try{o=r?decodeURIComponent(r):null}catch{}return a==="knowledge"?{sel:null,settings:!1,section:null,knowledge:!0}:a==="chat"&&o?{sel:o,settings:!1,section:null}:a==="settings"?{sel:null,settings:!0,section:v1.find(f=>f===o)??null}:{sel:null,settings:!1,section:null}}function b1(n,a){return n.page==="knowledge"?"#/knowledge":n.page==="settings"?n.section?`#/settings/${n.section}`:"#/settings":!n.sel||a&&n.mobile!=="chat"?"":`#/chat/${encodeURIComponent(n.sel)}`}const y1=["searxng","exa","tavily","brave","serper","jina","firecrawl","perplexity","youcom","ollama"];function Ab(){return y1.map(n=>({name:n,enabled:!1}))}class Ue extends Error{status;constructor(a,r){super(r),this.status=a}}async function ne(n,a){let r;try{r=await fetch(n,{credentials:"same-origin",...a})}catch(c){throw new Ue(0,`无法连接 Hob:${c instanceof Error?c.message:String(c)}`)}if(!r.ok){let c=`${r.status} ${r.statusText}`;try{const f=await r.json();f?.error&&(c=f.error)}catch{}throw new Ue(r.status,c)}if(r.status===204)return;const o=await r.text();return o?JSON.parse(o):void 0}function Le(n,a="POST"){return{method:a,headers:{"content-type":"application/json"},body:JSON.stringify(n)}}const k1=["assistant","assistant_removed","item","delta","job","delegation","job_step","activity","approval","draft","routine","routine_removed","profile","knowledge","skills"],j1={knowledge:(n={})=>{const a=new URLSearchParams;for(const[r,o]of Object.entries(n))o!==void 0&&o!==""&&a.set(r,String(o));return ne(`/api/knowledge?${a}`)},knowledgeEntry:(n,a)=>ne(`/api/knowledge/entries/${encodeURIComponent(n)}${a!==void 0?`?chunk=${a}`:""}`),reindexKnowledge:n=>ne(`/api/knowledge/collections/${encodeURIComponent(n)}/reindex`,{method:"POST"}),embeddingKey:()=>ne("/api/knowledge/embedding"),putEmbedding:(n,a,r)=>ne("/api/knowledge/embedding",Le({revision:n,embedding:a,...r?{apiKey:r}:{}},"PUT")),embeddingTest:n=>ne("/api/knowledge/embedding/test",Le(n)),createKnowledgeCollection:n=>ne("/api/knowledge/collections",Le({name:n})).then(a=>a.collection),renameKnowledgeCollection:(n,a)=>ne(`/api/knowledge/collections/${encodeURIComponent(n)}`,Le({name:a},"PATCH")).then(r=>r.collection),deleteKnowledgeCollection:n=>ne(`/api/knowledge/collections/${encodeURIComponent(n)}`,{method:"DELETE"}),patchKnowledgeEntry:(n,a)=>ne(`/api/knowledge/entries/${encodeURIComponent(n)}`,Le(a,"PATCH")).then(r=>r.entry),deleteKnowledgeEntry:n=>ne(`/api/knowledge/entries/${encodeURIComponent(n)}`,{method:"DELETE"}),uploadKnowledge:(n,a)=>{const r=new FormData;for(const o of a)r.append("files",o);return ne(`/api/knowledge/upload?collection=${encodeURIComponent(n)}`,{method:"POST",body:r})},me:()=>ne("/api/me"),login:n=>ne("/api/login",Le({password:n})),logout:()=>ne("/api/logout",{method:"POST"}),bootstrap:()=>ne("/api/bootstrap"),settings:()=>ne("/api/settings"),models:()=>ne("/api/models"),putSettings:(n,a)=>ne("/api/settings",Le({revision:n,patch:a},"PUT")),providers:()=>ne("/api/providers"),claude:()=>ne("/api/claude"),saveClaude:(n,a)=>ne("/api/claude",Le({revision:n,claude:a},"PUT")),putProvider:(n,a)=>ne(`/api/providers/${encodeURIComponent(n)}`,Le(a,"PUT")),putThinking:n=>ne("/api/models/thinking",Le(n,"PUT")),deleteProvider:n=>ne(`/api/providers/${encodeURIComponent(n)}`,{method:"DELETE"}),testProvider:n=>ne("/api/providers/test",Le(n)),discoverProvider:n=>ne("/api/providers/discover",Le(n)),providersImport:()=>ne("/api/providers/import"),importProviders:n=>ne("/api/providers/import",Le({ids:n})),assistantSkills:n=>ne(`/api/assistants/${encodeURIComponent(n)}/skills`),patchAssistantSkill:(n,a,r)=>ne(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:r})}),rollbackAssistantSkill:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}/rollback`,{method:"POST"}),deleteAssistantSkill:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),sedimentJob:n=>ne(`/api/jobs/${encodeURIComponent(n)}/sediment`,{method:"POST"}),skills:()=>ne("/api/skills"),skillsImport:n=>ne(`/api/skills/import/${n}`),importSkills:(n,a,r)=>ne(`/api/skills/import/${n}`,Le({ids:a,overwrite:r})),deleteSkill:n=>ne(`/api/skills/${encodeURIComponent(n)}`,{method:"DELETE"}),desktop:()=>ne("/api/desktop"),saveDesktop:n=>ne("/api/desktop",Le(n,"PUT")),saveDesktopPublic:(n,a)=>ne("/api/desktop/public",Le({revision:n,assistants:a},"PUT")),testDesktop:()=>ne("/api/desktop/test",Le({})),mcp:()=>ne("/api/mcp"),putMcp:(n,a)=>ne(`/api/mcp/${encodeURIComponent(n)}`,Le(a,"PUT")),patchMcp:(n,a)=>ne(`/api/mcp/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteMcp:n=>ne(`/api/mcp/${encodeURIComponent(n)}`,{method:"DELETE"}),testMcp:(n,a)=>ne(`/api/mcp/${encodeURIComponent(n)}/test`,Le({refresh:a})),mcpImports:()=>ne("/api/mcp/import"),importMcp:n=>ne("/api/mcp/import",Le({ids:n})),search:()=>ne("/api/search"),putSearch:(n,a,r)=>ne("/api/search",Le({revision:n,providers:a,keys:r},"PUT")),testSearch:(n,a,r)=>ne("/api/search/test",Le({name:n,baseUrl:a,apiKey:r})),imageKey:()=>ne("/api/image"),putImage:(n,a,r)=>ne("/api/image",Le({revision:n,image:a,...r?{apiKey:r}:{}},"PUT")),imageTest:n=>ne("/api/image/test",Le(n)),changePassword:(n,a)=>ne("/api/password",Le({old:n,new:a})),about:()=>ne("/api/about"),memory:()=>ne("/api/memory"),putMemory:(n,a)=>ne("/api/memory",Le({revision:n,provider:a},"PUT")),putLore:n=>ne("/api/memory/lore",Le(n,"PUT")),loreTest:n=>ne("/api/memory/lore-test",Le(n)),loreImport:()=>ne("/api/memory/lore/import"),importLore:()=>ne("/api/memory/lore/import",{method:"POST"}),items:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}/items?limit=60${a?`&before=${encodeURIComponent(a)}`:""}`),profile:n=>ne(`/api/assistants/${encodeURIComponent(n)}/profile`),sendMessage:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}/messages`,Le(a)),stopAssistant:n=>ne(`/api/assistants/${encodeURIComponent(n)}/stop`,{method:"POST"}),markRead:n=>ne(`/api/assistants/${encodeURIComponent(n)}/read`,{method:"POST"}),patchAssistant:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),archiveAssistant:n=>ne(`/api/assistants/${encodeURIComponent(n)}/archive`,{method:"POST"}),deleteRule:(n,a)=>ne(`/api/assistants/${encodeURIComponent(n)}/rules/${encodeURIComponent(a)}`,{method:"DELETE"}),retryDelegation:n=>ne(`/api/delegations/${encodeURIComponent(n)}/retry`,{method:"POST"}),answerApproval:(n,a)=>ne(`/api/approvals/${encodeURIComponent(n)}`,Le(a)),createDraft:n=>ne(`/api/drafts/${encodeURIComponent(n)}/create`,{method:"POST"}),dismissDraft:n=>ne(`/api/drafts/${encodeURIComponent(n)}/dismiss`,{method:"POST"}),createRoutine:n=>ne("/api/routines",Le(n)),patchRoutine:(n,a)=>ne(`/api/routines/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteRoutine:n=>ne(`/api/routines/${encodeURIComponent(n)}`,{method:"DELETE"}),runRoutine:n=>ne(`/api/routines/${encodeURIComponent(n)}/run`,{method:"POST"}),replyJob:(n,a)=>ne(`/api/jobs/${encodeURIComponent(n)}/reply`,Le({text:a})),stopJob:n=>ne(`/api/jobs/${encodeURIComponent(n)}/stop`,{method:"POST"}),transcript:n=>ne(`/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 r=a.toString();return ne(`/api/jobs${r?`?${r}`:""}`)},upload:async n=>{const a=new FormData;a.append("file",n);const r=await ne("/api/uploads",{method:"POST",body:a});if(!r.file?.path)throw new Error("上传响应缺少文件路径");return r.file.path},fileUrl:(n,a)=>`/api/files?path=${encodeURIComponent(n)}${a?.inline?"&inline=1":""}${a?.truncate?"&truncate=1":""}${a?.thumb?"&thumb=1":""}`,fileMeta:n=>ne(`/api/files/meta?path=${encodeURIComponent(n)}`),jobFiles:(n,a)=>ne(`/api/jobs/${encodeURIComponent(n)}/files${a?`?path=${encodeURIComponent(a)}`:""}`),push:()=>ne("/api/push"),subscribePush:(n,a)=>ne("/api/push/subscribe",Le({subscription:n,label:a})).then(r=>r.push),unsubscribePush:n=>ne("/api/push/subscribe",{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})}),testPush:n=>ne("/api/push/test",Le(n?{endpoint:n}:{})),visibility:(n,a)=>ne("/api/visibility",Le({clientId:n,visible:a})),events:({onEvent:n,onReconnect:a,onDown:r},o)=>{const c=new EventSource(`/api/events${o?`?clientId=${encodeURIComponent(o)}`:""}`);let f=!1;const h=m=>{try{n(JSON.parse(m.data))}catch{}};c.onmessage=h;for(const m of k1)c.addEventListener(m,h);return c.onerror=()=>{f=!0,r(c.readyState===EventSource.CLOSED?"实时连接已断开":"实时连接中断,正在重连")},c.onopen=()=>{f&&(f=!1,a())},()=>c.close()}},w1=60;function N1(n,a){return n.at===a.at?0:n.at<a.at?-1:1}function zb(n,a,r=w1){const o=Array.isArray(a)?a:[a];if(!o.length)return n;const c=n.slice(),f=new Map;c.forEach((h,m)=>f.set(h.id,m));for(const h of o){const m=f.get(h.id);m===void 0?(f.set(h.id,c.length),c.push(h)):c[m]=h}return c.sort(N1),c.length>r?c.slice(-r):c}function S1(n,a,r){const o=n.findIndex(h=>h.id===a);if(o<0)return n;const c=n[o];if(c.kind!=="assistant")return n;const f=n.slice();return f[o]={...c,text:c.text+r},f}function Mb(n){const a=n[n.length-1];return a?.kind==="assistant"&&!!a.streaming}function T1(n,a){return n.state==="writing"&&!a.seen&&!a.closed&&a.inChat&&n.assistantId===a.assistantId}function C1(n,a){return n.filter(r=>r.assistantId===a&&r.state==="writing")}const E1=900,za=new Map;function Ob(n){for(const a of n)za.has(a)||za.set(a,window.setTimeout(()=>za.delete(a),E1))}function A1(n){return za.has(n)}function z1(){for(const n of za.values())window.clearTimeout(n);za.clear()}function _b(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 Dn(n,a=180){const[r,o]=y.useState(n);return y.useEffect(()=>{if(n){o(!0);return}const c=window.setTimeout(()=>o(!1),a);return()=>window.clearTimeout(c)},[n,a]),{mounted:r,leaving:r&&!n}}function M1(n,a,r="",o=200){const[c,f]=y.useState([]),[h,m]=y.useState([]),p=y.useRef(null),v=y.useRef(r),x=y.useRef([]),b=y.useRef([]);return y.useEffect(()=>{const w=n.map(a);if(p.current===null||v.current!==r){p.current=new Set(w),v.current=r,x.current=n;return}const T=w.filter(A=>!p.current.has(A)),E=x.current.filter(A=>!w.includes(a(A)));if(p.current=new Set(w),x.current=n,T.length&&(f(A=>[...A,...T]),b.current.push(window.setTimeout(()=>f(A=>A.filter(z=>!T.includes(z))),1e3))),E.length){const A=E.map(z=>({item:z,key:a(z),state:"leave"}));m(z=>[...z,...A]),b.current.push(window.setTimeout(()=>m(z=>z.filter(U=>!A.some($=>$.key===U.key))),o))}},[n,a,r,o]),y.useEffect(()=>{const w=b.current;return()=>{for(const T of w)window.clearTimeout(T)}},[]),[...n.map(w=>{const T=a(w);return{item:w,key:T,state:c.includes(T)?"enter":"still"}}),...h]}function uc(n){return`pending/${n.id}/${n.name}`}function O1(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??uc(a))}:{}}}function _1(n,a){if(a.kind!=="user"||n.status!=="sending"||a.text!==n.text)return!1;const r=n.attachments.map(c=>c.path),o=a.files??[];return r.length===o.length&&r.every((c,f)=>c===o[f])}const R1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"};function Yi(n){const a=n.lastIndexOf(".");return a===-1?!1:n.slice(a).toLowerCase()in R1}function $i(n){return(n.split("/").pop()??n).replace(/^u-[a-z0-9]{6}-/,"")}function Rb(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 Db(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 Wo=["off","minimal","low","medium","high","xhigh","max"],Qo={off:"关闭",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},D1=40;function $1(n,a){return a?/gpt/i.test(n)?Wo.slice(0,6):[...Wo]:["off"]}function U1(n,a){return a==="google-generative-ai"||a==="google-vertex"?"high":n}function L1(n,a,r,o){if(!a)return{levels:["off"],chars:{},map:{}};const c=$1(n,a),f=[],h={},m={};for(const p of Wo){const v=r?.[p];if(!(v!==void 0?v!==null:c.includes(p))){m[p]=null;continue}f.push(p);const b=typeof v=="string"?v.trim():"";h[p]=b,b?m[p]=b:(p==="xhigh"||p==="max")&&(m[p]=U1(p,o))}return{levels:f,chars:h,map:m}}function H1(n){if(!n||typeof n!="object"||Array.isArray(n))return;const a=n,r={};let o=!1;for(const c of Wo){if(!(c in a))continue;o=!0;const f=a[c];if(f===null){r[c]=null;continue}const h=typeof f=="string"?f.trim():"";r[c]=h.length<=D1?h:""}if(o)return r.off===null&&(r.off=""),r}const $b={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"},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"}},bn=(()=>{let n=0;return a=>`${a}${++n}`})();function ee(n,a,r=0){const o=new Date;return o.setDate(o.getDate()-n),o.setHours(a,r,0,0),o.toISOString()}function ce(n){return new Date(Date.now()-n*6e4).toISOString()}function de(n){return JSON.parse(JSON.stringify(n))}function ec(){const n=new URLSearchParams(globalThis.location?.search??"").get("desktop");return n==="ready"||n==="deployed"||n==="failed"?n:"none"}const B1={version:"1.7.0",display:{width:1280,height:800},screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}]},q1={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:[]}},I1=[{at:ce(6),verb:"$",text:"npm run typecheck"},{at:ce(5),verb:"读",text:"protocol/src/projection.ts"},{at:ce(4),verb:"读",text:"client/src/runtime/store.ts"},{at:ce(3),verb:"跑",text:"浏览器 打开 http://localhost:3000/pricing"},{at:ce(3),verb:"跑",text:"npm test -w protocol"},{at:ce(2),verb:"读",text:"client/src/chat/Transcript.tsx"},{at:ce(1),verb:"读",text:"client/src/chat/ToolRow.tsx"}];function Y1(n){const a=n==="s1"||n==="s6",r=n==="s4",o=a||n==="mlist",c=!o&&n!=="mchat",f=[{id:"hob",name:"Hob",duty:"主助手",sprite:"hob",primary:!0,pinned:!0,hidden:!1,notify:!0,instructions:"输出用中文短句;编写代码的任务先询问项目目录。",createdAt:ee(30,9,0),last:{text:"已交给任务处理,完成后通知你。",at:ee(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:ee(30,9,0),last:{text:"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。",at:ee(0,10,20)},unread:2,busy:!1},{id:"server",name:"服务器",duty:"线上和机器",sprite:"server",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"清理日志前先查看保留天数的规则。",createdAt:ee(28,9,0),last:{text:"凌晨 3 点清理 2.1GB 旧日志",at:ee(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:ee(7,9,0),splitFrom:{from:"hob",at:ee(7,9,0),conversations:8},last:{text:"今天 6 条,挑选了 2 条重点",at:ee(0,9,0)},unread:0,busy:!1},{id:"house",name:"家里 NAS",duty:"相册和备份",sprite:"house",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:ee(25,9,0),last:{text:"相册备份完成,新增 312 张",at:ee(0,7,30)},unread:0,busy:!1},{id:"coin",name:"记账",duty:"账单和预算",sprite:"coin",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:ee(24,9,0),last:{text:"10 月账单已整理完成,比上月减少 12%",at:ee(1,21,10)},unread:0,busy:!1},{id:"book",name:"读书",duty:"读书笔记",sprite:"book",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:ee(20,9,0),last:{text:"本周读书笔记已整理完成",at:ee(3,20,0)},unread:0,busy:!1},{id:"leaf",name:"健身",duty:"每周训练",sprite:"leaf",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:ee(18,9,0),last:{text:"本周三次训练已记录",at:ee(2,19,0)},unread:0,busy:!1}],h=(q,F,W,Ee,he,we,Oe,se,ve)=>({id:q,assistantId:F,title:W,detail:Ee,options:he,status:we?"answered":"pending",chosen:we?Oe:void 0,source:"router",ruleText:ve,createdAt:se,answeredAt:we?se:void 0}),p={"ap-publish":h("ap-publish","page","发到公众号吗?",void 0,de([{key:"A",label:"发布"},{key:"B",label:"暂不发布"},{key:"C",label:"以后同类内容直接发布,无需确认",always:!0}]),c,"C",ee(0,7,42),"发公众号"),"ap-split":h("ap-split","hob","是否创建一个专属助手「行业动态」?",a?"这两周你让我查询了 8 次模型和 agent 产品的动态。创建后它会记住你关注的内容,每天早上 9 点提供一份简报。":"这两周你让我查询了 8 次模型和 agent 产品的动态。",[{key:"A",label:"创建专属助手"},{key:"B",label:"暂不创建"}],!o,"A",ee(0,10,15))},v={id:"d-bird",assistantId:"hob",status:r?"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:r?void 0:"bird",createdAt:ee(0,10,17)},x={id:"t-0931",assistantId:"hob",title:"排查页面卡顿",instruction:"排查页面卡顿的原因,不要修改代码。",status:"running",createdAt:ce(6),startedAt:ce(6),stats:{reads:14,commands:3,edits:0},cwd:"/srv/example/site",activity:de(I1)},b={id:"t-rounds",assistantId:"hob",title:"整理项目资料",instruction:"整理项目资料并列出缺失项。",status:"running",createdAt:ce(40),startedAt:ce(5),stats:{reads:5,commands:2,edits:0},rounds:[{status:"done",startedAt:ce(40),endedAt:ce(30),durationMs:6e5,summary:"已整理资料清单。",files:["/srv/example/list.md"],followUp:"核对缺失的文档。"},{status:"stuck",startedAt:ce(25),endedAt:ce(15),durationMs:6e5,summary:"缺少接口文档,暂时无法核对。",followUp:"先根据现有资料继续。"}],activity:[{at:ce(35),verb:"读",text:"/srv/example/资料"},{at:ce(20),verb:"搜",text:"接口文档"},{at:ce(3),verb:"读",text:"/srv/example/项目说明"}]},N={id:"t-0927",assistantId:"server",title:"清理旧日志",instruction:"清理三天前的旧日志,不要影响正在运行的服务。",status:"done",createdAt:ee(1,3,0),startedAt:ee(1,3,0),endedAt:ee(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:ee(1,3,0),verb:"$",text:"du -sh /var/log/*"},{at:ee(1,3,1),verb:"读",text:"/var/log/nginx"},{at:ee(1,3,3),verb:"跑",text:"find /var/log -mtime +3 -delete"},...Array.from({length:9},(q,F)=>({at:ee(1,3,4),verb:"读",text:`/srv/example/reports/src/check-${F}.ts`})),{at:ee(1,3,5),verb:"说",text:"已清理 2.1GB,服务均正常运行。"}]},w={id:"t-0929",assistantId:"house",title:"整理相册备份",instruction:"把手机里这个月的照片备份到 NAS,重复的跳过。",status:"done",createdAt:ce(58),startedAt:ce(58),endedAt:ce(51),stats:{reads:6,commands:2,edits:0},summary:"新增 312 张,重复跳过 87 张,占用 4.2GB。",activity:[{at:ce(57),verb:"读",text:"/mnt/nas/photos"},{at:ce(55),verb:"跑",text:"rsync -a --ignore-existing /sdcard/DCIM /mnt/nas/photos/"},{at:ce(51),verb:"说",text:"新增 312 张,占用 4.2GB。"}]},T=[{id:"r-morning",assistantId:"hob",name:"早报",instruction:"汇总昨天交代的事项和今天的重要事项,早上汇报一次。",schedules:["0 8 * * *"],active:!0,createdAt:ee(20,21,0),runs:[{jobId:"t-0901",at:ee(0,8,0),status:"done"}]},{id:"r-weekly-reminder",assistantId:"hob",name:"周报提醒",instruction:"周五下午提醒查看本周周报。",schedules:["0 17 * * 5"],active:!0,createdAt:ee(20,21,2),runs:[]},{id:"r-reconcile",assistantId:"hob",name:"月底对账",instruction:"月末核对账单,列出不一致的项目。",schedules:["0 9 28 * *"],active:!1,createdAt:ee(19,10,0),runs:[{jobId:"t-0820",at:ee(4,9,0),status:"done"}]},{id:"r-daily",skill:"daily-brief",assistantId:"bird",name:"每日简报",instruction:"挑模型发布、agent 产品和开源项目里最值得看的几条,每条一句话说清为什么重要。最多 6 条,不看融资新闻。",schedules:["0 9 * * *"],active:!0,createdAt:ee(7,9,0),runs:[{jobId:"t-0926",at:ee(0,9,0),status:"done",durationMs:372e3,tools:95,tokens:198e3},{jobId:"t-0925",at:ee(1,9,0),status:"done"},{jobId:"t-0924",at:ee(2,9,1),status:"done"},{jobId:"t-0923",at:ee(3,9,0),status:"done"}]},{id:"r-weekly-draft",assistantId:"page",name:"周报初稿",instruction:"每周五 17:00 撰写周报初稿,存入草稿箱,完成后通知我。",schedules:["0 17 * * 5"],active:!0,createdAt:ee(0,10,21),runs:[]}],E=(q,F,W,Ee)=>({kind:"assistant",id:q,at:F,text:W,routine:Ee}),z=[E("i-h1",ee(0,8,0),`早上好。昨晚交代的两件事均已完成:
|
|
51
|
+
|
|
52
|
+
- 写作已将周报初稿存入草稿箱
|
|
53
|
+
- 服务器凌晨 3 点清理了 2.1GB 旧日志`),{kind:"user",id:"i-h3",at:ee(0,10,5),text:"页面为什么这么卡?排查一下原因,不要修改代码。"},E("i-h4",ee(0,10,5),"已交给任务处理,完成后通知你。"),{kind:"job",id:"i-h5",at:ee(0,10,5),jobId:"t-0931"},{kind:"question",id:"i-h6",at:ee(0,10,a?9:15),approvalId:"ap-split"},{kind:"job",id:"i-round-1",at:ce(40),jobId:"t-rounds",round:0},{kind:"job",id:"i-round-2",at:ce(25),jobId:"t-rounds",round:1},{kind:"job",id:"i-round-3",at:ce(5),jobId:"t-rounds",round:2}];a||z.push({kind:"user",id:"i-h7",at:ee(0,10,16),text:"创建专属助手吧。最多 6 条即可,不要包含融资新闻。"},E("i-h8",ee(0,10,17),"草稿如下,需要修改请直接说明:"),{kind:"draft",id:"i-h9",at:ee(0,10,17),draftId:"d-bird"});const U=r?z.filter(q=>!["i-h2","i-h3","i-h4","i-h5"].includes(q.id)):z,$=[E("i-p1",ee(1,17,5),"周报初稿已完成,存放在草稿箱。"),{kind:"user",id:"i-p2",at:ee(1,17,6),text:n==="mchat"?"好,周一发布。":"标题再短一些。"},E("i-p3",ee(1,17,8),n==="mchat"?"好的,周一发布时我会再提醒你。":"已改为《这周:Hob 立项》。"),E("i-p4",ee(0,7,40),"《Grok Bot 能借鉴什么》已完成,3200 字,包含 4 张配图。"),{kind:"file",id:"i-p5",at:ee(0,7,41),path:"/srv/example/notes/Grok Bot 能借鉴什么.md",name:"Grok Bot 能借鉴什么.md",meta:"3200 字 · 4 张图"},{kind:"question",id:"i-p6",at:ee(0,7,42),approvalId:"ap-publish"}];n!=="mchat"&&$.push({kind:"note",id:"i-p7",at:ee(0,7,43),icon:"rule",text:"已记入写作的规则 · 发布公众号无需确认"},E("i-p8",ee(0,7,44),"已发布。[查看文章](https://mp.weixin.qq.com/)"),{kind:"user",id:"i-p9",at:ee(0,10,20),text:"以后周报也由你负责,周五下午提供初稿。"},E("i-p10",ee(0,10,20),"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。"),{kind:"note",id:"i-p11",at:ee(0,10,21),icon:"routine",text:"新增定时任务 · 周报初稿 · 每周五 17:00"});const j=[{kind:"note",id:"i-b0",at:ee(7,9,0),icon:"split",text:`${new Date(ee(7,9,0)).getMonth()+1}月${new Date(ee(7,9,0)).getDate()}日 由 Hob 创建 · 迁移 8 段对话、14 条记忆`},E("i-b1",ee(1,9,0),"昨天 5 条,没有特别要紧的。[看全部 5 条](https://example.com/)",{id:"r-daily",name:"每日简报"}),{kind:"job",id:"i-b-job",at:ee(0,9,0),jobId:"t-0926"},E("i-b2",ee(0,9,0),"今天 6 条,挑选 2 条重点:",{id:"r-daily",name:"每日简报",jobId:"t-0926"}),E("i-b3",ee(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:ee(0,9,12),text:"这个和 Hob 相比,差异在哪里?",quote:{itemId:"i-b3",text:"xAI 的 Grok Bot:常驻 Bot 加定时任务…"}},E("i-b5",ee(0,9,12),"它的 Bot 有一台云电脑,能直接操作网页;Bot 之间也能互相发消息。定时任务、审批、助手创建,我们均已具备。"),{kind:"user",id:"i-b6",at:ee(0,9,14),text:"以后不需要包含融资新闻。"},E("i-b7",ee(0,9,14),"好的,已记录。"),{kind:"note",id:"i-b8",at:ee(0,9,14),icon:"memory",text:"记忆已更新 · 不包含融资新闻,优先关注人工智能产品和模型的重要更新与实际应用"},{kind:"note",id:"i-b8-en",at:ee(0,9,14),icon:"memory",text:"记忆已更新 · Follow important AI product and model updates, focusing on practical applications."},{kind:"note",id:"i-b9",at:ee(0,9,15),icon:"skill",text:"已沉淀技能「每日行业简报」,以后定时执行按它做",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md"}],C=(q,F,W,Ee)=>[E(`${q}-1`,ee(1,20,0),F),{kind:"user",id:`${q}-2`,at:ee(1,20,2),text:W},E(`${q}-3`,ee(1,20,3),Ee)],S={hob:U,page:$,bird:j,server:[...C("i-s","凌晨清理日志的任务已完成,清理 2.1GB,服务均正常运行。","好的,以后每月清理一次。","已记录:每月 1 号凌晨 3 点清理一次。"),{kind:"job",id:"i-s4",at:ee(1,3,5),jobId:"t-0927"}],house:C("i-ho","相册备份已完成,新增 312 张,占用 4.2GB。","硬盘还剩多少?","剩余 1.8TB,可用约半年。"),coin:C("i-c","10 月账单已整理完成,比上月减少 12%。","哪一类支出较多?","餐饮和打车,比上月增加 800。"),book:C("i-bk","本周读书笔记已整理完成,共三条。","发给我看看。","已放入文件中。"),leaf:C("i-lf","本周三次训练已记录。","下周增加到四次。","好的,下周安排四次。")};n==="image"&&(S.hob=[{kind:"user",id:"image-user",at:ce(3),text:"画几张图片给我看看。"},{kind:"image",id:"image-done",at:ce(3),startedAt:ce(3),prompt:"海边的日落",size:"1536x1024",status:"done",path:"/mock/photo.jpg"},{kind:"image",id:"image-failed",at:ce(2),startedAt:ce(2),prompt:"山间的早晨",status:"failed",error:"图像服务暂时不可用,请稍后重试。"},{kind:"image",id:"image-pending",at:ce(1),startedAt:ce(1),prompt:"安静的街道",status:"pending"}]),(n==="bubbles"||n==="bubbles-dark")&&(S.hob=[{kind:"user",id:"bubble-user",at:ce(3),text:"给我看看公式、代码和媒体。"},E("bubble-text",ce(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。"),E("bubble-md",ce(2),"我把刚才的示意图整理成 `.md` 文件,图用 Mermaid 写,方便你看源码或直接预览。"),{kind:"job",id:"bubble-job",at:ce(2),jobId:"t-0927"},{kind:"file",id:"bubble-file",at:ce(2),path:"/mock/火星日落示意图.md",name:"火星日落示意图.md",meta:"349 字"},E("bubble-after-file",ce(2),"《火星日落示意图.md》已发给你。直接打开能看 Markdown 源码,用支持 Mermaid 的预览器可以看到光路图。"),{kind:"file",id:"bubble-page",at:ce(2),path:"/mock/sunset.html",name:"如果在地球和火星同时看日落",meta:"两幅同视角示意图:看太阳周围,再看远离太阳的天空。"},E("bubble-list",ce(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:ce(1),path:"/mock/audio.mp3",name:"语音样本.mp3"},{kind:"file",id:"bubble-video",at:ce(1),path:"/mock/video.mp4",name:"视频样本.mp4"},{kind:"user",id:"bubble-photo",at:ce(1),text:"这个是什么",files:["/mock/photo.jpg"]},{kind:"user",id:"bubble-photo-only",at:ce(1),text:"",files:["/mock/photo2.jpg"]},{kind:"user",id:"bubble-photos",at:ce(1),text:"两张对比一下",files:["/mock/photo.jpg","/mock/photo2.jpg"]},{kind:"user",id:"bubble-user-file",at:ce(1),text:"帮我看看这份报告",files:["/mock/u-k2m9xq-季度报告.pdf"]},{kind:"user",id:"bubble-user-2",at:ce(1),text:"画个简单的表格给我,有几种方式?"},E("bubble-table",ce(0),`主要有四种:
|
|
70
|
+
|
|
71
|
+
| 方式 | 适合什么情况 | 能不能改 |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| 聊天里直接画 | 简单的表,看一眼就行 | 让我重画 |
|
|
74
|
+
| 发 Excel 或 CSV 文件 | 要下载、自己改或者算 | 能 |
|
|
75
|
+
| 做成页面 | 能排序、筛选,以后还要更新 | 能 |
|
|
76
|
+
| 做成图片 | 要转发给别人或者发朋友圈 | 不能 |
|
|
77
|
+
|
|
78
|
+
想要哪种?告诉我放什么内容。`)]);const O={},R={"t-0931":x,"t-rounds":b,"t-0927":N,"t-0929":w,"t-0926":{id:"t-0926",assistantId:"bird",title:"每日简报",instruction:"整理每日简报",status:"done",createdAt:ee(0,8,54),startedAt:ee(0,8,54),endedAt:ee(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")&&(O["dg-sidebar-running"]={id:"dg-sidebar-running",from:"hob",to:"page",text:"整理文章。",createdAt:ce(6),status:"running",jobIds:[]},O["dg-sidebar-waiting"]={id:"dg-sidebar-waiting",from:"hob",to:"server",text:"检查服务器。",createdAt:ce(5),status:"waiting",jobIds:[]},S.hob.push({kind:"delegation",id:"sidebar-running",at:ce(6),delegationId:"dg-sidebar-running"},{kind:"delegation",id:"sidebar-waiting",at:ce(5),delegationId:"dg-sidebar-waiting"})),n.startsWith("d-")){const q=n==="d-waiting"||n==="d-mobile"?"waiting":n==="d-done"?"done":"running",F={id:"dg-demo",from:"hob",to:"server",text:"检查服务器磁盘和服务状态,清理前先确认,不要影响正在运行的服务。",createdAt:ce(6),status:q,jobIds:["t-delegated"],approvalIds:[]};O[F.id]=F,R["t-delegated"]={...x,id:"t-delegated",assistantId:"server",delegationId:F.id,title:"检查服务器状态",status:q==="waiting"?"waiting":q},q==="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:ce(2)}),S.hob=[{kind:"user",id:"d-user",at:ce(7),text:"检查一下服务器的磁盘和服务状态。"},{kind:"delegation",id:"d-card",at:ce(6),delegationId:F.id}],S.server=[{kind:"user",id:"d-forward",at:ce(6),text:F.text,from:{assistantId:"hob",name:"Hob",delegationId:F.id}},{kind:"job",id:"d-job",at:ce(5),jobId:"t-delegated"},...q==="waiting"?[{kind:"question",id:"d-question",at:ce(2),approvalId:"ap-delegation"}]:[]]}if(n.startsWith("h-")){const q=f.find(F=>F.id==="server");q&&(q.dutyLong="维护服务器、监控服务状态和磁盘空间;代理配置由其他助手负责。"),O["dg-returned"]={id:"dg-returned",from:"hob",to:"server",text:"检查代理节点为什么无法连接。",createdAt:ce(4),status:"returned",reply:"退回:代理配置不属于服务器维护职责。",jobIds:[]},S.hob=[{kind:"user",id:"h-forward",at:ce(8),text:"检查代理节点为什么无法连接。",from:{assistantId:"server",name:"服务器",delegationId:"hb-demo"}},{kind:"delegation",id:"h-card",at:ce(4),delegationId:"dg-returned"}],S.server=[{kind:"user",id:"h-user",at:ce(9),text:"检查代理节点为什么无法连接。"},{kind:"note",id:"h-note",at:ce(8),icon:"info",text:"已交回 Hob:代理配置不属于我的职责。",handbackId:"hb-demo"},{kind:"user",id:"h-delegation-forward",at:ce(4),text:"检查代理节点为什么无法连接。",from:{assistantId:"hob",name:"Hob",delegationId:"dg-returned"}}]}if(n.startsWith("act-")){const q=f.find(F=>F.id==="hob");q.busy=!0,q.activity=n==="act-think"||n==="act-demo"?{state:"thinking",label:"正在想…"}:{state:"tool",label:"搜索:最新 AI 动态"},S.hob=[{kind:"user",id:"act-user",at:ce(1),text:"帮我搜索最新 AI 动态。"}],n==="act-home"&&(f.find(F=>F.id==="page").busy=!0)}return{assistants:f,items:S,jobs:R,delegations:O,approvals:p,drafts:{"d-bird":v},routines:T,assistantSkills:{bird:[{name:"daily-brief",title:"每日行业简报",description:"整理值得关注的行业动态。",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md",version:2,createdAt:ee(7,9),updatedAt:ee(1,9),uses:3,lastUsedAt:ee(0,9),enabled:!0},{name:"release-watch",title:"重要发布追踪",description:"追踪模型和产品的重要发布。",path:"/mock/assistants/bird/skills/release-watch/SKILL.md",version:1,createdAt:ee(2,9),updatedAt:ee(2,9),uses:0,enabled:!0}]},rules:{hob:[{id:"rule-1",text:"花钱",mode:"ask",changedAt:ee(10,9,0)},{id:"rule-2",text:"改线上服务",mode:"ask",changedAt:ee(10,9,0)},{id:"rule-3",text:"清理我的文件",mode:"ask",changedAt:ee(3,9,0)}],page:[{id:"rule-4",text:"删除草稿",mode:"ask",changedAt:ee(9,9,0)},{id:"rule-5",text:"花钱",mode:"ask",changedAt:ee(9,9,0)},{id:"rule-6",text:"发公众号",mode:"allow",changedAt:ce(120)}],bird:[{id:"rule-7",text:"花钱订阅",mode:"ask",changedAt:ee(7,9,0)}]},worklog:{hob:[{at:ee(0,10,5),text:"任务已完成:排查页面卡顿",jobId:"t-0931"},{at:ee(0,8,2),text:"转述写作的审批:发布公众号"},{at:ee(0,8,0),text:"早报:两件事均已完成"}],page:[{at:ee(0,10,21),text:"新增定时任务:周报初稿",jobId:"r-weekly-draft"},{at:ee(0,7,44),text:"发布的文章:Grok Bot 能借鉴什么"},{at:ee(0,7,40),text:"完成《Grok Bot 能借鉴什么》,3200 字"},{at:ee(1,17,8),text:"周报初稿修改标题"}],bird:[{at:ee(0,9,0),text:"每日简报:今天 6 条",jobId:"t-0926"},{at:ee(1,9,0),text:"每日简报:昨天 5 条",jobId:"t-0925"}],server:[{at:ee(1,3,5),text:"任务已完成:清理旧日志",jobId:"t-0927"}],house:[{at:ee(0,7,30),text:"相册备份:新增 312 张"}],coin:[{at:ee(1,21,10),text:"10 月账单已整理"}],book:[],leaf:[]},settings:{revision:1,settings:{general:{theme:n==="d-dark"||n==="h-dark"||n==="act-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:{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},...Ab().filter(q=>q.name!=="searxng"&&q.name!=="exa")],work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}}}}}const G1={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:[]},lx={keyConfigured:!0},K1=[{id:"anthropic",name:"Anthropic"},{id:"openai",name:"OpenAI"},{id:"google",name:"Google"},{id:"deepseek",name:"DeepSeek"},{id:"openrouter",name:"OpenRouter"}],X1={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 tf(n,a){return(n.kind==="custom"?n.models.map(o=>({id:o.id,name:o.name?.trim()||o.id,reasoning:o.reasoning===!0})):X1[n.id]??[]).map(o=>{const c=`${n.id}/${o.id}`,f=a?.[c],h=L1(o.id,o.reasoning,f,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:f!==void 0}})}const V1="/Users/me/.pi/agent",Z1="/Users/me/.lore",Q1=[{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:"登录授权类凭据无法导入。"}],J1={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"}]}},ax=new Map,nf={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 P1(n="s1"){const a=Y1(n);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 r=[{id:"kc-1",name:"工作资料",createdAt:ce(1e3),count:0},{id:"kc-2",name:"灵感收藏",createdAt:ce(900),count:0}],o=["项目封面.png","产品设计页面.html","工作记录.md","数据汇总.csv","参考文档.pdf","插画.png","会议纪要.md","网站方案.html","预算表.csv","资料.txt","附件.json","录音.mp3"].map((j,C)=>({id:`k-${C}`,origin:C%3===0?"chat":C%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-${C}`,size:2048+C*1e3,createdAt:ce(C<6?C*60:336*60+C),updatedAt:ce(C<6?C*60:336*60+C),source:{assistantId:"hob",itemId:n==="bubbles"||n==="bubbles-dark"?["bubble-file","bubble-page","bubble-audio","bubble-video","bubble-job"][C%5]:n==="image"?"image-done":a.items.hob?.[0]?.id},collections:C%2?["kc-1"]:["kc-2"]}));const c=["queued","indexing","ready","failed","unsupported"];o.forEach((j,C)=>{j.index={state:c[C%c.length],...C%c.length===3?{error:"无法读取文件"}:{}}});const f=a.assistants.find(j=>j.id==="hob");f&&(f.knowledge=["kc-1"]);let h=!1;const m=new Set,p=j=>m.forEach(C=>C(j)),v=j=>a.assistants.find(C=>C.id===j),x=new Set(["anthropic","my-proxy"]);let b=de(q1[ec()]);const N=()=>({providers:a.settings.settings.providers.map(j=>({...j,keyConfigured:x.has(j.id)})),builtin:de(K1),settings:de(a.settings),models:Object.fromEntries(a.settings.settings.providers.map(j=>[j.id,tf(j,a.settings.settings.models.thinking)]))}),w={revision:a.settings.revision,provider:"local",providerExplicit:!1,lorePlugin:"1.12.5",lore:{configured:!1,baseUrl:null,source:"none",tokenConfigured:!1}},T=[{endpoint:"https://push.example/mock-iphone",label:"iPhone",createdAt:new Date(Date.now()-3*864e5).toISOString()}],E=()=>({publicKey:"BOmockVapidPublicKeyForPreviewOnly",email:a.settings.settings.push.email,devices:de(T)}),A=j=>{const C=[];return j.activity.forEach((S,O)=>{if(S.verb==="$")return;const R=S.text.match(/^浏览器 打开 (\S+)$/),q=R?"browser_open":S.verb==="读"?"read":S.verb==="跑"?"bash":S.verb==="改"?"edit":S.verb==="说"?"report":"ls";C.push({id:`mock-${j.id}-${O}`,kind:"tool",at:S.at,name:q,title:q==="report"?"提交结果":`${S.verb} ${S.text}`,args:R?{url:R[1]}:q==="bash"?{command:S.text}:q==="report"?{outcome:"done",summary:S.text}:{path:S.text},output:q==="report"?"结果已记录。":R?"已打开页面。":`${S.text}
|
|
79
|
+
`,durationMs:120})}),j.id==="t-0931"&&C.push({id:"mock-search",kind:"tool",at:j.createdAt,name:"web_search",title:"联网搜索:浏览器页面性能优化",args:{query:"浏览器页面性能优化"},output:"演示结果:网页性能优化指南。",durationMs:120}),C};function z(j,C){const S=v(j);S&&(Object.assign(S,C),p({type:"assistant",assistant:de(S)}))}function U(j,C){const S=a.items[j]??=[],O=S.findIndex(R=>R.id===C.id);O>=0?S[O]=C:S.push(C),p({type:"item",assistantId:j,item:C})}function $(j,C){z(j,{last:{text:C,at:new Date().toISOString()}})}return{knowledge:async(j={})=>{const C=j.q?.toLowerCase(),S=o.filter(R=>(!j.origin||R.origin===j.origin)&&(!j.collection||R.collections.includes(j.collection))&&(!j.kind||Db(R.kind)===j.kind)&&(!j.assistantId||R.source?.assistantId===j.assistantId)&&(!j.before||R.updatedAt<j.before)&&(!C||`${R.name} ${R.description}`.toLowerCase().includes(C))),O=j.limit??50;return{entries:de(S.slice(0,O).map(R=>C?{...R,snippet:R.description??R.name}:R)),hasMore:S.length>O,collections:de(r.map(R=>({...R,count:o.filter(q=>q.collections.includes(R.id)).length,indexed:o.filter(q=>q.collections.includes(R.id)&&q.index?.state==="ready").length,failed:o.filter(q=>q.collections.includes(R.id)&&q.index?.state==="failed").length,unsupported:o.filter(q=>q.collections.includes(R.id)&&q.index?.state==="unsupported").length})))}},knowledgeEntry:async(j,C)=>{const S=o.find(O=>O.id===j);if(!S)throw new Ue(404,"文件不存在");return{entry:de(S),...C!==void 0?{chunk:{index:C,heading:S.name,text:"模拟模式中的项目资料。"}}:{}}},reindexKnowledge:async j=>{if(!r.some(C=>C.id===j))throw new Ue(404,"知识库不存在");return o.filter(C=>C.collections.includes(j)&&C.index?.state==="failed").forEach(C=>{C.index={state:"queued"}}),p({type:"knowledge"}),{ok:!0}},embeddingKey:async()=>({keyConfigured:h}),putEmbedding:async(j,C,S)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改");return a.settings={revision:j+1,settings:{...a.settings.settings,knowledge:{embedding:C}}},S&&(h=!0),{settings:de(a.settings),keyConfigured:h}},embeddingTest:async()=>({ok:!0,dims:1024}),createKnowledgeCollection:async j=>{const C={id:`kc-${Date.now()}`,name:j,createdAt:new Date().toISOString(),count:0};return r.push(C),p({type:"knowledge"}),de(C)},renameKnowledgeCollection:async(j,C)=>{const S=r.find(O=>O.id===j);if(!S)throw new Ue(404,"知识库不存在");return S.name=C,p({type:"knowledge"}),de(S)},deleteKnowledgeCollection:async j=>{r=r.filter(S=>S.id!==j);const C=o.length;return o=o.filter(S=>!(S.origin==="upload"&&S.collections.length===1&&S.collections[0]===j)).map(S=>({...S,collections:S.collections.filter(O=>O!==j)})),p({type:"knowledge"}),{deleted:C-o.length}},patchKnowledgeEntry:async(j,C)=>{const S=o.find(O=>O.id===j);if(!S)throw new Ue(404,"文件不存在");return Object.assign(S,C),p({type:"knowledge"}),de(S)},deleteKnowledgeEntry:async j=>(o=o.filter(C=>C.id!==j),p({type:"knowledge"}),{ok:!0}),uploadKnowledge:async(j,C)=>{const S=C.map((O,R)=>({id:`k-${Date.now()}-${R}`,origin:"upload",name:O.name,kind:"other",path:URL.createObjectURL(O),hash:`mock-${Date.now()}-${R}`,size:O.size,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),collections:[j]}));return o.unshift(...S),p({type:"knowledge"}),{entries:de(S)}},me:async()=>{},login:async()=>{},logout:async()=>{},bootstrap:async()=>({assistants:de(a.assistants),jobs:de(Object.values(a.jobs)),delegations:de(Object.values(a.delegations)),routines:de(a.routines),approvals:de(Object.values(a.approvals).filter(j=>j.status==="pending")),settings:de(a.settings)}),settings:async()=>de(a.settings),models:async()=>({...de(G1),roster:de(a.settings.settings.models.roster)}),providers:async()=>N(),claude:async()=>({settings:de(a.settings),status:{found:!1,loggedIn:!1}}),saveClaude:async(j,C)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已更改,请刷新后重试。");return a.settings={revision:j+1,settings:{...a.settings.settings,claude:C}},{settings:de(a.settings),status:{found:!1,loggedIn:!1}}},putThinking:async j=>{const C=a.settings.settings.providers.find(F=>j.ref.startsWith(`${F.id}/`)),S=C?tf(C,a.settings.settings.models.thinking).find(F=>F.ref===j.ref):void 0;if(!C||!S)throw new Ue(400,`模型 ${j.ref} 不在已配置的服务商里。`);const O={...a.settings.settings.models.thinking??{}},R=j.levels===null?void 0:H1(j.levels);R?O[j.ref]=R:delete O[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(O).length?{thinking:O}:{}}}};const q=tf(C,a.settings.settings.models.thinking).find(F=>F.ref===j.ref);return{settings:de(a.settings),thinking:q}},putProvider:async(j,C)=>{const S=C,O={...S,id:j};delete O.key;const R=a.settings.settings.providers.filter(q=>q.id!==j);return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...R,O]}},S.key&&x.add(j),N()},deleteProvider:async j=>(a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:a.settings.settings.providers.filter(C=>C.id!==j)}},x.delete(j),N()),discoverProvider:async()=>({models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini",name:"GPT X mini"},{id:"gpt-x-vision"}]}),providersImport:async()=>({source:V1,items:Q1.map(j=>({...j,exists:j.exists||a.settings.settings.providers.some(C=>C.id===j.id)}))}),importProviders:async j=>{const C=j.map(O=>J1[O]).filter(O=>O!==void 0);if(!C.length)throw new Ue(400,"没有可导入的服务商:请选择状态为可导入的项目。");const S=a.settings.settings.providers.filter(O=>!C.some(R=>R.id===O.id));a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...S,...C]}};for(const O of C)x.add(O.id);return N()},testProvider:async()=>{},imageKey:async()=>de(lx),putImage:async(j,C,S)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,image:C}},{settings:de(a.settings),keyConfigured:!!S||lx.keyConfigured}},assistantSkills:async j=>de(a.assistantSkills[j]??[]),patchAssistantSkill:async(j,C,S)=>{const O=a.assistantSkills[j]?.find(R=>R.name===C);if(!O)throw new Error("技能不存在");return O.enabled=S,p({type:"skills",assistantId:j}),de(O)},rollbackAssistantSkill:async(j,C)=>{const S=a.assistantSkills[j]?.find(O=>O.name===C);if(!S||S.version<=1)throw new Error("没有上一版");return S.version--,p({type:"skills",assistantId:j}),de(S)},deleteAssistantSkill:async(j,C)=>(a.assistantSkills[j]=(a.assistantSkills[j]??[]).filter(S=>S.name!==C),p({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 setTimeout(()=>p({type:"sediment-finished",jobId:j}),0),{ok:!0}},skills:async()=>{const j=a.settings.settings.skills?.disabled??[],C=(S,O,R,q,F=!1)=>({id:S,name:S,description:R,source:O,content:q,enabled:!j.includes(`${O}:${S}`),overridden:F});return{skills:[C("weekly-report","hob","按固定结构整理本周进展、风险和下周计划,生成可直接发出的周报。",`# 周报
|
|
80
|
+
|
|
81
|
+
1. 汇总本周完成的事项
|
|
82
|
+
2. 列出风险和需要的支持
|
|
83
|
+
3. 写下周计划`),C("research","hob","查阅可靠来源,交叉核对后整理结论,并为每条结论注明出处。",`# 研究
|
|
84
|
+
|
|
85
|
+
查阅可靠来源,整理结论并注明出处。`),C("server-checkup","hob","检查主机的磁盘、内存、服务状态和最近的错误日志,给出处理建议。",`# 主机巡检
|
|
86
|
+
|
|
87
|
+
逐台检查磁盘、内存、服务与日志。`),C("browser","common","在浏览器中打开页面、操作并截图,验证改动是否生效。",`# 浏览器
|
|
88
|
+
|
|
89
|
+
通过浏览器检查和验证页面。`),C("pdf","common","读取、拆分、合并 PDF,提取其中的表格和文字。",`# PDF
|
|
90
|
+
|
|
91
|
+
处理 PDF 文件。`),C("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,C)=>({imported:C,skipped:[],errors:[]}),deleteSkill:async()=>{},desktop:async()=>de(b),saveDesktop:async j=>(b={...b,revision:b.revision+1,url:j.url,enabled:j.enabled,tokenConfigured:b.tokenConfigured||!!j.token},de(b)),saveDesktopPublic:async(j,C)=>{if(j!==b.revision)throw new Ue(409,"设置已在别处修改,已刷新");return b={...b,revision:b.revision+1,publicAssistants:[...C]},de(b)},testDesktop:async()=>ec()==="failed"?{ok:!1,error:`无法连接 ${b.url},请确认云桌面已部署并启动。`}:b.url?{ok:!0,health:de(B1)}:{ok:!1,error:"请先填写云桌面地址。"},mcp:async()=>({servers:nf.servers.map(j=>({...j}))}),putMcp:async()=>({servers:nf.servers.map(j=>({...j}))}),patchMcp:async()=>({servers:nf.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,C)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return a.settings={revision:j+1,settings:{...a.settings.settings,search:C}},de(a.settings)},testSearch:async()=>({ok:!1,error:"演示模式不连接搜索服务商。"}),imageTest:async()=>({ok:!1,error:"演示模式不连接图像生成接口;正式运行时会实际生成图片。"}),putSettings:async(j,C)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");const S=C.models??{};return a.settings={revision:a.settings.revision+1,settings:{general:{...a.settings.settings.general,...C.general??{},aboutYou:{...a.settings.settings.general.aboutYou,...C.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:C.skills??a.settings.settings.skills,work:{...a.settings.settings.work,...C.work??{}},push:{...a.settings.settings.push,...C.push??{}}}},de(a.settings)},changePassword:async j=>{if(j!=="test")throw new Ue(403,"旧密码不正确")},about:async()=>({version:"0.1.0",home:"/var/lib/hob"}),memory:async()=>de({...w,revision:a.settings.revision}),putMemory:async(j,C)=>{if(j!==a.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");if(C==="lore"&&!w.lore.configured)throw new Ue(400,"Lore 尚未配置:请先填写服务地址和 Token 并测试连接");return w.provider=C,w.providerExplicit=!0,a.settings.revision+=1,w.revision=a.settings.revision,de(w)},putLore:async j=>{const C=j.baseUrl.trim().replace(/\/+$/,"");if(!C)throw new Ue(400,"Lore 服务地址不能为空");const S=w.lore.baseUrl===C;return w.lore={configured:S?w.lore.tokenConfigured:!!j.token,baseUrl:C,source:"config",tokenConfigured:S?w.lore.tokenConfigured:!!j.token},de({...w,revision:a.settings.revision})},loreTest:async j=>{const C=(j.baseUrl??w.lore.baseUrl??"").trim().replace(/\/+$/,"");return C?C.startsWith("http://")&&!/^http:\/\/(localhost|127\.0\.0\.1|192\.168\.|10\.)/.test(C)?{ok:!1,reason:"insecure_http"}:!j.token&&!w.lore.tokenConfigured?{ok:!1,reason:"missing_token"}:{ok:!0,baseUrl:C}:{ok:!1,reason:"invalid_url"}},loreImport:async()=>({source:Z1,found:!0,baseUrl:"https://api.loremem.com",tokenPresent:!0}),importLore:async()=>(w.lore={configured:!0,baseUrl:"https://api.loremem.com",source:"config",tokenConfigured:!0},de({...w,revision:a.settings.revision})),items:async j=>({items:de(a.items[j]??[]),approvals:de(Object.values(a.approvals)),jobs:de(Object.values(a.jobs)),drafts:de(Object.values(a.drafts)),delegations:de(Object.values(a.delegations)),hasMore:!1}),profile:async j=>{const C=v(j);if(!C)throw new Error(`没有这个助手:${j}`);return{assistant:de(C),rules:de(a.rules[j]??[]),routines:de(a.routines.filter(O=>O.assistantId===j)),worklog:de(a.worklog[j]??[])}},sendMessage:async(j,C)=>{if(C.text==="模拟发送失败")throw new Error("网络连接已断开");const S=new Date().toISOString();for(const R of Object.values(a.delegations))R.to!==j||R.reportedAt||R.status==="interrupted"||(Object.assign(R,{status:"takenOver",endedAt:S,reportedAt:S}),p({type:"delegation",delegation:de(R)}));for(const R of Object.values(a.approvals))R.assistantId!==j||R.source!=="router"||R.status!=="pending"||(R.status="expired",p({type:"approval",approval:de(R)}));const O={kind:"user",id:bn("mock-u"),at:S,text:C.text,quote:C.quote,files:C.files&&C.files.length?C.files:void 0};return U(j,O),$(j,C.text),z(j,{busy:!0}),setTimeout(()=>{U(j,{kind:"assistant",id:bn("mock-a"),at:new Date().toISOString(),text:"收到。"}),$(j,"收到。"),z(j,{busy:!1})},320),{item:O}},stopAssistant:async j=>z(j,{busy:!1}),markRead:async j=>z(j,{unread:0}),patchAssistant:async(j,C)=>{if(!v(j))throw new Ue(404,"助手不存在。");if(C.rule){const S=a.rules[j]??=[],O=C.rule.id===void 0?void 0:S.find(W=>W.id===C.rule.id);if(C.rule.id!==void 0&&!O)throw new Ue(404,"规则不存在。");const R=C.rule.text===void 0?O?.text??"":C.rule.text.trim();if(!R||R.length>1e3)throw new Ue(400,"规则内容不能为空或超过 1000 字。");if(S.some(W=>W.id!==C.rule.id&&W.text===R))throw new Ue(400,"规则内容已存在。");const q=C.rule.mode??O?.mode;if(q!=="ask"&&q!=="allow")throw new Ue(400,"规则模式无效。");const F={id:O?.id??bn("r-"),text:R,mode:q,changedAt:new Date().toISOString()};return O?Object.assign(O,F):S.push(F),p({type:"profile",assistantId:j}),{rule:de(F)}}z(j,C)},archiveAssistant:async j=>{const C=v(j);if(!C)throw new Ue(404,"助手不存在");if(C.primary)throw new Ue(400,"主助手不能归档");if(Object.values(a.jobs).filter(O=>O.assistantId===j&&(O.status==="running"||O.status==="queued"||O.status==="waiting")).length)throw new Ue(409,"请等任务结束后再归档");for(const O of a.routines.filter(R=>R.assistantId===j))p({type:"routine_removed",id:O.id});a.routines=a.routines.filter(O=>O.assistantId!==j),a.assistants=a.assistants.filter(O=>O.id!==j),p({type:"assistant_removed",id:j})},deleteRule:async(j,C)=>{a.rules[j]=(a.rules[j]??[]).filter(S=>S.id!==C),p({type:"profile",assistantId:j})},answerApproval:async(j,C)=>{const S=a.approvals[j];if(!S||S.status!=="pending")return;S.status="answered",C.key?S.chosen=C.key:S.answerText=(C.text??"").trim(),S.answeredAt=new Date().toISOString(),S.options.find(R=>R.key===C.key)?.always&&S.ruleText&&((a.rules[S.assistantId]??=[]).push({id:bn("rule"),text:S.ruleText,mode:"allow",changedAt:S.answeredAt}),U(S.assistantId,{kind:"note",id:bn("mock-n"),at:S.answeredAt,icon:"rule",text:`已记入${v(S.assistantId)?.name??""}的规则 · ${S.ruleText}无需确认`}),p({type:"profile",assistantId:S.assistantId})),p({type:"approval",approval:de(S)});for(const R of Object.values(a.delegations))!R.reportedAt&&((R.approvalIds??[]).includes(S.id)||S.jobId&&R.jobIds.includes(S.jobId))&&(R.status="running",S.jobId&&a.jobs[S.jobId]?.status==="waiting"&&(a.jobs[S.jobId].status="running",p({type:"job",job:de(a.jobs[S.jobId])})),p({type:"delegation",delegation:de(R)}))},retryDelegation:async j=>{const C=a.delegations[j];if(!C||C.status!=="interrupted")throw new Ue(400,"只有已中断的委派可以重新转交");const S={...C,id:bn("dg-"),status:"running",createdAt:new Date().toISOString(),jobIds:[],approvalIds:[],reportedAt:void 0,endedAt:void 0};a.delegations[S.id]=S,p({type:"delegation",delegation:de(S)}),U("hob",{kind:"delegation",id:bn("item-"),at:S.createdAt,delegationId:S.id}),U(S.to,{kind:"user",id:bn("item-"),at:S.createdAt,text:S.text,from:{assistantId:"hob",name:"Hob",delegationId:S.id}})},createDraft:async j=>{const C=a.drafts[j];C&&(C.status="created",C.createdAssistantId="bird",p({type:"draft",draft:de(C)}),U(C.assistantId,{kind:"note",id:bn("mock-n"),at:new Date().toISOString(),icon:"split",text:`专属助手已创建 · ${C.name}`}))},dismissDraft:async j=>{const C=a.drafts[j];C&&(C.status="dismissed",p({type:"draft",draft:de(C)}))},createRoutine:async j=>{const C={...j,id:bn("r"),createdAt:new Date().toISOString(),runs:[]};return a.routines.push(C),p({type:"routine",routine:de(C)}),de(C)},patchRoutine:async(j,C)=>{const S=a.routines.find(q=>q.id===j);if(!S)return;const{skill:O,...R}=C;Object.assign(S,R),O===null?delete S.skill:O!==void 0&&(S.skill=O),p({type:"routine",routine:de(S)})},deleteRoutine:async j=>{a.routines=a.routines.filter(C=>C.id!==j),p({type:"routine_removed",id:j})},runRoutine:async j=>{const C=a.routines.find(q=>q.id===j);if(!C)return;const S=new Date().toISOString(),O={id:bn("t-"),assistantId:C.assistantId,title:`${C.name}(立即运行)`,instruction:C.instruction,status:"running",createdAt:S,startedAt:S,stats:{reads:0,commands:0,edits:0},routineId:C.id,activity:[{at:S,verb:"$",text:`立即运行 ${C.name}`}]};a.jobs[O.id]=O;const R={jobId:O.id,at:S,status:"running"};C.runs=[R,...C.runs].slice(0,20),U(C.assistantId,{kind:"job",id:bn("mock-j"),at:S,jobId:O.id}),p({type:"job",job:de(O)}),p({type:"routine",routine:de(C)}),$(C.assistantId,`运行定时任务:${C.name}`)},replyJob:async(j,C)=>{const S=a.jobs[j];if(!S)return;S.activity=[...S.activity,{at:new Date().toISOString(),verb:"说",text:C}],p({type:"activity",jobId:j,line:S.activity[S.activity.length-1],stats:de(S.stats)});const O=new Date().toISOString();p({type:"job_step",jobId:j,step:{id:`q${Date.now()}`,kind:"text",at:O,from:"user",text:C,queued:!0}}),setTimeout(()=>p({type:"job_step",jobId:j,step:{id:`u${Date.now()}`,kind:"text",at:new Date().toISOString(),from:"user",text:C}}),4e3)},transcript:async j=>{const C=a.jobs[j];if(!C)throw new Error(`没有这个任务:${j}`);return{job:de(C),steps:A(C)}},jobs:async(j={})=>{let C=Object.values(a.jobs).sort((R,q)=>q.createdAt.localeCompare(R.createdAt));if(j.assistantId&&(C=C.filter(R=>R.assistantId===j.assistantId)),j.status&&(C=C.filter(R=>R.status===j.status)),j.before){const R=C.findIndex(q=>q.id===j.before);R!==-1&&(C=C.slice(R+1))}const S=j.limit??30;return{jobs:de(C.slice(0,S)),hasMore:C.length>S}},stopJob:async j=>{const C=a.jobs[j];C&&(C.status="stopped",C.endedAt=new Date().toISOString(),p({type:"job",job:de(C)}))},upload:async j=>{await new Promise(S=>setTimeout(S,1200));const C=`/mock/uploads/u-${Math.random().toString(36).slice(2,8).padEnd(6,"0")}-${j.name}`;return ax.set(C,URL.createObjectURL(j)),C},fileUrl:(j,C)=>ax.get(j)??(j==="/srv/example/reports/stats.csv"?`data:text/plain;charset=utf-8,${encodeURIComponent(`项目,大小
|
|
92
|
+
旧日志,2.1GB
|
|
93
|
+
服务,正常`)}`:j==="/srv/example/reports/log-cleanup-1031.md"?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 清理报告
|
|
94
|
+
|
|
95
|
+
已清理旧日志,服务运行正常。`)}`:j.startsWith("/mock/assistants/")?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 每日行业简报
|
|
96
|
+
|
|
97
|
+
整理值得关注的行业动态。`)}`: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 模式没有真实文件。
|
|
98
|
+
|
|
99
|
+
${j}`)}`),fileMeta:async j=>{const C=j.split("/").pop()??j,S=C.lastIndexOf("."),O=S>0?C.slice(S).toLowerCase():"",R=[".png",".jpg",".jpeg",".webp",".gif"].includes(O)?"image":O===".md"?"markdown":O===".csv"?"csv":O===".html"?"html":O===".json"?"json":"text";return{path:j,name:C,size:2048,modifiedAt:new Date().toISOString(),mime:R==="image"?`image/${O===".jpg"?"jpeg":O.slice(1)}`:"text/plain; charset=utf-8",kind:R,text:R!=="image"}},jobFiles:async(j,C)=>{const S=a.jobs[j];if(!S)throw new Ue(404,"任务不存在");const O="/srv/example/reports",R=W=>({type:"file",path:`${O}/${W}`,rel:W,name:W.split("/").pop(),size:2048,modifiedAt:S.createdAt,kind:W.endsWith(".md")?"markdown":W.endsWith(".csv")?"csv":"code"}),q=j!=="t-0927"?[]:C?C==="src"?[{type:"directory",path:`${O}/src/checks`,rel:"src/checks",name:"checks",count:1},R("src/main.ts")]:C==="src/checks"?[R("src/checks/logs.ts")]:[]:[{type:"directory",path:`${O}/src`,rel:"src",name:"src",count:2},R("log-cleanup-1031.md"),R("stats.csv"),R("notes.txt")],F=q.filter(W=>W.type==="directory").length;return{files:q,total:q.length,directoryCount:F,fileCount:q.length-F}},push:async()=>E(),subscribePush:async(j,C)=>{const S=T.filter(O=>O.endpoint!==j.endpoint);return T.splice(0,T.length,...S,{endpoint:j.endpoint,label:C.trim()||"本机",createdAt:new Date().toISOString()}),E()},unsubscribePush:async j=>{const C=T.findIndex(S=>S.endpoint===j);return C>=0&&T.splice(C,1),E()},testPush:async()=>({sent:1,removed:0}),visibility:async()=>{},events:j=>{m.add(j.onEvent);const C=[];return n==="act-demo"&&(C.push(setTimeout(()=>p({type:"router-activity",assistantId:"hob",activity:{state:"tool",label:"搜索:最新 AI 动态"}}),2500)),C.push(setTimeout(()=>{p({type:"router-activity",assistantId:"hob",activity:null}),p({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"正在整理搜索结果…",streaming:!0}})},5500)),C.push(setTimeout(()=>{p({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"已整理好最新动态。"}}),p({type:"assistant",assistant:{...a.assistants.find(S=>S.id==="hob"),busy:!1,activity:null}})},7500))),()=>{C.forEach(clearTimeout),m.delete(j.onEvent)}}}}function F1(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 W1(n){const a=n.replace(/-/g,"+").replace(/_/g,"/"),r=a.padEnd(Math.ceil(a.length/4)*4,"="),o=atob(r),c=new Uint8Array(o.length);for(let f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}function Gf(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function ew(n,a){return!n||n.byteLength!==a.length?!1:new Uint8Array(n).every((o,c)=>o===a[c])}function tw(n){const a=n.toJSON(),r=a.keys?.p256dh??"",o=a.keys?.auth??"";return!a.endpoint||!r||!o?null:{endpoint:a.endpoint,keys:{p256dh:r,auth:o}}}async function Kf(){return Gf()?await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription()??null:null}async function nw(n){if(!Gf())return{error:"这个浏览器不支持推送"};let a=Notification.permission;if(a==="default")try{a=await Notification.requestPermission()}catch{return{error:"浏览器拒绝授予通知权限"}}if(a!=="granted")return{error:"浏览器未授予通知权限"};const r=await navigator.serviceWorker.getRegistration();if(!r)return{error:"离线页面尚未就绪,请刷新后重试"};const o=W1(n);let c=await r.pushManager.getSubscription();if(c&&!ew(c.options.applicationServerKey,o)){try{await c.unsubscribe()}catch{}c=null}if(!c)try{c=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:o.buffer})}catch(h){return{error:`浏览器订阅推送失败:${h instanceof Error?h.message:String(h)}`}}const f=tw(c);return f?{subscription:f}:{error:"浏览器返回的订阅信息不完整"}}function Tl(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 sw(n,a){if(a.from==="user"&&!a.queued){const c=n.findIndex(f=>f.queued&&f.text===a.text);c>=0&&(n=n.filter((f,h)=>h!==c))}const r=n.findIndex(c=>c.id===a.id);if(r<0)return[...n,a];const o=n.slice();return o[r]=a,o}function lw(n,a){const r=new Set(a.map(c=>c.id)),o=a.slice();for(const c of n)!r.has(c.id)&&!c.queued&&o.push(c);return o}function aw(n){const a=[];let r=[];const o=()=>{if(!r.length)return;const c=r.join(`
|
|
100
|
+
|
|
101
|
+
`);return r=[],c};for(const c of n){if(c.kind==="thinking"){const h=c.text?.trim();h&&r.push(h);continue}if(c.kind==="text"&&c.from==="user"){a.push(c);continue}const f=o();a.push(f?{...c,thinking:f}:c)}return{rows:a,thinking:o()??null}}function sf(n,a,r){const o=a&&!r?n.slice(0,8):n;return{rows:o,remaining:n.length-o.length}}const ix=400,iw=2e5,rx=3;function rw(n,a){const r=n===""?[]:n.split(`
|
|
102
|
+
`),o=a===""?[]:a.split(`
|
|
103
|
+
`);let c=0;for(;c<r.length&&c<o.length&&r[c]===o[c];)c+=1;let f=r.length,h=o.length;for(;f>c&&h>c&&r[f-1]===o[h-1];)f-=1,h-=1;const m=Math.min(c,rx),p=Math.min(r.length-f,rx),v=r.slice(c-m,c).map(x=>({sign:" ",text:x}));return v.push(...ow(r.slice(c,f),o.slice(c,h))),v.push(...r.slice(f,f+p).map(x=>({sign:" ",text:x}))),v.length<=ix?v:[...v.slice(0,ix),{sign:" ",text:"…"}]}function ow(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>iw)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 r=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)r[h][m]=n[h]===a[m]?r[h+1][m+1]+1:Math.max(r[h+1][m],r[h][m+1]);const o=[];let c=0,f=0;for(;c<n.length&&f<a.length;)n[c]===a[f]?(o.push({sign:" ",text:n[c]}),c+=1,f+=1):r[c+1][f]>=r[c][f+1]?(o.push({sign:"-",text:n[c]}),c+=1):(o.push({sign:"+",text:a[f]}),f+=1);for(;c<n.length;)o.push({sign:"-",text:n[c++]});for(;f<a.length;)o.push({sign:"+",text:a[f++]});return o}function cw(n,a){const r=n.rounds??[];return[...r,n].map((o,c)=>{const f=c===r.length,h=o.startedAt??(c===0?n.createdAt:r[c-1].endedAt),m=f?void 0:o.endedAt,p=f?void 0:r[c+1]?.startedAt??(c+1===r.length?n.startedAt:void 0);return{job:{...n,...o,summary:f&&["running","queued","waiting"].includes(n.status)?void 0:o.summary,files:f&&["running","queued","waiting"].includes(n.status)?void 0:o.files},instruction:c===0?n.instruction:r[c-1].followUp,steps:a?.filter(v=>(!h||v.at>=h)&&(!m||v.at<=m)&&(!p||v.at<p))}})}const uw=new Set(["排队中","进行中","待确认","已完成","受阻","失败","已停止"]);function dw(n,a=0){const r=n.rounds?.[a];return r?{...n,status:r.status,statusReason:r.statusReason,startedAt:r.startedAt,endedAt:r.endedAt,durationMs:r.durationMs}:n}function Xf(n){const a=n.statusReason?Tl(n.statusReason):"";if(!(!a||uw.has(a)))return a}function fw(n){return n.split(/`/).map((a,r)=>({text:a,mono:r%2===1})).filter(a=>a.text.length>0)}function hw(n,a){const r=n==="dark"||n==="system"&&a;return{dark:r,color:r?"#1b1b1d":"#f6f6f4"}}function mw(n,a){if(n.phase!=="ready")return a?"bg":"side";const r=n.panelStack.at(-1);return r?.kind==="file"&&(a||r.full)?"bg":a?r?.kind==="job"||r?.kind==="jobs"||n.page==="settings"||n.page==="knowledge"?"bg":r||n.sheet?"panel":"bg":n.page==="settings"||n.page==="knowledge"?"bg":"side"}function Ub(n,a){const r=document.documentElement;r.style.setProperty("--status-background",`var(--${mw(n,a)})`);const o=getComputedStyle(r).backgroundColor;document.querySelector('meta[name="theme-color"]')?.setAttribute("content",o)}function pw(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 Jn(n,a){const r=n.findIndex(o=>pw(o,a));return[...r<0?n:n.slice(0,r),a]}function gw(n,a,r,o){return a!==r&&!o?[]:n}function Lb(n){return n.slice(0,-1)}function Hb(n,a){return Jn(Lb(n),a)}function vw(n,a){return n.filter(r=>r.kind!=="file"||!r.liveId||!!a[r.liveId])}const xw={general:{theme:"system",timezone:"UTC",aboutYou:{name:"",language:"",notes:""}},providers:[],models:{roster:[],conversation:{ref:"",thinking:"low"},work:{ref:"",thinking:"high"}},image:{source:"off"},search:Ab(),work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}},wl=new URLSearchParams(location.search),Cl=wl.get("mock")==="1",bw=["image","act-demo","act-think","act-tool","act-dark","act-home","boot","bubbles","bubbles-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"],lf=wl.get("scene"),dc=lf&&bw.includes(lf)?lf:"s1",P=Cl?P1(dc):j1,Vf="hob.theme",Bb=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;let ox=!1;function cx(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 qb(){const n=localStorage.getItem(Vf);return n==="light"||n==="dark"||n==="system"?n:null}const Ib=wl.get("dark")==="1",Ta=x1(location.hash);function yw(){const n=$b[Cl?dc:"s1"],a={phase:"loading",error:null,notice:null,offline:null,assistants:[],jobs:{},sedimenting:{},delegations:{},routines:[],approvals:{},drafts:{},settings:{revision:0,settings:xw},page:"main",knowledge:{category:"all",q:"",kind:"",assistantId:"",entries:[],collections:[],hasMore:!1,loading:!1,error:null},section:null,sub:null,items:{},itemGen:{},profiles:{},assistantSkills:{},sel:"hob",panelStack:[],livePages:{},steps:{},worklog:null,collapsed:!1,nowWide:!1,theme:qb()??"system",query:"",quote:null,text:"",attachments:[],pending:{},nonce:0,mobile:"list",sheet:!1,search:!1,menu:null,tick:0,updateReady:!1,loggingIn:!1};if(Cl){a.sel=n.sel;const c=cx(n.panel);a.panelStack=c.kind==="now"?[]:[c],a.collapsed=n.collapsed,a.mobile=n.mobile,a.theme=n.dark?"dark":"light"}const r=wl.get("a");r&&(a.sel=r),Ta.sel&&(a.sel=Ta.sel),Ta.knowledge&&(a.page="knowledge"),Ta.settings&&(a.page="settings",a.section=Ta.section);const o=wl.get("panel");if(o){const c=cx(o);a.panelStack=c.kind==="now"?[]:[c]}return wl.get("collapsed")==="1"&&(a.collapsed=!0),Ib&&(a.theme="dark"),a}let ue=yw();function kw(){return Ta.sel?!0:Cl?$b[dc].mobile==="chat":!!wl.get("a")||window.innerWidth>=768}Cl||Ib||qb();const jf=new Set;function X(n){ue={...ue,...typeof n=="function"?n(ue):n},jf.forEach(a=>a())}function Yb(n){return jf.add(n),()=>jf.delete(n)}const Vs=()=>ue;function je(){return y.useSyncExternalStore(Yb,Vs,Vs)}function ge(n){return n instanceof Ue||n instanceof Error?n.message:String(n)}function jn(n){const a={};for(const r of n)a[r.id]=r;return a}function ux(n,a){const r=n.findIndex(c=>c.id===a.id);if(r<0)return[...n,a];const o=n.slice();return o[r]=a,o}function jw(n,a){const r=a.models??{};return{general:{...n.general,...a.general??{},aboutYou:{...n.general.aboutYou,...a.general?.aboutYou??{}}},models:{roster:r.roster??n.models.roster,conversation:r.conversation??n.models.conversation,work:r.work??n.models.work,thinkingChoice:r.thinkingChoice??n.models.thinkingChoice,...r.thinking??n.models.thinking?{thinking:r.thinking??n.models.thinking}:{}},image:n.image,search:n.search,providers:n.providers,work:{...n.work,...a.work??{}},push:{...n.push,...a.push??{}}}}let dx=Promise.resolve();function Zf(n){const a=dx.then(()=>ww(typeof n=="function"?n(ue.settings.settings):n));return dx=a.then(()=>{},()=>{}),a}async function ww(n){const a=ue.settings,r={revision:a.revision,settings:jw(a.settings,n)};X({settings:r,theme:r.settings.general.theme}),n.general?.theme&&jl(n.general.theme);try{const o=await P.putSettings(a.revision,n);return X({settings:o,theme:o.settings.general.theme}),jl(o.settings.general.theme),localStorage.setItem(Vf,o.settings.general.theme),!0}catch(o){if(o instanceof Ue&&o.status===409){try{const c=await P.settings();X({settings:c,theme:c.settings.general.theme}),jl(c.settings.general.theme)}catch{X({settings:a})}return X({notice:"设置已在别处修改,已刷新"}),!1}return X({settings:a,theme:a.settings.general.theme,notice:`保存失败:${ge(o)}`}),jl(a.settings.general.theme),!1}}async function Nw(n,a){try{return await P.changePassword(n,a),null}catch(r){return ge(r)}}async function Sw(){try{return await P.about()}catch(n){return X({notice:`无法读取版本信息:${ge(n)}`}),null}}async function Qf(){try{return await P.models()}catch(n){return X({notice:`无法读取模型列表:${ge(n)}`}),null}}async function Tw(){const n=await P.claude();return X({settings:n.settings}),n}async function Cw(n){const a=await P.saveClaude(ue.settings.revision,n);return X({settings:a.settings}),a}async function Jf(n){return X({settings:n.settings}),n}async function Ew(){try{return{ok:!0,view:await P.providers()}}catch(n){return{ok:!1,error:ge(n)}}}async function fx(n,a){try{return{ok:!0,view:await Jf(await P.putProvider(n,a))}}catch(r){return{ok:!1,error:ge(r)}}}async function Aw(n,a){try{const r=await P.putThinking({ref:n,levels:a});return X({settings:r.settings}),{ok:!0,settings:r.settings,thinking:r.thinking}}catch(r){return{ok:!1,error:ge(r)}}}async function zw(n){try{return{ok:!0,view:await Jf(await P.deleteProvider(n))}}catch(a){return{ok:!1,error:ge(a)}}}async function hx(n){try{return await P.testProvider(n),null}catch(a){return ge(a)}}async function Mw(n){try{return{ok:!0,models:(await P.discoverProvider(n)).models}}catch(a){return{ok:!1,error:ge(a)}}}async function Ow(){try{return{ok:!0,view:await P.providersImport()}}catch(n){return{ok:!1,error:ge(n)}}}async function _w(n){try{return{ok:!0,view:await Jf(await P.importProviders(n))}}catch(a){return{ok:!1,error:ge(a)}}}const Rw=()=>P.skills(),Dw=n=>P.skillsImport(n),$w=(n,a,r)=>P.importSkills(n,a,r),Uw=n=>P.deleteSkill(n),Lw=()=>P.desktop();async function Hw(n){const a=await P.saveDesktop(n);return X({settings:await P.settings()}),a}async function Bw(n,a){const r=await P.saveDesktopPublic(n,a);return X({settings:await P.settings()}),r}const qw=()=>P.testDesktop(),mx=()=>P.mcp(),Iw=(n,a)=>P.putMcp(n,a),Gb=(n,a)=>P.patchMcp(n,a),Yw=n=>P.deleteMcp(n),Gw=(n,a=!0)=>P.testMcp(n,a),Kw=()=>P.mcpImports(),Xw=n=>P.importMcp(n),Vw=()=>P.search(),Zw=(n,a,r)=>P.testSearch(n,a,r);async function Qw(n,a){try{const r=await P.putSearch(ue.settings.revision,n,a);return X({settings:r}),null}catch(r){return r instanceof Ue&&r.status===409&&X({settings:await P.settings()}),ge(r)}}const Jw=()=>P.embeddingKey(),Pw=n=>P.embeddingTest(n);async function Fw(n,a){try{const r=await P.putEmbedding(ue.settings.revision,n,a);return X({settings:r.settings}),r}catch(r){throw r instanceof Ue&&r.status===409&&X({settings:await P.settings()}),r}}const Ww=(n,a)=>P.knowledgeEntry(n,a),eN=n=>P.reindexKnowledge(n);async function tN(){try{return await P.imageKey()}catch(n){return X({notice:`无法读取图像生成设置:${ge(n)}`}),null}}async function px(n,a){try{const r=await P.putImage(ue.settings.revision,n,a);return X({settings:r.settings}),{ok:!0,keyConfigured:r.keyConfigured}}catch(r){if(r instanceof Ue&&r.status===409){try{X({settings:await P.settings()})}catch{}return{ok:!1,error:"设置已在别处修改,已刷新,请重新保存",conflict:!0}}return{ok:!1,error:ge(r),conflict:!1}}}async function gx(n){try{return await P.imageTest(n)}catch(a){return{ok:!1,error:`生成测试图片的请求失败:${ge(a)}`}}}async function af(){try{return{ok:!0,config:await P.memory()}}catch(n){return{ok:!1,error:`无法读取记忆设置:${ge(n)}`}}}async function vx(n,a){try{const r=await P.putMemory(n,a);return X(o=>({settings:{...o.settings,revision:Math.max(o.settings.revision,r.revision)}})),{ok:!0,config:r}}catch(r){return{ok:!1,error:ge(r)}}}async function nN(n){try{return{ok:!0,config:await P.putLore(n)}}catch(a){return{ok:!1,error:ge(a)}}}async function xx(n){try{return{ok:!0,result:await P.loreTest(n)}}catch(a){return{ok:!1,error:`测试请求失败:${ge(a)}`}}}async function sN(){try{return{ok:!0,view:await P.loreImport()}}catch(n){return{ok:!1,error:ge(n)}}}async function lN(){try{return{ok:!0,config:await P.importLore()}}catch(n){return{ok:!1,error:ge(n)}}}async function Vi(){try{return{ok:!0,view:await P.push()}}catch(n){return{ok:!1,error:`无法读取推送设置:${ge(n)}`}}}async function aN(){const n=await Vi();if(!n.ok)return n;try{const a=await nw(n.view.publicKey);return"error"in a?{ok:!1,error:a.error}:{ok:!0,view:await P.subscribePush(a.subscription,F1(navigator.userAgent))}}catch(a){return{ok:!1,error:`订阅推送失败:${ge(a)}`}}}async function iN(){try{const n=await Kf();if(n)try{await n.unsubscribe()}catch{}return Kb(n?.endpoint??await rN())}catch(n){return{ok:!1,error:`关闭推送失败:${ge(n)}`}}}async function rN(){const n=await Vi();return n.ok?n.view.devices[0]?.endpoint??"":""}async function Kb(n){if(!n)return Vi();try{return{ok:!0,view:await P.unsubscribePush(n)}}catch(a){return{ok:!1,error:`删除设备失败:${ge(a)}`}}}async function oN(){const n=await Kf();try{const a=await P.testPush(n?.endpoint);return{ok:!0,sent:a.sent,removed:a.removed}}catch(a){return{ok:!1,error:ge(a)}}}const Xb=window.matchMedia("(prefers-color-scheme: dark)");function jl(n){const{dark:a}=hw(n,Xb.matches);document.documentElement.classList.toggle("dark",a),document.documentElement.style.colorScheme=a?"dark":"light",Ub(ue,window.innerWidth<768)}Xb.addEventListener("change",()=>jl(ue.theme));let bx=!1,yx=null;async function cN(){if(!bx){if(bx=!0,jl(ue.theme),Cl){if(dc==="boot")return;await tc();return}try{await P.me()}catch(n){if(n instanceof Ue&&n.status===401){X({phase:"login"});return}X({phase:"error",error:ge(n)});return}await tc()}}async function uN(n){if(!ue.loggingIn){X({loggingIn:!0,error:null});try{await P.login(n)}catch(a){X({loggingIn:!1,error:a instanceof Ue&&a.status===401?"密码不正确":`登录失败:${ge(a)}`});return}X({loggingIn:!1,phase:"loading"}),await tc()}}async function tc(){try{const n=await P.bootstrap();X({phase:"ready",error:null,offline:null,assistants:n.assistants,jobs:jn(n.jobs),delegations:jn(n.delegations??[]),routines:n.routines,approvals:jn(n.approvals),settings:n.settings,theme:n.settings.settings.general.theme}),jl(n.settings.settings.general.theme),localStorage.setItem(Vf,n.settings.settings.general.theme),yx||(yx=P.events({onEvent:Vb,onReconnect:()=>{X({offline:null,sedimenting:{}}),tc()},onDown:r=>X({offline:r})},Bb),fN());const a=ue.sel&&n.assistants.some(r=>r.id===ue.sel)?ue.sel:n.assistants.find(r=>r.primary)?.id??n.assistants[0]?.id??null;a&&await Xt(a,kw()),ue.page==="knowledge"&&zt()}catch(n){X({phase:"error",error:ge(n)})}}const Pf=new Set;function Vb(n){switch(n.type){case"sediment-finished":X(a=>({sedimenting:{...a.sedimenting,[n.jobId]:!1}}));break;case"page-live":{const a=!ue.livePages[n.callId];X(r=>({livePages:{...r.livePages,[n.callId]:n},...T1(n,{seen:!a,closed:Pf.has(n.callId),assistantId:r.sel,inChat:r.page==="main"&&(r.mobile==="chat"||!window.matchMedia("(max-width: 767px)").matches)})?{panelStack:Jn(r.panelStack,{kind:"file",path:"",full:!1,liveId:n.callId})}:{}}));break}case"assistant":{const a=n.assistant;X(r=>({assistants:ux(r.assistants,a),profiles:r.profiles[a.id]?{...r.profiles,[a.id]:{...r.profiles[a.id],assistant:a}}:r.profiles}));break}case"router-activity":X(a=>({assistants:a.assistants.map(r=>r.id===n.assistantId?{...r,activity:n.activity}:r)}));break;case"assistant_removed":X(a=>({assistants:a.assistants.filter(r=>r.id!==n.id),sel:a.sel===n.id?a.assistants.find(r=>r.primary)?.id??null:a.sel}));break;case"item":{const a=ue.items[n.assistantId];if(!a)break;const r=ue.pending[n.assistantId]??[],o=r.find(c=>_1(c,n.item));!o&&!a.some(c=>c.id===n.item.id)&&Ob([n.item.id]),X(c=>({items:{...c.items,[n.assistantId]:zb(a,n.item)},...o?{pending:{...c.pending,[n.assistantId]:r.filter(f=>f!==o)}}:{}}));break}case"delta":{const a=ue.items[n.assistantId];if(!a)break;const r=S1(a,n.itemId,n.text);r!==a&&X(o=>({items:{...o.items,[n.assistantId]:r}}));break}case"job":X(a=>({jobs:{...a.jobs,[n.job.id]:n.job}})),dN(n.job.status)&&ue.panelStack.some(a=>a.kind==="job"&&a.id===n.job.id)&&ue.steps[n.job.id]&&n0(n.job.id);break;case"delegation":X(a=>({delegations:{...a.delegations,[n.delegation.id]:n.delegation}}));break;case"job_step":{const a=ue.steps[n.jobId];if(!a)break;X(r=>({steps:{...r.steps,[n.jobId]:sw(a,n.step)}}));break}case"activity":{const a=ue.jobs[n.jobId];if(!a)break;X(r=>({jobs:{...r.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:ux(a.routines,n.routine)}));break;case"routine_removed":X(a=>({routines:a.routines.filter(r=>r.id!==n.id),panelStack:a.panelStack.filter(r=>r.kind!=="routine"||r.id!==n.id)}));break;case"skills":gs(n.assistantId);break;case"knowledge":ue.page==="knowledge"&&zt(!1,!0);break;case"profile":Zb(n.assistantId);break}}function dN(n){return n==="done"||n==="stuck"||n==="failed"||n==="stopped"}function kx(){P.visibility(Bb,document.visibilityState==="visible").catch(()=>{})}function fN(){ox||(ox=!0,document.addEventListener("visibilitychange",kx),kx())}async function Xt(n,a=!0,r=!1){X(c=>({sel:n,panelStack:gw(c.panelStack,c.sel,n,r),...c.sel!==n&&!r?{worklog:null}:{},...a?{mobile:"chat",...r?{}:{sheet:!1},search:!1}:{},quote:null}));const o=ue.assistants.find(c=>c.id===n);o&&o.unread>0&&(X(c=>({assistants:c.assistants.map(f=>f.id===n?{...f,unread:0}:f)})),P.markRead(n).catch(()=>{})),await Promise.all([hN(n),Zb(n)])}async function hN(n){const a=new Set(Object.keys(ue.livePages));try{const r=await P.items(n);z1();const o=new Set((r.pageLive??[]).map(c=>c.callId));X(c=>{const f=Object.fromEntries(Object.entries(c.livePages).filter(([h,m])=>m.assistantId!==n||m.state==="done"||!a.has(h)||o.has(h)));return{livePages:f,panelStack:vw(c.panelStack,f)}});for(const c of r.pageLive??[])Vb({type:"page-live",...c});X(c=>({items:{...c.items,[n]:r.items},itemGen:{...c.itemGen,[n]:(c.itemGen[n]??0)+1},jobs:{...c.jobs,...jn(r.jobs)},approvals:{...c.approvals,...jn(r.approvals)},drafts:{...c.drafts,...jn(r.drafts)},delegations:{...c.delegations,...jn(r.delegations??[])}}))}catch(r){X({notice:`无法加载对话:${ge(r)}`})}}async function Zb(n){try{const a=await P.profile(n);X(r=>({profiles:{...r.profiles,[n]:a}}))}catch(a){X({notice:`无法加载档案:${ge(a)}`})}}function Ff(n){X({text:n})}function nc(n){X({quote:n,nonce:ue.nonce+1})}const Qb=new Map,wf=new Map,sc=new Map;function zl(n){return sc.get(n)??P.fileUrl(n,{thumb:!0})}function jx(n,a){const r=o=>o.some(c=>c.id===n)?o.map(c=>c.id===n?{...c,...a}:c):o;X(o=>({attachments:r(o.attachments),pending:Object.fromEntries(Object.entries(o.pending).map(([c,f])=>[c,f.map(h=>({...h,attachments:r(h.attachments)}))]))}))}function Jb(n){const a=Qb.get(n.id),r=P.upload(a).then(o=>{const c=sc.get(uc(n));return c&&sc.set(o,c),jx(n.id,{status:"done",path:o}),o},o=>{throw wf.delete(n.id),jx(n.id,{status:"failed"}),o});return r.catch(()=>{}),wf.set(n.id,r),r}function mN(n){const a=Array.from(n).map(r=>{const o={id:`att-${Math.random().toString(36).slice(2,10)}`,name:r.name,status:"uploading"};return Qb.set(o.id,r),Yi(r.name)&&sc.set(uc(o),URL.createObjectURL(r)),o});X(r=>({attachments:[...r.attachments,...a]})),a.forEach(r=>void Jb(r))}function wx(n){X(a=>({attachments:a.attachments.filter(r=>r.id!==n)}))}async function pN(n){return Promise.all(n.attachments.map(a=>wf.get(a.id)??Jb(a)))}function Nf(n,a,r){X(o=>{const c=o.pending[n]??[],f=r?c.map(h=>h.localId===a?{...h,...r}:h):c.filter(h=>h.localId!==a);return{pending:{...o.pending,[n]:f}}})}async function Pb(n){Nf(n.assistantId,n.localId,{status:"sending",error:void 0});try{const a=await pN(n),r=await P.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)},...r?.item?{items:{...o.items,[n.assistantId]:zb(o.items[n.assistantId]??[],r.item)}}:{}}))}catch(a){Nf(n.assistantId,n.localId,{status:"failed",error:ge(a)})}}async function Nx(){const n=ue.sel,a=ue.text.trim();if(!n||!a&&!ue.attachments.length)return;const r={localId:`local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,assistantId:n,at:new Date().toISOString(),text:a,...ue.quote?{quote:ue.quote}:{},attachments:ue.attachments,status:"sending"};Ob([r.localId]),X(o=>({text:"",quote:null,attachments:[],nonce:o.nonce+1,pending:{...o.pending,[n]:[...o.pending[n]??[],r]}})),await Pb(r)}function Sx(n,a){const r=ue.pending[n]?.find(o=>o.localId===a);r&&Pb(r)}function gN(n,a){Nf(n,a,null)}function Fb(n,a){if(!a)return[];const r=n.pending[a]??[],o=n.items[a]??[];return r.length?[...o,...r.map(O1)]:o}function vN(n,a,r){return a?n.pending[a]?.find(o=>o.localId===r):void 0}async function xN(n){try{await P.stopAssistant(n)}catch(a){X({notice:`停止失败:${ge(a)}`})}}async function Tx(n,a){const r=ue.approvals[n];if(r){X(o=>({approvals:{...o.approvals,[n]:{...r,status:"answered",...a.key?{chosen:a.key}:{answerText:(a.text??"").trim()}}}}));try{await P.answerApproval(n,a)}catch(o){X({approvals:{...ue.approvals,[n]:r},notice:`提交失败:${ge(o)}`})}}}async function bN(n){try{await P.createDraft(n)}catch(a){X({notice:`创建助手失败:${ge(a)}`})}}async function yN(n){try{await P.archiveAssistant(n);const a=ue.assistants.find(r=>r.primary);ue.sel===n&&a&&await Xt(a.id)}catch(a){X({notice:`归档失败:${ge(a)}`})}}async function kN(n){try{await P.retryDelegation(n)}catch(a){X({notice:`重新转交失败:${ge(a)}`})}}async function Cx(n,a,r){await e0(n,a,r?"forward":"handback")}async function Wf(n,a,r){await e0(n,a,r?"forward":"delegation")}async function Wb(n,a){let r=ue.items[n]??[];for(;!r.some(a)&&r.length;){const o=await P.items(n,r[0].id);if(!o.items.length||(r=[...o.items,...r],X(c=>({items:{...c.items,[n]:r},jobs:{...c.jobs,...jn(o.jobs)},approvals:{...c.approvals,...jn(o.approvals)},drafts:{...c.drafts,...jn(o.drafts)},delegations:{...c.delegations,...jn(o.delegations??[])}})),!o.hasMore))break}return r.some(a)}async function e0(n,a,r){(ue.sel!==n||!ue.items[n])&&await Xt(n);const o=c=>r==="forward"?c.kind==="user"&&c.from?.delegationId===a:r==="handback"?c.kind==="note"&&c.handbackId===a:c.kind==="delegation"&&c.delegationId===a;try{if(!await Wb(n,o)){X({notice:"未找到对应的转交消息"});return}requestAnimationFrame(()=>requestAnimationFrame(()=>document.getElementById(`${r}-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})))}catch(c){X({notice:`无法定位转交消息:${ge(c)}`})}}async function Sf(n,a){try{return await P.replyJob(n,a),!0}catch(r){return X({notice:`发送失败:${ge(r)}`}),!1}}async function t0(n){try{await P.stopJob(n)}catch(a){X({notice:`停止失败:${ge(a)}`})}}const Bo={};async function gs(n){const a=Bo[n]=(Bo[n]??0)+1;X(r=>({assistantSkills:{...r.assistantSkills,[n]:{skills:r.assistantSkills[n]?.skills??[],loading:!0,error:null}}}));try{const r=await P.assistantSkills(n);Bo[n]===a&&X(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:r,loading:!1,error:null}}}))}catch(r){Bo[n]===a&&X(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:[],loading:!1,error:ge(r)}}}))}}async function rf(n,a,r){try{r==="rollback"?await P.rollbackAssistantSkill(n,a):r==="delete"?await P.deleteAssistantSkill(n,a):await P.patchAssistantSkill(n,a,r==="enable"),await gs(n)}catch(o){X({notice:`操作失败:${ge(o)}`})}}async function jN(n){X(a=>({sedimenting:{...a.sedimenting,[n]:!0}}));try{return await P.sedimentJob(n),!0}catch(a){return X(r=>({notice:`沉淀失败:${ge(a)}`,sedimenting:{...r.sedimenting,[n]:!1}})),!1}}async function xl(n,a){const r=ue.routines.find(f=>f.id===n);if(!r)return;const{skill:o,...c}=a;X(f=>({routines:f.routines.map(h=>h.id===n?{...h,...c,...o!==void 0?{skill:o??void 0}:{}}:h)}));try{await P.patchRoutine(n,a)}catch(f){X({routines:ue.routines.map(h=>h.id===n?r:h),notice:`保存失败:${ge(f)}`})}}async function wN(n){const a=new Set(ue.routines.map(c=>c.id));let r;try{r=await P.createRoutine(n)}catch(c){X({notice:`创建失败:${ge(c)}`});return}const o=r?.id?r:ue.routines.find(c=>!a.has(c.id));o&&X(c=>({panelStack:Hb(c.panelStack,{kind:"routine",id:o.id})}))}async function NN(n){try{await P.deleteRoutine(n)}catch(a){X({notice:`删除失败:${ge(a)}`})}}async function SN(n){try{await P.runRoutine(n)}catch(a){X({notice:`运行失败:${ge(a)}`})}}async function lc(n,a){const r=ue.assistants.find(c=>c.id===n),o=ue.profiles[n];if(!r)return"助手不存在。";X(c=>({assistants:c.assistants.map(f=>f.id===n?{...f,...a}:f),profiles:c.profiles[n]?{...c.profiles,[n]:{...c.profiles[n],assistant:{...c.profiles[n].assistant,...a}}}:c.profiles}));try{return await P.patchAssistant(n,a),null}catch(c){const f=`保存失败:${ge(c)}`;return X(h=>({assistants:h.assistants.map(m=>m.id===n?r:m),profiles:o?{...h.profiles,[n]:o}:h.profiles,notice:f})),f}}async function TN(n,a,r){try{const o=await P.patchAssistant(n,{rule:{text:a,mode:r}});if(!o?.rule)throw new Error("保存响应缺少规则。");const c=o.rule;return X(f=>{const h=f.profiles[n];return!h||h.rules.some(m=>m.id===c.id)?{}:{profiles:{...f.profiles,[n]:{...h,rules:[...h.rules,c]}}}}),null}catch(o){return`保存失败:${ge(o)}`}}async function CN(n,a){try{return await P.patchAssistant(n,{rule:a}),X(r=>{const o=r.profiles[n];return o?{profiles:{...r.profiles,[n]:{...o,rules:o.rules.map(c=>c.id===a.id?{...c,...a,changedAt:new Date().toISOString()}:c)}}}:{}}),null}catch(r){return`保存失败:${ge(r)}`}}async function EN(n,a){const r=ue.profiles[n];if(r){X(o=>({profiles:{...o.profiles,[n]:{...r,rules:r.rules.filter(c=>c.id!==a)}}}));try{await P.deleteRule(n,a)}catch(o){X({profiles:{...ue.profiles,[n]:r},notice:`删除失败:${ge(o)}`})}}}async function n0(n){try{const{job:a,steps:r}=await P.transcript(n);X(o=>({jobs:{...o.jobs,[a.id]:a},steps:{...o.steps,[a.id]:o.steps[a.id]?lw(o.steps[a.id],r):r}}))}catch(a){X({notice:`无法加载任务过程:${ge(a)}`})}}function $n(n,a){X(r=>({panelStack:Jn(r.panelStack,{kind:"job",id:n,round:a})})),n0(n)}function eh(n=null){X(a=>({panelStack:Jn(a.panelStack,{kind:"jobs"})})),Tf({assistantId:n,status:null})}function er(){const n=ue.panelStack.at(-1);n?.kind==="file"&&n.liveId&&Pf.add(n.liveId),X(a=>({panelStack:Lb(a.panelStack)}))}function tr(){for(const n of ue.panelStack)n.kind==="file"&&n.liveId&&Pf.add(n.liveId);X({panelStack:[]})}async function Tf(n={}){const a=n.assistantId??null,r=n.status??null;X({worklog:{jobs:[],assistantId:a,status:r,hasMore:!1,loading:!0}});try{const o=await P.jobs({...a?{assistantId:a}:{},...r?{status:r}:{},limit:30});s0(o,a,r)}catch(o){X({worklog:null,notice:`无法加载任务记录:${ge(o)}`})}}async function Ex(){const n=ue.worklog;if(!n||!n.hasMore||n.loading)return;const a=n.jobs[n.jobs.length-1];X({worklog:{...n,loading:!0}});try{const r=await P.jobs({...n.assistantId?{assistantId:n.assistantId}:{},...n.status?{status:n.status}:{},...a?{before:a.id}:{},limit:30});s0(r,n.assistantId,n.status)}catch(r){X(o=>({worklog:o.worklog?{...o.worklog,loading:!1}:null,notice:`无法加载更多:${ge(r)}`}))}}function s0(n,a,r){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===r?[...o.worklog.jobs,...n.jobs.filter(h=>!c.has(h.id))]:n.jobs,assistantId:a,status:r,hasMore:n.hasMore,loading:!1},jobs:{...o.jobs,...jn(n.jobs)}}})}function Zi(){X({nonce:ue.nonce+1,mobile:"chat",sheet:!1})}function l0(){const n=ue.assistants.find(a=>a.primary);n&&(Xt(n.id),X({text:"我想创建一个专属助手,负责:",nonce:ue.nonce+1,mobile:"chat",sheet:!1}))}async function AN(n,a){(ue.sel!==n||!ue.items[n])&&await Xt(n),requestAnimationFrame(()=>{document.getElementById(`job-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})})}function a0(n){X(a=>({panelStack:Jn(a.panelStack,{kind:"routine",id:n})}))}function zN(){X(n=>({panelStack:Jn(n.panelStack,{kind:"newRoutine"})}))}function th(){X(n=>({panelStack:Jn(n.panelStack,{kind:"assistant"})}))}function qo(n){X(a=>({panelStack:Jn(a.panelStack,{kind:n})}))}function Ax(n,a){return P.knowledge({origin:"output",assistantId:n,before:a,limit:30})}let zx=!1;async function MN(){if(zx)return;const n=await P.knowledge({limit:1});zx=!0,X(a=>({knowledge:{...a.knowledge,collections:n.collections}}))}function Mx(n,a,r){X({menu:{id:n,x:a,y:r}})}function of(){ue.menu&&X({menu:null})}let cf=0;async function zt(n=!1,a=!1){if(n&&(ue.knowledge.loading||!ue.knowledge.hasMore))return;const r=ue.knowledge,o=++cf;X({knowledge:{...r,loading:n||r.entries.length===0,error:null}});try{const c=await P.knowledge({...r.category==="output"||r.category==="chat"?{origin:r.category}:r.category!=="all"?{collection:r.category}:{},q:r.q,kind:r.kind||void 0,assistantId:r.assistantId,before:n?r.entries.at(-1)?.updatedAt:void 0,limit:a?Math.min(200,Math.max(50,r.entries.length)):50});if(o!==cf)return;X({knowledge:{...ue.knowledge,entries:n?[...r.entries,...c.entries]:c.entries,collections:c.collections,hasMore:c.hasMore,loading:!1}})}catch(c){o===cf&&X({knowledge:{...ue.knowledge,loading:!1,error:ge(c)}})}}function Nl(n){X({knowledge:{...ue.knowledge,...n,hasMore:!1}}),zt()}async function i0(n,a=!0){try{const r=await P.createKnowledgeCollection(n.trim());return a?Nl({category:r.id}):await zt(!1,!0),r}catch(r){return X({notice:`新建失败:${ge(r)}`}),null}}async function ON(n,a){try{return await P.renameKnowledgeCollection(n,a.trim()),await zt(!1,!0),!0}catch(r){return X({notice:`改名失败:${ge(r)}`}),!1}}async function _N(n){try{const{deleted:a}=await P.deleteKnowledgeCollection(n);ue.knowledge.category===n?Nl({category:"all"}):await zt(!1,!0),X({notice:a?`已删除知识库,一起删掉 ${a} 个文件`:"已删除知识库"})}catch(a){X({notice:`删除失败:${ge(a)}`})}}async function Jo(n,a){try{return await P.patchKnowledgeEntry(n,a),await zt(!1,!0),!0}catch(r){return X({notice:`保存失败:${ge(r)}`}),!1}}async function RN(n){try{await P.deleteKnowledgeEntry(n),await zt(!1,!0)}catch(a){X({notice:`删除失败:${ge(a)}`})}}async function DN(n,a){try{await P.uploadKnowledge(n,a),await zt(!1,!0)}catch(r){X({notice:`上传失败:${ge(r)}`})}}function nh(){X({page:"knowledge",panelStack:[],sheet:!1}),zt()}function Qi(){X({page:"main",panelStack:[]})}async function $N(n,a){X({page:"main",panelStack:[]}),await Xt(n);try{if(!await Wb(n,c=>c.id===a)){X({notice:"未找到对应的对话消息"});return}const r=performance.now()+1500,o=()=>{if(ue.page!=="main"||ue.sel!==n)return;const c=Array.from(document.querySelectorAll("[data-item-id]")).find(f=>f.dataset.itemId===a);if(!c){performance.now()<r?requestAnimationFrame(o):X({notice:"没能定位到这条消息"});return}_b(c)};requestAnimationFrame(o)}catch(r){X({notice:`无法定位对话消息:${ge(r)}`})}}function fc(){X({page:"settings",section:null,sub:null,sheet:!1,search:!1,panelStack:[]})}function Cf(){X({page:"main",panelStack:[]})}function Sl(n){X({section:n,sub:null})}function Nn(n){X({sub:n})}function Lt(){X({sub:null})}function uf(){X(n=>({nowWide:!n.nowWide}))}function UN(){X({collapsed:!0,sheet:!1})}function LN(){X({collapsed:!1,panelStack:[]})}function r0(n){X({query:n})}function Ef(n){X({mobile:n,sheet:!1,search:!1})}function HN(){X({sheet:!0})}function o0(){X({sheet:!1})}function Ox(n){X({search:n,query:n?ue.query:""})}function BN(){X({notice:null})}function La(n){X({notice:n})}function qN(){X({updateReady:!0})}function IN(){X({tick:ue.tick+1})}function Ut(n,a){return P.fileUrl(n,a)}function sh(n){return P.fileMeta(n)}function c0(n,a){return P.jobFiles(n,a)}function Tt(n,a,r){X(o=>({panelStack:Jn(o.panelStack,{kind:"file",path:n,full:!1,...a?{title:a}:{},...r})}))}function YN(n){X(a=>({panelStack:Jn(a.panelStack,{kind:"file",path:"",full:!1,liveId:n})}))}function GN(){X(n=>{const a=n.panelStack.at(-1);return a?.kind==="file"?{panelStack:Hb(n.panelStack,{...a,full:!a.full})}:{}})}const KN=500,_x=10;function u0(n){const a=y.useRef(null),r=y.useRef(null),o=y.useRef(!1),c=()=>{a.current!==null&&window.clearTimeout(a.current),a.current=null,r.current=null};return y.useEffect(()=>c,[]),{handlers:{onContextMenu(h){h.preventDefault(),c(),Mx(n.id,h.clientX,h.clientY)},onPointerDown(h){h.pointerType==="touch"&&(c(),o.current=!1,r.current={x:h.clientX,y:h.clientY},a.current=window.setTimeout(()=>{a.current=null;const m=r.current;m&&(o.current=!0,window.setTimeout(()=>o.current=!1,1e3),Mx(n.id,m.x,m.y))},KN))},onPointerMove(h){const m=r.current;m&&(Math.abs(h.clientX-m.x)>_x||Math.abs(h.clientY-m.y)>_x)&&c()},onPointerUp:c,onPointerCancel:c},takeHeld(){return o.current?(o.current=!1,!0):!1}}}function Rx(){const n=je(),a=n.menu,r=y.useRef(null);if(y.useEffect(()=>{if(!a)return;const p=x=>{r.current&&!r.current.contains(x.target)&&of()},v=x=>{x.key==="Escape"&&of()};return document.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",v)}},[a]),!a)return null;const o=n.assistants.find(p=>p.id===a.id);if(!o)return null;const c=p=>{of(),p()},f=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-(f*34+16)));return l.jsxs("div",{className:"amenu",ref:r,style:{left:h,top:m,transformOrigin:`${a.x-h}px ${a.y-m}px`},onContextMenu:p=>p.preventDefault(),children:[o.primary?null:l.jsx("button",{onClick:()=>c(()=>void lc(o.id,{pinned:!o.pinned})),children:o.pinned?"取消置顶":"放在顶部"}),o.primary?null:l.jsx("button",{onClick:()=>c(()=>void lc(o.id,{hidden:!o.hidden})),children:o.hidden?"放回列表":"收起这个助手"}),l.jsx("button",{onClick:()=>c(()=>{Xt(o.id,!1),th()}),children:"助手设置"})]})}const d0={};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 r of a.split(" "))d0[r]=n;function Ml(n){const a=n.split(/[\\/]/).pop()??"",r=a.lastIndexOf(".");return r>0?d0[a.slice(r+1).toLowerCase()]??"file":"file"}const f0={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"/>',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 ac(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">${f0[n]}</svg>`}function V({name:n,size:a=16,w:r=1.7,className:o,style:c}){return l.jsx("svg",{className:`i${o?` ${o}`:""}`,width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",style:c,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:f0[n]}})}const Ea=["......k.....",".....kok....",".....kook...","..k.koook...",".kokoooook..",".kooooooook.","kooyyyyyyook","koyyeyyeyyok","koyyeyyeyyok","koyyyyyyyyok",".kooyyyyook.","..kkkkkkkk.."],kn=16,Dx="#40261a",Ra={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],El={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...."])}},XN=Object.keys(El),VN=Object.keys(Ra);function h0(n){if(n==="custom")return{prop:"custom",color:"orange"};if(n.startsWith("custom:")){const f=n.slice(7);return Object.hasOwn(Ra,f)?{prop:"custom",color:f}:void 0}const[a,r,...o]=n.split(":");if(o.length||!Object.hasOwn(El,a))return;const c=a;return r===void 0?{prop:c,color:El[c].color}:Object.hasOwn(Ra,r)?{prop:c,color:r}:void 0}function df(n){return n==="orange"?"custom":`custom:${n}`}const ZN=/^#[0-9a-f]{6}$/;function QN(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:r,dx:o}=n;if(!Array.isArray(a)||a.length===0)return{ok:!1,error:"prop_art.art 要是非空的字符串数组"};if(a.length>kn)return{ok:!1,error:`prop_art.art 最多 ${kn} 行,收到 ${a.length} 行`};for(const p of a){if(typeof p!="string")return{ok:!1,error:"prop_art.art 的每行都要是字符串"};if([...p].length!==kn)return{ok:!1,error:`prop_art.art 每行要正好 ${kn} 个字符,这一行是 ${[...p].length} 个:「${p}」`}}if(!r||typeof r!="object"||Array.isArray(r))return{ok:!1,error:"prop_art.pal 要是对象:单个小写字母 → #rrggbb"};const c=Object.entries(r);if(c.length>6)return{ok:!1,error:`prop_art.pal 最多 6 种颜色,收到 ${c.length} 种`};for(const[p,v]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 v!="string"||!ZN.test(v))return{ok:!1,error:`pal[${p}] 要是 #rrggbb 格式的颜色,收到「${String(v)}」`}}const f=a.join("");for(const p of new Set([...f].filter(v=>v!==".")))if(p!=="k"&&!Object.hasOwn(r,p))return{ok:!1,error:`art 里的「${p}」没有在 pal 里定义颜色`};const h=[...f].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=kn-Ea.length;for(let p=0;p<Ea.length;p++)for(let v=0;v<Ea[p].length;v++){if(Ea[p][v]!=="e")continue;const b=a[m+p]?.[o+v];if(b&&b!==".")return{ok:!1,error:`art 第 ${m+p+1} 行第 ${o+v+1} 列会盖住火苗的眼睛,把图案挪开(或调小 dx)`}}return{ok:!0,prop:{art:a,pal:r,dx:o}}}function ff(n,a){return a===El[n].color?n:`${n}:${a}`}function JN(n,a){const r=h0(n)??{prop:"hob",color:"slate"},o=r.prop==="custom"&&a?QN(a):void 0,c=r.prop==="custom"?o?.ok?o.prop:El.hob:El[r.prop],f=Ra[r.color],h=[...Array(kn-Ea.length).fill(""),...Ea].map((b,N)=>{const w=b?`${".".repeat(c.dx)}${b}`.padEnd(kn,"."):".".repeat(kn),T=c.art[N]??"";return[...w].map((E,A)=>T[A]&&T[A]!=="."?T[A]:E).join("")});let[m,p,v,x]=[kn,kn,0,0];return h.forEach((b,N)=>[...b].forEach((w,T)=>{w!=="."&&([m,p,v,x]=[Math.min(m,T),Math.min(p,N),Math.max(v,T+1),Math.max(x,N+1)])})),{rows:h,pal:{k:Dx,e:Dx,o:f.o,y:f.y,...c.pal},bg:f.bg,offset:[(m+v-kn)/2,(p+x-kn)/2]}}function PN(n){const a=[];return{body:n.rows.map((o,c)=>[...o].map((f,h)=>f!=="e"?f:(a.push([h,c]),"y")).join("")),eyes:a}}function $x({art:n}){const a=[];return n.rows.forEach((r,o)=>{for(let c=0;c<r.length;){const f=r[c];let h=c+1;for(;h<r.length&&r[h]===f;)h++;f!=="."&&n.pal[f]&&a.push({x:c,y:o,w:h-c,fill:n.pal[f]}),c=h}}),l.jsx(l.Fragment,{children:a.map((r,o)=>l.jsx("rect",{x:r.x,y:r.y,width:r.w+.02,height:1.02,fill:r.fill},o))})}const FN={busy:"正在工作",ask:"等你确认",stuck:"受阻",done:"已完成,未读"},WN=4,eS=7;function it({sprite:n,prop:a,size:r,title:o,onClick:c,motion:f,mark:h,free:m,slot:p}){const v=JN(n,a),x=f?PN(v):void 0,b=f==="peek"?`${(p??0)%eS*WN}s`:f?`${-([...n].reduce((N,w)=>(N*31+w.charCodeAt(0))%9973,7)%4e3)/1e3}s`:void 0;return l.jsxs("div",{className:`av${m?" av-free":""}${f?` av-motion av-${f}`:""}${h?" av-marked":""}`,title:o,onClick:c,style:{"--av-size":`${r}px`,"--av-bg":v.bg},children:[l.jsx("svg",{viewBox:`${v.offset[0]} ${v.offset[1]} 16 16`,shapeRendering:"crispEdges","aria-hidden":"true",style:b?{"--eye-delay":b}:void 0,children:x?l.jsxs(l.Fragment,{children:[l.jsx($x,{art:{...v,rows:x.body}}),l.jsx("g",{className:"av-eyes",children:l.jsx("g",{className:"av-blink",children:x.eyes.map(([N,w])=>l.jsx("rect",{x:N,y:w,width:1.02,height:1.02,fill:v.pal.e},`${N}-${w}`))})})]}):l.jsx($x,{art:v})}),h?l.jsx("span",{className:`av-mark ${h}`,"aria-label":FN[h],children:h==="busy"?l.jsxs("svg",{viewBox:"0 0 13 5",children:[l.jsx("circle",{cx:"2.5",cy:"2.5",r:"1.5"}),l.jsx("circle",{cx:"6.5",cy:"2.5",r:"1.5"}),l.jsx("circle",{cx:"10.5",cy:"2.5",r:"1.5"})]}):h==="done"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",children:l.jsx("path",{d:"M3 8.5 6.5 12 13 4.5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}):h==="ask"?"?":"!"}):null]})}var nr=Eb();async function lh(n){try{const a=navigator.clipboard;return a?.writeText?(await a.writeText(n),!0):!1}catch{return!1}}const tS="modulepreload",nS=function(n){return"/"+n},Ux={},sr=function(a,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=h(r.map(v=>{if(v=nS(v),v in Ux)return;Ux[v]=!0;const x=v.endsWith(".css"),b=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${b}`))return;const N=document.createElement("link");if(N.rel=x?"stylesheet":tS,x||(N.as="script"),N.crossOrigin="",N.href=v,p&&N.setAttribute("nonce",p),document.head.appendChild(N),x)return new Promise((w,T)=>{N.addEventListener("load",w),N.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${v}`)))})}))}function f(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"&&f(m.reason);return a().catch(f)})};function ah(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ol=ah();function m0(n){Ol=n}var kl={exec:()=>null};function bl(n){let a=[];return r=>{let o=Math.max(0,Math.min(3,r-1)),c=a[o];return c||(c=n(o),a[o]=c),c}}function Se(n,a=""){let r=typeof n=="string"?n:n.source,o={replace:(c,f)=>{let h=typeof f=="string"?f:f.source;return h=h.replace(ht.caret,"$1"),r=r.replace(c,h),o},getRegex:()=>new RegExp(r,a)};return o}var p0=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),ht={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:bl(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:bl(n=>new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:bl(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:bl(n=>new RegExp(`^ {0,${n}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:bl(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:bl(n=>new RegExp(`^ {0,${n}}(?:</?(?:${ar})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:bl(n=>new RegExp(`^ {0,${n}}>`))},sS=/^(?:[ \t]*(?:\n|$))+/,lS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,aS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,lr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,iS=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ih=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,g0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,v0=Se(g0).replace(/bull/g,ih).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(),rS=Se(g0).replace(/bull/g,ih).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(),rh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,oS=/^[^\n]+/,oh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,cS=Se(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",oh).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),uS=Se(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ih).getRegex(),ar="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",ch=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,dS=Se("^ {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",ch).replace("tag",ar).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x0=n=>Se(rh).replace("hr",lr).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",ar).getRegex(),fS=x0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),hS=x0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),mS=Se(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",hS).getRegex(),uh={blockquote:mS,code:lS,def:cS,fences:aS,heading:iS,hr:lr,html:dS,lheading:v0,list:uS,newline:sS,paragraph:fS,table:kl,text:oS},Lx=Se("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",lr).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",ar).getRegex(),pS={...uh,lheading:rS,table:Lx,paragraph:Se(rh).replace("hr",lr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Lx).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",ar).getRegex()},gS={...uh,html:Se(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",ch).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:kl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Se(rh).replace("hr",lr).replace("heading",` *#{1,6} *[^
|
|
104
|
+
]`).replace("lheading",v0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,b0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,bS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pn=/[\p{P}\p{S}]/u,Ha=/[\s\p{P}\p{S}]/u,ir=/[^\s\p{P}\p{S}]/u,yS=Se(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ha).getRegex(),kS=/[\p{Pi}\p{Ps}"']/u,y0=/(?!~)[\p{P}\p{S}]/u,jS=/(?!~)[\s\p{P}\p{S}]/u,wS=/(?:[^\s\p{P}\p{S}]|~)/u,NS=Se(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",p0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),k0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,SS=Se(k0,"u").replace(/punct/g,Pn).getRegex(),TS=Se(k0,"u").replace(/punct/g,y0).getRegex(),CS=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ES=Se(CS,"u").replace(/openQuote/g,kS).replace(/punct/g,Pn).getRegex(),j0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AS=Se(j0,"gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,Ha).replace(/punct/g,Pn).getRegex(),zS=Se(j0,"gu").replace(/notPunctSpace/g,wS).replace(/punctSpace/g,jS).replace(/punct/g,y0).getRegex(),MS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",OS=Se(MS,"gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,Ha).replace(/punct/g,Pn).getRegex(),_S=Se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,Ha).replace(/punct/g,Pn).getRegex(),RS="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",DS=Se(RS,"gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,Ha).replace(/punct/g,Pn).getRegex(),$S=Se(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Pn).getRegex(),US="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",LS=Se(US,"gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,Ha).replace(/punct/g,Pn).getRegex(),HS=Se(/\\(punct)/,"gu").replace(/punct/g,Pn).getRegex(),BS=Se(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,Pn).getRegex(),qS=Se(/^<(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(),IS=Se(ch).replace("(?:-->|$)","-->").getRegex(),YS=Se("^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",IS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),w0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,ic=Se(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",w0).getRegex(),GS=Se(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",ic).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),KS=Se(/^!?\[(label)\]\[(ref)\]/).replace("label",ic).replace("ref",oh).getRegex(),XS=Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",oh).getRegex(),Hx=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,VS=Se(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",w0).getRegex(),ZS=Se("reflink|nolink(?!\\()","g").replace("reflink",Se(/^!?\[(label)\]\[(ref)\]/).replace("label",VS).replace("ref",Hx).getRegex()).replace("nolink",Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hx).getRegex()).getRegex(),Bx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,QS=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,JS=Se(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,QS).getRegex(),dh={_backpedal:kl,anyPunctuation:HS,anyPunctuationOutsideCode:BS,autolink:qS,blockSkip:NS,br:b0,code:xS,del:kl,delLDelim:kl,delRDelim:kl,emStrongLDelim:SS,emStrongRDelimAst:AS,emStrongRDelimUnd:_S,escape:vS,link:GS,nolink:XS,punctuation:yS,reflink:KS,reflinkSearch:ZS,tag:YS,text:bS,url:kl},PS={...dh,emStrongLDelim:ES,emStrongRDelimAst:OS,emStrongRDelimUnd:DS,link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",ic).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ic).getRegex()},Af={...dh,emStrongRDelimAst:zS,emStrongLDelim:TS,delLDelim:$S,delRDelim:LS,url:Se(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",JS).replace("protocol",Bx).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:Se(/^(?:[^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",Bx).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",p0?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},FS={...Af,br:Se(b0).replace("{2,}","*").getRegex(),text:Se(Af.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Io={normal:uh,gfm:pS,pedantic:gS},Ui={normal:dh,gfm:Af,breaks:FS,pedantic:PS},WS={"&":"&","<":"<",">":">",'"':""","'":"'"},qx=n=>WS[n];function rn(n,a){if(a){if(ht.escapeTest.test(n))return n.replace(ht.escapeReplace,qx)}else if(ht.escapeTestNoEncode.test(n))return n.replace(ht.escapeReplaceNoEncode,qx);return n}function e2(n){return ht.numericCharacterReference.test(n)?n.replace(ht.numericCharacterReferenceOrAmpersand,(a,r,o)=>{if(r===void 0&&o===void 0)return"&";let c=r===void 0?Number.parseInt(o,16):Number.parseInt(r,10);return c===0||c>1114111||c>=55296&&c<=57343?"�":c===38?"&":String.fromCodePoint(c)}):n}function Ix(n){try{n=encodeURI(n).replace(ht.percentDecode,"%")}catch{return null}return n}function Yx(n,a){let r=n.replace(ht.findPipe,(f,h,m)=>{let p=!1,v=h;for(;--v>=0&&m[v]==="\\";)p=!p;return p?"|":" |"}),o=r.split(ht.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(ht.slashPipe,"|");return o}function ms(n,a,r){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 Gx(n){let a=n.split(`
|
|
105
|
+
`),r=a.length-1;for(;r>=0&&ht.blankLine.test(a[r]);)r--;return a.length-r<=2?n:a.slice(0,r+1).join(`
|
|
106
|
+
`)}function rc(n){return n.trim().replace(ht.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function Kx(n,a){if(n.indexOf(a[0])===-1&&n.indexOf(a[1])===-1)return-1;let r=0;for(let o=0;o<n.length;o++)if(n[o]==="\\")o++;else if(n[o]===a[0])r++;else if(n[o]===a[1]&&(r--,r<0))return o;return r>0?-2:-1}var Da=new WeakMap;function fh(n){let a={"*":-1,_:-1},r=-1,o=n.length;for(let c=0;c<o;c++){let f=n[c];if(f!=="*"&&f!=="_"&&f!=="~")continue;let h=c===0?`
|
|
107
|
+
`:n[c-1],m=c+1;for(;m<o&&n[m]===f;)m++;h!==" "&&h!==" "&&h!==`
|
|
108
|
+
`&&h!=="\r"&&h!=="\f"&&(f==="~"?r=c:a[f]=c),c=m-1}return{maskedSrc:n,lastPossibleEmStrongCloserIndex:a,lastPossibleDelCloserIndex:r}}function t2(n,a){let r=fh(a),o=Da.get(n);o?o.push(r):Da.set(n,[r])}function n2(n){let a=Da.get(n);a&&(a.pop(),a.length===0&&Da.delete(n))}function s2(n,a,r){let o=Da.get(n)?.at(-1);return o&&o.maskedSrc===a?o.lastPossibleEmStrongCloserIndex[r]:fh(a).lastPossibleEmStrongCloserIndex[r]}function l2(n,a){let r=Da.get(n)?.at(-1);return r&&r.maskedSrc===a?r.lastPossibleDelCloserIndex:fh(a).lastPossibleDelCloserIndex}function Yo(n,a=0){let r=a,o="";for(let c of n)if(c===" "){let f=4-r%4;o+=" ".repeat(f),r+=f}else o+=c,r++;return o}function Xx(n,a,r,o,c){let f=a.href,h=a.title||null,m=n[1].replace(c.other.outputLinkReplace,"$1"),p=n[0].charAt(0)==="!",v=o.state.inLink,x=o.state.linkEmitted,b=o.state.inRawBlock;o.state.inLink=!0,o.state.linkEmitted=!1;let N=o.inlineTokens(m),w=o.state.linkEmitted;if(o.state.linkEmitted=x,o.state.inLink=v,!p){if(w){o.state.inRawBlock=b;return}o.state.linkEmitted=!0}return{type:p?"image":"link",raw:r,href:f,title:h,text:m,tokens:N}}function a2(n,a,r){let o=n.match(r.other.indentCodeCompensation);if(o===null)return a;let c=o[1];return a.split(`
|
|
109
|
+
`).map(f=>{let h=f.match(r.other.beginningSpace);if(h===null)return f;let[m]=h;return f.slice(Math.min(m.length,c.length))}).join(`
|
|
110
|
+
`)}function Vx(n,a,r,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 f=n.slice(r+c),h=o.inline.tag.exec(f)||o.inline.autolink.exec(f);if(h){if(h[0].length>a.length-c)return!0;c+=h[0].length-1}}return!1}var Ma=class{options;rules;lexer;constructor(a){this.options=a||Ol}space(a){let r=this.rules.block.newline.exec(a);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(a){let r=this.rules.block.code.exec(a);if(r){let o=this.options.pedantic?r[0]:Gx(r[0]),c=o.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:o,codeBlockStyle:"indented",text:c}}}fences(a){let r=this.rules.block.fences.exec(a);if(r){let o=r[0],c=a2(o,r[3]||"",this.rules);return{type:"code",raw:o,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:c}}}heading(a){let r=this.rules.block.heading.exec(a);if(r){let o=r[2].trim();if(this.rules.other.endingHash.test(o)){let c=ms(o,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceTabChar.test(c))&&(o=c.trim())}return{type:"heading",raw:ms(r[0],`
|
|
111
|
+
`),depth:r[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(a){let r=this.rules.block.hr.exec(a);if(r)return{type:"hr",raw:ms(r[0],`
|
|
112
|
+
`)}}blockquote(a){let r=this.rules.block.blockquote.exec(a);if(r){let o=ms(r[0],`
|
|
113
|
+
`).split(`
|
|
114
|
+
`),c="",f="",h=[];for(;o.length>0;){let m=!1,p=[],v;for(v=0;v<o.length;v++)if(this.rules.other.blockquoteStart.test(o[v]))p.push(o[v]),m=!0;else if(!m)p.push(o[v]);else break;o=o.slice(v);let x=p.join(`
|
|
115
|
+
`),b=x.replace(this.rules.other.blockquoteMarkerWhitespace,(T,E,A)=>E+Yo(A,E.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
116
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
|
|
117
|
+
${x}`:x,f=f?`${f}
|
|
118
|
+
${b}`:b;let N=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,h,!0),this.lexer.state.top=N,o.length===0)break;let w=h.at(-1);if(w?.type==="code"||w?.type==="heading"||w?.type==="hr"||w?.type==="html"||w?.type==="table")break;if(w?.type==="blockquote"){let T=w,E=o.join(`
|
|
119
|
+
`),A=T.raw+`
|
|
120
|
+
`+E.replace(this.rules.other.blockquoteSetextReplace2,""),z=this.blockquote(A);h[h.length-1]=z;let U=A.substring(z.raw.length).replace(/^\n/,""),$=U?U.split(`
|
|
121
|
+
`).length:0,j=$?o.slice(0,-$):o;if(j.length>0&&(c=`${c}
|
|
122
|
+
${j.join(`
|
|
123
|
+
`)}`),f=f.substring(0,f.length-T.text.length)+z.text,o=o.slice(j.length),o.length>0&&this.rules.other.blockquoteStart.test(o[0]))continue;break}else if(w?.type==="list"){let T=w,E=T.raw+`
|
|
124
|
+
`+o.join(`
|
|
125
|
+
`),A=this.list(E);h[h.length-1]=A;let z=A.raw.length>T.raw.length?E.slice(T.raw.length+1,A.raw.length).split(`
|
|
126
|
+
`).length:0;if(z>0){let U=o.slice(0,z).join(`
|
|
127
|
+
`);c=`${c}
|
|
128
|
+
${U}`,f=`${f}
|
|
129
|
+
${U}`}o=o.slice(z);continue}}return{type:"blockquote",raw:c,tokens:h,text:f}}}list(a){let r=this.rules.block.list.exec(a);if(r){let o=a,c=()=>o.length-a.length,f=r[1].trim(),h=f.length>1,m={type:"list",raw:"",ordered:h,start:h?+f.slice(0,-1):"",loose:!1,items:[]};f=h?`\\d{1,9}\\${f.slice(-1)}`:`\\${f}`,this.options.pedantic&&(f=h?f:"[*+-]");let p=this.rules.other.listItemRegex(f),v=!1;for(;a;){let b=!1,N="";if(!(r=p.exec(a))||this.rules.block.hr.test(a))break;let w=c();a=a.substring(r[0].length);let T=r[2].split(`
|
|
130
|
+
`,1)[0],E=r[1].length,A=this.options.pedantic?Yo(T,E):T.replace(this.rules.other.leadingSpaceTab,C=>Yo(C,E)),z=a.split(`
|
|
131
|
+
`,1)[0],U=!A.trim(),$=0;if(this.options.pedantic?($=2,N=A.trimStart()):U?$=E+1:($=A.search(this.rules.other.nonSpaceChar),$=$>4?1:$,N=A.slice($),$+=E),U&&this.rules.other.blankLine.test(z)&&(a=a.substring(z.length+1),b=!0),!b){let C=this.rules.other.nextBulletRegex($),S=this.rules.other.hrRegex($),O=this.rules.other.fencesBeginRegex($),R=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex($):this.rules.other.headingBeginRegex($),q=this.rules.other.htmlBeginRegex($),F=this.rules.other.blockquoteBeginRegex($);for(;a;){let W=a.split(`
|
|
132
|
+
`,1)[0],Ee;if(z=W,this.options.pedantic?(z=z.replace(this.rules.other.listReplaceNesting," "),Ee=z):Ee=z.replace(this.rules.other.leadingSpaceTab,he=>Yo(he)),O.test(z)||R.test(z)||q.test(z)||F.test(z)||C.test(z)||S.test(z))break;if(Ee.search(this.rules.other.nonSpaceChar)>=$||!z.trim())N+=`
|
|
133
|
+
`+Ee.slice($);else{if(U||A.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||O.test(A)||R.test(A)||q.test(A)||S.test(A))break;let he=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(z)&&this.rules.block.lheading.test(`${A}
|
|
134
|
+
${z}`)?` ${Ee.replace(/^ {0,3}/,"")}`:z;N+=`
|
|
135
|
+
`+he}U=!z.trim(),a=a.substring(W.length+1),A=Ee.slice($)}}let j=o.slice(w,c());m.loose||(v?m.loose=!0:this.rules.other.doubleBlankLine.test(j)&&(v=!0)),m.items.push({type:"list_item",raw:j,task:!!this.options.gfm&&this.rules.other.listIsTask.test(N),loose:!1,text:N,tokens:[]})}let x=m.items.at(-1);if(x)x.raw=x.raw.trimEnd(),x.text=x.text.trimEnd();else return;m.raw=o.slice(0,c()).trimEnd();for(let b of m.items)if(this.lexer.state.top=!1,b.tokens=this.lexer.blockTokens(b.text,[]),!m.loose){let N=b.tokens.filter(T=>T.type==="space"),w=N.length>0&&N.some(T=>this.rules.other.anyLine.test(T.raw));m.loose=w}for(let b of m.items){let N=b.tokens[0];if(b.task&&(N?.type==="text"||N?.type==="paragraph")){b.text=b.text.replace(this.rules.other.listReplaceTask,""),N.raw=N.raw.replace(this.rules.other.listReplaceTask,""),N.text=N.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 w=this.rules.other.listTaskCheckbox.exec(b.raw);if(w){let T={type:"checkbox",raw:w[0]+" ",checked:w[0]!=="[ ]"};b.checked=T.checked,m.loose?b.tokens[0]&&["paragraph","text"].includes(b.tokens[0].type)&&"tokens"in b.tokens[0]&&b.tokens[0].tokens?(b.tokens[0].raw=T.raw+b.tokens[0].raw,b.tokens[0].text=T.raw+b.tokens[0].text,b.tokens[0].tokens.unshift(T)):b.tokens.unshift({type:"paragraph",raw:T.raw,text:T.raw,tokens:[T]}):b.tokens.unshift(T)}}else b.task&&(b.task=!1)}if(m.loose)for(let b of m.items){b.loose=!0;for(let N of b.tokens)N.type==="text"&&(N.type="paragraph")}return m}}html(a){let r=this.rules.block.html.exec(a);if(r){let o=Gx(r[0]);return{type:"html",block:!0,raw:o,pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:o}}}def(a){let r=this.rules.block.def.exec(a);if(r){if(!this.rules.other.startAngleBracket.test(r[2])&&Kx(r[2],"()")!==-1)return;let o=rc(r[1]),c=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",f=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:o,raw:ms(r[0],`
|
|
136
|
+
`),href:c,title:f}}}table(a){let r=this.rules.block.table.exec(a);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let o=Yx(r[1]),c=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),f=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
137
|
+
`):[],h={type:"table",raw:ms(r[0],`
|
|
138
|
+
`),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 f)h.rows.push(Yx(m,h.header.length).map((p,v)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:h.align[v]})));return h}}lheading(a){let r=this.rules.block.lheading.exec(a);if(r){let o=r[1].trim();return{type:"heading",raw:ms(r[0],`
|
|
139
|
+
`),depth:r[2].charAt(0)==="="?1:2,text:o,tokens:this.lexer.inline(o)}}}paragraph(a){let r=this.rules.block.paragraph.exec(a);if(r){let o=r[1].charAt(r[1].length-1)===`
|
|
140
|
+
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:o,tokens:this.lexer.inline(o)}}}text(a){let r=this.rules.block.text.exec(a);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(a){let r=this.rules.inline.escape.exec(a);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(a){let r=this.rules.inline.tag.exec(a);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(a){if(this.lexer.state.linkParenPossible===!1)return;let r=this.rules.inline.link.exec(a);if(r){let o=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Vx(a,r[1],o,this.rules))return;let c=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(c)){if(!this.rules.other.endAngleBracket.test(c))return;let p=ms(c.slice(0,-1),"\\");if((c.length-p.length)%2===0)return}else{let p=Kx(r[2],"()");if(p===-2)return;if(p>-1){let v=(r[0].indexOf("!")===0?5:4)+r[1].length+p;r[2]=r[2].substring(0,p),r[0]=r[0].substring(0,v).trim(),r[3]=""}}let f=ms(r[0].slice(0,-1),"\\");if((r[0].length-f.length)%2===0)return;let h=r[2],m="";if(this.options.pedantic){let p=this.rules.other.pedanticHrefTitle.exec(h);p&&(h=p[1],m=p[3])}else m=r[3]?r[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)),Xx(r,{href:h&&h.replace(this.rules.inline.anyPunctuation,"$1"),title:m&&m.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(a,r){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&&Vx(a,o[1],c,this.rules))return;let f=r[rc(o[2]||o[1])];if(!f){let h=o[0].charAt(0);return{type:"text",raw:h,text:h}}return Xx(o,f,o[0],this.lexer,this.rules)}}emStrong(a,r,o=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||!c[1]&&!c[2]&&!c[3]&&!c[4])return;let f=c[0][0],h=o===f,m=r.length-a.length,p=m;for(;!this.options.pedantic&&p>0&&r[p-1]===f;)p--;let v=[...r.slice(Math.max(0,p-2),p)].at(-1)??"",x=v==="*"||v==="_"||!!this.rules.inline.punctuation.exec(v);p<m&&(o=v);let b=p<m?x:!!this.rules.inline.punctuation.exec(o);if(c[4]&&o.match(this.rules.other.unicodeAlphaNumeric))return;let N=c[1]||c[3]||"";if(!N||!o||b){let w=[...c[0]].length-1,T,E,A=w,z=0,U=m-p+w,$=!this.options.pedantic&&!!v.trim()&&(!!N||f==="*"&&!x);if(f!=="*"&&f!=="_")return;let j=f==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,C=s2(this,r,f),S=r.length-a.length+w;if(C<S)return;r=r.slice(-1*a.length+w);let O=C-S;for(j.lastIndex=0;(c=j.exec(r))!==null&&!(c.index>O);){if(T=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!T)continue;if(E=[...T].length,c[3]||c[4]){A+=E;continue}else if(c[5]||c[6]||$){if(h&&(c[5]||c[6]))break;if(U%3&&!((U+E)%3)){z+=E;continue}}if(A-=E,A>0)continue;E=Math.min(E,E+A+z);let R=[...c[0]][0].length,q=a.slice(0,w+c.index+R+E);if(Math.min(w,E)%2){let W=q.slice(1,-1);return{type:"em",raw:q,text:W,tokens:this.lexer.inlineTokens(W)}}let F=q.slice(2,-2);return{type:"strong",raw:q,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(a){let r=this.rules.inline.code.exec(a);if(r){let o=r[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(o),f=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return c&&f&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:r[0],text:o}}}br(a){let r=this.rules.inline.br.exec(a);if(r)return{type:"br",raw:r[0]}}del(a,r,o=""){let c=this.rules.inline.delLDelim.exec(a);if(c&&(!c[1]||!o||this.rules.inline.punctuation.exec(o))){let f=[...c[0]].length-1,h,m,p=f,v=this.rules.inline.delRDelim,x=l2(this,r),b=r.length-a.length+f;if(x<b)return;r=r.slice(-1*a.length+f);let N=x-b;for(v.lastIndex=0;(c=v.exec(r))!==null&&!(c.index>N);){if(h=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!h||(m=[...h].length,m!==f))continue;if(c[3]||c[4]){p+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p);let w=[...c[0]][0].length,T=a.slice(0,f+c.index+w+m),E=T.slice(f,-f);return{type:"del",raw:T,text:E,tokens:this.lexer.inlineTokens(E)}}}}autolink(a){let r=this.rules.inline.autolink.exec(a);if(r){let o,c;return r[2]==="@"?(o=r[1],c="mailto:"+o):(o=r[1],c=o),{type:"link",raw:r[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}url(a){let r;if(r=this.rules.inline.url.exec(a)){let o,c;if(r[2]==="@")o=r[0],c="mailto:"+o;else{let f;do f=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(f!==r[0]);o=r[0],r[1]==="www."?c="http://"+r[0]:c=r[0]}return{type:"link",raw:r[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(a){let r=this.rules.inline.text.exec(a);if(r){let o=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:o?r[0]:e2(r[0]),escaped:o}}}},_n=class zf{tokens;options;state;inlineQueue;tokenizer;constructor(a){this.tokens=[],this.tokens.links=Object.create(null),this.options=a||Ol,this.options.tokenizer=this.options.tokenizer||new Ma,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 r={other:ht,block:Io.normal,inline:Ui.normal};this.options.pedantic?(r.block=Io.pedantic,r.inline=Ui.pedantic):this.options.gfm&&(r.block=Io.gfm,this.options.breaks?r.inline=Ui.breaks:r.inline=Ui.gfm),this.tokenizer.rules=r}static get rules(){return{block:Io,inline:Ui}}static lex(a,r){return new zf(r).lex(a)}static lexInline(a,r){return new zf(r).inlineTokens(a)}lex(a){a=a.replace(ht.carriageReturn,`
|
|
141
|
+
`),this.blockTokens(a,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let o=this.inlineQueue[r];this.state.inRawBlock=!1,this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(a,r=[],o=!1){this.tokenizer.lexer=this,this.options.pedantic&&(a=a.replace(ht.tabCharGlobal," ").replace(ht.spaceLine,""));let c=1/0;for(;a;){if(a.length<c)c=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}let f;if(this.options.extensions?.block?.some(m=>(f=m.call({lexer:this},a,r))?(a=a.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(a)){a=a.substring(f.raw.length);let m=r.at(-1);f.raw.length===1&&m!==void 0?m.raw+=`
|
|
142
|
+
`:r.push(f);continue}if(f=this.tokenizer.code(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
143
|
+
`)?"":`
|
|
144
|
+
`)+f.raw,m.text+=`
|
|
145
|
+
`+f.text,this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(f=this.tokenizer.fences(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.heading(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.hr(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.blockquote(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.list(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.html(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.def(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
146
|
+
`)?"":`
|
|
147
|
+
`)+f.raw,m.text+=`
|
|
148
|
+
`+f.raw,this.inlineQueue.at(-1).src=m.text):(this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title}),r.push(f));continue}if(f=this.tokenizer.table(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.lheading(a)){a=a.substring(f.raw.length),r.push(f);continue}let h=a;if(this.options.extensions?.startBlock){let m=1/0,p=a.slice(1),v;this.options.extensions.startBlock.forEach(x=>{v=x.call({lexer:this},p),typeof v=="number"&&v>=0&&(m=Math.min(m,v))}),m<1/0&&m>=0&&(h=a.substring(0,m+1))}if(this.state.top&&(f=this.tokenizer.paragraph(h))){let m=r.at(-1);o&&m?.type==="paragraph"?(m.raw+=(m.raw.endsWith(`
|
|
149
|
+
`)?"":`
|
|
150
|
+
`)+f.raw,m.text+=`
|
|
151
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f),o=h.length!==a.length,a=a.substring(f.raw.length);continue}if(f=this.tokenizer.text(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
152
|
+
`)?"":`
|
|
153
|
+
`)+f.raw,m.text+=`
|
|
154
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return this.state.top=!0,r}inline(a,r=[]){return this.inlineQueue.push({src:a,tokens:r}),r}linkInText(a){if(!a.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let o of a.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.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],f=c.lastIndexOf("[");if(!(c.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,rc(c.slice(f+1,-1))))&&!(f>1&&this.linkInText(c.slice(1,f-1))))return!0}return!1}inlineTokens(a,r=[]){this.tokenizer.lexer=this;let o=this.state.linkParenPossible;this.state.linkParenPossible=o&&a.includes(")");try{return this.#e(a,r)}finally{this.state.linkParenPossible=o}}#e(a,r){let o=a.includes("*")||a.includes("_")||a.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Ma.prototype.emStrong||this.tokenizer.del!==Ma.prototype.del?this.#n(a):a;t2(this.tokenizer,o);try{return this.#t(a,o,r)}finally{n2(this.tokenizer)}}#t(a,r,o){let c=!1,f="",h=1/0;for(;a;){if(a.length<h)h=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}c||(f=""),c=!1;let m;if(this.options.extensions?.inline?.some(v=>(m=v.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 v=o.at(-1);m.type==="text"&&v?.type==="text"?(v.raw+=m.raw,v.text+=m.text):o.push(m);continue}if(m=this.tokenizer.emStrong(a,r,f)){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,r,f)){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 v=1/0,x=a.slice(1),b;this.options.extensions.startInline.forEach(N=>{b=N.call({lexer:this},x),typeof b=="number"&&b>=0&&(v=Math.min(v,b))}),v<1/0&&v>=0&&(p=a.substring(0,v+1))}if(m=this.tokenizer.inlineText(p)){a=a.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(f=m.raw.slice(-1)),c=!0;let v=o.at(-1);v?.type==="text"?(v.raw+=m.raw,v.text+=m.text):o.push(m);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return o}#n(a){let r=a;if(this.tokens.links&&a.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,c=f=>{let h=f.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,rc(f.slice(h+1,-1))))return f;if(h>1&&f.charAt(0)!=="!"){let m=f.slice(1,h-1);if(this.linkInText(m))return"["+m.replace(o,c)+"]["+"a".repeat(f.length-h-2)+"]"}return"["+"a".repeat(f.length-2)+"]"};r=r.replace(o,c)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(o,c,f)=>f?"+".repeat(o.length):c?c+o.slice(c.length,-c.length).replace(/`/g,"+")+c:o),r=r.replace(this.tokenizer.rules.inline.blockSkip,(o,c,f)=>{let h=f?f.length:0;return o.slice(0,h)+"["+"a".repeat(o.length-h-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(a){let r="Infinite loop on byte: "+a;if(this.options.silent)console.error(r);else throw new Error(r)}},oc=class{options;parser;constructor(n){this.options=n||Ol}space(n){return""}code({text:n,lang:a,escaped:r}){let o=(a||"").match(ht.notSpaceStart)?.[0],c=n?n.replace(ht.endingNewline,"")+`
|
|
155
|
+
`:"";return o?'<pre><code class="language-'+rn(o)+'">'+(r?c:rn(c,!0))+`</code></pre>
|
|
156
|
+
`:"<pre><code>"+(r?c:rn(c,!0))+`</code></pre>
|
|
157
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
158
|
+
${this.parser.parse(n)}</blockquote>
|
|
159
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:a}){return`<h${a}>${this.parser.parseInline(n)}</h${a}>
|
|
160
|
+
`}hr(n){return`<hr>
|
|
161
|
+
`}list(n){let a=n.ordered,r=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",f=a&&r!==1?' start="'+r+'"':"";return"<"+c+f+`>
|
|
162
|
+
`+o+"</"+c+`>
|
|
163
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
164
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
165
|
+
`}table(n){let a="",r="";for(let c=0;c<n.header.length;c++)r+=this.tablecell(n.header[c]);a+=this.tablerow({text:r});let o="";for(let c=0;c<n.rows.length;c++){let f=n.rows[c];r="";for(let h=0;h<f.length;h++)r+=this.tablecell(f[h]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
166
|
+
<thead>
|
|
167
|
+
`+a+`</thead>
|
|
168
|
+
`+o+`</table>
|
|
169
|
+
`}tablerow({text:n}){return`<tr>
|
|
170
|
+
${n}</tr>
|
|
171
|
+
`}tablecell(n){let a=this.parser.parseInline(n.tokens),r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+a+`</${r}>
|
|
172
|
+
`}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>${rn(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:a,text:r,tokens:o,autolink:c}){let f=c?rn(r,!0):this.parser.parseInline(o),h=Ix(n);if(h===null)return f;n=rn(h,c);let m='<a href="'+n+'"';return a&&(m+=' title="'+rn(a)+'"'),m+=">"+f+"</a>",m}image({href:n,title:a,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let c=Ix(n);if(c===null)return rn(r);n=c;let f=`<img src="${rn(n)}" alt="${rn(r)}"`;return a&&(f+=` title="${rn(a)}"`),f+=">",f}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:rn(n.text)}},hh=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}},Rn=class Mf{options;renderer;textRenderer;constructor(a){this.options=a||Ol,this.options.renderer=this.options.renderer||new oc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hh,this.textRenderer.parser=this}static parse(a,r){return new Mf(r).parse(a)}static parseInline(a,r){return new Mf(r).parseInline(a)}parse(a){this.renderer.parser=this;let r="";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)){r+=m||"";continue}}let f=c;switch(f.type){case"space":{r+=this.renderer.space(f);break}case"hr":{r+=this.renderer.hr(f);break}case"heading":{r+=this.renderer.heading(f);break}case"code":{r+=this.renderer.code(f);break}case"table":{r+=this.renderer.table(f);break}case"blockquote":{r+=this.renderer.blockquote(f);break}case"list":{r+=this.renderer.list(f);break}case"checkbox":{r+=this.renderer.checkbox(f);break}case"html":{r+=this.renderer.html(f);break}case"def":{r+=this.renderer.def(f);break}case"paragraph":{r+=this.renderer.paragraph(f);break}case"text":{r+=this.renderer.text(f);break}default:{let h='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}parseInline(a,r=this.renderer){this.renderer.parser=this;let o="";for(let c=0;c<a.length;c++){let f=a[c];if(this.options.extensions?.renderers?.[f.type]){let m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}let h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"checkbox":{o+=r.checkbox(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.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}},Li=class{options;block;constructor(n){this.options=n||Ol}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?Rn.parse:Rn.parseInline}};function Xs(n,a){if(Array.isArray(a))for(let r=0;r<a.length;r++)n.push(a[r]);else n.push(a)}var N0=class{defaults=ah();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Rn;Renderer=oc;TextRenderer=hh;Lexer=_n;Tokenizer=Ma;Hooks=Li;constructor(...n){this.use(...n)}walkTokens(n,a){let r=[];for(let o of n)switch(Xs(r,a.call(this,o)),o.type){case"table":{let c=o;for(let f of c.header)Xs(r,this.walkTokens(f.tokens,a));for(let f of c.rows)for(let h of f)Xs(r,this.walkTokens(h.tokens,a));break}case"list":{let c=o;Xs(r,this.walkTokens(c.items,a));break}default:{let c=o;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(f=>{let h=c[f].flat(1/0);Xs(r,this.walkTokens(h,a))}):c.tokens&&Xs(r,this.walkTokens(c.tokens,a))}}return r}use(...n){let a=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return n.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let f=a.renderers[c.name];f?a.renderers[c.name]=function(...h){let m=c.renderer.apply(this,h);return m===!1&&(m=f.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 f=a[c.level];f?f.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),r.renderer){let c=this.defaults.renderer||new oc(this.defaults);for(let f in r.renderer){if(!(f in c))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;let h=f,m=r.renderer[h],p=c[h];c[h]=(...v)=>{let x=m.apply(c,v);return x===!1&&(x=p.apply(c,v)),x===!1?"":x??""}}o.renderer=c}if(r.tokenizer){let c=this.defaults.tokenizer||new Ma(this.defaults);for(let f in r.tokenizer){if(!(f in c))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;let h=f,m=r.tokenizer[h],p=c[h];c[h]=(...v)=>{let x=m.apply(c,v);return x===!1&&(x=p.apply(c,v)),x}}o.tokenizer=c}if(r.hooks){let c=this.defaults.hooks||new Li;for(let f in r.hooks){if(!(f in c))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;let h=f,m=r.hooks[h],p=c[h];Li.passThroughHooks.has(f)?c[h]=v=>{if(c.options.async&&Li.passThroughHooksRespectAsync.has(f))return(async()=>{let b=await m.call(c,v);return p.call(c,b)})();let x=m.call(c,v);return p.call(c,x)}:c[h]=(...v)=>{if(c.options.async)return(async()=>{let b=await m.apply(c,v);return b===!1&&(b=await p.apply(c,v)),b})();let x=m.apply(c,v);return x===!1&&(x=p.apply(c,v)),x}}o.hooks=c}if(r.walkTokens){let c=this.defaults.walkTokens,f=r.walkTokens;o.walkTokens=function(h){let m=[];return Xs(m,f.call(this,h)),c&&Xs(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 Rn.parse(n,a??this.defaults)}parseMarkdown(n){return(a,r)=>{let o={...r},c={...this.defaults,...o},f=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&o.async===!1)return f(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 f(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return f(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 v=await(c.hooks?await c.hooks.provideParser(n):n?Rn.parse:Rn.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(v):v})().catch(f);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?Rn.parse:Rn.parseInline)(h,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(h){return f(h)}}}onError(n,a){return r=>{if(r.message+=`
|
|
173
|
+
Please report this to https://github.com/markedjs/marked.`,n){let o="<p>An error occurred:</p><pre>"+rn(r.message+"",!0)+"</pre>";return a?Promise.resolve(o):o}if(a)return Promise.reject(r);throw r}}},Al=new N0;function Je(n,a){return Al.parse(n,a)}Je.options=Je.setOptions=function(n){return Al.setOptions(n),Je.defaults=Al.defaults,m0(Je.defaults),Je};Je.getDefaults=ah;Je.defaults=Ol;function i2(...n){return Al.use(...n),Je.defaults=Al.defaults,m0(Je.defaults),Je}Je.use=i2;Je.walkTokens=function(n,a){return Al.walkTokens(n,a)};Je.parseInline=Al.parseInline;Je.Parser=Rn;Je.parser=Rn.parse;Je.Renderer=oc;Je.TextRenderer=hh;Je.Lexer=_n;Je.lexer=_n.lex;Je.Tokenizer=Ma;Je.Hooks=Li;Je.parse=Je;Je.options;Je.setOptions;Je.walkTokens;Je.parseInline;Rn.parse;_n.lex;const Un="\\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}",$a=new RegExp(`[${Un}]`,"u"),r2=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${Un}])`,"u");function S0(n,a,r){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${n}(\\*+)(?=[\\s]|$)|${r}(\\*+)(?!\\*)(?=${a}|$)|(?!\\*)${a}(\\*+)(?=${r})|[\\s](\\*+)(?!\\*)(?=${n})|(?!\\*)${n}(\\*+)(?!\\*)(?=${n})|${r}(\\*+)(?=${r})`,"gu")}function o2(n,a,r){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${n}(_+)(?=[\\s]|$)|${r}(_+)(?!_)(?=${a}|$)|(?!_)${a}(_+)(?=${r})|[\\s](_+)(?!_)(?=${n})|(?!_)${n}(_+)(?!_)(?=${n})`,"gu")}function c2(n,a,r){return new RegExp(`^[^~]+(?=[^~])|(?!~)${n}(~~?)(?=[\\s]|$)|${r}(~~?)(?!~)(?=${a}|$)|(?!~)${a}(~~?)(?=${r})|[\\s](~~?)(?!~)(?=${n})|(?!~)${n}(~~?)(?!~)(?=${n})|${r}(~~?)(?=${r})`,"gu")}const T0=`[\\p{P}\\p{S}${Un}]`,C0=`[\\s\\p{P}\\p{S}${Un}]`,E0=`[^\\s\\p{P}\\p{S}${Un}]`,u2=`(?![*_])[\\p{P}\\p{S}${Un}]`,d2=`(?![*_])[\\s\\p{P}\\p{S}${Un}]`,f2=`(?:[^\\s\\p{P}\\p{S}${Un}]|[*_])`,h2=`(?!~)[\\p{P}\\p{S}${Un}]`,m2=`(?!~)[\\s\\p{P}\\p{S}${Un}]`,p2=`(?:[^\\s\\p{P}\\p{S}${Un}]|~)`,g2=S0(T0,C0,E0),v2=S0(h2,m2,p2),x2=o2(T0,C0,E0),Zx=c2(u2,d2,f2);function Qx(n,a,r){let o=r2.test(n);if(!o&&n){const c=a.length-r.length;if(c>=1){let f=c-1,h=a.charCodeAt(f);if(h>=65024&&h<=65038&&f>=1&&(f--,h=a.charCodeAt(f)),(h&64512)===56320&&f>=1){const m=a.codePointAt(f-1);m!==void 0&&m>65535&&(m>=917760&&m<=917999?o=!0:o=$a.test(String.fromCodePoint(m)))}else o=$a.test(String.fromCharCode(h))}}return o}function Jx(n,a){if(!(n[1]||n[2]||n[3]||n[4]))return!1;const r=String.fromCodePoint(n[0].codePointAt(0)),o=n.index+n[0].length,c=o<a.length?String.fromCodePoint(a.codePointAt(o)):"";return $a.test(r)||$a.test(c)}function mh(n){return n.length>=5}function b2(n){return!!(n[1]||n[2]||n[3]||n[4])}function y2(n){return mh(n)?!!n[4]:!!n[3]}function k2(n){return mh(n)?n[1]||n[3]||"":n[1]||n[2]||""}function Go(n){let a=n.length;const r=a-1;for(let o=0;o<r;){const c=n.charCodeAt(o++);if(c<55296||56320<=c)continue;const f=n.charCodeAt(o);f<56320||57344<=f||(o++,a--)}return a}function j2(){return{tokenizer:{emStrong(n,a,r=""){const{rules:o}=this,c=o.inline.emStrongLDelim.exec(n);if(!c)return!1;const f=mh(c);if(f&&!b2(c))return;if(y2(c)&&r.match(o.other.unicodeAlphaNumeric))return!1;const h=k2(c),m=Qx(r,a,n);if(!h||!r||o.inline.punctuation.exec(r)||m||$a.test(h)){const p=Go(c[0])-1;let v,x,b=p,N=0;const w=f&&r===c[0][0],T=o.inline.emStrongRDelimAst.source.includes("(?!~)");let E;c[0][0]==="*"?E=T?v2:g2:E=x2,E.lastIndex=0;const A=a.slice(-1*n.length+p);let z;for(;(z=E.exec(A))!=null;){if(v=z[1]||z[2]||z[3]||z[4]||z[5]||z[6],!v)continue;x=Go(v);const U=Jx(z,A),$=!!(z[3]||z[4]),j=!!(z[5]||z[6]);if($&&!U){b+=x;continue}if(j||U){if(p%3&&!((p+x)%3)){N+=x;continue}if(w&&j)break}if(b-=x,b>0)continue;x=Math.min(x,x+b+N);const C=z[0].codePointAt(0)>65535?2:1,S=n.slice(0,p+z.index+C+x);if(Math.min(p,x)%2){const R=S.slice(1,-1);return{type:"em",raw:S,text:R,tokens:this.lexer.inlineTokens(R)}}const O=S.slice(2,-2);return{type:"strong",raw:S,text:O,tokens:this.lexer.inlineTokens(O)}}}},del(n,a,r=""){const{rules:o}=this,c=o.inline.delLDelim.exec(n);if(!c)return!1;const f=c[1]||"",h=Qx(r,a,n);if(!f||!r||o.inline.punctuation.exec(r)||h||$a.test(f)){const m=Go(c[0])-1;let p,v,x=m;Zx.lastIndex=0;const b=a.slice(-1*n.length+m);let N;for(;(N=Zx.exec(b))!=null;){if(p=N[1]||N[2]||N[3]||N[4]||N[5]||N[6],!p||(v=Go(p),v!==m))continue;const w=Jx(N,b);if((N[3]||N[4])&&!w){x+=v;continue}if(x-=v,x>0)continue;v=Math.min(v,v+x);const T=N[0].codePointAt(0)>65535?2:1,E=n.slice(0,m+N.index+T+v),A=E.slice(m,-m);return{type:"del",raw:E,text:A,tokens:this.lexer.inlineTokens(A)}}}}}}}function Gi(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let Of,w2;function N2(){return w2??=sr(()=>import("./math-weKGDUmL.js"),__vite__mapDeps([0,1])).then(n=>{Of=n.default})}function S2(n){let a=!1;return Ji.walkTokens(Ji.lexer(n),r=>{(r.type==="inlineMath"||r.type==="displayMath")&&(a=!0)}),a}function Px(n,a,r){if(!Of)return Gi(r);try{return Of.renderToString(n,{displayMode:a,throwOnError:!0,trust:!1})}catch{return Gi(r)}}const Ji=new N0({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">${Px(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 Px(String(n.text),!1,n.raw)}}],renderer:{html(n){return Gi(n.text??"")},code(n){const a=n.lang?.trim().split(/\s+/)[0]??"";return`<div class="code-block">${a?`<div class="code-head">${Gi(a)}</div>`:""}<button type="button" class="code-copy" aria-label="复制代码" title="复制代码">${ac("copy",15)}</button><pre><code>${Gi(n.text)}
|
|
174
|
+
</code></pre></div>`}}});Ji.use(j2());const T2=/^(https?:|mailto:|\/|#|\.)/i;function C2(n){return Ji.parse(n,{async:!1,gfm:!0,breaks:!0}).replace(/<a href="([^"]*)"/g,(r,o)=>Rb(o)?`<a class="knowledge-citation" href="${o}"`:T2.test(o.trim())?`<a target="_blank" rel="noreferrer" href="${o}"`:"<a").replace(/(<a class="knowledge-citation"[^>]*>)/g,`$1${ac("doc",13)}`).replace(/[((]\s*(<a class="knowledge-citation"[^>]*>[\s\S]*?<\/a>)\s*[))]/g,"$1")}function E2(n){const a=[];for(const o of Ji.lexer(n,{gfm:!0})){const c=o.type==="table",f=a.at(-1);f&&!f.table&&!c?f.md+=o.raw:a.push({table:c,md:o.raw})}const r=a.filter(o=>o.table||o.md.trim());return r.length?r:[{table:!1,md:n}]}const _f=/[\p{L}\p{N}]/u;function A2(n){const a=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s*[#>\-*]+\s*/gm,"");return Array.from(a).filter(r=>_f.test(r)).join("")}function z2(n,a){const r=[];let o="";for(const v of n)for(let x=0;x<v.data.length;){const b=String.fromCodePoint(v.data.codePointAt(x));if(_f.test(b)){o+=b;for(let N=0;N<b.length;N++)r.push({node:v,offset:x,end:x+b.length})}x+=b.length}const c=Array.from(a).filter(v=>_f.test(v)).join("");if(!c)return null;let f=o.indexOf(c),h=f+c.length;if(f<0){const v=Array.from(c),x=v.slice(0,40).join(""),b=v.slice(-40).join("");if(f=o.indexOf(x),f<0)return null;const N=o.lastIndexOf(b,f+c.length*2-b.length);h=N>=f+x.length?N+b.length:f+x.length}const m=r[f],p=r[h-1];return{start:{node:m.node,offset:m.offset},end:{node:p.node,offset:p.end}}}async function M2(n,a){try{const r=await Ww(n,a);Tt(r.entry.path,r.entry.name,{find:r.chunk?A2(r.chunk.text):void 0,page:r.chunk?.page})}catch(r){La(r instanceof Ue&&r.status===404?"这份资料已经删除":`无法打开资料:${r instanceof Error?r.message:String(r)}`)}}function Ua({text:n,className:a,streaming:r,onMathRendered:o}){const[c,f]=y.useState(0);return y.useEffect(()=>{let h=!0;return S2(n)&&N2().then(()=>{h&&f(m=>m+1)}).catch(()=>{}),()=>{h=!1}},[n]),y.useEffect(()=>{c&&o?.()},[c,o]),l.jsx("div",{className:a,onClick:h=>{const m=h.target.closest("a.knowledge-citation"),p=m&&Rb(m.getAttribute("href")??"");if(p){h.preventDefault(),h.stopPropagation(),M2(p.entryId,p.chunk);return}const v=h.target.closest(".code-copy");if(!v)return;h.stopPropagation();const x=v.closest(".code-block")?.querySelector("code")?.textContent??"";lh(x.endsWith(`
|
|
175
|
+
`)?x.slice(0,-1):x).then(b=>{if(!b){La("复制失败:浏览器不允许写入剪贴板");return}v.innerHTML=ac("check",15),v.setAttribute("aria-label","已复制"),window.setTimeout(()=>{v.innerHTML=ac("copy",15),v.setAttribute("aria-label","复制代码")},1500)})},dangerouslySetInnerHTML:{__html:C2(n)+(r?'<span class="cur"></span>':"")}})}const O2={".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 _2(n){const a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function R2(n){return O2[_2(n)]}function D2(n,a){return Array.from({length:a},(r,o)=>{const c=Math.floor(o*n.length/a),f=Math.floor((o+1)*n.length/a);let h=0;for(let m=c;m<f;m++)h=Math.max(h,Math.abs(n[m]));return h})}let Na=null;function $2({path:n,name:a,fallback:r,itemId:o}){const c=y.useRef(null),[f,h]=y.useState(null),[m,p]=y.useState(0),[v,x]=y.useState(0),[b,N]=y.useState(!0),[w,T]=y.useState(1);y.useEffect(()=>{const z=new AbortController;let U;return(async()=>{try{const $=await fetch(Ut(n),{signal:z.signal});if(!$.ok||Number($.headers.get("content-length"))>20*1024*1024)return;const j=$.body?.getReader();if(!j)return;const C=[];let S=0;for(;;){const{done:F,value:W}=await j.read();if(F)break;if(S+=W.byteLength,S>20*1024*1024){await j.cancel();return}C.push(W)}const O=new Uint8Array(S);let R=0;for(const F of C)O.set(F,R),R+=F.byteLength;U=new AudioContext;const q=await U.decodeAudioData(O.buffer);z.signal.aborted||h(D2(q.getChannelData(0),50))}catch{}finally{U&&U.close()}})(),()=>{z.abort(),Na===c.current&&(Na=null)}},[n]);const E=v?Math.min(1,m/v):0,A=z=>`${Math.floor(z/60)}:${String(Math.floor(z%60)).padStart(2,"0")}`;return l.jsxs("div",{className:"media-audio","data-item-id":o,children:[l.jsx("audio",{ref:c,src:Ut(n),preload:"metadata",onError:r,onPlay:z=>{Na&&Na!==z.currentTarget&&Na.pause(),Na=z.currentTarget,N(!1)},onPause:()=>N(!0),onTimeUpdate:z=>p(z.currentTarget.currentTime),onLoadedMetadata:z=>x(z.currentTarget.duration)}),l.jsx("button",{className:"audio-play","aria-label":b?"播放":"暂停",onClick:()=>{const z=c.current;z&&(z.paused?z.play().catch(r):z.pause())},children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",children:b?l.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"}):l.jsx("path",{d:"M7 5h3.5v14H7zM13.5 5H17v14h-3.5z"})})}),l.jsxs("div",{className:"audio-main",children:[l.jsx("button",{className:"audio-name",onClick:()=>Tt(n,a),children:a}),l.jsxs("div",{className:"audio-track",children:[f?l.jsx("div",{className:"audio-bars","aria-hidden":"true",children:f.map((z,U)=>l.jsx("i",{className:U/f.length<E?"played":"",style:{height:`${Math.max(12,z*100)}%`}},U))}):l.jsx("div",{className:"audio-line",children:l.jsx("i",{style:{width:`${E*100}%`}})}),l.jsx("input",{type:"range","aria-label":"播放进度",min:0,max:v||0,step:"0.01",value:Math.min(m,v||0),onChange:z=>{c.current&&(c.current.currentTime=Number(z.target.value))}})]})]}),l.jsx("span",{className:"audio-time",children:A(v||0)}),l.jsxs("button",{className:"audio-rate",onClick:()=>{const z=w===1?1.5:w===1.5?2:1;T(z),c.current&&(c.current.playbackRate=z)},children:[w,"×"]})]})}function Fx({path:n,name:a,fallback:r,itemId:o}){const[c,f]=y.useState(!1);if(c)return r;const h=R2(n);return h==="audio"?l.jsx($2,{path:n,name:a,fallback:()=>f(!0),itemId:o}):h==="video"?l.jsxs("div",{className:"media-video","data-item-id":o,children:[l.jsx("video",{controls:!0,playsInline:!0,preload:"metadata",src:Ut(n),onError:()=>f(!0)}),l.jsx("button",{onClick:()=>Tt(n,a),children:a})]}):r}const Sa=13,U2=2.7,Wx=700;function L2(n){const a=/^(\d{2,5})x(\d{2,5})$/.exec(n??""),r=a?Number(a[1])/Number(a[2]):1;return Math.min(16/9,Math.max(9/16,r))}function H2(n){return Math.min(.96,1-Math.exp(-n/30))}function B2(n){return n<.2?"正在构思":n<.55?"正在勾勒草图":n<.85?"正在上色":"正在润色细节"}function q2(){return[[.22,.6,.3],[.18,.5,.7]].map(([n,a,r])=>{const o=.3+Math.random()*.4;return{x:r,y:o,tx:r,ty:o,next:0,r:n,gain:a}})}function I2(n,a){for(let r=0;r<6;r++)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 hf=[3500,7500];function Y2(n,a,r,o){const c=(a-n.at)/n.dur;if(c<0||c>=1)return 0;const f=Math.hypot(r,o);if(n.kind==="ring"){const h=f-c*.85;return .75*(1-c)*Math.exp(-(h*h)/.008)}return .7*Math.sin(Math.PI*c)*Math.exp(-(f*f)/.03)}function G2({status:n,prompt:a,size:r,path:o,error:c,startedAt:f,fresh:h,itemId:m}){const p=y.useRef(null),[v,x]=y.useState(n==="done"?"shown":"live"),[b,N]=y.useState(()=>Date.now()),w=Date.parse(f)||Date.now(),T=y.useRef(v);T.current=v,y.useEffect(()=>{if(n!=="pending")return;const z=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(z)},[n]),y.useEffect(()=>{if(v!=="reveal")return;const z=setTimeout(()=>x("shown"),Wx+200);return()=>clearTimeout(z)},[v]),y.useEffect(()=>{const z=p.current;if(!z||v==="shown")return;const U=z.getContext("2d");if(!U)return;const $=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let j=0,C=!0,S=0,O=[];const R=q2();let q=[],F=0,W=0;const Ee=new IntersectionObserver(([we])=>{C=we.isIntersecting,C&&!j&&(j=requestAnimationFrame(he))});Ee.observe(z);function he(we){j=0;const Oe=Math.min(2,window.devicePixelRatio||1),{width:se,height:ve}=z.getBoundingClientRect();(z.width!==Math.round(se*Oe)||z.height!==Math.round(ve*Oe))&&(z.width=Math.round(se*Oe),z.height=Math.round(ve*Oe)),U.setTransform(Oe,0,0,Oe,0,0),U.clearRect(0,0,se,ve);const me=Math.max(1,Math.floor(se/Sa)),Me=Math.max(1,Math.floor(ve/Sa)),Ae=(se-(me-1)*Sa)/2,xt=(ve-(Me-1)*Sa)/2;O.length!==me*Me&&(O=Array.from({length:me*Me},()=>Math.random()));const Mt=document.documentElement.classList.contains("dark");T.current==="reveal"&&!S&&(S=we);const Ct=S?Math.min(1,(we-S)/Wx):0,D=n==="pending"&&!$,J=W?Math.min(.1,(we-W)/1e3):0;if(W=we,D){if(F||(F=we+1200+Math.random()*1500),we>F){const ae=Math.random()<.5;q.push({kind:ae?"ring":"swell",x:.2+Math.random()*.6,y:.2+Math.random()*.6,at:we,dur:ae?2600:1800}),F=we+hf[0]+Math.random()*(hf[1]-hf[0])}q=q.filter(ae=>we-ae.at<ae.dur);for(const[ae,le]of R.entries()){we>le.next&&(I2(le,R[1-ae]),le.next=we+3e3+Math.random()*2500);const oe=1-Math.exp(-J*.7);le.x+=(le.tx-le.x)*oe,le.y+=(le.ty-le.y)*oe}}U.fillStyle=Mt?"rgb(232,232,230)":"rgb(38,38,36)";const te=se/ve,re=we/1e3;for(let ae=0;ae<Me;ae++)for(let le=0;le<me;le++){const oe=O[ae*me+le],xe=me>1?le/(me-1):.5,nt=Me>1?ae/(Me-1):.5,Sn=Math.min(1,Math.min(xe,1-xe,nt,1-nt)/.3);let Ln=.12;if(n!=="failed"){for(const Ot of R){const Tn=(xe-Ot.x)*te,Zs=nt-Ot.y;Ln+=Ot.gain*Math.exp(-(Tn*Tn+Zs*Zs)/(Ot.r*Ot.r))}for(const Ot of q)Ln+=Y2(Ot,we,(xe-Ot.x)*te,nt-Ot.y)}const cn=D?Math.sin(re*1.3+oe*6.28)*.03:0,rt=Math.min(1,Math.max(0,.08+.92*(.35+.65*Sn)*Math.min(1,Ln)+cn)),Ye=Math.min(1,Math.max(0,(Ct-oe*.6)/.4)),Zt=(.45+(U2-.45)*rt)*(1-Ye);Zt<.3||(U.globalAlpha=(.16+.84*rt)*(1-Ye),U.beginPath(),U.arc(Ae+le*Sa,xt+ae*Sa,Zt,0,Math.PI*2),U.fill())}U.globalAlpha=1,(T.current==="reveal"?Ct<1:D)&&C&&(j=requestAnimationFrame(he))}return j=requestAnimationFrame(he),()=>{cancelAnimationFrame(j),Ee.disconnect()}},[v,n,w]);const E=Math.max(0,Math.floor((b-w)/1e3)),A=H2(E);return l.jsxs("div",{className:`igen ${v}${n==="failed"?" failed":""}${h?" enter":""}`,"data-item-id":m,children:[v==="live"&&n!=="failed"?l.jsx("div",{className:"igen-stage",role:"status",title:a,children:B2(A)}):null,l.jsxs("div",{className:"igen-frame",style:{aspectRatio:String(L2(r))},children:[o?l.jsx("button",{className:"igen-img",onClick:()=>Tt(o),title:a,tabIndex:v==="live"?-1:0,children:l.jsx("img",{src:zl(o),alt:a,onLoad:()=>{T.current==="live"&&x("reveal")}})}):null,v==="shown"?null:l.jsx("canvas",{ref:p,"aria-hidden":"true"}),v==="live"&&n==="pending"?l.jsxs("span",{className:"igen-pct",children:[Math.floor(A*100),"%"]}):null]}),n==="failed"&&v==="live"?l.jsxs("div",{className:"igen-cap",role:"status",title:a,children:[l.jsx("span",{children:"没有生成出来"}),l.jsx("span",{className:"igen-note",children:c||"图片生成失败。"})]}):null]})}const K2=50,X2=110;function V2({photos:n,onOpen:a}){const[r,o]=y.useState(0),[c,f]=y.useState(0),h=y.useRef(null),m=n.length,p=Math.min(1,Math.abs(c)/X2),v=x=>{const b=h.current;h.current=null,b&&(b.moved?Math.abs(c)>K2&&o((r+1)%m):x&&a(n[r]),f(0))};return l.jsx("div",{className:`album-stack${c?" dragging":""}`,role:"group","aria-label":`${m} 张图片,左右滑动切换,点一下查看`,onPointerDown:x=>{h.current={id:x.pointerId,x:x.clientX,moved:!1},x.currentTarget.setPointerCapture(x.pointerId)},onPointerMove:x=>{const b=h.current;if(!b||b.id!==x.pointerId)return;const N=x.clientX-b.x;!b.moved&&Math.abs(N)<6||(b.moved=!0,f(N))},onPointerUp:()=>v(!0),onPointerCancel:()=>v(!1),children:n.map((x,b)=>{const N=(b-r+m)%m;if(N>2)return null;const T={"--d":N===0?0:N-p,"--dx":N===0?`${c}px`:"0px","--rot":N===0?`${c*.06}deg`:"0deg",zIndex:m-N};return l.jsx("img",{src:zl(x),alt:"",draggable:!1,style:T},x)})})}const A0=["日","一","二","三","四","五","六"];function Hi(n){return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function ph(n,a){const r=new Date(n),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime();return Math.round((o-c)/864e5)}function Kt(n,a=new Date){const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const o=ph(n,a);return o===0?`今天 ${Hi(r)}`:o===1?`昨天 ${Hi(r)}`:o===-1?`明天 ${Hi(r)}`:`${r.getMonth()+1}月${r.getDate()}日 ${Hi(r)}`}function Po(n,a=new Date){if(!n)return"";const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const o=ph(n,a);return o===0?Hi(r):o===1?"昨天":`${r.getMonth()+1}月${r.getDate()}日`}function rr(n,a=Date.now()){const r=Math.max(0,Math.round((a-new Date(n).getTime())/6e4));if(r<1)return"刚刚";if(r<60)return`${r} 分钟`;const o=Math.floor(r/60),c=r%60;return c?`${o} 小时 ${c} 分钟`:`${o} 小时`}function _l(n){const a=Math.max(0,Math.round(n/1e3));if(a<60)return`${a} 秒`;const r=Math.floor(a/60);if(r<60){const o=a%60;return o?`${r} 分 ${o} 秒`:`${r} 分钟`}return`${Math.floor(r/60)} 小时 ${r%60} 分钟`}function Rf(n){if(n<1e3)return String(n);const a=n/1e3;return`${a<10?a.toFixed(1):Math.round(a)}k`}function Z2(n){return[n.durationMs!==void 0?_l(n.durationMs):void 0,n.tools!==void 0?`${n.tools} 次操作`:void 0,n.tokens!==void 0?`${Rf(n.tokens)} token`:void 0].filter(Boolean).join(" · ")}function Ba(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 Q2(n,a=new Date){return ph(n,a)===0}function J2(n,a){return n?new Date(a).getTime()-new Date(n).getTime()>300*1e3:!1}function gh(n){const a={kind:"raw",hour:9,minute:0,weekday:5,day:1,raw:n},r=n.trim().split(/\s+/);if(r.length!==5)return a;const[o,c,f,h,m]=r;if(!/^\d+$/.test(o)||!/^\d+$/.test(c)||h!=="*")return a;const p=Number(o),v=Number(c);return p>59||v>23?a:f==="*"&&m==="*"?{...a,kind:"daily",hour:v,minute:p}:f==="*"&&/^\d$/.test(m)?{...a,kind:"weekly",hour:v,minute:p,weekday:Number(m)}:/^\d{1,2}$/.test(f)&&m==="*"?{...a,kind:"monthly",hour:v,minute:p,day:Number(f)}:a}function P2(n){const a=String(n.minute).padStart(2,"0"),r=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} ${r} * * *`}function vh(n){const a=gh(n),r=`${String(a.hour).padStart(2,"0")}:${String(a.minute).padStart(2,"0")}`;return a.kind==="daily"?`每天 ${r}`:a.kind==="weekly"?`每周${A0[a.weekday]??"?"} ${r}`:a.kind==="monthly"?`每月${a.day}日 ${r}`:n}function F2(n,a,r){const o=a-n.x,c=r-n.y;let f=n.direction;return f==="pending"&&Math.hypot(o,c)>8&&(o<-8&&Math.abs(o)>Math.abs(c)*1.5?f="horizontal":(Math.abs(c)>Math.abs(o)||o>8)&&(f="vertical")),{...n,direction:f,distance:f==="horizontal"?Math.max(0,-o):0}}function eb(n){return n.direction==="horizontal"&&n.distance>48}function W2(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 eT(n,a){return a.type==="open"?a.id:a.type==="outside"&&a.inside?n:null}const tT={memory:"mem",skill:"bulb",rule:"rule",routine:"clock",split:"split",info:"info"};function nT(){const[n,a]=y.useState(()=>window.matchMedia("(hover: none)").matches);return y.useEffect(()=>{const r=window.matchMedia("(hover: none)"),o=()=>a(r.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),n}function Df({text:n,itemId:a,menu:r=!1,close:o}){const[c,f]=y.useState(!1),h=y.useRef(0);y.useEffect(()=>()=>window.clearTimeout(h.current),[]);const m=async()=>{if(!await lh(n)){La("复制失败:浏览器不允许写入剪贴板");return}if(r){o?.();return}f(!0),window.clearTimeout(h.current),h.current=window.setTimeout(()=>f(!1),1500)};return l.jsxs("div",{className:`tools${r?" menu":""}`,children:[l.jsxs("button",{title:"回复","aria-label":"回复",onClick:()=>{nc({itemId:a,text:Tl(n).slice(0,60)}),Zi(),o?.()},children:[l.jsx(V,{name:"reply",size:16}),r?"回复":null]}),l.jsxs("button",{className:c?"copied":"",title:c?"已复制":"复制","aria-label":c?"已复制":"复制",onClick:()=>void m(),children:[l.jsx(V,{name:c?"check":"copy",size:16}),r?"复制":null]})]})}function tb({anchor:n,text:a,itemId:r,close:o}){const[c,f]=y.useState(null),h=y.useRef(null);if(y.useLayoutEffect(()=>{const x=n.current,b=x?.closest(".mmsgs, .msgs");x&&b&&f({bubble:x.getBoundingClientRect(),area:b.getBoundingClientRect()})},[n]),y.useLayoutEffect(()=>{!c||!h.current||!n.current||h.current.replaceChildren(n.current.cloneNode(!0))},[n,c]),!c)return null;const{bubble:m,area:p}=c,v=W2(m,p);return nr.createPortal(l.jsxs("div",{className:"message-popup",onPointerDown:x=>x.stopPropagation(),children:[l.jsx("div",{className:"message-shade",style:{left:p.left,top:p.top,width:p.width,height:p.height},onPointerDown:o}),l.jsx("div",{ref:h,className:"message-popup-bubble",style:{left:m.left,top:m.top,width:m.width}}),l.jsx("div",{className:"message-popup-menu",style:v,children:l.jsx(Df,{text:a,itemId:r,menu:!0,close:o})})]}),document.body)}function sT(n,a){const o=[...n.currentTarget.closest(".col")?.querySelectorAll(".message-row[data-item-id]")??[]].find(c=>c.dataset.itemId===a);o&&_b(o)}const Fo={running:{text:"进行中",icon:"spin",cls:"spin"},queued:{text:"排队中",icon:"clock",cls:""},waiting:{text:"待确认",icon:"pause",cls:""},done:{text:"已完成",icon:"check",cls:""},stuck:{text:"受阻",icon:"close",cls:""},failed:{text:"失败",icon:"close",cls:""},stopped:{text:"已停止",icon:"stop",cls:""}};function nb(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:_l(a)}function lT({job:n,round:a,fresh:r,itemId:o}){const c=je(),f=dw(n,a),h=f!==n,[m,p]=y.useState(!1),[v,x]=y.useState(""),[b,N]=y.useState(!1),w=Dn(m,200),T=Fo[f.status],E=f.status==="done",A=f.status==="running",z=!h&&(A||f.status==="waiting"),U=f.status==="stuck"||f.status==="failed",$=Xf(f),j=c.assistants.find(S=>S.id===f.assistantId),C=y.useRef(f.status);return y.useEffect(()=>{if(C.current===f.status)return;C.current=f.status,N(!0);const S=window.setTimeout(()=>N(!1),400);return()=>window.clearTimeout(S)},[f.status]),l.jsx("div",{className:`hov${r?" enter":""}`,id:h?void 0:`job-${f.id}`,"data-item-id":o,children:l.jsxs("div",{className:"b jobcard",role:"button",tabIndex:0,onClick:()=>$n(f.id,a??0),onKeyDown:S=>{S.key==="Enter"&&$n(f.id,a??0)},children:[l.jsxs("div",{className:"tt",children:[j?l.jsx("span",{className:"jav",children:l.jsx(it,{sprite:j.sprite,prop:j.prop,size:40})}):null,l.jsxs("span",{className:"jt",children:[f.routineId?l.jsx(V,{name:"clock",size:14}):null,f.title]}),l.jsxs("span",{className:`st${E?" done":""}`,children:[l.jsxs("span",{className:"stico",children:[l.jsx(V,{name:"spin",size:14,w:2,className:`spin stspin${A?"":" off"}`}),A?null:l.jsx(V,{name:T.icon,size:14,w:2,className:`stic${E?" pop":""}${b?" anim":""}`})]}),T.text,A?` · ${rr(f.startedAt??f.createdAt)}`:nb(f)?` · 用时 ${nb(f)}`:null]})]}),$?l.jsx("div",{className:`meta${U?" bad":""}`,children:$}):null,z||A?l.jsxs("div",{className:"acts",children:[z?l.jsxs("button",{className:`btn job-reply${m?" selected":""}`,"aria-pressed":m,onClick:S=>{S.stopPropagation(),p(O=>!O)},children:[l.jsx(V,{name:"edit",size:14}),"补充要求"]}):null,A?l.jsxs("button",{className:"btn job-stop",onClick:S=>{S.stopPropagation(),t0(f.id)},children:[l.jsx(V,{name:"stop",size:14}),"停止"]}):null]}):null,w.mounted?l.jsx("div",{className:`replywrap${w.leaving?" leaving":""}`,onClick:S=>S.stopPropagation(),children:l.jsx("div",{className:"replyclip",children:l.jsxs("div",{className:"replybox",children:[l.jsx("input",{autoFocus:!0,value:v,placeholder:"补充说明或更正方向",onChange:S=>x(S.target.value),onKeyDown:S=>{S.key==="Enter"&&v.trim()&&(Sf(f.id,v.trim()),x(""),p(!1)),S.key==="Escape"&&p(!1)}}),l.jsx("button",{className:"pbtn solid",onClick:()=>{v.trim()&&Sf(f.id,v.trim()),x(""),p(!1)},children:"发送"})]})})}):null]})})}function sb({draft:n}){const a=je(),r=n.status==="created"&&n.createdAssistantId,o=r?a.assistants.find(h=>h.id===n.createdAssistantId):void 0,c=o?.prop??n.prop,f=!!r&&!o;return l.jsxs("div",{className:"draft",children:[l.jsxs("div",{className:"top",children:[l.jsx(it,{sprite:o?.sprite??n.sprite,prop:c,size:46}),l.jsxs("div",{children:[l.jsx("div",{className:"dn",children:n.name}),l.jsx("div",{className:"ds",children:n.status==="created"?"新助手 · 已创建":"新助手 · 草稿"})]})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"职责"}),l.jsx("span",{children:n.dutyLong})]}),l.jsx("div",{className:`expand${r?"":" open"}`,inert:!!r,children:l.jsxs("div",{children:[l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"定时任务"}),l.jsx("span",{className:n.routinesText?void 0:"none",children:n.routinesText||"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"执行前确认"}),l.jsx("span",{className:n.askFirst.length?void 0:"none",children:n.askFirst.join(" · ")||"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"补充说明"}),n.instructions.length?l.jsx("span",{children:n.instructions.map((h,m)=>l.jsx("span",{className:"line",children:h},m))}):l.jsx("span",{className:"none",children:"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"迁移"}),l.jsxs("span",{children:[n.carry.conversations," 段对话"]})]})]})}),l.jsxs("div",{className:"acts swap",style:{marginTop:12},children:[l.jsxs("div",{className:r?"off":void 0,children:[l.jsx("button",{className:"btn solid",onClick:()=>void bN(n.id),children:"创建"}),l.jsx("button",{className:"btn",style:{background:"var(--bubble)"},onClick:()=>{Ff("请修改草稿:"),Zi()},children:"修改草稿"})]}),l.jsx("div",{className:r?void 0:"off",children:l.jsx("button",{className:"btn solid",disabled:f,onClick:()=>void Xt(n.createdAssistantId),children:f?"已归档":"已创建 · 查看"})})]})]})}function aT({delegation:n,fresh:a}){const r=je(),[o,c]=y.useState(!1),f=r.assistants.find(v=>v.id===n.to),h=f?.name??n.to,m={running:"进行中",waiting:"等你确认",done:"已完成",stuck:"受阻",interrupted:"已中断",returned:"已退回",takenOver:"已被你接手"},p=Object.values(r.approvals).filter(v=>v.status==="pending"&&((n.approvalIds??[]).includes(v.id)||!!(v.jobId&&n.jobIds.includes(v.jobId))));return l.jsx("div",{className:`hov${a?" enter":""}`,id:`delegation-${n.id}`,children:l.jsxs("div",{className:"b jobcard delegation-card",children:[l.jsxs("div",{className:"tt",children:[f?l.jsx("span",{className:"jav",children:l.jsx(it,{sprite:f.sprite,prop:f.prop,size:40})}):null,l.jsxs("span",{className:"jt",children:["交给「",h,"」"]}),l.jsxs("span",{className:`st${n.status==="done"?" done":""}${n.status==="stuck"||n.status==="interrupted"||n.status==="returned"?" bad":""}`,children:[l.jsx(V,{name:n.status==="running"?"spin":n.status==="done"?"check":n.status==="waiting"?"pause":n.status==="takenOver"?"user":"close",className:n.status==="running"?"spin":"",size:14}),m[n.status]]})]}),l.jsx("button",{className:`delegation-text${o?" expanded":""}`,onClick:()=>c(!o),title:o?"收起":"查看全文",children:n.text}),n.status==="returned"&&n.reply?l.jsx("div",{className:"note",children:n.reply}):null,n.jobIds.map(v=>{const x=r.jobs[v];return x?l.jsxs("button",{className:`delegation-job ${x.status}`,onClick:()=>$n(v),title:Fo[x.status].text,children:[l.jsx(V,{name:Fo[x.status].icon,size:14,w:2,className:Fo[x.status].cls}),l.jsx("span",{children:x.title}),l.jsx(V,{name:"chev",size:14,className:"go"})]},v):null}),p.map(v=>l.jsx(z0,{approval:v,fresh:!1},v.id)),l.jsxs("div",{className:"delegation-actions",children:[l.jsxs("button",{onClick:()=>void Wf(n.to,n.id,!0),children:["去「",h,"」看看 →"]}),n.status==="interrupted"?l.jsx("button",{onClick:()=>void kN(n.id),children:"重新转交"}):null]})]})})}function z0({approval:n,fresh:a}){const r=n.options.find(w=>w.key===n.chosen),o=n.status==="answered"&&r?n.chosen:void 0,[c,f]=y.useState(null),[h,m]=y.useState(""),p=c??o,v=c!==null,x=n.status==="answered"?n.answerText:void 0,b=h.trim(),N=()=>{b&&Tx(n.id,{text:b})};return l.jsxs("div",{className:`b q${a?" enter":""}`,children:[l.jsx("div",{className:"qt",children:n.title}),n.detail?l.jsx("div",{className:"qs",children:n.detail}):null,l.jsxs("div",{className:"opts",children:[n.status==="expired"?l.jsx("div",{className:"opt",children:"已结束"}):x?l.jsxs("div",{className:"opt chosen",children:[l.jsx("span",{className:"key",children:l.jsx(V,{name:"user",size:12})}),x,l.jsx("span",{className:"ck",children:l.jsx(V,{name:"check",size:16})})]}):p&&!v?l.jsxs("div",{className:"opt chosen",children:[l.jsx("span",{className:"key",children:p}),n.options.find(w=>w.key===p)?.label,l.jsx("span",{className:"ck",children:l.jsx(V,{name:"check",size:16})})]}):n.options.map(w=>{const T=w.key===p;return l.jsx("div",{className:`optrow${v&&!T?" away":""}`,children:l.jsx("div",{className:"optclip",children:l.jsxs("button",{className:`opt${T?" chosen":""}`,disabled:v,onClick:()=>{f(w.key),Tx(n.id,{key:w.key})},children:[l.jsx("span",{className:"key",children:w.key}),w.label,T&&v?l.jsx("span",{className:"ck",children:l.jsx(V,{name:"check",size:16})}):null]})})},w.key)}),n.status==="expired"||x||v||p?null:l.jsxs("div",{className:"other",children:[l.jsx("input",{value:h,placeholder:"其他想法…",onChange:w=>m(w.target.value),onKeyDown:w=>{w.key==="Enter"&&!w.nativeEvent.isComposing&&N()}}),b?l.jsx("button",{className:"ib other-send",title:"发送",onClick:N,children:l.jsx(V,{name:"send",size:16})}):null]})]})]})}function iT({name:n,path:a,meta:r,fresh:o,itemId:c}){return l.jsxs("button",{className:`att filecard${o?" enter":""}`,"data-item-id":c,onClick:()=>Tt(a,n),children:[l.jsx("span",{className:"ico",children:l.jsx(V,{name:Ml(a),size:18})}),l.jsxs("span",{children:[l.jsx("span",{className:"n",style:{display:"block"},children:n}),r?l.jsx("span",{className:"m",children:r}):null]})]})}function rT({name:n,path:a,fresh:r,itemId:o}){return l.jsx("button",{className:`imgcard${r?" enter":""}`,"data-item-id":o,onClick:()=>Tt(a),title:n,children:l.jsx("img",{src:zl(a),alt:n,loading:"lazy"})})}function oT(n){const a=y.useRef(null);return y.useLayoutEffect(()=>{const r=a.current;if(!r||(r.style.maxWidth="",n===void 0))return;let o=!0;const c=()=>{if(!o)return;r.style.maxWidth="";const f=r.getBoundingClientRect();if(!f.width)return;let h=0;const m=document.createRange(),p=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let x=p.nextNode();x;x=p.nextNode()){let b;if(x instanceof Element){if(getComputedStyle(x).display!=="inline")continue;b=x.getClientRects()}else m.selectNodeContents(x),b=m.getClientRects();for(const N of b)h=Math.max(h,N.right)}if(!h)return;const v=Math.ceil(h-f.left+parseFloat(getComputedStyle(r).paddingRight));v>=f.width-1||(r.style.maxWidth=`${v}px`,r.getBoundingClientRect().height>f.height+.5&&(r.style.maxWidth=""))};return c(),document.fonts.ready.then(c),()=>{o=!1}},[n]),a}function cT({item:n,inlineDraft:a,fresh:r,tools:o}){const c=je(),f=r?" enter":"",[h,m]=y.useState(!1),p=oT(n.kind==="user"&&!n.files?.length?n.text:void 0),v=o.touch?w=>w.preventDefault():void 0,x=o.distance?{transform:`translateX(-${Math.min(64,o.distance*.8)}px)`,transition:"none"}:void 0,b=Math.min(1,o.distance/48),N=o.distance>0?l.jsx("span",{className:`swipe-reply${o.ready?" ready":""}`,style:{opacity:b,transform:`scale(${b})`},children:l.jsx("span",{className:"swipe-reply-inner",children:l.jsx(V,{name:"reply",size:18})})}):null;if(n.kind==="user"){const w=n.files?.filter(Yi)??[],T=n.files?.filter(S=>!Yi(S))??[],E=w.length===1,A=w.length>1,z=!!(n.from||n.quote||n.text||T.length),U=vN(c,c.sel,n.id),$=S=>{S.startsWith("pending/")||Tt(S,$i(S))},j=(S,O)=>l.jsx("button",{className:O,onClick:()=>$(S),title:$i(S),children:l.jsx("img",{src:zl(S),alt:$i(S),loading:"lazy"})},S),C=S=>l.jsxs("button",{className:"ufile",onClick:()=>$(S),children:[l.jsx("span",{className:"fi",children:l.jsx(V,{name:Ml(S),size:16})}),l.jsx("span",{className:"fn",children:$i(S)})]});return l.jsxs("div",{className:"message-row right",id:n.from?`forward-${n.from.delegationId}`:void 0,"data-item-id":n.id,onPointerDown:o.start,onContextMenu:v,children:[N,U?.status==="failed"?l.jsx("button",{className:"send-failed",title:"重试","aria-label":"未送达,重试",onClick:()=>Sx(U.assistantId,U.localId),children:"!"}):U&&n.files?.length?l.jsx("span",{className:"send-progress","aria-label":"正在发送",children:l.jsx(V,{name:"spin",size:16,w:2.2,className:"spin"})}):null,l.jsxs("div",{className:`hov right msg${r?" enter-right":""}${U?" pending":""}`,children:[A?l.jsxs("div",{className:`u-album${h?" open":""}`,ref:z?void 0:p,style:z?void 0:x,children:[l.jsx("button",{className:"album-pill",onClick:()=>m(!h),children:h?"收起":`展开 ${w.length}`}),h?l.jsx("div",{className:"album-list",children:w.map(S=>j(S,"u-photo album-item"))}):l.jsx(V2,{photos:w,onOpen:$})]}):null,E?l.jsx("div",{className:"u-solo",ref:z?void 0:p,style:z?void 0:x,children:j(w[0],"u-photo album-item")}):null,z?l.jsxs("div",{className:"u",ref:p,style:x,children:[n.from?l.jsxs("button",{className:"forward-label",onClick:()=>void(n.from.assistantId==="hob"?Wf(n.from.assistantId,n.from.delegationId,!1):Cx(n.from.assistantId,n.from.delegationId,!1)),children:[(()=>{const S=c.assistants.find(O=>O.id===n.from.assistantId);return S?l.jsx(it,{sprite:S.sprite,prop:S.prop,size:16}):null})(),"转自 ",n.from.assistantId==="hob"?n.from.name:`「${n.from.name}」`]}):null,n.quote?l.jsx("button",{className:"quote",onClick:S=>sT(S,n.quote.itemId),children:n.quote.text}):null,n.text?l.jsx("span",{className:"u-text",children:n.text}):null,T.map(S=>S.startsWith("pending/")?l.jsx(y.Fragment,{children:C(S)},S):l.jsx(Fx,{path:S,name:$i(S),fallback:C(S)},S))]}):null,U?.status==="failed"?l.jsxs("div",{className:"send-status",children:["未送达",l.jsx("button",{onClick:()=>Sx(U.assistantId,U.localId),children:"重试"}),l.jsx("button",{onClick:()=>gN(U.assistantId,U.localId),children:"删除"})]}):null,U?null:l.jsx(Df,{text:n.text,itemId:n.id})]}),o.open?l.jsx(tb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})}if(n.kind==="assistant")return l.jsxs(l.Fragment,{children:[n.routine?l.jsx("div",{className:`tag${r?" enter-fade":""}`,children:n.routine.jobId?l.jsxs("button",{onClick:()=>$n(n.routine.jobId),children:[l.jsx(V,{name:"clock",size:13}),n.routine.name]}):l.jsxs(l.Fragment,{children:[l.jsx(V,{name:"clock",size:13}),n.routine.name]})}):null,l.jsxs("div",{className:"message-row","data-item-id":n.id,onPointerDown:o.start,onContextMenu:v,children:[N,l.jsxs("div",{className:`hov msg${f}`,children:[E2(n.text).map((w,T,E)=>w.table?l.jsx("div",{className:"tablecard",ref:T===0?p:void 0,style:T===0?x:void 0,children:l.jsx(Ua,{text:w.md})},T):l.jsxs("div",{className:`b${a&&T===E.length-1?" wide":""}`,ref:T===0?p:void 0,style:T===0?x:void 0,children:[l.jsx(Ua,{text:w.md,streaming:n.streaming&&T===E.length-1}),a&&T===E.length-1?l.jsx(sb,{draft:a}):null]},T)),l.jsx(Df,{text:n.text,itemId:n.id})]}),o.open?l.jsx(tb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})]});if(n.kind==="note")return l.jsxs("div",{className:`sys${r?" enter-fade":""}`,id:n.handbackId?`handback-${n.handbackId}`:void 0,children:[n.icon!=="split"?l.jsx(V,{name:tT[n.icon],size:14}):null,n.handbackId?l.jsx("button",{onClick:()=>void Cx("hob",n.handbackId,!0),children:n.text}):n.icon==="skill"&&n.path?l.jsx("button",{onClick:()=>Tt(n.path),children:n.text}):n.icon==="memory"?l.jsx("span",{className:"sys-memory",title:n.text,children:n.text.replace(/[::,,;;、]+\s*$/u,"")}):n.text]});if(n.kind==="question"){const w=c.approvals[n.approvalId];return w?l.jsx(z0,{approval:w,fresh:r}):null}if(n.kind==="job"){const w=c.jobs[n.jobId];return w?l.jsx(lT,{job:w,round:n.round,fresh:r,itemId:n.id}):null}if(n.kind==="draft"){const w=c.drafts[n.draftId];return w?l.jsx("div",{className:`b wide${f}`,children:l.jsx(sb,{draft:w})}):null}if(n.kind==="delegation"){const w=c.delegations[n.delegationId];return w?l.jsx(aT,{delegation:w,fresh:r}):null}return n.kind==="image"?l.jsx(G2,{...n,fresh:r,itemId:n.id}):Yi(n.path)?l.jsx(rT,{path:n.path,name:n.name,fresh:r,itemId:n.id}):l.jsx(Fx,{path:n.path,name:n.name,itemId:n.id,fallback:l.jsx(iT,{path:n.path,name:n.name,meta:n.meta,fresh:r,itemId:n.id})})}function uT(n,a){return n?n.kind==="user"!=(a.kind==="user")||!!a.lead:!1}function M0({items:n}){const a=je(),r=nT(),[o,c]=y.useReducer(eT,null),f=y.useRef(null),[h,m]=y.useState(null);y.useEffect(()=>{const v=()=>{f.current&&window.clearTimeout(f.current.timer),f.current=null,m(null)},x=T=>{c({type:"outside",inside:T.target instanceof Element&&!!T.target.closest(".tools.menu")})},b=T=>{const E=f.current;if(!E||E.pointerId!==T.pointerId)return;if(E.swipe=F2(E.swipe,T.clientX,T.clientY),Math.hypot(T.clientX-E.swipe.x,T.clientY-E.swipe.y)>10&&window.clearTimeout(E.timer),E.swipe.direction==="vertical"){v();return}if(E.swipe.direction!=="horizontal")return;window.clearTimeout(E.timer);const A=eb(E.swipe);if(A&&!E.ready&&navigator.vibrate?.(10),E.ready=A,window.matchMedia("(prefers-reduced-motion: reduce)").matches){A&&(nc({itemId:E.id,text:Tl(E.text).slice(0,60)}),Zi(),v());return}m({id:E.id,distance:E.swipe.distance,ready:A})},N=T=>{const E=f.current;!E||E.pointerId!==T.pointerId||(eb(E.swipe)&&(nc({itemId:E.id,text:Tl(E.text).slice(0,60)}),Zi()),v())},w=()=>{v(),c({type:"close"})};return document.addEventListener("pointerdown",x,!0),document.addEventListener("pointermove",b,!0),document.addEventListener("pointerup",N,!0),document.addEventListener("pointercancel",v,!0),document.addEventListener("scroll",w,!0),()=>{v(),document.removeEventListener("pointerdown",x,!0),document.removeEventListener("pointermove",b,!0),document.removeEventListener("pointerup",N,!0),document.removeEventListener("pointercancel",v,!0),document.removeEventListener("scroll",w,!0)}},[]);const p=[];n.length&&!Q2(n[0].at)&&n[0].kind!=="note"&&p.push(l.jsx("div",{className:"div",children:Kt(n[0].at)},"first-div"));for(let v=0;v<n.length;v++){const x=n[v],b=n[v-1],N=n[v+1],w=A1(x.id),T=x.kind==="assistant"&&N?.kind==="draft"?a.drafts[N.draftId]:void 0,E={open:r&&o===x.id,touch:r,distance:h?.id===x.id?h.distance:0,ready:h?.id===x.id&&h.ready,close:()=>c({type:"close"}),start:r?A=>{if(A.pointerType!=="touch"||x.kind!=="user"&&x.kind!=="assistant"||A.target.closest("a,button,input,textarea,select,[contenteditable],.draft,.album-stack"))return;f.current&&window.clearTimeout(f.current.timer);const{clientX:z,clientY:U,pointerId:$}=A,j=window.setTimeout(()=>{f.current=null,c({type:"open",id:x.id})},500);f.current={timer:j,pointerId:$,id:x.id,text:x.text,swipe:{x:z,y:U,direction:"pending",distance:0},ready:!1}}:void 0};T&&v++,p.push(l.jsxs(y.Fragment,{children:[J2(b?.at,x.at)?l.jsx("div",{className:`div${w?" enter-fade":""}`,children:Kt(x.at)}):uT(b,x)?l.jsx("div",{className:"g"}):null,l.jsx(cT,{item:x,inlineDraft:T,fresh:w,tools:E})]},x.id))}for(const v of C1(Object.values(a.livePages),a.sel))p.push(l.jsxs("button",{className:`att filecard${v.state==="failed"?" bad":""}`,onClick:()=>YN(v.callId),children:[l.jsx("span",{className:"ico",children:l.jsx(V,{name:v.state==="writing"?"spin":"close",className:v.state==="writing"?"spin":"",size:18})}),l.jsxs("span",{children:[l.jsx("span",{className:"n",style:{display:"block"},children:v.title||"正在写页面…"}),l.jsx("span",{className:"m",children:v.state==="failed"?`生成失败:${v.error}`:"生成中"})]})]},v.callId));return l.jsx(l.Fragment,{children:p})}function O0({leaving:n,gap:a,a:r}){return l.jsxs(l.Fragment,{children:[a?l.jsx("div",{className:"g"}):null,l.jsx("div",{className:`hov think${n?" leaving":""}`,children:l.jsxs("div",{className:"activity-line",role:"status",children:[l.jsx(it,{sprite:r.sprite,prop:r.prop,size:46,free:!0,motion:r.activity?.state==="tool"?"work":"think"}),l.jsx("span",{className:"activity-shimmer",children:r.activity?.label??"正在想…"})]})})]})}function _0(n,a,r,o){const c=y.useRef(!0),f=y.useRef({key:"",len:0});y.useEffect(()=>{const h=n.current;if(!h)return;let m=h.scrollTop;const p=()=>{h.scrollHeight-h.scrollTop-h.clientHeight<80?c.current=!0:h.scrollTop<m-2&&(c.current=!1),m=h.scrollTop},v=new ResizeObserver(()=>{c.current&&(h.scrollTop=h.scrollHeight,m=h.scrollTop)});h.addEventListener("scroll",p,{passive:!0}),v.observe(h);for(const x of Array.from(h.children))v.observe(x);return()=>{h.removeEventListener("scroll",p),v.disconnect()}},[n]),y.useLayoutEffect(()=>{const h=n.current;if(!h)return;const m=f.current;f.current={key:a,len:r},m.key!==a||r<m.len?(c.current=!0,h.scrollTop=h.scrollHeight):r>m.len&&(c.current||o)&&(c.current=!0,h.scrollTo({top:h.scrollHeight,behavior:"smooth"}))},[n,a,r,o])}function R0(n){return n?.kind==="user"&&!n.from}const dT=["查看这台电脑的磁盘和内存占用","每天早上 9 点给我一份科技新闻简报","把附件里的会议记录整理成要点"];function D0({a:n}){const r=je().settings.settings.models,o=r.roster.length>0&&r.conversation.ref!=="";return l.jsxs("div",{className:"hello",children:[l.jsx(it,{sprite:n.sprite,prop:n.prop,size:88,free:!0,motion:"home"}),l.jsx("div",{className:"t",children:`我是${$0(n.name,!1)}${n.primary?",你的主助手":""}`}),l.jsx("div",{className:"d",children:n.primary?"交给我的事,我会分派给后台任务执行,完成、受阻或需要你确认时再告诉你;也可以让我定时执行。同类工作多了,我会建议创建专属助手。":`负责${n.duty}。`}),o?n.primary?l.jsx("div",{className:"ex",children:dT.map(c=>l.jsx("button",{className:"btn",onClick:()=>{Ff(c),Zi()},children:c},c))}):null:l.jsxs("div",{className:"setup",children:[l.jsx("div",{children:"开始使用前,请先添加模型服务商并选择模型。"}),l.jsx("button",{className:"btn solid",onClick:()=>{fc(),Sl("providers")},children:"前往设置"})]})]})}function $0(n,a=!0){const r=o=>!!(o&&/[A-Za-z0-9]/.test(o));return`${r(n[0])?" ":""}${n}${a&&r(n.at(-1))?" ":""}`}function U0(n,a){return`${n??""}|${a??0}`}function fT(){const n=je(),a=n.assistants.find(p=>p.id===n.sel),r=Fb(n,n.sel),o=!!(a&&n.sel&&r.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=y.useRef(null),f=U0(n.sel,n.sel?n.itemGen[n.sel]:0),h=!!a?.busy&&!Mb(r),m=Dn(h,180);return _0(c,f,r.length,R0(r.at(-1))),l.jsxs("main",{className:"chat",children:[l.jsxs("div",{className:"head",children:[a?l.jsx(it,{sprite:a.sprite,prop:a.prop,size:24}):null,l.jsx("span",{className:"nm",children:a?.name??""}),l.jsx("span",{className:"sp"}),n.collapsed?l.jsx("button",{className:"ib",title:"展开右栏",onClick:LN,children:l.jsx(V,{name:"panel",size:18})}):null]}),l.jsx("div",{className:"msgs",ref:c,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[o&&a?l.jsx(D0,{a}):l.jsx(M0,{items:r}),m.mounted&&a?l.jsx(O0,{a,leaving:m.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(L0,{})]})}function L0({variant:n="desktop"}){const a=je(),r=a.assistants.find(p=>p.id===a.sel),o=y.useRef(null),c=a.text.trim().length>0||a.attachments.length>0,f=Dn(a.quote!==null,180);y.useLayoutEffect(()=>{const p=o.current;if(!p)return;p.style.height="auto";const v=n==="mobile"?120:180;p.style.height=`${Math.min(p.scrollHeight,v)}px`},[a.text,a.nonce,n]),y.useEffect(()=>{a.nonce&&o.current?.focus()},[a.nonce]);const h=y.useRef(null);y.useLayoutEffect(()=>{const p=h.current,v=p?.closest(".chat");if(!p||!v)return;const x=new ResizeObserver(()=>v.style.setProperty("--comp-h",`${p.offsetHeight}px`));return x.observe(p),()=>x.disconnect()},[n]);const m=l.jsxs("div",{className:n==="mobile"?"mcomp":"comp",children:[f.mounted?l.jsxs("div",{className:`comp-quote${f.leaving?" leaving":""}`,children:[l.jsx("div",{className:"quote",children:a.quote?.text}),l.jsx("button",{className:"ib",style:{width:20,height:20},onClick:()=>nc(null),title:"取消引用",children:l.jsx(V,{name:"close",size:13})})]}):null,a.attachments.length?l.jsx("div",{className:"comp-files",children:a.attachments.map(p=>{const v=p.path??uc(p),x=p.status==="uploading"?" uploading":p.status==="failed"?" failed":"";return Yi(p.name)?l.jsxs("span",{className:`comp-thumb${x}`,children:[l.jsx("img",{src:zl(v),alt:p.name}),p.status==="uploading"?l.jsx("span",{className:"att-spin",children:l.jsx(V,{name:"spin",size:18,w:2.2,className:"spin"})}):null,p.status==="failed"?l.jsx("span",{className:"att-bad",children:"!"}):null,l.jsx("button",{onClick:()=>wx(p.id),title:"移除","aria-label":"移除",children:l.jsx(V,{name:"close",size:11,w:2.2})})]},p.id):l.jsxs("span",{className:`filechip${x}`,children:[l.jsx("span",{className:"fi",children:p.status==="uploading"?l.jsx(V,{name:"spin",size:16,w:2.2,className:"spin"}):l.jsx(V,{name:Ml(p.name),size:16})}),l.jsx("span",{className:"fn",children:p.name}),l.jsx("button",{onClick:()=>wx(p.id),title:"移除","aria-label":"移除",children:l.jsx(V,{name:"close",size:12})})]},p.id)})}):null,l.jsxs("div",{className:"comp-main",children:[l.jsxs("label",{className:"pl",title:"加文件",children:[l.jsx(V,{name:"plus",size:19}),l.jsx("input",{type:"file",multiple:!0,hidden:!0,onChange:p=>{const v=Array.from(p.target.files??[]);p.target.value="",v.length&&mN(v)}})]}),l.jsx("textarea",{ref:o,className:"ta",rows:1,value:a.text,placeholder:`给${$0(r?.name??"")}发消息`,onChange:p=>Ff(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),Nx())}}),r?.busy&&!c?l.jsx("button",{className:"sendbtn stop",title:"停止",onClick:()=>void xN(r.id),children:l.jsx(V,{name:"stop",size:18})}):l.jsx("button",{className:"sendbtn",title:"发送",disabled:!c,onClick:()=>void Nx(),children:l.jsx(V,{name:"send",size:17})})]})]});return n==="mobile"?l.jsx("div",{className:"mcomp-wrap",ref:h,children:m}):l.jsx("div",{className:"compwrap",ref:h,children:l.jsx("div",{className:"col",children:m})})}function hT(){const n=je(),a=n.assistants.find(p=>p.id===n.sel),r=Fb(n,n.sel),o=!!(a&&n.sel&&r.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=y.useRef(null),f=!!a?.busy&&!Mb(r),h=Dn(f,180),m=U0(n.sel,n.sel?n.itemGen[n.sel]:0);return _0(c,m,r.length,R0(r.at(-1))),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mchat-head",children:[l.jsx("button",{className:"ib",style:{marginLeft:-8},title:"返回",onClick:()=>Ef("list"),children:l.jsx(V,{name:"left",size:22})}),a?l.jsx(it,{sprite:a.sprite,prop:a.prop,size:30}):null,l.jsx("span",{className:"nm",children:a?.name??""}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"ib",title:"助手信息",onClick:HN,children:l.jsx(V,{name:"more",size:20})})]}),l.jsx("div",{className:"mmsgs",ref:c,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[o&&a?l.jsx(D0,{a}):l.jsx(M0,{items:r}),h.mounted&&a?l.jsx(O0,{a,leaving:h.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(L0,{variant:"mobile"})]})}const mT="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')});",pT="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'})});",gT="(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)})();",vT="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: https:; media-src data: https:; font-src data:",xT=`: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}
|
|
176
|
+
: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}
|
|
177
|
+
*{box-sizing:border-box}
|
|
178
|
+
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}
|
|
179
|
+
body{margin:0;padding:52px 24px 80px}
|
|
180
|
+
.page{max-width:760px;margin:0 auto}
|
|
181
|
+
.hd{margin-bottom:40px;padding-bottom:28px;border-bottom:1px solid var(--line)}
|
|
182
|
+
.hd h1{font-size:32px;line-height:1.25;letter-spacing:-.015em;margin:0 0 10px;font-weight:700}
|
|
183
|
+
.hd p{margin:0;color:var(--muted);font-size:17px;line-height:1.6}
|
|
184
|
+
h2{font-size:22px;line-height:1.35;letter-spacing:-.01em;margin:48px 0 14px;font-weight:700}
|
|
185
|
+
h3{font-size:16.5px;line-height:1.45;margin:28px 0 8px;font-weight:650}
|
|
186
|
+
main>h2:first-child,main>section:first-child>h2:first-child{margin-top:0}
|
|
187
|
+
p,ul,ol,table,pre,figure,blockquote,.note,.cards,.cols,.kpis,.steps{margin:0 0 18px}
|
|
188
|
+
ul,ol{padding-left:1.4em}li{margin:5px 0}li::marker{color:var(--faint)}
|
|
189
|
+
a{color:var(--accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--accent) 35%,transparent)}
|
|
190
|
+
strong,b{font-weight:650}
|
|
191
|
+
.muted{color:var(--muted)}.accent{color:var(--accent)}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}
|
|
192
|
+
code{font:.88em/1.5 ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;background:var(--soft);padding:.12em .4em;border-radius:5px}
|
|
193
|
+
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}
|
|
194
|
+
blockquote{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted)}
|
|
195
|
+
hr{border:0;border-top:1px solid var(--line);margin:36px 0}
|
|
196
|
+
table{width:100%;border-collapse:collapse;font-size:14.5px;line-height:1.6}
|
|
197
|
+
.tw{overflow-x:auto;margin:0 0 18px}.tw>table{margin:0}
|
|
198
|
+
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
|
|
199
|
+
th{font-size:13px;font-weight:600;color:var(--muted);border-bottom-width:1.5px;white-space:nowrap}
|
|
200
|
+
td{min-width:5.5em}
|
|
201
|
+
th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}
|
|
202
|
+
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
|
|
203
|
+
.card{background:var(--soft);border-radius:14px;padding:16px 18px}.card h3{margin:0 0 6px;font-size:15.5px}
|
|
204
|
+
.cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px 28px}
|
|
205
|
+
.cols>div>h3:first-child{margin-top:0}
|
|
206
|
+
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
|
|
207
|
+
.kpi{border:1px solid var(--line);border-radius:14px;padding:14px 16px 12px}
|
|
208
|
+
.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}
|
|
209
|
+
.steps{list-style:none;padding:0;counter-reset:s}
|
|
210
|
+
.steps>li{position:relative;margin:0;padding:1px 0 20px 44px;counter-increment:s}
|
|
211
|
+
.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}
|
|
212
|
+
.steps>li::after{content:"";position:absolute;left:13.5px;top:34px;bottom:6px;width:1px;background:var(--line)}
|
|
213
|
+
.steps>li:last-child{padding-bottom:0}.steps>li:last-child::after{display:none}.steps>li>b:first-child{display:block}
|
|
214
|
+
.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)}
|
|
215
|
+
.card>:last-child,.note>:last-child,.cols>div>:last-child,section>:last-child{margin-bottom:0}
|
|
216
|
+
.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}
|
|
217
|
+
.card .tag{background:var(--bg)}
|
|
218
|
+
.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)}
|
|
219
|
+
figure{margin:28px 0;overflow-x:auto}img,svg{max-width:100%;height:auto}figure>svg,figure>img{display:block;margin:0 auto}
|
|
220
|
+
figcaption{color:var(--muted);font-size:13.5px;margin-top:10px;text-align:center}
|
|
221
|
+
svg{color:var(--ink)}svg text{fill:var(--ink);font-family:inherit;font-size:13px}
|
|
222
|
+
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}
|
|
223
|
+
svg .line{fill:none;stroke:var(--faint);stroke-width:1.5}svg text.muted{fill:var(--muted)}svg text.accent{fill:var(--accent)}
|
|
224
|
+
@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}}`,mf=n=>n.replace(/[&<>"]/g,a=>({"&":"&","<":"<",">":">",'"':"""})[a]);function bT(){return yT("","","").replace("</body>",`<script>
|
|
225
|
+
(function(){
|
|
226
|
+
let latest, scheduled = false, follow = true;
|
|
227
|
+
addEventListener('scroll', function(){ follow = document.documentElement.scrollHeight - innerHeight - scrollY < 48; }, {passive:true});
|
|
228
|
+
addEventListener('message', function(e){
|
|
229
|
+
if(e.source !== parent || e.data?.type !== 'hob-page-live') return;
|
|
230
|
+
latest = e.data;
|
|
231
|
+
if(scheduled) return;
|
|
232
|
+
scheduled = true;
|
|
233
|
+
requestAnimationFrame(function(){
|
|
234
|
+
scheduled = false;
|
|
235
|
+
document.documentElement.classList.toggle('dark', !!latest.dark);
|
|
236
|
+
document.title = latest.title || '';
|
|
237
|
+
document.querySelector('.hd h1').textContent = latest.title || '';
|
|
238
|
+
document.querySelector('.hd p').textContent = latest.summary || '';
|
|
239
|
+
const main = document.querySelector('main');
|
|
240
|
+
const template = document.createElement('template');
|
|
241
|
+
template.innerHTML = (latest.html || '').replace(/<[^>]*$/, '');
|
|
242
|
+
template.content.querySelectorAll('script,iframe,object,embed').forEach(function(el){el.remove()});
|
|
243
|
+
template.content.querySelectorAll('*').forEach(function(el){
|
|
244
|
+
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)});
|
|
245
|
+
});
|
|
246
|
+
main.innerHTML = template.innerHTML;
|
|
247
|
+
main.querySelectorAll('table').forEach(function(t){const w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});
|
|
248
|
+
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'});
|
|
249
|
+
if(follow) scrollTo(0, document.documentElement.scrollHeight);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
})();<\/script></body>`)}function yT(n,a,r){return`<!doctype html>
|
|
253
|
+
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
254
|
+
<meta http-equiv="Content-Security-Policy" content="${vT}">
|
|
255
|
+
<title>${mf(n)}</title><script>${gT}${pT}<\/script><style>${xT}</style></head>
|
|
256
|
+
<body><div class="page"><header class="hd"><h1>${mf(n)}</h1><p>${mf(a)}</p></header>
|
|
257
|
+
<main>
|
|
258
|
+
${r}
|
|
259
|
+
</main></div><script>${mT}<\/script></body></html>
|
|
260
|
+
`}function kT(n){const[a,...r]=n;return a?a.map((o,c)=>r.length>0&&r.every(f=>{const h=f[c]?.trim();return!!h&&/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(h)&&Number.isFinite(Number(h))})):[]}function Pi({title:n,children:a,root:r=!1,close:o=!1,className:c=""}){const f=je(),h=r||f.page!=="main"&&f.panelStack.length<=1;return l.jsxs("div",{className:`panel-head ${c}`,children:[l.jsx("button",{className:`ib${h?" panel-mobile-back":""}`,title:"返回",onClick:r?o0:er,children:l.jsx(V,{name:"left",size:18})}),n,a,o?l.jsx("button",{className:"ib panel-close",title:"关闭",onClick:tr,children:l.jsx(V,{name:"close",size:17})}):null]})}const jT=1024*1024;function Bi({embedded:n=!1,direction:a="",page:r}){const o=je(),c=r??o.panelStack.at(-1),f=c?.kind==="file"?c:null,h=Dn(!!f,180),m=y.useRef(f);f&&(m.current=f);const p=f??m.current;return!h.mounted||!p?null:l.jsx("div",{className:`${n?"fp-embedded":"fpwrap"}${a?` ${a}`:""}${h.leaving?" leaving":""}`,onClick:n?void 0:tr,children:l.jsx("div",{className:`fp${p.full?" full":""}`,onClick:v=>v.stopPropagation(),children:p.liveId&&o.livePages[p.liveId]?l.jsx(wT,{page:o.livePages[p.liveId]}):l.jsx(NT,{path:p.path,title:p.title,find:p.find,page:p.page})})})}function wT({page:n}){const a=y.useRef(null),r=y.useRef(n);r.current=n;const[o,c]=y.useState(null),f=y.useMemo(()=>bT(),[]),h=()=>a.current?.contentWindow?.postMessage({type:"hob-page-live",title:r.current.title,summary:r.current.summary,html:r.current.html,dark:document.documentElement.classList.contains("dark")},"*");y.useEffect(()=>{h()},[n]),y.useEffect(()=>{const p=new MutationObserver(h);p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const v=x=>{if(!(x.source!==a.current?.contentWindow||x.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const b=new URL(x.data.url);["http:","https:"].includes(b.protocol)&&window.open(b.href,"_blank","noopener")}catch{}};return window.addEventListener("message",v),()=>{p.disconnect(),window.removeEventListener("message",v)}},[]),y.useEffect(()=>{let p=!0;return n.path&&sh(n.path).then(v=>{p&&c(v)}).catch(v=>La(`无法加载文件信息:${v instanceof Error?v.message:String(v)}`)),()=>{p=!1}},[n.path]);const m=n.state!=="done";return l.jsxs(l.Fragment,{children:[l.jsx(H0,{name:n.title||"正在写页面…",meta:o,path:n.path||"page.html",liveStatus:n.state==="writing"?"正在生成…":n.state==="failed"?`生成失败:${n.error}`:void 0,disabled:m}),l.jsx("div",{className:"fp-body",children:n.state==="done"&&/<\s*script\b/i.test(n.html)&&o?l.jsx(B0,{meta:o}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),l.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",srcDoc:f,onLoad:h,title:n.title||"正在写页面"})]})})]})}function NT({path:n,title:a,find:r,page:o}){const[c,f]=y.useState({state:"loading"});y.useEffect(()=>{let p=!0;return f({state:"loading"}),sh(n).then(v=>{p&&f({state:"ok",meta:v})}).catch(v=>{if(!p)return;const x=v instanceof Error?v.message:String(v),b=x.includes("只允许读 Hob 自己的文件");f({state:"error",outside:b,message:x})}),()=>{p=!1}},[n]);const h=c.state==="ok"?c.meta:null,m=a??h?.name??n.split("/").pop()??n;return l.jsxs(l.Fragment,{children:[l.jsx(H0,{name:m,meta:h,path:n}),l.jsx("div",{className:"fp-body",children:c.state==="loading"?l.jsx("div",{className:"fp-center dim",children:"正在读取文件信息…"}):c.state==="error"?l.jsx("div",{className:"fp-center",children:l.jsxs("div",{className:"fp-nofile",children:[l.jsx(V,{name:"doc",size:22}),l.jsx("div",{children:c.outside?"这个文件不在 Hob 的数据目录或任务的工作目录里,无法预览":c.message}),l.jsx("button",{className:"pbtn",onClick:()=>void lh(n).then(p=>La(p?"路径已复制":"复制失败:浏览器不允许写入剪贴板")),children:"复制路径"})]})}):l.jsx(ST,{meta:c.meta,find:r,page:o})})]})}function H0({name:n,meta:a,path:r,liveStatus:o,disabled:c}){const f=je().panelStack.at(-1),h=f?.kind==="file"&&f.full;return l.jsxs(Pi,{className:"fphead",close:!0,children:[l.jsx(V,{name:Ml(r),size:18,className:"fp-file-icon"}),l.jsxs("div",{className:"fpt",children:[l.jsx("div",{className:"n",title:n,children:n}),o?l.jsx("div",{className:"m",children:o}):a?l.jsxs("div",{className:"m",children:[Ba(a.size)," · ",Kt(a.modifiedAt)]}):null]}),c?l.jsx("button",{className:"ib fp-act",title:"下载",disabled:!0,children:l.jsx(V,{name:"dl",size:17})}):l.jsx("a",{className:"ib fp-act",title:"下载",href:Ut(r),download:n,children:l.jsx(V,{name:"dl",size:17})}),l.jsx("button",{className:"ib fp-act",title:"在新窗口打开",disabled:c,onClick:()=>window.open(Ut(r,{inline:!0}),"_blank","noopener"),children:l.jsx(V,{name:"out",size:17})}),l.jsx("button",{className:"ib fp-act fp-wide-btn",title:"切换全宽",onClick:GN,children:l.jsx(V,{name:h?"shrink":"expand",size:17})})]})}function B0({meta:n}){const a=y.useRef(null);return y.useEffect(()=>{const r=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",r),()=>window.removeEventListener("message",r)},[n.page]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),l.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",src:Ut(n.path,{inline:!0})+(n.page?document.documentElement.classList.contains("dark")?"#dark":"#light":""),title:n.name})]})}function ST({meta:n,find:a,page:r}){switch(n.kind){case"image":return l.jsx(lb,{path:n.path,name:n.name,svg:!1});case"svg":return l.jsx(lb,{path:n.path,name:n.name,svg:!0});case"pdf":return l.jsx("iframe",{className:"fp-frame",src:Ut(n.path)+(r?`#page=${r}`:""),title:n.name});case"audio":return l.jsx("div",{className:"fp-center",children:l.jsx("audio",{controls:!0,src:Ut(n.path)})});case"video":return l.jsx("div",{className:"fp-center",children:l.jsx("video",{controls:!0,src:Ut(n.path)})});case"html":return l.jsx(B0,{meta:n});case"other":return l.jsx("div",{className:"fp-center",children:l.jsxs("div",{className:"fp-nofile",children:[l.jsx(V,{name:"doc",size:22}),l.jsx("div",{children:"这种文件不在浏览器里预览,可以下载后打开。"}),l.jsx("a",{className:"pbtn solid",href:Ut(n.path),download:n.name,children:"下载"})]})});default:return l.jsx(TT,{meta:n,find:a})}}function lb({path:n,name:a,svg:r}){const[o,c]=y.useState(!1),f=Ut(n,r?{inline:!0}:void 0),[h,m]=y.useState(r);return y.useEffect(()=>{if(!o)return;const p=v=>{v.key==="Escape"&&(v.stopImmediatePropagation(),c(!1))};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[o]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-img",children:l.jsxs("button",{onClick:()=>c(!0),title:"放大",className:h?void 0:"fp-img-loading",children:[h?null:l.jsx("img",{className:"fp-img-thumb",src:zl(n),alt:"","aria-hidden":"true"}),l.jsx("img",{src:f,alt:a,onLoad:()=>m(!0),onError:()=>m(!0),style:h?void 0:{position:"absolute",opacity:0}})]})}),o?l.jsx("div",{className:"lightbox",role:"dialog","aria-label":a,onClick:()=>c(!1),children:l.jsx("img",{src:f,alt:a})}):null]})}function TT({meta:n,find:a}){const[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(0),p=y.useCallback(()=>m(x=>x+1),[]);if(y.useEffect(()=>{let x=!0;return o(null),f(null),(async()=>{try{const b=await fetch(Ut(n.path,{truncate:!0}));if(!b.ok)throw new Error(`读取失败(${b.status})`);x&&o(await b.text())}catch(b){x&&f(b instanceof Error?b.message:String(b))}})(),()=>{x=!1}},[n.path]),c)return l.jsx("div",{className:"fp-center fp-nofile",children:c});if(r===null)return l.jsx("div",{className:"fp-center dim",children:"正在读取内容…"});const v=n.size>jT?l.jsxs("div",{className:"fp-note",children:["文件有 ",Ba(n.size),",只显示前 1 MB,完整内容请下载。"]}):null;if(n.kind==="markdown")return l.jsxs(l.Fragment,{children:[v,l.jsx(Ko,{find:a,text:r,mathVersion:h,children:l.jsx(Ua,{className:"fp-md markdown-body",text:r,onMathRendered:p})})]});if(n.kind==="json"){let x=r;try{x=JSON.stringify(JSON.parse(r),null,2)}catch{}return l.jsxs(l.Fragment,{children:[v,l.jsx(Ko,{find:a,text:r,children:l.jsx(ab,{text:x})})]})}return n.kind==="csv"?l.jsxs(l.Fragment,{children:[v,l.jsx(Ko,{find:a,text:r,children:l.jsx(CT,{text:r,tsv:n.mime.includes("tab-separated")})})]}):l.jsxs(l.Fragment,{children:[v,l.jsx(Ko,{find:a,text:r,children:l.jsx(ab,{text:r})})]})}function Ko({find:n,text:a,mathVersion:r,children:o}){const c=y.useRef(null);return y.useEffect(()=>{const f=CSS.highlights;if(!c.current||!n||!f||typeof Highlight>"u")return;const h=document.createTreeWalker(c.current,NodeFilter.SHOW_TEXT,{acceptNode(N){return N.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=z2(m,n);if(!p)return;const{start:v,end:x}=p,b=document.createRange();return b.setStart(v.node,v.offset),b.setEnd(x.node,x.offset),f.set("knowledge-source",new Highlight(b)),v.node.parentElement?.scrollIntoView({block:"center"}),()=>{f.delete("knowledge-source")}},[n,a,r]),l.jsx("div",{ref:c,children:o})}function ab({text:n}){const[a,r]=y.useState(!0),o=y.useMemo(()=>n.split(`
|
|
261
|
+
`),[n]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"fp-codebar",children:[l.jsxs("span",{className:"dim",children:[o.length," 行"]}),l.jsx("button",{className:"pbtn",onClick:()=>r(!a),children:a?"不自动换行":"自动换行"})]}),l.jsx("div",{className:`fp-code mono${a?" wrap":""}`,children:o.map((c,f)=>l.jsxs("div",{className:"cl",children:[l.jsx("span",{className:"ln",children:f+1}),l.jsx("span",{className:"ct",children:c||" "})]},f))})]})}function CT({text:n,tsv:a}){const r=y.useMemo(()=>ET(n,a?" ":","),[n,a]),o=y.useMemo(()=>kT(r),[r]),c=r.slice(0,1e3),[f,...h]=c;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-codebar",children:l.jsxs("span",{className:"dim",children:[r.length," 行",r.length>1e3?"(只显示前 1000 行)":""]})}),l.jsx("div",{className:"fp-table-wrap",children:l.jsxs("table",{className:"fp-table",children:[f?l.jsx("thead",{children:l.jsx("tr",{children:f.map((m,p)=>l.jsx("th",{className:o[p]?"numeric":void 0,children:m},p))})}):null,l.jsx("tbody",{children:h.map((m,p)=>l.jsx("tr",{children:m.map((v,x)=>l.jsx("td",{className:o[x]?"numeric":void 0,children:v},x))},p))})]})})]})}function ET(n,a){const r=[];let o=[],c="",f=!1;for(let h=0;h<n.length;h+=1){const m=n[h];f?m==='"'?n[h+1]==='"'?(c+='"',h+=1):f=!1:c+=m:m==='"'?f=!0:m===a?(o.push(c),c=""):m===`
|
|
262
|
+
`?(o.push(c),r.push(o),o=[],c=""):m!=="\r"&&(c+=m)}return(c||o.length)&&(o.push(c),r.push(o)),r}const AT=y.lazy(()=>sr(()=>import("./DesktopView-rVxacveF.js"),[]).then(n=>({default:n.DesktopView}))),q0={queued:{text:"排队中",icon:"clock"},running:{text:"进行中",icon:"spin",spin:!0},waiting:{text:"待确认",icon:"pause"},done:{text:"已完成",icon:"check"},stuck:{text:"受阻",icon:"close",bad:!0},failed:{text:"失败",icon:"close",bad:!0},stopped:{text:"已停止",icon:"stop"}},zT={off:"关",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},MT=["running","waiting","queued","done","stuck","failed","stopped"],OT={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 Fi(n){return n.status==="running"||n.status==="queued"||n.status==="waiting"}function hc({job:n}){const a=q0[n.status];return l.jsxs("span",{className:`jt-st${a.bad?" bad":""}${n.status==="done"?" ok":""}${n.status==="running"?" live":""}`,children:[l.jsx(V,{name:a.icon,size:13,className:`${a.spin?"spin ":""}${a.bad?"bad":""}`}),a.text]})}function pf({embedded:n=!1,direction:a="",page:r}){const o=je(),c=r??o.panelStack.at(-1),f=c?.kind==="job"||c?.kind==="jobs"?c:null,h=Dn(!!f,180),m=y.useRef(f);f&&(m.current=f);const p=f??m.current;return!h.mounted||!p?null:l.jsx("div",{className:`${n?"jd-embedded":"jd-overlay"}${a?` ${a}`:""}${h.leaving?" leaving":""}`,onClick:n?void 0:tr,children:l.jsx("div",{className:"jd",onClick:v=>v.stopPropagation(),children:p.kind==="jobs"?l.jsxs(l.Fragment,{children:[l.jsx(Pi,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务记录"}),close:!0}),l.jsx(XT,{})]}):l.jsx(_T,{id:p.id,round:p.round},`${p.id}-${p.round??"default"}`)})})}function _T({id:n,round:a}){const r=je(),o=r.jobs[n],c=r.steps[n],f=y.useRef(null),h=y.useRef(a===void 0&&(o?Fi(o):!0)),[m,p]=y.useState(null),[v,x]=y.useState(!1),[b,N]=y.useState(a);if(y.useEffect(()=>{Qf().then($=>p($?.models??null))},[]),y.useEffect(()=>{const $=f.current;if(!$)return;const j=()=>{h.current=$.scrollHeight-$.scrollTop-$.clientHeight<80};return $.addEventListener("scroll",j),()=>$.removeEventListener("scroll",j)},[]),y.useEffect(()=>{const $=f.current,j=c?.[c.length-1]?.queued;$&&(h.current||j)&&($.scrollTop=$.scrollHeight,h.current=!0)},[c?.length,c?.[c.length-1]?.id]),!o)return l.jsxs("div",{className:"jdbody",children:[l.jsx(Pi,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务"}),close:!0}),l.jsx("div",{className:"empty",children:"无法读取这个任务。"})]});const w=r.assistants.find($=>$.id===o.assistantId),T=o.model?m?.find($=>$.ref===o.model)?.name??o.model:"",E=o.startedAt??o.createdAt,A=o.durationMs??(Fi(o)?Date.now()-new Date(E).getTime():void 0),z=o.usage,U=Xf(o);return l.jsxs(l.Fragment,{children:[l.jsxs(Pi,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务"}),close:!0,children:[o.status==="done"?l.jsxs("button",{className:"panel-action",disabled:!!r.sedimenting[o.id],onClick:()=>{jN(o.id)},children:[l.jsx(V,{name:"mem",size:14}),r.sedimenting[o.id]?"正在沉淀…":"沉淀成技能"]}):null,c?.some($=>$.name?.startsWith("browser_")||$.name?.startsWith("desktop_"))?l.jsxs("button",{className:"panel-action",onClick:()=>x(!0),children:[l.jsx(V,{name:"pointer",size:14}),"看桌面"]}):null]}),l.jsxs("div",{className:"jdbody",ref:f,children:[l.jsx("div",{className:"jd-title",children:o.title}),l.jsxs("div",{className:"jd-meta",children:[l.jsx(hc,{job:o}),w||o.assistantName?l.jsxs("span",{className:"jd-owner",children:[w?l.jsx(it,{sprite:w.sprite,prop:w.prop,size:16}):null,w?.name??o.assistantName]}):null,l.jsx("span",{children:Kt(E)}),A!==void 0?l.jsxs("span",{children:["用时 ",_l(A)]}):null]}),o.model||z?l.jsxs("div",{className:"jd-meta dim",children:[o.model?l.jsx("span",{className:T===o.model?"mono":void 0,title:o.model,children:T}):null,o.thinking?l.jsxs("span",{children:["思考 ",zT[o.thinking]??o.thinking]}):null,o.modelReason?l.jsx("span",{children:o.modelReason}):null,z?l.jsxs("span",{children:["输入 ",Rf(z.input)," · 输出 ",Rf(z.output),z.cost>0?` · $${z.cost.toFixed(4)}`:""]}):null]}):null,U?l.jsx("div",{className:"jd-reason",children:U}):null,o.rounds?.length?(()=>{const $=cw(o,c),j=Math.min(b??$.length-1,$.length-1);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"seg jd-rounds",role:"tablist",style:{"--seg-count":$.length,"--seg-index":j},children:$.map((C,S)=>l.jsxs("button",{role:"tab","aria-selected":S===j,className:S===j?"on":void 0,onClick:()=>N(S),children:["第 ",S+1," 轮"]},S))}),l.jsx(ib,{part:$[j],last:j===$.length-1,index:j},j)]})})():l.jsx(l.Fragment,{children:l.jsx(ib,{part:{job:o,instruction:o.instruction,steps:c},last:!0,index:0})})]}),l.jsx(RT,{job:o}),v?l.jsx(y.Suspense,{fallback:l.jsx("div",{children:"正在打开云桌面…"}),children:l.jsx(AT,{onClose:()=>x(!1)})}):null]})}function ib({part:n,last:a,index:r}){const[o,c]=y.useState(!1),f=n.steps===void 0?void 0:aw(n.steps),h=Xf(n.job),m=!Fi(n.job);return l.jsxs(l.Fragment,{children:[a?null:l.jsxs("div",{className:"jd-meta",children:[l.jsx(hc,{job:n.job}),n.job.durationMs!==void 0?l.jsxs("span",{children:["用时 ",_l(n.job.durationMs)]}):null]}),h&&!a?l.jsx("div",{className:"jd-reason",children:h}):null,m?l.jsxs(l.Fragment,{children:[l.jsx(qT,{job:n.job}),l.jsx(IT,{job:n.job})]}):null,n.instruction?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:r===0?"任务内容":"这一轮的要求"}),l.jsx("div",{className:"jd-instruction",children:n.instruction})]}):null,l.jsx("div",{className:"lbl",children:"执行过程"}),l.jsx("div",{className:"jd-timeline",children:f===void 0?l.jsx("div",{className:"empty",children:"正在读取执行过程…"}):f.rows.length||f.thinking?l.jsxs(l.Fragment,{children:[sf(f.rows,m,o).rows.map(p=>l.jsx(DT,{step:p,cwd:n.job.cwd},p.id)),sf(f.rows,m,o).remaining?l.jsx("div",{className:"jd-tool",children:l.jsxs("button",{className:"jd-tool-head",onClick:()=>c(!0),children:[l.jsx("span",{className:"ico",children:l.jsx(V,{name:"more",size:14})}),l.jsxs("span",{className:"tt",children:["还有 ",sf(f.rows,m,o).remaining," 步"]})]})}):null,f.thinking?l.jsx($T,{text:f.thinking}):null]}):l.jsx("div",{className:"empty",children:"还没有执行步骤。"})}),a?l.jsx(GT,{jobId:n.job.id}):null]})}function RT({job:n}){const[a,r]=y.useState(""),o=a.trim().length>0,c=()=>{if(!o)return;const f=a.trim();r(""),Sf(n.id,f).then(h=>{h||r(m=>m||f)})};return l.jsxs("div",{className:"jd-foot",children:[l.jsx("input",{value:a,placeholder:Fi(n)?"补充说明或更正方向":"接着说…",onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.nativeEvent.isComposing&&c()}}),l.jsx("button",{className:"pbtn solid",disabled:!o,onClick:c,children:"发送"}),n.status==="running"?l.jsx("button",{className:"pbtn",onClick:()=>void t0(n.id),children:"停止"}):null]})}function DT({step:n,cwd:a}){const[r,o]=y.useState(!1),c=Dn(r,180);if(n.kind==="text")return n.from==="user"?l.jsxs("div",{className:`jd-mine${n.queued?" queued":""}`,children:[n.text,n.queued?l.jsx("div",{className:"jd-mine-note",children:"已送达,当前这一步做完后读取"}):null]}):l.jsxs("div",{className:"jd-textrow",children:[n.thinking?l.jsx(I0,{text:n.thinking,open:!1}):null,l.jsx(Ua,{className:"jd-text",text:n.text??""})]});const f=n.title??n.name??"",h=fw(f);return l.jsxs("div",{className:`jd-tool${n.isError?" bad":""}${r?" open":""}`,children:[l.jsxs("button",{className:"jd-tool-head",onClick:()=>o(m=>!m),children:[l.jsx("span",{className:"ico",children:n.running?l.jsx(V,{name:"spin",size:14,className:"spin"}):l.jsx(V,{name:OT[n.name??""]??(/^(lore|memory)_/.test(n.name??"")?"mem":"more"),size:14})}),l.jsx("span",{className:"tt",children:h.map((m,p)=>l.jsx("span",{className:m.mono?"mono":void 0,children:m.text},p))}),n.thinking?l.jsx("span",{className:"blb",title:"有思考过程",children:l.jsx(V,{name:"bulb",size:13})}):null,l.jsx("span",{className:"tm",children:n.isError?"出错":n.durationMs&&n.durationMs>=1e3?_l(n.durationMs):""}),l.jsx(V,{name:r?"down":"chev",size:13})]}),l.jsx("div",{className:`expand${r?" open":""}`,inert:!r,children:l.jsx("div",{children:c.mounted?l.jsx(LT,{step:n,cwd:a}):null})})]})}function I0({text:n,open:a}){const[r,o]=y.useState(a);return l.jsxs("div",{className:"jd-think-in",children:[l.jsxs("button",{className:"jd-think-head",title:r?"收起思考过程":"展开思考过程",onClick:()=>o(c=>!c),children:[l.jsx("span",{className:"ico",children:l.jsx(V,{name:"bulb",size:13})}),l.jsx("span",{className:"tt",children:"思考过程"}),l.jsx(V,{name:r?"down":"chev",size:12})]}),r?l.jsx("div",{className:"jd-think-body",children:n}):null]})}function $T({text:n}){const[a,r]=y.useState(!1);return l.jsxs("div",{className:"jd-think",children:[l.jsxs("button",{onClick:()=>r(o=>!o),children:[l.jsx("span",{className:"ico",children:l.jsx(V,{name:"bulb",size:14})}),l.jsx("span",{className:"tt",children:"思考中"}),l.jsx(V,{name:a?"down":"chev",size:13})]}),a?l.jsx("div",{className:"jd-think-body",children:n}):null]})}function UT(n){const a=n.args?.edits;return Array.isArray(a)?a.map(r=>({oldText:String(r?.oldText??""),newText:String(r?.newText??"")})):[]}function $f({path:n,cwd:a}){if(!n)return null;const r=n.startsWith("/")?n:a?`${a.replace(/\/+$/,"")}/${n}`:null;return r?l.jsx("button",{className:"jd-kv mono jd-path",title:r,onClick:()=>Tt(r),children:n}):l.jsx("div",{className:"jd-kv mono",children:n})}function LT({step:n,cwd:a}){const r=n.args??{},o=UT(n);return l.jsxs("div",{className:"jd-tool-body",children:[n.thinking?l.jsx(I0,{text:n.thinking,open:!0}):null,o.length?l.jsxs(l.Fragment,{children:[l.jsx($f,{path:String(r.path??""),cwd:a}),o.map((c,f)=>l.jsx(BT,{before:c.oldText,after:c.newText},f))]}):l.jsx(HT,{step:n,args:r,cwd:a}),n.output?l.jsx(Uf,{text:n.output,className:"jd-out mono"}):null,n.outputPath?l.jsxs("button",{className:"jd-file",onClick:()=>Tt(n.outputPath),children:[l.jsx(V,{name:"doc",size:12}),"完整输出"]}):null]})}function HT({step:n,args:a,cwd:r}){if(n.name==="bash")return l.jsx(Uf,{text:String(a.command??""),className:"jd-arg mono",lines:8});if(n.name==="write")return l.jsxs("div",{className:"jd-kv-wrap",children:[l.jsx($f,{path:String(a.path??""),cwd:r}),l.jsxs("span",{className:"jd-kv-len",children:[String(a.contentLength??0)," 字"]})]});if(n.name==="read"||n.name==="ls"||n.name==="edit")return l.jsx($f,{path:String(a.path??""),cwd:r});const o=JSON.stringify(a,null,2);return o==="{}"?null:l.jsx(Uf,{text:o,className:"jd-arg mono",lines:6})}function BT({before:n,after:a}){const[r,o]=y.useState(!1),c=rw(n,a),f=r?c:c.slice(0,24);return l.jsxs("div",{className:"jd-diff",children:[f.map((h,m)=>l.jsxs("div",{className:`dl ${h.sign==="-"?"del":h.sign==="+"?"add":""}`,children:[l.jsx("span",{className:"sg",children:h.sign}),l.jsx("span",{className:"mono",children:h.text||" "})]},m)),c.length>f.length?l.jsxs("button",{className:"jd-more",onClick:()=>o(!0),children:["展开全部 ",c.length," 行"]}):null]})}function Uf({text:n,className:a,lines:r=12}){const[o,c]=y.useState(!1),f=n.split(`
|
|
263
|
+
`).length;return l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:`${a}${o?" all":""}`,style:o?void 0:{maxHeight:`${r*1.6}em`},children:n}),f>r?l.jsx("button",{className:"jd-more",onClick:()=>c(!o),children:o?"收起":`展开全部 ${f} 行`}):null]})}function qT({job:n}){return n.summary?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"报告"}),l.jsx(Ua,{className:"jd-report",text:n.summary})]}):null}function IT({job:n}){const a=[...new Set(n.files??[])];return a.length?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"产出文件"}),l.jsx("div",{className:"jd-files",children:a.map(r=>l.jsx(YT,{path:r},r))})]}):null}function YT({path:n}){const[a,r]=y.useState(),[o,c]=y.useState("");return y.useEffect(()=>{let f=!0;return sh(n).then(h=>{f&&r(h.size)}).catch(h=>{f&&c(h instanceof Error?h.message:String(h))}),()=>{f=!1}},[n]),l.jsxs("button",{className:"jd-file-row",onClick:()=>Tt(n),children:[l.jsx(V,{name:Ml(n),size:18}),l.jsx("span",{children:n.split("/").pop()}),o?l.jsx("small",{title:o,children:"大小读取失败"}):a!==void 0?l.jsx("small",{children:Ba(a)}):null]})}function GT({jobId:n}){const[a,r]=y.useState(!1),[o,c]=y.useState(),[f,h]=y.useState(""),[m,p]=y.useState(0);return y.useEffect(()=>{let v=!0;return h(""),c0(n).then(x=>{v&&c(x)}).catch(x=>{v&&h(x instanceof Error?x.message:String(x))}),()=>{v=!1}},[n,m]),o&&!o.total&&!f?null:l.jsxs("div",{className:"jd-directory",children:[l.jsxs("button",{className:"jd-directory-head",onClick:()=>r(!a),children:[l.jsx(V,{name:a?"down":"chev",size:15}),"工作目录",o?` · ${o.fileCount} 个文件、${o.directoryCount} 个文件夹`:""]}),f?l.jsxs("div",{className:"jd-dir-error",children:[f," ",l.jsx("button",{className:"jd-more",onClick:()=>p(m+1),children:"重试"})]}):null,a&&o?l.jsx(Y0,{jobId:n,view:o}):null]})}function Y0({jobId:n,view:a}){return l.jsxs("div",{className:"jd-files",children:[a.files.map(r=>r.type==="file"?l.jsxs("button",{className:"jd-file-row",onClick:()=>Tt(r.path),children:[l.jsx(V,{name:Ml(r.name),size:18}),l.jsx("span",{children:r.name}),l.jsx("small",{children:Ba(r.size)})]},r.rel):l.jsx(KT,{jobId:n,entry:r},r.rel)),a.total>a.files.length?l.jsxs("div",{className:"jd-dir-more",children:["还有 ",a.total-a.files.length," 项"]}):null]})}function KT({jobId:n,entry:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(),[h,m]=y.useState(""),[p,v]=y.useState(0);return y.useEffect(()=>{if(!r||c)return;let x=!0;return m(""),c0(n,a.rel).then(b=>{x&&f(b)}).catch(b=>{x&&m(b instanceof Error?b.message:String(b))}),()=>{x=!1}},[r,c,n,a.rel,p]),l.jsxs("div",{children:[l.jsxs("button",{className:"jd-file-row",onClick:()=>o(!r),children:[l.jsx(V,{name:r?"down":"chev",size:14}),l.jsx(V,{name:"folder",size:18}),l.jsx("span",{children:a.name}),l.jsxs("small",{children:[a.count," 项"]})]}),r?l.jsx("div",{className:"jd-dir-child",children:h?l.jsxs("div",{className:"jd-dir-error",children:[h," ",l.jsx("button",{className:"jd-more",onClick:()=>v(p+1),children:"重试"})]}):c?l.jsx(Y0,{jobId:n,view:c}):l.jsx("div",{className:"jd-dir-more",children:"正在读取…"})}):null]})}function XT(){const n=je(),a=n.worklog,r=a?.assistantId??null,o=a?.status??null;return l.jsxs("div",{className:"jdbody",onScroll:c=>{const f=c.currentTarget;a?.hasMore&&!a.loading&&f.scrollHeight-f.scrollTop-f.clientHeight<100&&Ex()},children:[l.jsxs("div",{className:"jd-filters",children:[l.jsxs("select",{className:"pick",value:r??"",onChange:c=>void Tf({assistantId:c.target.value||null,status:o}),children:[l.jsx("option",{value:"",children:"全部助手"}),n.assistants.map(c=>l.jsx("option",{value:c.id,children:c.name},c.id))]}),l.jsxs("select",{className:"pick",value:o??"",onChange:c=>void Tf({assistantId:r,status:c.target.value||null}),children:[l.jsx("option",{value:"",children:"全部状态"}),MT.map(c=>l.jsx("option",{value:c,children:q0[c].text},c))]}),l.jsx("span",{className:"sp"}),a?l.jsxs("span",{className:"dim",children:[a.jobs.length," 个"]}):null]}),a===null?l.jsx("div",{className:"empty",children:"正在读取任务记录…"}):a.jobs.length?l.jsx("div",{className:"jd-rows",children:a.jobs.map(c=>{const f=n.jobs[c.id]??c,h=n.assistants.find(m=>m.id===f.assistantId);return l.jsxs("button",{className:"jd-row",onClick:()=>{h&&Xt(f.assistantId,!0,!0),$n(f.id)},children:[h?l.jsx(it,{sprite:h.sprite,prop:h.prop,size:26}):l.jsx("span",{style:{width:26}}),l.jsx("span",{className:"n",children:f.title}),l.jsx(hc,{job:f}),l.jsx("span",{className:"tm",children:Kt(f.startedAt??f.createdAt)}),l.jsx("span",{className:"du",children:f.durationMs!==void 0?_l(f.durationMs):Fi(f)?rr(f.startedAt??f.createdAt):""})]},f.id)})}):l.jsx("div",{className:"empty",children:"没有符合条件的任务。"}),a?.hasMore?l.jsx("button",{className:"pbtn jd-morebtn",onClick:()=>void Ex(),children:a.loading?"正在读取…":"加载更多"}):null]})}function VT(){const n=je(),[a,r]=y.useState(""),[o,c]=y.useState(!1);y.useEffect(()=>{if(!n.error)return;c(!0);const h=window.setTimeout(()=>c(!1),260);return()=>window.clearTimeout(h)},[n.error]);const f=()=>{a&&uN(a)};return l.jsx("div",{className:"login",children:l.jsxs("div",{className:"card",children:[l.jsx(it,{sprite:"hob",size:88,free:!0,motion:"home"}),l.jsx("div",{className:"nm",children:"Hob"}),l.jsx("div",{className:"ds",children:"请输入密码"}),l.jsx("label",{className:`field${o?" shake":""}`,children:l.jsx("input",{type:"password",autoFocus:!0,value:a,placeholder:"密码",onChange:h=>r(h.target.value),onKeyDown:h=>{h.key==="Enter"&&f()}})}),l.jsx("button",{className:"btn solid",onClick:f,disabled:n.loggingIn,children:n.loggingIn?"正在登录…":"登录"}),n.error?l.jsx("div",{className:"err",style:{width:"100%"},children:n.error}):null]})})}const ZT=[["","全部类型"],["image","图片"],["document","文档"],["table","表格"],["page","网页"],["other","其他"]],QT=n=>`删除知识库「${n}」?直接上传到这里、又不在别的知识库里的文件会一起删除,其余文件只是移出。`;function mc(n="right"){const[a,r]=y.useState(null),o=y.useRef(null);return y.useLayoutEffect(()=>{if(!a||!o.current)return;const c=a.anchor.getBoundingClientRect(),f=o.current.getBoundingClientRect(),h=n==="left"?c.left:c.right-f.width;o.current.style.left=`${Math.max(8,Math.min(h,window.innerWidth-f.width-8))}px`,o.current.style.top=`${Math.max(8,Math.min(c.bottom+4,window.innerHeight-f.height-8))}px`}),y.useEffect(()=>{if(!a)return;const c=m=>{!o.current?.contains(m.target)&&!a.anchor.contains(m.target)&&r(null)},f=m=>{m.key==="Escape"&&(m.stopPropagation(),r(null))},h=m=>{o.current?.contains(m.target)||r(null)};return document.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",f,!0),document.addEventListener("scroll",h,!0),()=>{document.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",f,!0),document.removeEventListener("scroll",h,!0)}},[a]),{menu:a,box:o,close:()=>r(null),toggle:(c,f)=>r(h=>h?.id===c?null:{id:c,anchor:f})}}function cc({initial:n="",label:a,save:r,cancel:o}){const[c,f]=y.useState(n),[h,m]=y.useState(!1);return l.jsx("form",{className:"knowledge-name",onSubmit:p=>{p.preventDefault(),!(!c.trim()||h)&&(m(!0),r(c.trim()).then(v=>{v?o():m(!1)}))},children:l.jsx("input",{autoFocus:!0,"aria-label":a,value:c,disabled:h,onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),o())}})})}function JT({collections:n,selected:a,narrow:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),m=mc(),p=n.find(v=>v.id===m.menu?.id);return l.jsxs("nav",{className:r?"knowledge-categories":"setnav","aria-label":"知识库分类",children:[!r&&l.jsx("div",{className:"setnavtitle",children:"知识库"}),[["all","全部"],["output","助手产出"],["chat","对话上传"]].map(([v,x])=>l.jsx("div",{children:l.jsx("button",{className:`navrow${a===v?" sel":""}`,onClick:()=>Nl({category:v}),children:x})},v)),!r&&l.jsx("div",{className:"knowledge-label",children:"我的知识库"}),n.map(v=>l.jsxs("div",{className:`knowledge-category${m.menu?.id===v.id?" menu-open":""}${a===v.id?" selected":""}`,onContextMenu:x=>{x.preventDefault();const b=x.currentTarget.querySelector(".category-dots");b&&m.toggle(v.id,b)},children:[f===v.id?l.jsx(cc,{initial:v.name,label:"知识库名称",save:x=>ON(v.id,x),cancel:()=>h(null)}):l.jsxs("button",{className:`navrow${a===v.id?" sel":""}`,onClick:()=>Nl({category:v.id}),children:[l.jsx("span",{children:v.name}),l.jsx("span",{className:"knowledge-count",children:v.count})]}),l.jsx("button",{className:"knowledge-dots category-dots","aria-label":`${v.name}的操作`,onClick:x=>m.toggle(v.id,x.currentTarget),children:l.jsx(V,{name:"more",size:18})})]},v.id)),l.jsx("div",{children:o?l.jsx(cc,{label:"新知识库名称",save:async v=>!!await i0(v),cancel:()=>c(!1)}):l.jsx("button",{className:"navrow knowledge-new",onClick:()=>c(!0),children:"+ 新建"})}),!r&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sp"}),l.jsx("button",{className:"navrow",onClick:Qi,children:"返回 Hob"})]}),p&&nr.createPortal(l.jsxs("div",{className:"amenu knowledge-popup",ref:m.box,children:[l.jsx("button",{onClick:()=>{m.close(),h(p.id)},children:"改名"}),l.jsx("button",{onClick:()=>{m.close(),window.confirm(QT(p.name))&&_N(p.id)},children:"删除"})]}),document.body)]})}function PT({knowledge:n,assistants:a,uploading:r,upload:o}){const[c,f]=y.useState(n.q),[h,m]=y.useState(!1),p=y.useRef(null),v=n.collections.some(x=>x.id===n.category);return y.useEffect(()=>{if(h||c===n.q)return;const x=window.setTimeout(()=>Nl({q:c}),250);return()=>window.clearTimeout(x)},[c,h,n.q]),l.jsxs("div",{className:"knowledge-filters",children:[l.jsxs("label",{className:"knowledge-search",children:[l.jsx(V,{name:"search",size:16}),l.jsx("input",{placeholder:"搜索知识库",value:c,onChange:x=>f(x.target.value),onCompositionStart:()=>m(!0),onCompositionEnd:x=>{f(x.currentTarget.value),m(!1)}})]}),l.jsx("select",{"aria-label":"类型",value:n.kind,onChange:x=>Nl({kind:x.target.value}),children:ZT.map(([x,b])=>l.jsx("option",{value:x,children:b},x))}),l.jsxs("select",{"aria-label":"助手",value:n.assistantId,onChange:x=>Nl({assistantId:x.target.value}),children:[l.jsx("option",{value:"",children:"全部助手"}),a.map(x=>l.jsx("option",{value:x.id,children:x.name},x.id))]}),v&&l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:p,type:"file",multiple:!0,hidden:!0,onChange:x=>{o(Array.from(x.target.files??[])),x.target.value=""}}),l.jsx("button",{className:"knowledge-upload",disabled:r,onClick:()=>p.current?.click(),children:r?"正在上传…":"上传"})]})]})}function FT({entry:n,collections:a}){return l.jsx(l.Fragment,{children:a.map(r=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:n.collections.includes(r.id),onChange:o=>{const c=o.target.checked?[...n.collections,r.id]:n.collections.filter(f=>f!==r.id);Jo(n.id,{collections:c})}}),r.name]},r.id))})}function WT({entry:n,collections:a,category:r,join:o,rename:c,remove:f,confirm:h}){return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:o,children:"加入知识库"}),l.jsx("button",{onClick:c,children:"改名"}),l.jsx("a",{href:Ut(n.path),download:n.name,children:"下载"}),a.some(m=>m.id===r)&&l.jsx("button",{onClick:f,children:"移出这个知识库"}),l.jsx("button",{onClick:h,children:"删除"})]})}function eC({entry:n,collections:a,assistants:r,selected:o,category:c}){const f=mc(),[h,m]=y.useState(!1),[p,v]=y.useState(!1),[x,b]=y.useState(!1),N=Db(n.kind),w=r.find(z=>z.id===n.source?.assistantId),T=n.source,E=n.index?.state==="queued"||n.index?.state==="indexing"?"正在建索引…":n.index?.state==="failed"?`未能建索引:${n.index.error||"未知原因"}`:n.index?.state==="unsupported"?"这类文件还不能建索引":"",A=[n.origin==="upload"?"上传":w?.name,Kt(n.updatedAt),Ba(n.size),n.versions?.length?`第 ${n.versions.length+1} 版`:"",E].filter(Boolean).join(" · ");return l.jsxs("div",{className:`knowledge-row${o?" selected":""}`,children:[l.jsxs("div",{className:"knowledge-open",role:"button",tabIndex:0,onClick:()=>{x||Tt(n.path,n.name)},onKeyDown:z=>{!x&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),Tt(n.path,n.name))},children:[l.jsx("span",{className:"knowledge-thumb",children:N==="image"?l.jsx("img",{src:zl(n.path),alt:""}):l.jsx(V,{name:N==="table"?"table":N==="page"?"globe":"doc",size:24})}),l.jsxs("div",{className:"knowledge-info",children:[x?l.jsx(cc,{initial:n.name,label:"文件名称",save:z=>Jo(n.id,{name:z}),cancel:()=>b(!1)}):l.jsx("strong",{children:n.name}),n.snippet||n.description?l.jsx("span",{className:"knowledge-description",children:n.snippet||n.description}):null,l.jsxs("span",{className:"knowledge-meta",children:[l.jsx("span",{className:"knowledge-meta-text",children:A}),l.jsx("span",{className:"knowledge-tags",children:n.collections.map(z=>{const U=a.find($=>$.id===z);return U?l.jsx("span",{children:U.name},z):null})})]})]})]}),T&&(T.itemId||T.jobId)?l.jsx("button",{className:"knowledge-source",onClick:()=>{T.itemId?$N(T.assistantId,T.itemId):T.jobId&&(Qi(),$n(T.jobId))},children:"出处"}):null,l.jsx("div",{className:"knowledge-actions",children:l.jsx("button",{className:"knowledge-dots","aria-label":`${n.name}的操作`,onClick:z=>{f.toggle(n.id,z.currentTarget),m(!1)},children:l.jsx(V,{name:"more",size:18})})}),f.menu&&nr.createPortal(l.jsx("div",{className:"amenu knowledge-popup",ref:f.box,children:h?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"knowledge-menu-title",children:"加入知识库"}),l.jsx(FT,{entry:n,collections:a}),p?l.jsx(cc,{label:"新知识库名称",save:async z=>{const U=await i0(z,!1);return!!U&&await Jo(n.id,{collections:[...n.collections,U.id]})},cancel:()=>v(!1)}):l.jsx("button",{onClick:()=>v(!0),children:"+ 新建知识库"})]}):l.jsx(WT,{entry:n,collections:a,category:c,join:()=>m(!0),rename:()=>{f.close(),b(!0)},remove:()=>{f.close(),Jo(n.id,{collections:n.collections.filter(z=>z!==c)})},confirm:()=>{f.close(),window.confirm(`删除「${n.name}」?会从所有知识库里移除,不能恢复。`)&&RN(n.id)}})}),document.body)]})}function tC({knowledge:n,assistants:a,previewPath:r,upload:o}){const c=n.collections.some(h=>h.id===n.category),f=n.category==="output"&&!n.q?"还没有助手产出。助手交给你的文件、图片和页面会自动收在这里。":n.category==="chat"&&!n.q?"还没有对话上传的文件。":n.q?"没有找到匹配的资料。":"这里还没有资料。";return l.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&&zt(!0)},children:[n.error?l.jsxs("div",{className:"knowledge-empty",children:["加载失败:",n.error," ",l.jsx("button",{onClick:()=>void zt(),children:"重试"})]}):!n.entries.length&&!n.loading?l.jsx("div",{className:"knowledge-empty",children:f}):null,n.entries.map(h=>l.jsx(eC,{entry:h,collections:n.collections,assistants:a,selected:h.path===r,category:n.category},h.id)),n.loading?l.jsx("div",{className:"knowledge-empty",children:"正在加载…"}):null,n.hasMore&&!n.loading?l.jsx("button",{className:"knowledge-more",onClick:()=>void zt(!0),children:"加载更多"}):null]})}function nC({collectionId:n,collections:a,assistants:r,busy:o,setBusy:c}){return l.jsx(l.Fragment,{children:r.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:f.knowledge?.includes(n)??!1,disabled:o,onChange:()=>{const h=(f.knowledge??[]).filter(m=>a.some(p=>p.id===m));c(!0),lc(f.id,{knowledge:h.includes(n)?h.filter(m=>m!==n):[...h,n]}).finally(()=>c(!1))}}),f.name]},f.id))})}function sC({id:n,busy:a,setBusy:r}){return l.jsx("button",{disabled:a,onClick:()=>{r(!0),eN(n).then(()=>zt(!1,!0)).catch(o=>La(`重试失败:${o instanceof Error?o.message:String(o)}`)).finally(()=>r(!1))},children:"重试"})}function lC({collection:n,collections:a,assistants:r,embedding:o}){const c=mc("left"),f=r.filter(p=>p.knowledge?.includes(n.id)),[h,m]=y.useState(!1);return l.jsxs("div",{className:"knowledge-status",children:[l.jsxs("div",{children:[f.length?`给 ${f.map(p=>p.name).join("、")} 用`:l.jsx("strong",{children:"还没有助手用这个库"})," · ",l.jsx("button",{onClick:p=>c.toggle(n.id,p.currentTarget),children:f.length?"修改":"选择助手"})]}),c.menu&&nr.createPortal(l.jsx("div",{className:"amenu knowledge-popup",ref:c.box,children:l.jsx(nC,{collectionId:n.id,collections:a,assistants:r,busy:h,setBusy:m})}),document.body),l.jsxs("div",{children:["已建索引 ",n.indexed??0,"/",n.count-(n.unsupported??0),(n.failed??0)>0?l.jsxs(l.Fragment,{children:[" · ",n.failed," 个失败 · ",l.jsx(sC,{id:n.id,busy:h,setBusy:m})]}):null,o?null:l.jsxs(l.Fragment,{children:[" · 只按关键词查 · ",l.jsx("button",{onClick:()=>{fc(),Sl("knowledge")},children:"去设置向量模型"})]})]})]})}function aC({narrow:n,leaving:a}){const r=je(),o=r.knowledge,c=r.panelStack.at(-1),f=c?.kind==="file"?c:null,[h,m]=y.useState(!1),p=v=>{!v.length||h||(m(!0),DN(o.category,v).finally(()=>m(!1)))};return y.useEffect(()=>{if(r.page!=="knowledge"||f)return;const v=x=>{x.key==="Escape"&&Qi()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[r.page,f]),l.jsxs("main",{className:`setpage knowledge${n?" narrow":""}${f&&!n?" has-preview":""}${f?.full&&!n?" preview-full":""}${a?" leaving":""}`,children:[n?l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"ib",title:"返回",onClick:Qi,children:l.jsx(V,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"知识库"})]}):null,l.jsx(JT,{collections:o.collections,selected:o.category,narrow:n}),l.jsxs("section",{className:"knowledge-main",children:[l.jsx(PT,{knowledge:o,assistants:r.assistants,uploading:h,upload:p}),o.collections.find(v=>v.id===o.category)?l.jsx(lC,{collection:o.collections.find(v=>v.id===o.category),collections:o.collections,assistants:r.assistants,embedding:r.settings.settings.knowledge?.embedding.source==="openai"}):null,l.jsx(tC,{knowledge:o,assistants:r.assistants,previewPath:f?.path,upload:p})]}),!n&&f?l.jsx("aside",{className:"knowledge-preview",children:l.jsx(Bi,{embedded:!0})}):null]})}const iC=5,rC=24*3600*1e3;function Ki(n,a){const r=a.trim();return r?n.name.includes(r)||n.duty.includes(r)||(n.last?.text??"").includes(r):!0}function rb(n,a){return(a.last?.at??"").localeCompare(n.last?.at??"")}const ob=n=>n.status==="running"||n.status==="queued"||n.status==="waiting";function oC(n,a){return(a.startedAt??a.createdAt).localeCompare(n.startedAt??n.createdAt)}function cC(n,a){return(a.endedAt??a.createdAt).localeCompare(n.endedAt??n.createdAt)}function cb(n){const a=gh(n.schedules[0]??"");return a.kind==="raw"?1440:a.hour*60+a.minute}function uC(n,a=Date.now()){const r=n.query.trim().length>0,o=new Date(a-rC).toISOString(),c=Object.values(n.jobs),f=n.assistants.filter(w=>w.pinned&&!w.hidden&&Ki(w,n.query)),h=n.assistants.filter(w=>!w.pinned&&!w.hidden&&Ki(w,n.query)).sort(rb),m=n.assistants.filter(w=>w.hidden&&Ki(w,n.query)).sort(rb),p=r?[]:Object.values(n.approvals).filter(w=>w.status==="pending").sort((w,T)=>T.createdAt.localeCompare(w.createdAt)),v=r?[]:c.filter(ob).sort(oC),x=r?[]:c.filter(w=>!ob(w)&&(w.endedAt??w.createdAt)>o).sort(cC).slice(0,iC),b=r?[]:n.routines.filter(w=>w.active).sort((w,T)=>cb(w)-cb(T)),N=!r&&!p.length&&!v.length&&!h.length&&!m.length&&!x.length&&!b.length;return{searching:r,pins:f,rows:h,hidden:m,asks:p,live:v,recent:x,routines:b,empty:N}}function At(n,a,r,o,c,f,h,m){return At.fromTZ(At.tp(n,a,r,o,c,f,h),m)}At.fromTZISO=(n,a,r)=>At.fromTZ(dC(n,a),r);At.fromTZ=function(n,a){let r=new Date(Date.UTC(n.y,n.m-1,n.d,n.h,n.i,n.s)),o=gf(n.tz,r),c=new Date(r.getTime()-o),f=gf(n.tz,c);if(f-o===0)return c;{let h=new Date(r.getTime()-f),m=gf(n.tz,h);if(m-f===0||!a&&m-f>0)return h;if(a)throw new Error("Invalid date passed to fromTZ()");return c}};At.toTZ=function(n,a){let r=n.toLocaleString("en-US",{timeZone:a}).replace(/[\u202f]/," "),o=new Date(r);return{y:o.getFullYear(),m:o.getMonth()+1,d:o.getDate(),h:o.getHours(),i:o.getMinutes(),s:o.getSeconds(),tz:a}};At.tp=(n,a,r,o,c,f,h)=>({y:n,m:a,d:r,h:o,i:c,s:f,tz:h});function gf(n,a=new Date){let r=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} ${r}`)}function dC(n,a){let r=new Date(Date.parse(n));if(isNaN(r))throw new Error("minitz: Invalid ISO8601 passed to parser.");let o=n.substring(9);return n.includes("Z")||o.includes("-")||o.includes("+")?At.tp(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):At.tp(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),a)}At.minitz=At;var xh=32,Xi=31|xh,G0=[1,2,4,8,16],ub=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 yn(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,Xi),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(n,a,r,o){let c=this[n],f=n==="day"&&this.lastDayOfMonth;if(a===""&&!f)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],r,o);else a.indexOf("-")!==-1&&a.indexOf("/")!==-1?this.handleRangeWithStepping(a,n,r,o):a.indexOf("-")!==-1?this.handleRange(a,n,r,o):a.indexOf("/")!==-1?this.handleStepping(a,n,r,o):a!==""&&this.handleNumber(a,n,r,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,r,o){let c=this.extractNth(n,a),f=parseInt(c[0],10)+r;if(isNaN(f))throw new TypeError("CronPattern: "+a+" is not a number: '"+n+"'");this.setPart(a,f,c[1]||o)}setPart(n,a,r){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,r);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]=r}handleRangeWithStepping(n,a,r,o){let c=this.extractNth(n,a),f=c[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(f===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+n+"'");let[,h,m,p]=f,v=parseInt(h,10)+r,x=parseInt(m,10)+r,b=parseInt(p,10);if(isNaN(v))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(x))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(b))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(b===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(b>this[a].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[a].length+")");if(v>x)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let N=v;N<=x;N+=b)this.setPart(a,N,c[1]||o)}extractNth(n,a){let r=n,o;if(r.includes("#")){if(a!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=r.split("#")[1],r=r.split("#")[0]}return[r,o]}handleRange(n,a,r,o){let c=this.extractNth(n,a),f=c[0].split("-");if(f.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+n+"'");let h=parseInt(f[0],10)+r,m=parseInt(f[1],10)+r;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,r,o){let c=this.extractNth(n,a),f=c[0].split("/");if(f.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+n+"'");f[0]===""&&(f[0]="*");let h=0;f[0]!=="*"&&(h=parseInt(f[0],10)+r);let m=parseInt(f[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]|xh;else if(a===Xi)this.dayOfWeek[n]=Xi;else if(a<6&&a>0)this.dayOfWeek[n]=this.dayOfWeek[n]|G0[a-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${a}, Type: ${typeof a}`)}},db=[31,28,31,30,31,30,31,31,30,31,30,31],ps=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],yn=class K0{tz;ms;second;minute;hour;day;month;year;constructor(a,r){if(this.tz=r,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 K0)this.fromCronDate(a);else throw new TypeError("CronDate: Invalid type ("+typeof a+") passed to CronDate constructor")}isNthWeekdayOfMonth(a,r,o,c){let f=new Date(Date.UTC(a,r,o)).getUTCDay(),h=0;for(let m=1;m<=o;m++)new Date(Date.UTC(a,r,m)).getUTCDay()===f&&h++;if(c&Xi&&G0[h-1]&c)return!0;if(c&xh){let m=new Date(Date.UTC(a,r+1,0)).getUTCDate();for(let p=o+1;p<=m;p++)if(new Date(Date.UTC(a,r,p)).getUTCDay()===f)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 r=At.toTZ(a,this.tz);this.ms=a.getMilliseconds(),this.second=r.s,this.minute=r.i,this.hour=r.h,this.day=r.d,this.month=r.m-1,this.year=r.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>db[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 r=At.fromTZISO(a);this.ms=r.getUTCMilliseconds(),this.second=r.getUTCSeconds(),this.minute=r.getUTCMinutes(),this.hour=r.getUTCHours(),this.day=r.getUTCDate(),this.month=r.getUTCMonth(),this.year=r.getUTCFullYear(),this.apply()}else return this.fromDate(At.fromTZISO(a,this.tz))}findNext(a,r,o,c){let f=this[r],h;o.lastDayOfMonth&&(this.month!==1?h=db[this.month]:h=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let m=!o.starDOW&&r=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let p=this[r]+c;p<o[r].length;p++){let v=o[r][p];if(r==="day"&&o.lastDayOfMonth&&p-c==h&&(v=1),r==="day"&&!o.starDOW){let x=o.dayOfWeek[(m+(p-c-1))%7];if(x&&x&Xi)x=this.isNthWeekdayOfMonth(this.year,this.month,p-c,x)?1:0;else if(x)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${x}`);a.legacyMode&&!o.starDOM?v=v||x:v=v&&x}if(v)return this[r]=p-c,f!==this[r]?2:1}return 3}recurse(a,r,o){let c=this.findNext(r,ps[o][0],a,ps[o][2]);if(c>1){let f=o+1;for(;f<ps.length;)this[ps[f][0]]=-ps[f][2],f++;if(c===3)return this[ps[o][1]]++,this[ps[o][0]]=-ps[o][2],this.apply(),this.recurse(a,r,0);if(this.apply())return this.recurse(a,r,o-1)}return o+=1,o>=ps.length?this:this.year>=3e3?null:this.recurse(a,r,o)}increment(a,r,o){return this.second+=r.interval!==void 0&&r.interval>1&&o?r.interval:1,this.ms=0,this.apply(),this.recurse(a,r,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)):At.fromTZ(At.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function fC(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 yn(n.startAt,n.timezone)),n.stopAt&&(n.stopAt=new yn(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 qi(n){return Object.prototype.toString.call(n)==="[object Function]"||typeof n=="function"||n instanceof Function}function hC(n){return qi(n)}function mC(n){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(n):n&&typeof n.unref<"u"&&n.unref()}var fb=30*1e3,Xo=[],pC=class{name;options;_states;fn;constructor(n,a,r){let o,c;if(qi(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(qi(r))c=r;else if(typeof r=="object")o=r;else if(r!==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=fC(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 ub("* * * * *")},n&&(n instanceof Date||typeof n=="string"&&n.indexOf(":")>0)?this._states.once=new yn(n,this.options.timezone||this.options.utcOffset):this._states.pattern=new ub(n,this.options.timezone),this.name){if(Xo.find(f=>f.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");Xo.push(this)}return c!==void 0&&hC(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 r=[],o=a||this._states.currentRun||void 0;for(;n--&&(o=this.nextRun(o));)r.push(o);return r}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let n=this.nextRun(this._states.currentRun),a=!this._states.paused,r=this.fn!==void 0,o=!this._states.kill;return a&&r&&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 yn||n instanceof Date?a.getTime()-n.getTime():a.getTime()-new yn(n).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let n=Xo.indexOf(this);n>=0&&Xo.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(),r=this.nextRun(this._states.currentRun);return a==null||isNaN(a)||r===null?this:(a>fb&&(a=fb),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),a),this._states.currentTimeout&&this.options.unref&&mC(this._states.currentTimeout),this)}async _trigger(n){if(this._states.blocking=!0,this._states.currentRun=new yn(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){qi(this.options.catch)&&this.options.catch(a,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new yn(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,r=!this._states.paused&&a.getTime()>=n.getTime(),o=this._states.blocking&&this.options.protect;r&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):r&&o&&qi(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(n){let a=!!(n||this._states.currentRun),r=!1;!n&&this.options.startAt&&this.options.interval&&([n,a]=this._calculatePreviousRun(n,a),r=!n),n=new yn(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 yn(n,this.options.timezone||this.options.utcOffset);return!r&&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 r=new yn(void 0,this.options.timezone||this.options.utcOffset),o=n;if(this.options.startAt.getTime()<=r.getTime()){o=this.options.startAt;let c=o.getTime()+this.options.interval*1e3;for(;c<=r.getTime();)o=new yn(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 X0(n,a,r=new Date){let o;for(const c of n)if(c.active)for(const f of c.schedules)try{const h=new pC(f,{timezone:a}).nextRun(r);h&&(!o||h<o.at)&&(o={routine:c,at:h})}catch{}return o}function bh(n,a,r,o){const c=a.filter(f=>f.assistantId===n.id);return r.some(f=>f.status==="pending"&&(f.assistantId===n.id||c.some(h=>h.id===f.jobId)))||c.some(f=>f.status==="waiting")?"等你确认":n.busy||c.some(f=>f.status==="running")||o.some(f=>f.status==="running"&&(f.from===n.id||f.to===n.id))?"执行中":c.some(f=>f.status==="queued")?"排队中":"空闲"}function V0(n,a){const r=n.filter(h=>h.assistantId===a),o=r.filter(h=>["running","queued","waiting"].includes(h.status)).sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0],c=r.filter(h=>!["running","queued","waiting"].includes(h.status)&&h.endedAt).sort((h,m)=>m.endedAt.localeCompare(h.endedAt))[0],f=r.filter(h=>h.status==="running").sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0];return{active:o,running:f,last:c,recent:r.sort((h,m)=>m.createdAt.localeCompare(h.createdAt)).slice(0,5)}}function Z0(n,a,r=new Date){const o=b=>new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"}).format(b),c=o(n),[f,h,m]=o(r).split("-").map(Number),p=new Date(Date.UTC(f,h-1,m+1)).toISOString().slice(0,10),v=new Intl.DateTimeFormat("zh-CN",{timeZone:a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(n);return c===o(r)?`今天 ${v}`:c===p?`明天 ${v}`:`${new Intl.DateTimeFormat("zh-CN",{timeZone:a,month:"numeric",day:"numeric"}).format(n)} ${v}`}function gC(n,a,r=new Date){if(!n.length)return"没有";const o=X0(n,a,r);return o?`${n.length} 个 · ${Z0(o.at,a,r)}`:`${n.length} 个 · ${n.some(c=>c.active)?"无下次执行时间":"已暂停"}`}function vC(n,a,r){return{skills:n?`${n} 个`:"没有",knowledge:a.length?a.join("、"):"未开启",rules:r?`${r} 条`:"没有"}}function xC(n,a=new Date){const r=new Date(a.getFullYear(),a.getMonth(),a.getDate());return r.setDate(r.getDate()-(r.getDay()+6)%7),{week:n.filter(o=>new Date(o.updatedAt)>=r),older:n.filter(o=>new Date(o.updatedAt)<r)}}function bC(n,a=new Date){return`${n.uses?`用过 ${n.uses} 次${n.lastUsedAt?` · 上次${Kt(n.lastUsedAt,a)}`:""}`:"还没用过"} · 第 ${n.version} 版`}function Q0(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 r=yC.exec(a);if(r){let o=r[2];const c=hb(o);if(c){let[f,h]=c;const m=/^(?:ba)?sh\s+-l?c\s+/.exec(f),p=m?hb(f.slice(m[0].length)):void 0;p&&(f=p[0]+p[1]),o=f+h}a=`${r[1]}: ${Q0(o)}`}return a||n.trim()}const yC=/^ssh\s+(?:-[BbcDEeFIiJLlmOoPpQRSWw]\s*\S+\s+|-[46AaCfGgKkMNnqsTtVvXxYy]+\s+)*([^\s'"-]\S*)\s+(.+)$/s;function hb(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 kC(){const n=je(),a=n.sel??"hob",r=n.profiles[a],o=r?.assistant??n.assistants.find(q=>q.id===a),c=n.routines.filter(q=>q.assistantId===a),f=V0(Object.values(n.jobs),a).recent,h=n.assistantSkills[a],[m,p]=y.useState("任务"),[v,x]=y.useState([]),[b,N]=y.useState(!1),[w,T]=y.useState(""),[E,A]=y.useState(!1),[z,U]=y.useState(""),[$,j]=y.useState(!0);y.useEffect(()=>{p("任务"),x([]),N(!1),T(""),gs(a)},[a]),y.useEffect(()=>{MN().catch(q=>U(q instanceof Error?q.message:String(q))).finally(()=>j(!1))},[]),y.useEffect(()=>{if(m!=="文件")return;let q=!0;return A(!0),T(""),Ax(a).then(F=>{q&&(x(F.entries),N(F.hasMore))}).catch(F=>{q&&T(F instanceof Error?F.message:String(F))}).finally(()=>{q&&A(!1)}),()=>{q=!1}},[a,m]);const C=async(q=!1)=>{A(!0),T("");try{const F=await Ax(a,q?void 0:v.at(-1)?.updatedAt);x(q?F.entries:[...v,...F.entries]),N(F.hasMore)}catch(F){T(F instanceof Error?F.message:String(F))}finally{A(!1)}},S=(o?.knowledge??[]).map(q=>n.knowledge.collections.find(F=>F.id===q)?.name).filter(q=>!!q),O=vC(h?.skills.length??0,S,r?.rules.length??0),R=xC(v);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"sidebar-info",children:[l.jsxs("button",{className:"sidebar-instructions",onClick:th,children:[l.jsx("small",{children:"补充说明"}),l.jsx("span",{className:o?.instructions?"":"muted",children:o?.instructions||"添加这个助手特有的做法"}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>qo("routines"),children:[l.jsx(V,{name:"clock",size:15}),l.jsx("span",{children:"定时任务"}),l.jsx("small",{children:gC(c,n.settings.settings.general.timezone)}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>qo("skills"),children:[l.jsx(V,{name:"mem",size:15}),l.jsx("span",{children:"技能"}),l.jsx("small",{children:h?.error?"加载失败":!h||h.loading?"正在加载…":O.skills}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>qo("knowledge"),children:[l.jsx(V,{name:"archive",size:15}),l.jsx("span",{children:"知识库"}),l.jsx("small",{children:z?"加载失败":$?"正在加载…":O.knowledge}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>qo("rules"),children:[l.jsx(V,{name:"rule",size:15}),l.jsx("span",{children:"执行前确认"}),l.jsx("small",{children:O.rules}),l.jsx("b",{children:"›"})]})]}),l.jsx("div",{className:"sidebar-tabs",children:l.jsx("div",{className:"seg",style:{"--seg-count":3,"--seg-index":["任务","文件","日志"].indexOf(m)},children:["任务","文件","日志"].map(q=>l.jsx("button",{className:m===q?"on":"",onClick:()=>p(q),children:q},q))})}),m==="任务"?l.jsxs("div",{className:f.length?"sidebar-list":"sidebar-empty",children:[f.length?f.map(q=>l.jsxs("button",{className:"sidebar-item",onClick:()=>$n(q.id),children:[l.jsx(V,{name:q.status==="running"?"spin":q.status==="done"?"check":q.status==="failed"||q.status==="stuck"?"close":q.status==="stopped"?"stop":"pause",className:q.status==="running"?"spin":"",size:16}),l.jsxs("span",{children:[l.jsxs("strong",{children:[q.routineId?"⏱ ":"",q.title]}),l.jsxs("small",{children:[Kt(q.startedAt??q.createdAt),q.status==="running"||q.status==="waiting"?` · 已进行 ${rr(q.startedAt??q.createdAt)}`:q.durationMs!==void 0?` · 用时 ${_l(q.durationMs)}`:""]})]}),l.jsx("b",{children:"›"})]},q.id)):l.jsx("div",{className:"empty",children:"分派的任务会显示在这里"}),f.length?l.jsx("button",{className:"sidebar-more",onClick:()=>eh(a),children:"全部任务 ›"}):null]}):null,m==="文件"?l.jsxs("div",{className:v.length||E||w?"sidebar-list":"sidebar-empty",children:[[["本周",R.week],["更早",R.older]].map(([q,F])=>F.length?l.jsxs("div",{children:[l.jsx("div",{className:"sidebar-group-label",children:q}),F.map(W=>l.jsxs("button",{className:"sidebar-item",onClick:()=>Tt(W.path,W.name),children:[l.jsx(V,{name:Ml(W.name),size:18}),l.jsxs("span",{children:[l.jsx("strong",{children:W.name}),l.jsxs("small",{children:[Ba(W.size)," · ",Kt(W.updatedAt)]})]}),l.jsx("b",{children:"›"})]},W.id))]},q):null),!v.length&&!E&&!w?l.jsx("div",{className:"empty",children:"还没有产出文件"}):null,w?l.jsxs("div",{className:"badline",children:["加载失败:",w," ",l.jsx("button",{onClick:()=>void C(!v.length),children:"重试"})]}):null,b&&!w?l.jsx("button",{className:"sidebar-more",disabled:E,onClick:()=>void C(),children:"更多"}):null]}):null,m==="日志"?l.jsx("div",{className:r?.worklog.length?"sidebar-list":"sidebar-empty",children:r?.worklog.length?r.worklog.map((q,F)=>l.jsxs("div",{className:"wl",children:[l.jsx("span",{className:"t",children:Kt(q.at)}),l.jsx("span",{children:Tl(q.text)})]},`${q.at}-${F}`)):l.jsx("div",{className:"empty",children:"还没有工作日志"})}):null]})}const Aa=["off","minimal","low","medium","high","xhigh","max"];function J0(n){return n?.thinkingLevels??["off"]}function Wi(n,a){const r=J0(n);if(!n||r.includes(a))return a;const o=Aa.indexOf(a);return[...r].reverse().find(c=>Aa.indexOf(c)<=o)??"off"}function jC(n,a){const r=a.trim().toLowerCase();return r?n.filter(o=>o.name.toLowerCase().includes(r)||o.ref.toLowerCase().includes(r)):n}function wC(n){const a=[];for(const r of n){let o=a.find(c=>c.provider===r.provider);o||(o={provider:r.provider,models:[]},a.push(o)),o.models.push(r)}return a}function NC(){const[n,a]=y.useState({screens:[],profiles:{}});return y.useEffect(()=>{if(Cl){(ec()==="ready"||ec()==="deployed")&&a({screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}],profiles:{hob:"hob"}});return}let r=!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();r&&a(v=>({profiles:p.profiles,screens:o===h?p.screens:v.screens}))}catch{r&&a({screens:[],profiles:{}})}},f=new EventSource("/api/events");return f.onopen=()=>{c()},f.onerror=()=>{r&&a(h=>({...h,screens:[]}))},f.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{}},()=>{r=!1,f.close()}},[]),n}async function VE(n){const a=await fetch(`/api/desktop/screens/${encodeURIComponent(n)}/start`,{method:"POST"});if(!a.ok){const r=await a.json().catch(()=>({}));throw new Error(r.error??"无法启动屏幕。")}}const SC=y.lazy(()=>sr(()=>import("./DesktopView-rVxacveF.js"),[]).then(n=>({default:n.DesktopMini}))),TC=y.lazy(()=>sr(()=>import("./DesktopView-rVxacveF.js"),[]).then(n=>({default:n.DesktopView}))),CC={queued:"排队中",running:"进行中",waiting:"待确认",done:"已完成",stuck:"受阻",failed:"失败",stopped:"已停止"},EC={读:"读取",跑:"运行",改:"修改",写:"写入",搜:"搜索"};function Lf(n){return[EC[n.verb]??n.verb,n.verb==="跑"?Q0(n.text):n.text]}function Hf({mobile:n=!1,page:a}){const r=je(),o=a===void 0?r.panelStack.at(-1):a,c=o&&o.kind!=="job"&&o.kind!=="jobs"&&o.kind!=="file"?o:{kind:"now"},f=c.kind,[h,m]=y.useState(!1),p=r.profiles[r.sel??"hob"]?.assistant??r.assistants.find(x=>x.id===(r.sel??"hob"));y.useEffect(()=>m(!1),[r.sel]);const v=c.kind==="routine"?r.routines.find(x=>x.id===c.id)?.name??"定时任务":f==="newRoutine"?"新建定时任务":f==="routines"?"定时任务":f==="skills"?"技能":f==="knowledge"?"知识库":f==="rules"?"执行前确认":f==="now"?"":"编辑助手";return l.jsxs("aside",{className:"panel",onScroll:x=>{if(f==="now"){const b=x.currentTarget.querySelector(".sidebar-card"),N=x.currentTarget.querySelector(".phead");m(!!b&&!!N&&b.getBoundingClientRect().bottom<=N.getBoundingClientRect().bottom)}},children:[l.jsxs(Pi,{className:"phead",root:f==="now",title:l.jsx("span",{className:"t",children:f==="now"&&h&&p?l.jsxs("span",{className:"sidebar-head-identity",children:[l.jsx(it,{sprite:p.sprite,prop:p.prop,size:24}),p.name]}):v}),children:[f==="now"?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"ib",title:"编辑助手",onClick:th,children:l.jsx(V,{name:"edit",size:17})}),l.jsx("button",{className:"ib panel-close",title:"收起右栏",onClick:UN,children:l.jsx(V,{name:"dbl",size:17})})]}):null,f==="routines"?l.jsx("button",{className:"ib",title:"新建定时任务",onClick:zN,children:l.jsx(V,{name:"plus",size:17})}):null,c.kind==="routine"?l.jsx("button",{className:"pbtn",onClick:()=>void SN(c.id),children:"立即运行"}):null]}),l.jsx("div",{className:`pbody sidebar-page-${f}`,children:f==="routine"?l.jsx(_C,{id:c.kind==="routine"?c.id:""},c.kind==="routine"?c.id:""):f==="newRoutine"?l.jsx(OC,{}):f==="assistant"?l.jsx(qC,{},r.sel??"hob"):f==="routines"?l.jsx(zC,{}):f==="skills"?l.jsx(UC,{aid:r.sel??"hob"}):f==="knowledge"?l.jsx($C,{aid:r.sel??"hob"}):f==="rules"?l.jsx(MC,{aid:r.sel??"hob"}):l.jsxs(l.Fragment,{children:[l.jsx(AC,{}),l.jsx(kC,{})]})})]})}function AC(){const n=je(),a=n.sel??"hob",r=n.profiles[a]?.assistant??n.assistants.find($=>$.id===a),o=Object.values(n.jobs),{running:c,last:f}=V0(o,a),h=r?bh(r,o,Object.values(n.approvals),Object.values(n.delegations)):"空闲",m=X0(n.routines.filter($=>$.assistantId===a),n.settings.settings.general.timezone),p=NC(),v=p.profiles[n.sel??"hob"],x=!!v&&p.screens.some($=>$.id===v&&$.running),[b,N]=y.useState(null),w=x&&n.nowWide,T=(c?.activity??[]).slice(x&&!w?-2:-8),E=T.map($=>`${$.at}|${$.verb}|${$.text}`),A=y.useRef(null);A.current===null&&(A.current=new Set(E));const z=new Set(E.filter($=>!A.current.has($)));y.useEffect(()=>{for(const $ of E)A.current.add($)});const U=($,j,C)=>l.jsxs("button",{className:`screen ${$}`,title:j,onClick:C,children:[T.map((S,O)=>S.verb==="$"?l.jsxs("div",{className:z.has(E[O])?"new":void 0,children:[l.jsx("span",{className:"p",children:"$"})," ",S.text]},E[O]):l.jsxs("div",{className:z.has(E[O])?"new":void 0,children:[l.jsx("span",{className:"v",children:Lf(S)[0]}),Lf(S)[1]]},E[O])),l.jsx("div",{children:l.jsx("span",{className:"cur"})})]});return l.jsxs("div",{className:"sidebar-card",children:[r?l.jsxs("div",{className:"sidebar-identity",children:[l.jsx(it,{sprite:r.sprite,prop:r.prop,size:44}),l.jsxs("span",{children:[l.jsx("strong",{children:r.name}),l.jsx("small",{children:r.duty})]}),l.jsx("em",{className:h!=="空闲"?"active":"",children:h})]}):null,x?l.jsxs("div",{className:"now-desk",children:[l.jsxs("div",{className:"now-screen",children:[l.jsx("button",{className:"now-hit",title:w?"收起":"在侧栏展开","aria-label":w?"收起":"在侧栏展开",onClick:uf}),l.jsx(y.Suspense,{fallback:null,children:l.jsx(SC,{screen:v},v)}),l.jsx("span",{className:"now-live",children:"实时"}),l.jsxs("div",{className:"now-acts",children:[w?l.jsx("button",{className:"now-btn",title:"收起","aria-label":"收起",onClick:uf,children:l.jsx(V,{name:"shrink",size:15})}):null,l.jsx("button",{className:"now-btn",title:"全屏","aria-label":"全屏查看云桌面",onClick:()=>N("view"),children:l.jsx(V,{name:"expand",size:15})}),l.jsxs("button",{className:"now-btn txt",title:"接管云桌面",onClick:()=>N("take"),children:[l.jsx(V,{name:"pointer",size:14}),"接管"]})]})]}),c?U("strip",w?"收起":"在侧栏展开",uf):null]}):null,b&&v?l.jsx(y.Suspense,{fallback:null,children:l.jsx(TC,{initialScreen:v,takeOver:b==="take",onClose:()=>N(null)})}):null,c?l.jsxs(l.Fragment,{children:[x?null:U("jd-open","打开任务详情",()=>$n(c.id)),l.jsxs("div",{className:"caprow",children:[l.jsxs("span",{className:"cap",children:[c.title,c.routineId?" · 定时执行":""," · 已进行 ",rr(c.startedAt??c.createdAt)]}),l.jsx("button",{className:"more",onClick:()=>$n(c.id),children:"任务详情 ›"})]})]}):l.jsxs("div",{className:"sidebar-facts",children:[f?l.jsxs("button",{onClick:()=>$n(f.id),children:["上次 ",l.jsxs("span",{children:[l.jsx(V,{name:f.status==="done"?"check":f.status==="failed"||f.status==="stuck"?"close":"stop",size:14}),l.jsx("span",{children:f.title})]}),l.jsx("small",{children:Kt(f.endedAt)})]}):null,m?l.jsxs("div",{children:["下一次 ",l.jsxs("span",{children:[l.jsx("span",{"aria-hidden":"true",children:"⏱"}),l.jsx("span",{children:m.routine.name})]}),l.jsx("small",{children:Z0(m.at,n.settings.settings.general.timezone)})]}):null]}),n.sel==="hob"?Object.values(n.delegations).filter($=>$.status==="running"||$.status==="waiting").map($=>{const j=n.assistants.find(C=>C.id===$.to);return l.jsxs("button",{className:"sidebar-delegation",onClick:()=>void Wf("hob",$.id,!1),children:[j?l.jsx(it,{sprite:j.sprite,prop:j.prop,size:22}):null,l.jsxs("span",{children:["交给「",j?.name??$.to,"」"]}),l.jsx("small",{children:$.status==="waiting"?"等你确认":"进行中"})," ›"]},$.id)}):null]})}function zC(){const n=je(),a=n.routines.filter(r=>r.assistantId===(n.sel??"hob"));return l.jsx("div",{className:"sidebar-group sidebar-group-rows",children:a.length?a.map(r=>l.jsxs("button",{className:"sidebar-item",onClick:()=>a0(r.id),children:[l.jsx(V,{name:r.active?"clock":"pause",size:18}),l.jsxs("span",{children:[l.jsx("strong",{children:r.name}),l.jsx("small",{children:r.active?`${vh(r.schedules[0]??"")}${r.runs[0]?` · 上次 ${r.runs[0].status==="done"?"✓":"✗"} ${Kt(r.runs[0].at)}`:""}`:"已暂停"})]}),l.jsx("b",{children:"›"})]},r.id)):l.jsx("div",{className:"empty",children:"这个助手还没有定时任务"})})}function MC({aid:n}){const a=je().profiles[n]?.rules??[];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"note",children:"标为「需确认」的事项,助手执行前会先征求你的同意。"}),l.jsxs("div",{className:"sidebar-group sidebar-group-rows",children:[a.map(r=>l.jsx(HC,{aid:n,rule:r},r.id)),l.jsx(BC,{aid:n})]})]})}function P0({value:n,onSave:a,onRemove:r}){const[o,c]=y.useState(!1),f=gh(n);if(!o)return l.jsxs("button",{className:"w",onClick:()=>c(!0),children:[l.jsx(V,{name:"clock",size:15}),vh(n)]});const h=p=>{const v=f.kind==="raw"?{...f,kind:"daily"}:f;a(P2({...v,...p}))},m=`${String(f.hour).padStart(2,"0")}:${String(f.minute).padStart(2,"0")}`;return l.jsxs("div",{className:"w sched-edit",children:[l.jsxs("select",{value:f.kind,onChange:p=>h({kind:p.target.value}),children:[l.jsx("option",{value:"daily",children:"每天"}),l.jsx("option",{value:"weekly",children:"每周"}),l.jsx("option",{value:"monthly",children:"每月"}),l.jsx("option",{value:"raw",children:"自定义"})]}),f.kind==="weekly"?l.jsx("select",{value:f.weekday,onChange:p=>h({weekday:Number(p.target.value)}),children:A0.map((p,v)=>l.jsxs("option",{value:v,children:["周",p]},v))}):null,f.kind==="monthly"?l.jsx("input",{type:"number",min:1,max:28,value:f.day,onChange:p=>h({day:Number(p.target.value)||1})}):null,f.kind==="raw"?l.jsx("input",{className:"rawcron",value:f.raw,onChange:p=>a(p.target.value)}):l.jsx("input",{type:"time",value:m,onChange:p=>{const[v,x]=p.target.value.split(":").map(Number);h({hour:v||0,minute:x||0})}}),r?l.jsx("button",{className:"pbtn",onClick:r,children:"删除"}):null,l.jsx("button",{className:"pbtn",onClick:()=>c(!1),children:"完成"})]})}function OC(){const n=je(),[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState("0 9 * * *"),[m,p]=y.useState(!0),[v,x]=y.useState(""),[b,N]=y.useState(!1),w=n.sel??"hob";y.useEffect(()=>{gs(w)},[w]);const T=a.trim()!==""&&o.trim()!==""&&!b,E=async()=>{N(!0),await wN({assistantId:n.sel??"hob",name:a.trim(),instruction:o.trim(),schedules:[f],active:m,...v?{skill:v}:{}}),N(!1)};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"sidebar-group",children:l.jsxs("div",{className:"ctl",children:[l.jsx("span",{children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${m?"":" off"}`,title:m?"暂停":"启用",onClick:()=>p(!m)})]})}),l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("label",{className:"field",children:l.jsx("input",{autoFocus:!0,value:a,placeholder:"如「每日简报」",onChange:A=>r(A.target.value)})}),l.jsx("div",{className:"lbl",children:"任务内容"}),l.jsx("label",{className:"field",children:l.jsx("textarea",{rows:4,value:o,placeholder:"到点后交给后台任务执行的内容,写清楚需要什么结果",onChange:A=>c(A.target.value)})}),l.jsx("div",{className:"lbl",children:"执行时间"}),l.jsx("div",{className:"when",children:l.jsx(P0,{value:f,onSave:h})}),l.jsx("div",{className:"lbl",children:"技能"}),n.assistantSkills[w]?.error?l.jsxs("div",{className:"badline",children:["加载失败:",n.assistantSkills[w].error," ",l.jsx("button",{onClick:()=>void gs(w),children:"重试"})]}):null,l.jsx("div",{className:"sidebar-group",children:l.jsxs("select",{className:"pick","aria-label":"技能",value:v,disabled:!n.assistantSkills[w]||n.assistantSkills[w].loading||!!n.assistantSkills[w].error,onChange:A=>x(A.target.value),children:[l.jsx("option",{value:"",children:"不用技能"}),(n.assistantSkills[w]?.skills??[]).filter(A=>A.enabled).map(A=>l.jsx("option",{value:A.name,children:A.title},A.name))]})}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"sp"}),l.jsx("button",{className:"pbtn",onClick:er,children:"取消"}),l.jsx("button",{className:"pbtn solid",disabled:!T,onClick:()=>void E(),children:"创建"})]})]})}function _C({id:n}){const a=je(),r=a.routines.find(c=>c.id===n),o=r?.assistantId;return y.useEffect(()=>{o&&gs(o)},[o]),r?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"sidebar-group",children:l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${r.active?"":" off"}`,title:r.active?"暂停":"启用",onClick:()=>void xl(r.id,{active:!r.active})})]})}),l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("label",{className:"field",children:l.jsx("input",{defaultValue:r.name,onBlur:c=>{const f=c.target.value.trim();f&&f!==r.name&&xl(r.id,{name:f})}})}),l.jsx("div",{className:"lbl",children:"任务内容"}),l.jsx("label",{className:"field",children:l.jsx("textarea",{rows:4,defaultValue:r.instruction,onBlur:c=>{c.target.value!==r.instruction&&xl(r.id,{instruction:c.target.value})}})}),l.jsx("div",{className:"lbl",children:"执行时间"}),l.jsxs("div",{className:"when",children:[r.schedules.map((c,f)=>l.jsx(P0,{value:c,onSave:h=>{const m=r.schedules.slice();m[f]=h,xl(r.id,{schedules:m})},onRemove:r.schedules.length>1?()=>void xl(r.id,{schedules:r.schedules.filter((h,m)=>m!==f)}):void 0},f)),l.jsxs("button",{className:"w",onClick:()=>void xl(r.id,{schedules:[...r.schedules,"0 9 * * *"]}),children:[l.jsx(V,{name:"plus",size:14}),"添加执行时间"]})]}),l.jsx("div",{className:"lbl",children:"技能"}),a.assistantSkills[r.assistantId]?.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.assistantSkills[r.assistantId].error," ",l.jsx("button",{onClick:()=>void gs(r.assistantId),children:"重试"})]}):null,l.jsx("div",{className:"sidebar-group",children:l.jsxs("select",{className:"pick","aria-label":"技能",value:r.skill??"",disabled:!a.assistantSkills[r.assistantId]||a.assistantSkills[r.assistantId].loading||!!a.assistantSkills[r.assistantId].error,onChange:c=>void xl(r.id,{skill:c.target.value||null}),children:[l.jsx("option",{value:"",children:"不用技能"}),r.skill&&!a.assistantSkills[r.assistantId]?.skills.some(c=>c.name===r.skill&&c.enabled)?l.jsx("option",{value:r.skill,disabled:!0,children:r.skill}):null,(a.assistantSkills[r.assistantId]?.skills??[]).filter(c=>c.enabled).map(c=>l.jsx("option",{value:c.name,children:c.title},c.name))]})}),l.jsx("div",{className:"lbl",children:"运行记录"}),l.jsx("div",{className:"sidebar-group sidebar-runs",children:r.runs.length?r.runs.map(c=>{const h=a.jobs[c.jobId]?.status??c.status,m=h==="running"||h==="queued",p=h==="failed"||h==="stuck",v=Z2(c);return l.jsxs("button",{className:`run${p?" bad":""}`,onClick:()=>void AN(r.assistantId,c.jobId),children:[l.jsxs("span",{className:"rt",children:[Kt(c.at),v?l.jsx("small",{children:v}):null]}),l.jsx(V,{name:m?"spin":p?"close":"check",size:16,className:m?"spin":""})]},c.jobId)}):l.jsx("div",{className:"empty",children:"还没有运行记录"})}),l.jsx("div",{className:"sidebar-group sidebar-danger",style:{marginTop:18},children:l.jsx("button",{className:"pbtn danger",onClick:async()=>{window.confirm(`删除定时任务「${r.name}」?已有的运行记录会保留在对话里。`)&&(await NN(r.id),er())},children:"删除定时任务"})})]}):l.jsx("div",{className:"empty",children:"这个定时任务已不存在。"})}function or(n){const[a,r]=y.useState(null),[o,c]=y.useState(!1);return y.useEffect(()=>{if(a!=="已保存")return;const h=setTimeout(()=>r(null),3e3);return()=>clearTimeout(h)},[a]),{save:async h=>{c(!0);const m=await lc(n,h);return c(!1),r(m??"已保存"),!m},busy:o,message:a,fail:h=>r(h)}}function cr({message:n}){return n?l.jsx("div",{role:"status",className:n==="已保存"?"okline":"badline",children:n}):null}function Vo({value:n,multiline:a,placeholder:r,save:o}){const[c,f]=y.useState(n);y.useEffect(()=>f(n),[n]);const h={value:c,placeholder:r,onChange:m=>f(m.target.value),onBlur:()=>{c!==n&&o(c).then(m=>{m||f(n)})},onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),m.currentTarget.blur())}};return l.jsx("label",{className:"field",children:a?l.jsx("textarea",{rows:2,...h}):l.jsx("input",{...h})})}function RC({aid:n}){const a=je(),r=or(n),o=a.profiles[n],[c,f]=y.useState(null);y.useEffect(()=>{Qf().then(f)},[]);const h=a.settings.settings.models.roster;if(!o)return null;const m=o.assistant.models??{},p=a.settings.settings.models,v=A=>c?.models.find(z=>z.ref===A)?.name??A,x=A=>h.find(z=>z.ref===A),b=A=>void r.save({models:A}),N=A=>z=>{const U={...m};if(z){const $=A==="conversation"?p.conversation.thinking:p.work.thinking;U[A]={ref:z,thinking:Wi(c?.models.find(j=>j.ref===z),x(z)?.thinking??$)}}else delete U[A];b(U)},w=m.allowed??[],T=A=>{const z={...m};A.length?z.allowed=A:delete z.allowed,b(z)},E=(A,z)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:A}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:m[z]?.ref??"",onChange:U=>N(z)(U.target.value),children:[l.jsxs("option",{value:"",children:["跟随全局(",v(z==="conversation"?p.conversation.ref:p.work.ref),")"]}),h.map(U=>l.jsx("option",{value:U.ref,children:v(U.ref)},U.ref))]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(cr,{message:r.message}),E("对话模型","conversation"),E("默认任务模型","work"),l.jsx("div",{className:"lbl",children:"可分派的模型"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`pbtn${w.length?"":" solid"}`,onClick:()=>T([]),children:"全部"}),l.jsx("button",{className:`pbtn${w.length?" solid":""}`,onClick:()=>T(h.map(A=>A.ref)),children:"指定"}),l.jsx("span",{className:"note",style:{margin:0},children:w.length?`已选 ${w.length} 个`:`可用模型共 ${h.length} 个`})]}),w.length?l.jsx("div",{className:"chips",style:{marginTop:8},children:h.map(A=>{const z=w.includes(A.ref);return l.jsx("button",{className:`chip${z?" on":""}`,onClick:()=>T(z?w.filter(U=>U!==A.ref):[...w,A.ref]),children:v(A.ref)},A.ref)})}):null]})}function DC({aid:n}){const a=je(),r=or(n),o=a.profiles[n];if(!o)return null;const c=o.assistant.abilities??{exec:!0,write:!0,image:!0},f=a.settings.settings.image.source!=="off",h=p=>void r.save({abilities:{...c,...p}}),m=(p,v,x,b)=>l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:p}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${v?"":" off"}`,title:v?"关闭":"开启",onClick:x})]}),b?l.jsx("div",{className:"note",children:b}):null]});return l.jsxs(l.Fragment,{children:[l.jsx(cr,{message:r.message}),m("执行命令",c.exec,()=>h({exec:!c.exec}),"开启后,任务可以运行命令,并可通过命令访问网络。"),m("修改文件",c.write,()=>h({write:!c.write}),"开启后,任务可以创建和修改文件。"),f?m("图像生成",c.image,()=>h({image:!c.image}),"开启后,任务可以生成图片,图片以缩略图显示在对话中。"):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctl",style:{marginTop:8},children:[l.jsx("span",{style:{fontSize:14,color:"var(--text3)"},children:"图像生成"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"tog off",disabled:!0,title:"需要先在 设置 → 图像生成 中完成配置"})]}),l.jsx("div",{className:"note",children:"需要先在 设置 → 图像生成 中完成配置。"})]}),l.jsx("div",{className:"note",children:"读取文件始终可用。"})]})}function $C({aid:n}){const a=je(),r=or(n);y.useEffect(()=>{zt()},[]);const o=(a.profiles[n]?.assistant.knowledge??[]).filter(c=>a.knowledge.collections.some(f=>f.id===c));return l.jsxs(l.Fragment,{children:[l.jsx(cr,{message:r.message}),a.knowledge.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.knowledge.error," ",l.jsx("button",{onClick:()=>void zt(),children:"重试"})]}):a.knowledge.loading?l.jsx("div",{className:"note",children:"正在加载…"}):a.knowledge.collections.length?l.jsx("div",{className:"sidebar-group sidebar-group-rows",children:a.knowledge.collections.map(c=>l.jsxs("div",{className:"ctl",children:[l.jsx("span",{children:c.name}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${o.includes(c.id)?"":" off"}`,"aria-label":c.name,"aria-pressed":o.includes(c.id),disabled:r.busy,onClick:()=>void r.save({knowledge:o.includes(c.id)?o.filter(f=>f!==c.id):[...o,c.id]})})]},c.id))}):l.jsxs("div",{className:"note",children:["还没有知识库 · ",l.jsx("button",{onClick:nh,children:"去知识库"})]})]})}function UC({aid:n}){const a=je().assistantSkills[n],r=mc();y.useEffect(()=>{gs(n)},[n]);const o=a?.skills.find(c=>c.name===r.menu?.id);return l.jsxs(l.Fragment,{children:[a?.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.error," ",l.jsx("button",{onClick:()=>void gs(n),children:"重试"})]}):!a||a.loading&&!a.skills.length?l.jsx("div",{className:"note",children:"正在加载…"}):a.skills.length?l.jsx("div",{className:"sidebar-group sidebar-group-rows",children:a.skills.map(c=>l.jsxs("div",{className:"assistant-skill",children:[l.jsxs("button",{className:"assistant-skill-info",onClick:()=>Tt(c.path),children:[l.jsx("strong",{children:c.title}),l.jsx("span",{children:c.description}),l.jsx("span",{children:bC(c)})]}),l.jsx("button",{className:`tog${c.enabled?"":" off"}`,"aria-label":c.title,"aria-pressed":c.enabled,onClick:()=>void rf(n,c.name,c.enabled?"disable":"enable")}),l.jsx("button",{className:"knowledge-dots","aria-label":`${c.title}的操作`,onClick:f=>r.toggle(c.name,f.currentTarget),children:l.jsx(V,{name:"more",size:18})})]},c.name))}):l.jsx("div",{className:"note",children:"还没有技能。任务完成后会自动沉淀,也可以在任务详情里点「沉淀成技能」。"}),o&&r.menu&&nr.createPortal(l.jsxs("div",{className:"amenu knowledge-popup",ref:r.box,children:[l.jsx("button",{onClick:()=>{r.close(),Tt(o.path)},children:"查看"}),o.version>1?l.jsx("button",{onClick:()=>{r.close(),rf(n,o.name,"rollback")},children:"回退到上一版"}):null,l.jsx("button",{onClick:()=>{r.close(),window.confirm(`删除「${o.title}」?`)&&rf(n,o.name,"delete")},children:"删除"})]}),document.body)]})}function LC({aid:n,sprite:a,prop:r,onDone:o}){const c=or(n),f=h0(a)??{prop:"hob",color:"slate"},h=m=>{m!==a&&c.save({sprite:m})};return l.jsxs(l.Fragment,{children:[l.jsx(cr,{message:c.message}),l.jsxs("div",{className:"sprite-pick",children:[r?l.jsx("button",{className:f.prop==="custom"?"on":void 0,title:"自画道具",onClick:()=>h(df(f.color)),children:l.jsx(it,{sprite:df(f.color),prop:r,size:34})}):null,XN.map(m=>l.jsx("button",{className:m===f.prop?"on":void 0,title:El[m].label,onClick:()=>h(ff(m,f.color)),children:l.jsx(it,{sprite:ff(m,f.color),size:34})},m))]}),l.jsxs("div",{className:"sprite-colors",children:[VN.map(m=>l.jsx("button",{className:m===f.color?"on":void 0,title:Ra[m].name,style:{background:Ra[m].o},onClick:()=>h(f.prop==="custom"?df(m):ff(f.prop,m))},m)),l.jsx("button",{className:"pbtn",onClick:o,children:"完成"})]})]})}function HC({aid:n,rule:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(a.text),[h,m]=y.useState(!1),[p,v]=y.useState(!1),[x,b]=y.useState(null),N=y.useRef(!1);y.useEffect(()=>{if(x!=="已保存")return;const E=setTimeout(()=>b(null),3e3);return()=>clearTimeout(E)},[x]);const w=async E=>{v(!0);const A=await CN(n,{id:a.id,...E});v(!1),b(A??"已保存"),A||o(!1)},T=()=>{if(N.current){N.current=!1;return}const E=c.trim();if(E===a.text){o(!1);return}if(!E){b("规则内容不能为空。");return}w({text:E})};return l.jsxs("div",{className:"rule-wrap",children:[l.jsxs("div",{className:"rule",children:[r?l.jsx("input",{className:"rule-input",autoFocus:!0,value:c,maxLength:1e3,disabled:p,onChange:E=>f(E.target.value),onBlur:T,onKeyDown:E=>{E.key==="Enter"&&E.currentTarget.blur(),E.key==="Escape"&&(N.current=!0,f(a.text),o(!1))}}):l.jsx("button",{className:"rule-text",onClick:()=>{N.current=!1,f(a.text),o(!0)},disabled:p,title:"编辑规则",children:a.text}),l.jsxs("span",{className:"v",children:[l.jsx("button",{className:`rule-mode ${a.mode}`,disabled:p,onClick:()=>void w({mode:a.mode==="ask"?"allow":"ask"}),title:"切换确认方式",children:a.mode==="ask"?"需确认":"直接执行"}),l.jsx("button",{className:"del",title:"删除这条规则",disabled:p,onClick:()=>m(!0),children:l.jsx(V,{name:"close",size:13})})]})]}),h?l.jsxs("div",{className:"rule-confirm",children:[l.jsx("span",{children:"确定删除这条规则?"}),l.jsx("button",{className:"pbtn",onClick:()=>m(!1),children:"取消"}),l.jsx("button",{className:"pbtn danger",onClick:()=>void EN(n,a.id),children:"确认删除"})]}):null,x?l.jsx("div",{className:x==="已保存"?"okline":"badline",role:"status",children:x}):null]})}function BC({aid:n}){const[a,r]=y.useState(!1),[o,c]=y.useState(""),[f,h]=y.useState("ask"),[m,p]=y.useState(!1),[v,x]=y.useState(null);y.useEffect(()=>{if(v!=="已保存")return;const w=setTimeout(()=>x(null),3e3);return()=>clearTimeout(w)},[v]);const b=()=>{r(!1),c(""),h("ask"),x(null)},N=async()=>{if(m||!o.trim())return;p(!0),x(null);const w=await TN(n,o.trim(),f);if(p(!1),w){x(w);return}c(""),h("ask"),r(!1),x("已保存")};return l.jsxs("div",{className:"rule-wrap",children:[a?l.jsxs("form",{className:"rule-new",onSubmit:w=>{w.preventDefault(),N()},onKeyDown:w=>{w.key==="Escape"&&!m&&(w.preventDefault(),b())},children:[l.jsx("input",{className:"rule-input",autoFocus:!0,"aria-label":"规则文字",placeholder:"输入规则内容",maxLength:1e3,value:o,disabled:m,onChange:w=>c(w.target.value)}),l.jsxs("div",{className:"ctl",children:[l.jsxs("select",{className:"pick","aria-label":"规则确认方式",value:f,disabled:m,onChange:w=>h(w.target.value),children:[l.jsx("option",{value:"ask",children:"需确认"}),l.jsx("option",{value:"allow",children:"直接执行"})]}),l.jsx("span",{className:"sp"}),l.jsx("button",{type:"button",className:"pbtn",disabled:m,onClick:b,children:"取消"}),l.jsx("button",{type:"submit",className:"pbtn solid",disabled:m||!o.trim(),children:m?"正在保存…":"保存"})]})]}):l.jsx("button",{className:"rule-add",onClick:()=>{x(null),r(!0)},children:"+ 新增规则"}),v?l.jsx("div",{className:v==="已保存"?"okline":"badline",role:"status",children:v}):null]})}function qC(){const n=je(),a=n.sel??"hob",r=n.profiles[a],[o,c]=y.useState(!1),[f,h]=y.useState(!1),m=or(a);if(!r)return l.jsx("div",{className:"empty",children:"正在读取档案…"});const p=r.assistant;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"bigav",children:l.jsx(it,{sprite:p.sprite,prop:p.prop,size:96,motion:"home",onClick:()=>c(v=>!v),title:"换头像"})}),l.jsx("div",{className:"avatar-hint",children:"点头像更换"}),o?l.jsx(LC,{aid:a,sprite:p.sprite,prop:p.prop,onDone:()=>c(!1)}):null,l.jsx(cr,{message:m.message}),l.jsx("div",{className:"sech",children:l.jsx("span",{children:"基本信息"})}),l.jsxs("div",{className:"sidebar-group",children:[l.jsx("div",{className:"lbl",children:"名字"}),l.jsx(Vo,{value:p.name,save:v=>v.trim()?m.save({name:v.trim()}):(m.fail("名字不能为空。"),Promise.resolve(!1))}),l.jsx("div",{className:"lbl",children:"职责简介"}),l.jsx(Vo,{value:p.duty,save:v=>m.save({duty:v})}),l.jsx("div",{className:"lbl",children:"详细职责"}),l.jsx(Vo,{multiline:!0,value:p.dutyLong??"",save:v=>m.save({dutyLong:v})}),l.jsx("div",{className:"lbl",children:"补充说明"}),l.jsx(Vo,{multiline:!0,value:p.instructions,placeholder:"这个助手特有的做法,如“周报先列要点再展开”",save:v=>m.save({instructions:v})})]})]}),l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"模型"})}),l.jsx("div",{className:"sidebar-group",children:l.jsx(RC,{aid:a})}),l.jsx("div",{className:"sech",children:l.jsx("span",{children:"能力"})}),l.jsx("div",{className:"sidebar-group",children:l.jsx(DC,{aid:a})})]}),l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"通知与位置"})}),l.jsxs("div",{className:"sidebar-group",children:[l.jsx("div",{className:"lbl",children:"通知"}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"需要确认时通知我"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${p.notify?"":" off"}`,title:p.notify?"关闭通知":"开启通知",disabled:m.busy,onClick:()=>void m.save({notify:!p.notify})})]}),l.jsx("div",{className:"note",children:"要在手机上接收推送,请先在 设置 → 通知 中开启本机推送。"}),p.primary?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"位置"}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"放在顶部"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${p.pinned?"":" off"}`,title:p.pinned?"取消置顶":"放在顶部",disabled:m.busy,onClick:()=>void m.save({pinned:!p.pinned})})]})]}),p.primary?null:l.jsx("div",{className:"mergebar",children:l.jsx("button",{className:"pbtn",onClick:()=>void m.save({hidden:!p.hidden}),children:p.hidden?"放回列表":"收起这个助手"})})]})]}),p.primary?null:l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"危险操作"})}),l.jsx("div",{className:"mergebar sidebar-group",children:f?l.jsxs("div",{className:"mergeconfirm",children:["归档「",p.name,"」?它会从列表中移除,定时任务一并停掉。对话、规则和历史任务都留着,不会转给 Hob。",l.jsxs("div",{className:"acts",children:[l.jsx("button",{className:"pbtn solid",onClick:()=>void yN(a),children:"确认归档"}),l.jsx("button",{className:"pbtn",onClick:()=>h(!1),children:"取消"})]})]}):l.jsx("button",{className:"pbtn danger",onClick:()=>h(!0),children:"归档这个助手"})})]})]})}function mb(n,a){return bh(a,Object.values(n.jobs),Object.values(n.approvals),Object.values(n.delegations))!=="空闲"}function yh(n){const a=je();return!n||!mb(a,n)?{busy:!1,slot:0}:{busy:!0,slot:a.assistants.filter(r=>mb(a,r)).findIndex(r=>r.id===n.id)}}function F0(n,a){const r=je();if(bh(n,Object.values(r.jobs),Object.values(r.approvals),Object.values(r.delegations))==="等你确认")return"ask";const o=Object.values(r.jobs).filter(c=>c.assistantId===n.id&&c.endedAt).sort((c,f)=>(f.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 W0({a:n,sel:a,size:r=52}){const o=u0(n),{busy:c,slot:f}=yh(n),h=F0(n,c);return l.jsxs("button",{className:`pin${a?" sel":""}`,...o.handlers,onClick:()=>{o.takeHeld()||Xt(n.id)},children:[l.jsx(it,{sprite:n.sprite,prop:n.prop,size:r,motion:c&&!a?"peek":void 0,slot:f,mark:h}),n.unread>0?l.jsx("span",{className:"badge",children:n.unread>99?"99+":n.unread}):null,l.jsx("div",{className:"nm",children:n.name}),l.jsx("div",{className:"sub",children:n.duty})]})}function ey(n){return n===1?{cls:" n1",size:72}:n===2?{cls:" n2",size:62}:{cls:"",size:52}}function pb({a:n,sel:a,size:r=42,onClick:o}){const c=u0(n),{busy:f,slot:h}=yh(n),m=F0(n,f);return l.jsxs("button",{className:`row${a?" sel":""}`,...c.handlers,onClick:()=>{c.takeHeld()||(o?o():Xt(n.id))},children:[l.jsx(it,{sprite:n.sprite,prop:n.prop,size:r,motion:f&&!a?"peek":void 0,slot:h,mark:m}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:n.name}),l.jsx("span",{className:"tm",children:Po(n.last?.at)})]}),l.jsx("div",{className:"pv",children:n.last?Tl(n.last.text):n.duty})]})]})}function IC(n,a){const r=n.activity.at(-1);return[a?.name,r?Lf(r).join(" "):""].filter(Boolean).join(" · ")}function gb(n,a){tr(),a&&Xt(n.assistantId),$n(n.id)}function vb({job:n,owner:a,time:r,text:o,size:c,onClick:f,moving:h}){return l.jsxs("button",{className:"row job",onClick:f,children:[l.jsx(Bf,{owner:a,size:c,moving:h}),l.jsxs("span",{className:"nm",children:[n.routineId?l.jsx(V,{name:"clock",size:14}):null,n.title]}),l.jsx("span",{className:"tm",children:r}),l.jsx("span",{className:"pv",children:Tl(o)}),l.jsx(hc,{job:n})]})}function Ca({title:n,more:a,children:r}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gt",children:[l.jsx("span",{children:n}),a]}),r]})}function Bf({owner:n,size:a,moving:r}){const{slot:o}=yh(n);return n?l.jsx(it,{sprite:n.sprite,prop:n.prop,size:a,motion:r?"peek":void 0,slot:o}):l.jsx("span",{style:{width:a,flex:"none"}})}function xb({title:n,text:a}){return l.jsx(Ca,{title:n,children:l.jsx("div",{className:"slot",children:a})})}function ty({size:n=42,markSel:a=!1}){const r=je(),[o,c]=y.useState(!0),f=uC(r),h=x=>r.assistants.find(b=>b.id===x),m=!o||f.searching,p=new Set,v=x=>{const b=h(x.assistantId);return!b?.hidden||m||a&&b.id===r.sel||p.has(b.id)?!1:(p.add(b.id),!0)};return l.jsxs(l.Fragment,{children:[f.asks.length?l.jsx(Ca,{title:"待确认",children:f.asks.map(x=>l.jsxs("button",{className:"row",onClick:()=>void Xt(x.assistantId),children:[l.jsx(Bf,{owner:h(x.assistantId),size:n}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:x.title}),l.jsx("span",{className:"tm",children:Po(x.createdAt)})]}),l.jsxs("div",{className:"pv",children:[h(x.assistantId)?.name??""," · 等待你的选择"]})]})]},x.id))}):null,f.live.length?l.jsx(Ca,{title:"进行中",children:f.live.map(x=>l.jsx(vb,{job:x,owner:h(x.assistantId),moving:v(x),time:rr(x.startedAt??x.createdAt),text:IC(x,h(x.assistantId)),size:n,onClick:()=>gb(x,h(x.assistantId))},x.id))}):null,f.rows.length||f.hidden.length?l.jsxs(Ca,{title:"日常",children:[f.rows.map(x=>l.jsx(pb,{a:x,size:n,sel:a&&x.id===r.sel},x.id)),f.hidden.length&&!f.searching?l.jsxs("button",{className:"fold",onClick:()=>c(x=>!x),children:[l.jsx("span",{children:"收起的助手"}),l.jsxs("span",{children:[f.hidden.length,l.jsx(V,{name:o?"chev":"down",size:13})]})]}):null,l.jsx("div",{className:`expand${m?" open":""}`,inert:!m,children:l.jsx("div",{children:f.hidden.map(x=>l.jsx(pb,{a:x,size:n,sel:a&&x.id===r.sel},x.id))})})]}):null,f.recent.length?l.jsx(Ca,{title:"最近任务",more:l.jsx("button",{className:"more",onClick:()=>eh(),children:"全部"}),children:f.recent.map(x=>l.jsx(vb,{job:x,owner:h(x.assistantId),time:Po(x.endedAt??x.createdAt),text:x.summary||x.statusReason||"",size:n,onClick:()=>gb(x,h(x.assistantId))},x.id))}):null,f.routines.length?l.jsx(Ca,{title:"定时任务",children:f.routines.map(x=>{const b=x.runs[0];return l.jsxs("button",{className:"row",onClick:()=>{tr(),Xt(x.assistantId),a0(x.id)},children:[l.jsx(Bf,{owner:h(x.assistantId),size:n}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:x.name}),l.jsx("span",{className:"tm",children:vh(x.schedules[0]??"")})]}),l.jsx("div",{className:"pv",children:b?`上次运行 ${Po(b.at)} · ${CC[b.status]}`:"尚未运行"})]})]},x.id)})}):null,f.empty?l.jsxs(l.Fragment,{children:[l.jsx(xb,{title:"最近任务",text:"分派的任务会显示在这里"}),l.jsx(xb,{title:"定时任务",text:"定时任务会显示在这里"})]}):null]})}function YC(){const n=je(),a=n.assistants.filter(o=>o.pinned&&!o.hidden&&Ki(o,n.query)),r=ey(a.length);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mhead",children:[l.jsx("button",{className:"me",title:"设置",onClick:fc,children:l.jsx(V,{name:"user",size:17})}),l.jsx("span",{className:"sp"}),n.search?l.jsxs("div",{className:"msearch",children:[l.jsx(V,{name:"search",size:15}),l.jsx("input",{autoFocus:!0,value:n.query,placeholder:"搜索助手",onChange:o=>r0(o.target.value)}),l.jsx("button",{onClick:()=>Ox(!1),title:"关闭搜索",children:l.jsx(V,{name:"close",size:14})})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"ib",title:"知识库",onClick:nh,children:l.jsx(V,{name:"archive",size:19})}),l.jsx("button",{className:"ib",title:"搜索助手",onClick:()=>Ox(!0),children:l.jsx(V,{name:"search",size:19})}),l.jsx("button",{className:"ib",title:"创建专属助手",onClick:l0,children:l.jsx(V,{name:"plus",size:21})})]})]}),l.jsx("div",{className:`mpins${r.cls}`,children:a.map(o=>l.jsx(W0,{a:o,size:r.size},o.id))}),l.jsx("div",{className:"mlist",children:l.jsx(ty,{size:36})})]})}function bb({leaving:n,layered:a=!1,direction:r="",page:o}){return l.jsx("div",{className:`mfull${n?" leaving":""}${a?` layered ${r}`:""}`,children:l.jsx(Hf,{mobile:!0,page:o})})}const ny={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 kh(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 yb(n,a){return ny[n].reduce((r,o)=>Math.abs(o.value-a)<Math.abs(r.value-a)?o:r).label}function sy(n){return`聪明 ${n.smart}% · 成本 ${n.cost}% · 速度 ${n.speed}%`}function jh(n){if(n>=1e6){const a=n/1e6;return`${Number.isInteger(a)?a:a.toFixed(1)}M`}return`${Math.round(n/1e3)}K`}const GC=y.lazy(()=>sr(()=>import("./DesktopView-rVxacveF.js"),[]).then(n=>({default:n.DesktopView})));function We({title:n,desc:a}){return l.jsxs("div",{className:"setintro",children:[l.jsx("div",{className:"h",children:n}),l.jsx("div",{className:"d",children:a})]})}function vs({items:n,value:a,onChange:r,disabled:o}){return l.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=>l.jsx("button",{role:"radio","aria-checked":a===c.key,className:a===c.key?"on":void 0,onClick:()=>r(c.key),disabled:o,children:c.label},c.key))})}function be({children:n}){return l.jsx("div",{className:"group",children:n})}function Fn({saved:n,error:a,children:r}){return l.jsxs("div",{className:"sfoot",children:[n&&!a?l.jsx("span",{className:"okline",children:"已保存"}):null,a?l.jsx("span",{className:"badline",children:a}):null,l.jsx("span",{className:"sp"}),r]})}function Oa(){const[n,a]=y.useState(null),[r,o]=y.useState(!1);return y.useEffect(()=>{if(n!=="已保存")return;const f=setTimeout(()=>a(null),3e3);return()=>clearTimeout(f)},[n]),{save:async f=>{o(!0);const h=await Zf(f);return o(!1),a(h?"已保存":Vs().notice??"保存失败,请重试。"),h},busy:r,message:n}}function wn({message:n,toast:a=!1}){return n?l.jsx("span",{className:`${n==="已保存"?"okline":"badline"}${a?" savetoast":""}`,role:"status",children:n}):null}function _a({value:n,placeholder:a,multiline:r,onSave:o}){const[c,f]=y.useState(n),[h,m]=y.useState(!1);y.useEffect(()=>f(n),[n]);const p=async()=>{if(h||c===n)return;m(!0);const x=await o(c);m(!1),x||f(n)},v={value:c,placeholder:a,disabled:h,onChange:x=>f(x.target.value),onBlur:()=>void p(),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),x.currentTarget.blur())}};return l.jsx("div",{className:"field",children:r?l.jsx("textarea",{...v,rows:3}):l.jsx("input",{...v})})}const vf=[{id:"general",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:"push",label:"通知"},{id:"about",label:"关于"}],KC=[{key:"system",label:"跟随系统"},{key:"light",label:"浅色"},{key:"dark",label:"深色"}];function XC(){return Intl.supportedValuesOf?.("timeZone")??[]}function VC({narrow:n,leaving:a}){const r=je(),o=r.section??(n?null:"general"),c=y.useRef(null);return y.useEffect(()=>{c.current?.scrollTo(0,0)},[o,r.sub]),n&&o===null?l.jsxs("div",{className:`setpage narrow${a?" leaving":""}`,children:[l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"ib",title:"返回",onClick:Cf,children:l.jsx(V,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"设置"})]}),l.jsx("div",{className:"setbody",children:vf.map(f=>l.jsxs("button",{className:"setitem",onClick:()=>Sl(f.id),children:[l.jsx("span",{children:f.label}),l.jsx(V,{name:"chev",size:15})]},f.id))})]}):l.jsxs("div",{className:`setpage${n?" narrow":""}${a?" leaving":""}`,children:[n?l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"ib",title:"返回",onClick:r.sub?Lt:()=>Sl(null),children:l.jsx(V,{name:"left",size:17})}),l.jsx("span",{className:"t",children:r.sub?.title??vf.find(f=>f.id===o)?.label??"设置"})]}):l.jsxs("div",{className:"setnav",children:[l.jsx("div",{className:"setnavtitle",children:"设置"}),vf.map(f=>l.jsx("button",{className:`navrow${o===f.id?" sel":""}`,onClick:()=>Sl(f.id),children:f.label},f.id)),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"navrow",onClick:Cf,children:"返回 Hob"})]}),l.jsx("div",{className:"setmain",ref:c,children:o==="providers"?l.jsx(eE,{}):o==="models"?l.jsx(oE,{}):o==="memory"?l.jsx(vE,{}):o==="image"?l.jsx(kE,{}):o==="knowledge"?l.jsx(yE,{}):o==="search"?l.jsx(DE,{}):o==="skills"?l.jsx(NE,{}):o==="mcp"?l.jsx(AE,{}):o==="desktop"?l.jsx(ZC,{}):o==="work"?l.jsx(fE,{}):o==="push"?l.jsx(hE,{}):o==="about"?l.jsx(UE,{}):l.jsx(QC,{})})]})}function ZC(){const[n,a]=y.useState(null),[r,o]=y.useState(""),[c,f]=y.useState(""),[h,m]=y.useState(!1),[p,v]=y.useState(!1),[x,b]=y.useState(null),[N,w]=y.useState(null),[T,E]=y.useState(!1),[A,z]=y.useState(null),[U,$]=y.useState([]),j=je().assistants;y.useEffect(()=>{Lw().then(W=>{a(W),o(W.url),m(W.enabled),v(!W.tokenConfigured),$(W.publicAssistants)}).catch(W=>w({ok:!1,text:`无法读取云桌面配置:${W.message}`}))},[]);const C=n?.deployed??!1,S=n!==null&&h!==n.enabled;async function O(){if(n){E(!0),w(null);try{const W=await Hw({revision:n.revision,url:r,enabled:h,...c?{token:c}:{}});a(W),f(""),v(!W.tokenConfigured),w({ok:!0,text:"已保存"})}catch(W){w({ok:!1,text:W instanceof Error?W.message:String(W)})}finally{E(!1)}}}async function R(){if(n){E(!0),w(null);try{const W=await Bw(n.revision,U);a(W),$(W.publicAssistants),w({ok:!0,text:"已保存"})}catch(W){w({ok:!1,text:W instanceof Error?W.message:String(W)})}finally{E(!1)}}}async function q(){E(!0),b(null);try{const W=await qw();if(!W.ok){b({ok:!1,text:W.error});return}const Ee=W.health.screens.filter(he=>he.browserRunning).map(he=>he.id).join("、");b({ok:!0,text:`已连接 · ${W.health.display.width}×${W.health.display.height} · 浏览器:${Ee||"无"}`})}catch(W){b({ok:!1,text:W instanceof Error?W.message:String(W)})}finally{E(!1)}}const F=x?l.jsx("span",{className:x.ok?"okline":"badline",style:x.ok?void 0:{color:"var(--danger)"},role:"status",children:x.text}):null;return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"云桌面",desc:"云桌面需要单独部署。登录 Hob 的人可以观看和接管桌面。"}),C?l.jsxs(be,{children:[l.jsx("div",{className:"note",children:"由部署配置(compose 的 desktop 服务)"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"地址"}),l.jsx("div",{className:"sline mono",children:n?.url||"未配置"}),l.jsx("div",{className:"lbl sub",children:"令牌"}),l.jsx("div",{className:"sline",children:n?.tokenConfigured?"已设置":"未设置"}),l.jsx("div",{className:"lbl sub",children:"启用"}),l.jsx("div",{className:"sline",children:n?.enabled?"已启用":"未启用"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"pbtn",disabled:T||!n,onClick:()=>void q(),children:"测试连接"}),l.jsx("button",{className:"pbtn",disabled:!n?.enabled,onClick:()=>z("hob"),children:"打开桌面"}),F]})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"启用"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`tog${h?"":" off"}`,"aria-label":"启用云桌面","aria-pressed":h,disabled:!n,onClick:()=>m(!h)}),l.jsx("span",{className:"note",children:(h?"已启用。登录 Hob 的人可以观看桌面,接管后可以操作。":"未启用。界面不打开桌面,任务也不能使用桌面。")+(S?"(保存后生效)":"")})]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:r,disabled:!n||T,onChange:W=>o(W.target.value),placeholder:"http://127.0.0.1:6080"})}),l.jsx("div",{className:"lbl sub",children:"令牌"}),p?l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:c,disabled:!n||T,onChange:W=>f(W.target.value),placeholder:n?.tokenConfigured?"已保存,留空则沿用":"云桌面的访问令牌"})}):l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已设置"}),l.jsx("button",{className:"pbtn",disabled:T,onClick:()=>v(!0),children:"更换"})]}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"pbtn",disabled:T||!n,onClick:()=>void q(),children:"测试连接"}),F??l.jsx("span",{className:"note",children:"测试地址、令牌和云桌面是否可用。"})]})]}),l.jsxs("div",{className:"note",children:["部署说明见 ",l.jsx("a",{href:"https://github.com/FFatTiger/hob#云桌面",target:"_blank",rel:"noreferrer",children:"云桌面文档"}),"。"]}),l.jsxs("div",{className:"sfoot",children:[N?l.jsx("span",{className:N.ok?"okline":"badline",role:"status",children:N.text}):null,l.jsx("span",{className:"sp"}),l.jsx("button",{className:"pbtn",disabled:!n?.enabled,onClick:()=>z("hob"),children:"打开桌面"}),l.jsx("button",{className:"pbtn solid",disabled:T||!n,onClick:()=>void O(),children:"保存"})]})]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"公共屏幕"}),l.jsx("div",{className:"note",children:"用于登录你自己的账号,勾选的助手可以使用。受 Google 限制,目前无法登录 Google 账号。"}),l.jsxs("div",{className:"formcard",children:[j.map(W=>l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:U.includes(W.id),disabled:T||!n,onChange:Ee=>$(he=>Ee.target.checked?[...he,W.id]:he.filter(we=>we!==W.id))}),l.jsx("span",{children:W.name})]},W.id)),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"pbtn",disabled:!n?.enabled||T,onClick:()=>z("public"),children:"打开公共屏幕"}),l.jsx("button",{className:"pbtn solid",disabled:!n||T,onClick:()=>void R(),children:"保存公共屏幕设置"}),N?l.jsx("span",{className:N.ok?"okline":"badline",role:"status",children:N.text}):null]})]})]}),A?l.jsx(y.Suspense,{fallback:null,children:l.jsx(GC,{initialScreen:A,takeOver:A==="public",onClose:()=>z(null)})}):null]})}function QC(){const n=je(),a=n.settings.settings.general.aboutYou,r=Oa(),o=Oa(),c=Oa(),[f,h]=y.useState(null);return y.useEffect(()=>{if(!f)return;const m=setTimeout(()=>h(null),4e3);return()=>clearTimeout(m)},[f]),l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"通用",desc:"主题、时区、个人信息、登录密码。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"主题"}),l.jsx(vs,{items:KC,value:n.theme,disabled:r.busy,onChange:m=>void r.save({general:{theme:m}})}),l.jsx(wn,{message:r.message})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"时区"}),l.jsx(JC,{value:n.settings.settings.general.timezone,onSave:m=>o.save({general:{timezone:m}})}),l.jsx(wn,{message:o.message}),l.jsx("div",{className:"note",children:"助手的「现在时间」和定时任务都按这个时区算。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"展示页面"}),l.jsx("button",{className:`tog${n.settings.settings.general.showPage===!1?" off":""}`,"aria-label":"展示页面","aria-pressed":n.settings.settings.general.showPage!==!1,disabled:r.busy,onClick:()=>void r.save({general:{showPage:n.settings.settings.general.showPage===!1}})}),l.jsx(wn,{message:r.message}),l.jsx("div",{className:"note",children:"允许助手把适合可视化的内容展示为页面。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"个人信息"}),l.jsx("div",{className:"lbl sub",children:"称呼"}),l.jsx(_a,{placeholder:"如「王先生」",value:a.name,onSave:m=>c.save({general:{aboutYou:{name:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"语言"}),l.jsx(_a,{placeholder:"如「中文」",value:a.language,onSave:m=>c.save({general:{aboutYou:{language:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"其他"}),l.jsx(_a,{multiline:!0,placeholder:"如「不要看融资新闻」",value:a.notes,onSave:m=>c.save({general:{aboutYou:{notes:m}}})}),l.jsx(wn,{message:c.message}),l.jsx("div",{className:"note",children:"所有助手都会参考这些信息;未填写的项不使用。"})]}),l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx(PC,{onDone:h}),f?l.jsx("div",{className:"note",children:f}):null]})})]})}function JC({value:n,onSave:a}){const r=XC(),[o,c]=y.useState(n),[f,h]=y.useState(!1),[m,p]=y.useState(null),v=y.useRef(null);y.useEffect(()=>c(n),[n]),y.useEffect(()=>{if(!f)return;const N=w=>{v.current?.contains(w.target)||h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]);const x=r.filter(N=>N.toLowerCase().includes(o.trim().toLowerCase())).slice(0,40),b=N=>{h(!1),p(null),c(N),N!==n&&a(N).then(w=>{w||c(n)})};return l.jsxs("div",{className:"tz",ref:v,children:[l.jsx("label",{className:"field",children:l.jsx("input",{value:o,placeholder:"搜索时区,如 Berlin",onFocus:()=>h(!0),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.currentTarget.blur())},onChange:N=>{c(N.target.value),h(!0)},onBlur:()=>{o.trim()!==n&&(r.includes(o.trim())?b(o.trim()):(c(n),p("时区无效,请从列表中选择。")))}})}),m?l.jsx("div",{className:"badline",role:"status",children:m}):null,f&&x.length?l.jsx("div",{className:"tzlist",children:x.map(N=>l.jsx("button",{className:N===n?"sel":"",onMouseDown:()=>b(N),children:N},N))}):null]})}function PC({onDone:n}){const[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState(""),[m,p]=y.useState(!1),v=async()=>{if(m)return;if(!a||!o){n("请填写旧密码和新密码。");return}if(o!==f){n("两次输入的新密码不一致。");return}p(!0);const x=await Nw(a,o);if(p(!1),x){n(`修改失败:${x}`);return}r(""),c(""),h(""),n("密码已修改。")};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"登录密码"}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"旧密码",value:a,onChange:x=>r(x.target.value)})}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"新密码",value:o,onChange:x=>c(x.target.value)})}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"再次输入新密码",value:f,onChange:x=>h(x.target.value)})}),l.jsxs(Fn,{saved:!1,error:null,children:[a||o||f?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"pbtn",disabled:m||!(a||o||f),onClick:()=>{r(""),c(""),h(""),n("")},children:"取消"}),l.jsx("button",{className:"pbtn solid",onClick:()=>void v(),disabled:m||!a||!o||!f,children:m?"正在验证…":"保存"})]})]})}function ly({value:n,options:a,label:r,icon:o,onChange:c}){return l.jsxs("span",{className:"ctl",children:[o?l.jsx(V,{name:o,size:14}):null,l.jsx("select",{className:"pick","aria-label":r,value:n,onChange:f=>c(f.target.value),children:a.map(f=>l.jsx("option",{value:f.value,children:f.text},f.value))})]})}function ay({value:n,model:a,onChange:r}){const o=J0(a);return o.length===1?null:l.jsx(ly,{value:n,label:"思考强度",icon:"bulb",options:o.map(c=>({value:c,text:Qo[c]})),onChange:r})}function kb({modelRef:n,info:a,disabled:r,onSaved:o}){const[c,f]=y.useState(!1),[h,m]=y.useState(null),[p,v]=y.useState(""),[x,b]=y.useState(!1),[N,w]=y.useState(null),[T,E]=y.useState(!1);y.useEffect(()=>{if(!T)return;const S=setTimeout(()=>E(!1),3e3);return()=>clearTimeout(S)},[T]);const A=h??a.levels,z=Aa.filter(S=>!A.some(O=>O.level===S)),U=h!==null,$=S=>{m(S.slice().sort((O,R)=>Aa.indexOf(O.level)-Aa.indexOf(R.level))),w(null),E(!1)},j=async S=>{b(!0),w(null);const O=await Aw(n,S);if(b(!1),!O.ok){m(null),w(O.error);return}m(null),E(!0),o(O.thinking,O.settings)},C=(S=A)=>{const O={};for(const R of Aa){const q=S.find(F=>F.level===R);O[R]=q?q.text.trim():null}j(O)};return l.jsxs("div",{className:"think-levels",children:[l.jsxs("button",{className:"thinkhead",onClick:()=>f(S=>!S),disabled:x,children:[l.jsx("span",{className:"lbl sub",children:"思考档"}),l.jsxs("span",{className:"note",children:[A.length," 档",a.custom?" · 有自定义":" · 默认"]}),l.jsx(V,{name:c?"down":"chev",size:14})]}),l.jsx("div",{className:`expand${c?" open":""}`,inert:!c,children:l.jsxs("div",{children:[l.jsx("div",{className:"thinkrows",children:A.map(S=>l.jsxs("div",{className:"thinkrow",children:[l.jsx("span",{className:"tname",children:Qo[S.level]}),l.jsx("input",{className:"ttext",value:S.text,placeholder:"默认",title:"留空就按服务商协议的默认值发",onChange:O=>$(A.map(R=>R.level===S.level?{...R,text:O.target.value}:R)),onBlur:()=>{U&&C()},onKeyDown:O=>{O.key==="Enter"&&O.currentTarget.blur()},disabled:x||r}),S.level==="off"?l.jsx("span",{className:"rremove still",title:"关闭这一档不能删","aria-hidden":!0}):l.jsx("button",{className:"rremove",title:`删掉「${Qo[S.level]}」`,onClick:()=>C(A.filter(O=>O.level!==S.level)),disabled:x||r,children:l.jsx(V,{name:"close",size:13})})]},S.level))}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[l.jsxs("select",{className:"pick",value:p,onChange:S=>v(S.target.value),disabled:x||r||!z.length,"aria-label":"添加思考档",children:[l.jsx("option",{value:"",children:z.length?"选择档位":"七个档都用上了"}),z.map(S=>l.jsx("option",{value:S,children:Qo[S]},S))]}),l.jsx("button",{className:"pbtn",onClick:()=>{p&&(C([...A,{level:p,text:""}]),v(""))},disabled:x||r||!p,children:"添加思考档"}),l.jsx("span",{className:"sp"}),a.custom?l.jsx("button",{className:"pbtn",onClick:()=>void j(null),disabled:x||r,children:"恢复默认"}):null]}),l.jsx("div",{className:"note",children:"留空就按服务商协议的默认值发;填了才按你写的发(例如 DeepSeek 的「中」填 high)。 关闭这一档不能删,其余档删掉后不再出现在思考强度里。"}),N?l.jsx("div",{className:"badline",children:N}):null,T?l.jsx("div",{className:"okline",children:"已保存思考档"}):null]})})]})}function iy({info:n}){const a=jh(n.contextWindow);return l.jsxs("span",{className:"caps",children:[n.input.includes("image")?l.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:l.jsx(V,{name:"image",size:14})}):null,n.reasoning?l.jsx("span",{title:"支持推理","aria-label":"支持推理",children:l.jsx(V,{name:"bulb",size:14})}):null,l.jsx("span",{className:"ctx",title:`上下文 ${a}`,children:a})]})}const ry=[{key:"openai-completions",label:"OpenAI 兼容"},{key:"openai-responses",label:"OpenAI Responses 兼容"},{key:"anthropic-messages",label:"Anthropic 兼容"},{key:"google-generative-ai",label:"Google 兼容"}],FC=Object.fromEntries(ry.map(n=>[n.key,n.label])),Zo=128e3,xf=n=>n.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),WC={literal:"包含 Key",env:"包含 Key",command:"需手动填写",none:"无 Key"};function eE(){const a=je().sub,[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,v]=y.useState({}),x=(w,T)=>v(E=>({...E,[w]:T}));if(y.useEffect(()=>{Ew().then(w=>w.ok?o(w.view):f(w.error))},[]),y.useEffect(()=>{a&&m(null)},[a]),y.useEffect(()=>{r&&v(w=>Object.fromEntries(Object.entries(w).filter(([T])=>r.providers.some(E=>E.id===T))))},[r]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx("div",{className:"empty",children:"正在读取服务商…"});const b=(w,T)=>{T.startsWith("已导入")&&v({}),o(w),m(T),Lt()},N=(w,T,E)=>{o(A=>A&&{...A,settings:E,models:{...A.models,[w]:(A.models[w]??[]).map(z=>z.ref===T.ref?T:z)}})};return a?.kind==="provider"?l.jsx(sE,{id:a.id,view:r,onView:o,onSaved:b,onThinking:N,onConnection:x}):a?.kind==="addProvider"?l.jsx(lE,{view:r,onSaved:b,onConnection:x}):a?.kind==="importProviders"?l.jsx(aE,{onSaved:b}):l.jsx(tE,{view:r,notice:h,connectionStatus:p})}function tE({view:n,notice:a,connectionStatus:r}){const o=f=>n.builtin.find(h=>h.id===f)?.name??f,c=f=>f.kind==="builtin"?o(f.id):f.name;return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"服务商",desc:"模型服务商与 API Key。内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。API Key 只保存在本机,保存后不再显示。"}),l.jsx(nE,{}),l.jsxs(be,{children:[l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"pbtn solid",onClick:()=>Nn({kind:"addProvider",title:"添加服务商"}),children:"添加服务商"})}),l.jsx("div",{className:"lbl",children:"已配置的服务商"}),l.jsxs("div",{className:"roster",children:[n.providers.map(f=>l.jsxs("button",{className:"rrow",onClick:()=>Nn({kind:"provider",id:f.id,title:c(f)}),children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname",children:c(f)}),l.jsx("div",{className:"rprov",children:f.kind==="builtin"?"内置服务商":"兼容接口"})]}),l.jsx("span",{className:f.keyConfigured&&r[f.id]!=="failed"?"note":"badline",children:f.keyConfigured?`${r[f.id]==="connected"?"已连接":r[f.id]==="failed"?"连接失败":"未验证"} · ${n.models[f.id]?.length??0} 个模型`:"未填 Key"}),l.jsx(V,{name:"chev",size:15,className:"rgo"})]},f.id)),l.jsxs("button",{className:"maddrow",onClick:()=>Nn({kind:"importProviders",title:"从本机导入"}),children:[l.jsx(V,{name:"doc",size:16}),"从本机导入"]})]}),n.providers.length?null:l.jsx("div",{className:"note",children:"尚未添加其他服务商。"}),l.jsx("div",{className:"note",children:"从本机导入会只读本机配置并一次性复制到 Hob,不会修改来源。"}),a?l.jsx("div",{className:"okline",children:a}):null]})]})}function nE(){const[n,a]=y.useState(null),[r,o]=y.useState({enabled:!1,plan:"pro",executable:""}),[c,f]=y.useState(!1),[h,m]=y.useState("");async function p(b=!1){f(!0),m("");try{const N=await Tw();a(N),b&&o(N.settings.settings.claude??{enabled:!1,plan:"pro",executable:""})}catch(N){m(N instanceof Error?N.message:String(N))}finally{f(!1)}}y.useEffect(()=>{p(!0)},[]);async function v(){f(!0),m("");try{a(await Cw(r)),m("已保存")}catch(b){m(b instanceof Error?b.message:String(b))}finally{f(!1)}}const x=n?.status;return l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"Claude 订阅(经本机 Claude Code)"}),l.jsxs("div",{className:"formcard",children:[l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`tog${r.enabled?"":" off"}`,"aria-label":"启用 Claude 订阅","aria-pressed":r.enabled,disabled:!n||c,onClick:()=>o({...r,enabled:!r.enabled})}),l.jsxs("span",{className:"note",children:[r.enabled?"已启用":"未启用",n&&r.enabled!==(n.settings.settings.claude?.enabled??!1)?"(保存后生效)":""]})]}),l.jsx("div",{className:"lbl sub",children:"状态"}),l.jsx("div",{className:x?.loggedIn?"okline":"badline",role:"status",children:x?x.found?x.error?x.error:x.loggedIn?`已登录${x.version?` · ${x.version}`:""}${x.plan?` · ${x.plan}`:""}${x.email?` · ${x.email}`:""}`:`未登录${x.version?` · ${x.version}`:""},当前不可用。`:"未找到 Claude Code,当前不可用。":"正在检测…"}),x?.found&&!x.loggedIn?l.jsxs("div",{className:"note",children:["请在终端执行 ",l.jsx("code",{children:"claude auth login"}),",然后重新检测。"]}):null,l.jsx("div",{className:"lbl sub",children:"套餐"}),l.jsxs("select",{className:"pick",value:r.plan,disabled:c||!n,onChange:b=>o({...r,plan:b.target.value}),children:[l.jsx("option",{value:"pro",children:"Pro"}),l.jsx("option",{value:"max",children:"Max"})]}),l.jsx("div",{className:"lbl sub",children:"Claude Code 程序路径"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:r.executable,disabled:c||!n,onChange:b=>o({...r,executable:b.target.value}),placeholder:x?.executable||"留空时自动查找"})}),l.jsx("div",{className:"note",children:"用量计入你的 Claude 订阅额度,与 Claude Code 共用。Docker 镜像不支持此功能。"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"pbtn",disabled:c,onClick:()=>void p(),children:"重新检测"}),l.jsx("button",{className:"pbtn solid",disabled:c||!n,onClick:()=>void v(),children:"保存"}),h?l.jsx("span",{className:"note",role:"status",children:h}):null]})]})]})}function sE({id:n,view:a,onView:r,onSaved:o,onThinking:c,onConnection:f}){const h=a.providers.find(p=>p.id===n);if(y.useEffect(()=>{h||Lt()},[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 l.jsx(oy,{view:a,initial:m,onSaved:o,onView:r,onConnection:f,onThinking:(p,v)=>c(n,p,v),extra:l.jsx(iE,{view:a,provider:h,onDeleted:p=>{r(p),Lt()}})})}function lE({view:n,onSaved:a,onConnection:r}){const[o,c]=y.useState(null),[f,h]=y.useState(null),m=n.builtin.filter(v=>!n.providers.some(x=>x.id===v.id));if(o===null)return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"服务商"}),l.jsx(We,{title:"添加服务商",desc:"内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。"}),l.jsx(be,{children:l.jsxs("div",{className:"mcard",children:[l.jsxs("button",{className:"mrow",onClick:()=>c("builtin"),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:"内置服务商"}),l.jsx("span",{className:"sp"}),l.jsx(V,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"提供完整的模型目录,填写 API Key 即可。"})]}),l.jsxs("button",{className:"mrow",onClick:()=>c("custom"),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:"兼容接口"}),l.jsx("span",{className:"sp"}),l.jsx(V,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"填写服务地址、协议与模型;模型列表可从接口获取。"})]})]})})]});if(o==="builtin"&&f===null)return l.jsxs(l.Fragment,{children:[l.jsxs("button",{className:"subback",onClick:()=>c(null),children:[l.jsx(V,{name:"left",size:15}),"添加服务商"]}),l.jsx(We,{title:"选择内置服务商",desc:"选择服务商后填写 API Key。"}),l.jsx(be,{children:l.jsx("div",{className:"mcard",children:m.length?m.map(v=>l.jsxs("button",{className:"mrow",onClick:()=>h(v.id),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:v.name}),l.jsx("span",{className:"sp"}),l.jsx(V,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"内置服务商"})]},v.id)):l.jsx("div",{className:"empty",children:"所有内置服务商均已添加。"})})})]});const p=o==="builtin"?{kind:"builtin",isNew:!0,id:f??"",key:""}:{kind:"custom",isNew:!0,id:"",name:"",api:"openai-completions",baseUrl:"",key:"",models:[]};return l.jsx(oy,{view:n,initial:p,onSaved:a,onConnection:r,onThinking:()=>{}})}function aE({onSaved:n}){const[a,r]=y.useState(null),[o,c]=y.useState(new Set),[f,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{Ow().then(b=>{if(!b.ok){p(b.error);return}r(b.view),c(new Set(b.view.items.filter(N=>N.selectable&&!N.exists).map(N=>N.id)))})},[]);const v=b=>c(N=>{const w=new Set(N);return w.has(b)?w.delete(b):w.add(b),w}),x=async()=>{if(f||!o.size)return;h(!0),p(null);const b=[...o],N=await _w(b);if(h(!1),!N.ok){p(N.error);return}n(N.view,`已导入 ${b.length} 个服务商`)};return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"服务商"}),l.jsx(We,{title:"从本机导入",desc:"读取本机其他客户端保存的服务商配置。来源文件只读,导入后 Key 存入 Hob,不再显示。"}),a===null?m?null:l.jsx("div",{className:"empty",children:"正在读取…"}):l.jsxs(be,{children:[l.jsxs("div",{className:"sline",children:["来源:",a.source]}),a.items.length?l.jsx("div",{className:"roster",style:{marginTop:8},children:a.items.map(b=>l.jsxs("label",{className:`rrow${b.selectable?"":" gone"}`,children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:o.has(b.id),disabled:!b.selectable||f,onChange:()=>v(b.id)}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[b.id,l.jsxs("span",{className:"rtags",children:[l.jsx("span",{className:"rtag",children:b.kind==="builtin"?"内置服务商":`兼容接口${b.api?` · ${FC[b.api]}`:""}`}),b.models?l.jsxs("span",{className:"rtag",children:[b.models," 个模型"]}):null,b.exists?l.jsx("span",{className:"rtag",children:"将覆盖"}):null]})]}),b.baseUrl?l.jsx("div",{className:"rprov",children:b.baseUrl}):null,l.jsx("div",{className:"rfoot",children:l.jsx("span",{className:b.key==="none"&&!b.note?"rtag bad":"rtag",children:WC[b.key]})}),b.note?l.jsx("div",{className:"note",children:b.note}):null]})]},b.id))}):l.jsx("div",{className:"empty",style:{marginTop:8},children:"未找到可导入的配置。"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[l.jsx("button",{className:"pbtn solid",onClick:()=>void x(),disabled:f||!o.size,children:f?"正在导入…":"导入所选"}),l.jsx("button",{className:"pbtn",onClick:Lt,disabled:f,children:"取消"})]})]}),m?l.jsx("div",{className:"badline",children:m}):null]})}function iE({view:n,provider:a,onDeleted:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),[m,p]=y.useState(!1),v=["conversation","work"].filter(N=>n.settings.settings.models[N].ref.startsWith(`${a.id}/`)),x=a.kind==="builtin"?n.builtin.find(N=>N.id===a.id)?.name??a.id:a.name,b=async()=>{if(o)return;c(!0),h(null);const N=await zw(a.id);if(c(!1),!N.ok){h(N.error);return}r(N.view)};return l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"危险操作"}),l.jsx("div",{className:"mcard",children:m?l.jsxs("div",{className:"ctl",style:{padding:12,gap:8,flexWrap:"wrap"},children:[l.jsxs("span",{children:["删除「",x,"」后,该服务商的模型将不可用。",v.length?`受影响的默认模型:${v.map(N=>N==="conversation"?"对话":"任务执行").join("、")}。`:"当前默认模型不受影响。"]}),l.jsx("button",{className:"pbtn",onClick:()=>p(!1),disabled:o,children:"取消"}),l.jsx("button",{className:"pbtn danger",onClick:()=>void b(),disabled:o,children:"确认删除"})]}):l.jsx("button",{className:"mline danger",onClick:()=>p(!0),disabled:o,children:"删除服务商"})}),f?l.jsx("div",{className:"badline",children:f}):null]})}function oy({view:n,initial:a,onSaved:r,onView:o,onConnection:c,onThinking:f,extra:h}){const m=je(),[p,v]=y.useState(a),[x,b]=y.useState(!1),[N,w]=y.useState(null);y.useEffect(()=>{if(!N||N!=="已保存")return;const K=setTimeout(()=>w(null),3e3);return()=>clearTimeout(K)},[N]);const[T,E]=y.useState([]),[A,z]=y.useState(a.isNew||!n.providers.find(K=>K.id===a.id)?.keyConfigured),[U,$]=y.useState(null),[j,C]=y.useState(null),[S,O]=y.useState(null),[R,q]=y.useState(!1),F=new Set(n.providers.map(K=>K.id)),W=K=>n.builtin.find(ae=>ae.id===K)?.name??K,Ee=K=>n.models[p.id]?.find(ae=>ae.id===K),he=K=>v(ae=>({...ae,...K})),we=p.isNew||JSON.stringify(p)!==JSON.stringify(a),Oe=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()}:{}},se=JSON.stringify(Oe),ve=async()=>{if(R)return;q(!0),O(null),C(null);const K=await hx(Oe);if(q(!1),!we&&p.id&&c(p.id,K?"failed":"connected"),K){$(null),O(K);return}$(se),C("连接成功")},me=K=>{const ae=`${p.id}/${K.id}`,le=m.settings.settings.models,oe=le.roster.some(nt=>nt.ref===ae),xe=le.conversation.ref===ae||le.work.ref===ae;return l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",checked:oe,disabled:p.isNew||!Ee(K.id)||x||R||xe,onChange:()=>{const nt=oe?le.roster.filter(Sn=>Sn.ref!==ae):[...le.roster,{ref:ae,note:"",scores:kh({id:K.id,name:K.name??K.id,reasoning:!!K.reasoning}),scoresConfirmed:!1}];b(!0),w(null),Zf({models:{roster:nt}}).then(Sn=>{b(!1),w(Sn?"已保存":"保存失败,请重试。")})}}),l.jsx("span",{children:xe?"默认模型已加入":"加入可用模型"})]})},Me=async()=>{if(p.kind!=="custom"||R)return;q(!0),O(null);const K=await Mw({api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{},...p.id?{id:p.id}:{}});if(q(!1),!K.ok){O(K.error),E([]);return}E(K.models)},Ae=async K=>{if(p.kind!=="custom")return;if(p.isNew){he({models:K});return}const ae=n.providers.find(Sn=>Sn.id===p.id);if(!ae||ae.kind!=="custom")return;q(!0),O(null);const{id:le,keyConfigured:oe,...xe}=ae,nt=await fx(le,{...xe,models:K});if(q(!1),!nt.ok){O(nt.error);return}he({models:K}),o?.(nt.view),w("已保存")},xt=K=>{if(p.kind!=="custom")return;const ae=p.models.some(le=>le.id===K.id);Ae(ae?p.models.filter(le=>le.id!==K.id):[...p.models,{id:K.id,...K.name?{name:K.name}:{}}])},Mt=K=>{if(p.kind!=="custom")return;const ae=K.trim();!ae||p.models.some(le=>le.id===ae)||Ae([...p.models,{id:ae}])},Ct=(K,ae)=>{p.kind==="custom"&&Ae(p.models.map(le=>le.id===K?{...le,...ae}:le))},D=K=>{const ae=n.models[K]??[];return ae.length?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"模型"}),l.jsx("div",{className:"roster",children:ae.map(le=>l.jsx("div",{className:"rrow",children:l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[le.name,l.jsx("span",{className:"rtags",children:l.jsx("span",{className:"rtag mono",children:le.id})})]}),l.jsxs("div",{className:"caps",children:[le.input?.includes("image")?l.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:l.jsx(V,{name:"image",size:14})}):null,le.reasoning?l.jsx("span",{title:"支持推理","aria-label":"支持推理",children:l.jsx(V,{name:"bulb",size:14})}):null,le.contextWindow?l.jsx("span",{className:"ctx",children:jh(le.contextWindow)}):null]}),me(le),le.reasoning?l.jsx(kb,{modelRef:le.ref,info:le,disabled:R,onSaved:f}):l.jsx("div",{className:"note",children:"不推理,没有思考档。"})]})},le.id))}),l.jsx("div",{className:"note",children:"模型由服务商提供。会推理的模型可以改每个思考档发给服务商的字符。"})]}):null},J=async()=>{if(R)return;q(!0),O(null);const K=n.providers.find(xe=>xe.id===p.id),ae=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,...K?.kind==="custom"&&K.extra?{extra:K.extra}:{},...p.key.trim()?{key:p.key.trim()}:{}},le=p.kind==="custom"&&p.isNew?p.id.trim()||xf(p.name):p.id;if(!le){q(!1),O("保存失败:请填写标识。模型引用使用该标识,只能包含小写字母、数字、点和短横线,例如 my-proxy。");return}if(p.isNew&&F.has(le)){q(!1),O("该服务商标识已存在,请使用其他标识。");return}if(U!==se){C("正在验证连接…");const xe=await hx(Oe);if(C(null),xe){q(!1),O(`测试连接失败:${xe}`);return}}const oe=await fx(le,ae);if(q(!1),!oe.ok){O(oe.error);return}c(le,"connected"),r(oe.view,"已保存")},te=p.kind==="builtin"?p.isNew?"添加内置服务商":W(p.id):p.isNew?"添加兼容接口":p.name||"兼容接口",re=p.kind==="builtin"?p.id:p.id||xf(p.name);return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"服务商"}),l.jsx(We,{title:te,desc:re?l.jsx("span",{className:"mono",children:re}):null}),p.kind==="builtin"?l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"服务商"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick grow",value:p.id,onChange:K=>he({id:K.target.value}),disabled:!0,children:n.builtin.filter(K=>!p.isNew||!F.has(K.id)).map(K=>l.jsxs("option",{value:K.id,children:[K.name,F.has(K.id)?"(已配置)":""]},K.id))})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),A?l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(K=>K.id===p.id)?.keyConfigured?"已保存,留空则沿用":"sk-…",onChange:K=>he({key:K.target.value}),disabled:R})}):l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已保存"}),l.jsx("button",{className:"pbtn",onClick:()=>z(!0),children:"更换"})]}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"pbtn",disabled:R,onClick:()=>void ve(),children:"测试连接"}),l.jsx("span",{className:"note",children:"测试会请求模型,可能产生费用。"}),j&&U===se?l.jsx("span",{className:"okline",children:j}):null]}),l.jsx(jb,{busy:R,error:S,dirty:we,onCancel:Lt,onSave:()=>void J()})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.name,placeholder:"如「我的代理」",onChange:K=>he({name:K.target.value}),disabled:R})}),p.isNew?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl sub",children:"标识"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.id,placeholder:xf(p.name)||"my-proxy",onChange:K=>he({id:K.target.value}),disabled:R})}),l.jsx("div",{className:"note",children:"模型引用使用该标识,例如 my-proxy/gpt-x。留空则按名称自动生成。"})]}):l.jsxs("div",{className:"note mono",children:["标识:",p.id]}),l.jsx("div",{className:"lbl sub",children:"协议"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick grow",value:p.api,onChange:K=>he({api:K.target.value}),disabled:R,children:ry.map(K=>l.jsx("option",{value:K.key,children:K.label},K.key))})}),l.jsx("div",{className:"lbl sub",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.baseUrl,placeholder:"http://127.0.0.1:8080/v1",onChange:K=>he({baseUrl:K.target.value}),disabled:R})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),A?l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(K=>K.id===p.id)?.keyConfigured?"已保存,留空则沿用":"sk-…",onChange:K=>he({key:K.target.value}),disabled:R})}):l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已保存"}),l.jsx("button",{className:"pbtn",onClick:()=>z(!0),children:"更换"})]}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap"},children:[l.jsx("button",{className:"pbtn",disabled:R||!p.baseUrl.trim(),onClick:()=>void ve(),children:"测试连接"}),j&&U===se?l.jsx("span",{className:"okline",children:j}):null,l.jsx("button",{className:"pbtn",onClick:()=>void Me(),disabled:R||!p.baseUrl.trim(),children:R?"正在获取…":"获取模型列表"}),l.jsx("span",{className:"note",children:"从接口获取模型列表,选择需要使用的模型。"})]}),l.jsx(jb,{busy:R,error:S,dirty:we,onCancel:Lt,onSave:()=>void J()})]})]}),T.length?l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"接口上的模型"}),l.jsx("div",{className:"chips",children:T.map(K=>{const ae=p.models.some(le=>le.id===K.id);return l.jsx("button",{className:`chip${ae?" on":""}`,onClick:()=>xt(K),disabled:R,children:K.name??K.id},K.id)})}),l.jsx("div",{className:"note",children:"点击添加或移除,添加后可在下方修改模型能力。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"模型"}),p.models.length?l.jsx("div",{className:"roster",children:p.models.map(K=>l.jsxs("div",{className:"rrow",children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname mono",children:K.id}),l.jsxs("div",{className:"rfoot",children:[l.jsx("button",{className:`chip${K.input?.includes("image")?" on":""}`,onClick:()=>Ct(K.id,{input:K.input?.includes("image")?["text"]:["text","image"]}),disabled:R,children:"支持图片输入"}),l.jsx("button",{className:`chip${K.reasoning?" on":""}`,onClick:()=>Ct(K.id,{reasoning:!K.reasoning}),disabled:R,children:"支持推理"}),l.jsx("span",{className:"rtag",children:"上下文"}),l.jsx("input",{className:"pmctx",type:"number",min:1,defaultValue:K.contextWindow??Zo,title:"上下文窗口(token)",onBlur:ae=>{const le=Number(ae.target.value)||Zo;le!==(K.contextWindow??Zo)&&Ct(K.id,{contextWindow:le})},onKeyDown:ae=>{ae.key==="Enter"&&ae.currentTarget.blur()},disabled:R},`${K.id}:${K.contextWindow??Zo}`)]}),me(K),K.reasoning?Ee(K.id)?l.jsx(kb,{modelRef:`${p.id}/${K.id}`,info:Ee(K.id),disabled:R,onSaved:f}):l.jsx("div",{className:"note",children:"保存服务商后可以设置思考档。"}):null]}),l.jsx("button",{className:"rremove",title:"移除该模型",disabled:R,onClick:()=>void Ae(p.models.filter(ae=>ae.id!==K.id)),children:l.jsx(V,{name:"close",size:13})})]},K.id))}):l.jsx("div",{className:"empty",children:"尚未添加模型。可获取模型列表后勾选,或手动填写模型 ID。"}),l.jsx(rE,{disabled:R,onAdd:Mt})]})]}),p.kind==="builtin"&&!p.isNew?l.jsx(be,{children:D(p.id)}):null,N?l.jsx("div",{className:N==="已保存"?"okline":"badline",role:"status",children:N}):null,h]})}function rE({disabled:n,onAdd:a}){const[r,o]=y.useState(""),c=()=>{r.trim()&&(a(r),o(""))};return l.jsxs("div",{className:"ctl",style:{gap:8,marginTop:10},children:[l.jsx("div",{className:"field",style:{flex:1},children:l.jsx("input",{value:r,placeholder:"手动填写模型 ID,如 gpt-4o-mini",onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},disabled:n})}),l.jsx("button",{className:"pbtn",onClick:c,disabled:n||!r.trim(),children:"添加"})]})}function jb({busy:n,error:a,dirty:r,onCancel:o,onSave:c}){return l.jsxs(Fn,{saved:!1,error:a,children:[!a&&r?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"pbtn",onClick:o,disabled:n,children:"取消"}),l.jsx("button",{className:"pbtn solid",onClick:c,disabled:n||!r,children:n?"正在验证…":"保存"})]})}function oE(){const n=je(),[a,r]=y.useState(null);return y.useEffect(()=>{Qf().then(r)},[]),a?n.sub?.kind==="model"?l.jsx(uE,{view:a,modelRef:n.sub.ref}):n.sub?.kind==="addModels"?l.jsx(dE,{view:a}):l.jsx(cE,{view:a}):l.jsx("div",{className:"empty",children:"正在读取模型列表…"})}function qf(n,a){return{scores:n.scores??kh(a??{id:n.ref.split("/").at(-1)??n.ref,name:"",reasoning:!1}),unconfirmed:!n.scores||n.scoresConfirmed!==!0}}function cy({entry:n,info:a,update:r,collapsible:o=!1}){const c=qf(n,a),[f,h]=y.useState(!o||c.unconfirmed),[m,p]=y.useState(c.scores),[v,x]=y.useState(n.note),b=y.useRef(!1),N=y.useRef(m);N.current=m,y.useEffect(()=>{b.current||p(qf(n,a).scores)},[n.scores,a]),y.useEffect(()=>x(n.note),[n.note]);const w=A=>r({scores:A,scoresConfirmed:!0}),T=()=>{if(!b.current)return;b.current=!1;const A=n.scores,z=N.current;(!A||n.scoresConfirmed!==!0||A.smart!==z.smart||A.cost!==z.cost||A.speed!==z.speed)&&w(z)};if(!f)return l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:sy(n.scores??m)}),l.jsx("button",{className:"pbtn",onClick:()=>h(!0),children:"修改"})]});const E={smart:"聪明程度",cost:"成本",speed:"速度"};return l.jsxs("div",{className:"group",children:[l.jsxs("div",{className:"note",children:["Hob 按用途选择分派任务的模型。",c.unconfirmed?"数值按模型名称推测,请确认。":""]}),Object.keys(E).map(A=>l.jsxs("div",{className:"score-row",children:[l.jsxs("div",{className:"score-head",children:[l.jsx("label",{htmlFor:`${n.ref}-${A}`,children:E[A]}),l.jsxs("span",{children:[yb(A,m[A])," · ",m[A],"%"]})]}),l.jsx("input",{id:`${n.ref}-${A}`,className:"score-range",type:"range",min:"0",max:"100",step:"5",value:m[A],onChange:z=>{b.current=!0,p({...N.current,[A]:Number(z.target.value)})},onPointerUp:T,onTouchEnd:T,onKeyUp:T,onBlur:T}),l.jsx("div",{className:"score-ticks",children:ny[A].map(z=>l.jsx("button",{style:{left:`${z.value}%`},className:z.value===0?"first":z.value===100?"last":void 0,"aria-pressed":z.label===yb(A,m[A]),onClick:()=>{const U={...N.current,[A]:z.value};p(U),w(U)},children:z.label},z.value))})]},A)),l.jsx("div",{className:"field",children:l.jsx("input",{value:v,onChange:A=>x(A.target.value),onBlur:()=>{v!==n.note&&r({note:v})},onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()},placeholder:"补充说明(选填),如「中文写作特别好」"})}),o?l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"pbtn",onClick:()=>h(!1),children:"收起"})}):null]})}function wh(){const a=je().settings.settings.models,r=Oa(),o=m=>void r.save({models:m});return{models:a,save:o,setRoster:m=>o({roster:m}),update:(m,p)=>void r.save(v=>({models:{roster:v.models.roster.map(x=>x.ref===m?{...x,...p}:x)}})),roles:m=>[a.conversation.ref===m?"对话":null,a.work.ref===m?"任务执行":null].filter(p=>p!==null),feedback:r}}function on({label:n="模型"}){return l.jsxs("button",{className:"subback",onClick:Lt,children:[l.jsx(V,{name:"left",size:15}),n]})}function cE({view:n}){const{models:a,save:r,roles:o,feedback:c}=wh(),f=new Map(n.models.map(p=>[p.ref,p])),h=p=>[...a.roster.length?[]:[{value:"",text:"未设置"}],...a.roster.filter(v=>f.has(v.ref)||v.ref===p).map(v=>({value:v.ref,text:f.get(v.ref)?.name??v.ref}))],m=(p,v,x)=>l.jsxs("div",{className:"mline",children:[l.jsx("span",{className:"k",children:v}),l.jsxs("span",{className:"vals",children:[l.jsx(ly,{value:a[p].ref,label:x,options:h(a[p].ref),onChange:b=>r({[p]:{ref:b,thinking:Wi(f.get(b),a[p].thinking)}})}),l.jsx(ay,{value:Wi(f.get(a[p].ref),a[p].thinking),model:f.get(a[p].ref),onChange:b=>r({[p]:{...a[p],thinking:b}})})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"模型",desc:"可用模型来自「服务商」,默认模型从可用模型中选择。"}),l.jsx(wn,{message:c.message,toast:!0}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"默认模型"}),l.jsxs("div",{className:"mcard",children:[m("conversation","对话","对话模型"),m("work","任务执行","默认任务模型")]}),l.jsx("div",{className:"note",children:"助手分派任务时未指定模型,使用任务执行的模型。"}),l.jsx("div",{className:"lbl",children:"任务的思考档"}),l.jsx(vs,{items:[{key:"auto",label:"助手按任务选择"},{key:"fixed",label:"固定使用默认档"}],value:a.thinkingChoice??"auto",disabled:c.busy,onChange:p=>r({thinkingChoice:p})}),l.jsx("div",{className:"note",children:"按任务选择时,助手会给简单的活用低档、复杂的活用高档;固定时一律使用上面设置的默认档。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"可用模型"}),l.jsxs("div",{className:"mcard",children:[a.roster.map(p=>{const v=f.get(p.ref),x=v?.name??p.ref,b=qf(p,v);return l.jsxs("button",{className:`mrow${v?"":" gone"}`,onClick:()=>Nn({kind:"model",ref:p.ref,title:x}),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:x}),l.jsx("span",{className:"sp"}),v?l.jsx(iy,{info:v}):l.jsx("span",{className:"mbad",children:"不可用"}),l.jsx(V,{name:"chev",size:14})]}),l.jsxs("span",{className:"mprev",children:[o(p.ref).map(N=>l.jsx("span",{className:"mrole",children:N},N)),sy(b.scores),b.unconfirmed?l.jsx("span",{className:"model-use-warning",children:"请确认用途"}):null,v?null:" · 该模型的服务商已删除或未配置 Key"]})]},p.ref)}),l.jsxs("button",{className:"maddrow",onClick:()=>Nn({kind:"addModels",title:"添加模型"}),children:[l.jsx(V,{name:"plus",size:16}),"添加模型"]})]}),l.jsx("div",{className:"note",children:"助手分派任务时,按用途说明在可用模型中选择。"})]})]})}function uE({view:n,modelRef:a}){const{models:r,setRoster:o,update:c,roles:f,feedback:h}=wh(),[m,p]=y.useState(!1),v=r.roster.find(N=>N.ref===a);if(y.useEffect(()=>{v||Lt()},[v]),!v)return null;const x=n.models.find(N=>N.ref===a),b=f(a);return l.jsxs(l.Fragment,{children:[l.jsx(on,{}),l.jsx(We,{title:x?.name??a,desc:l.jsx("span",{className:"mono",children:a})}),l.jsx(wn,{message:h.message,toast:!0}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"用途说明"}),l.jsx(cy,{entry:v,info:x,update:N=>c(a,N)})]}),x?.reasoning?l.jsxs(be,{children:[l.jsx("div",{className:"mcard",children:l.jsxs("div",{className:"mline",children:[l.jsx("span",{className:"k",children:"分派时的思考强度"}),l.jsx(ay,{value:Wi(x,v.thinking??r.work.thinking),model:x,onChange:N=>c(a,{thinking:N})})]})}),l.jsx("div",{className:"note",children:"助手把任务分派给这个模型时使用。作为默认模型时,以「默认模型」中的设置为准。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"信息"}),l.jsxs("div",{className:"kvcard",children:[l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:"服务商"}),l.jsx("span",{className:"v",children:x?.provider??"不可用"})]}),x?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"kvrow",children:[l.jsxs("span",{className:"k kicon",children:[l.jsx(V,{name:"image",size:14}),"图片输入"]}),l.jsx("span",{className:"v",children:x.input.includes("image")?"支持":"不支持"})]}),l.jsxs("div",{className:"kvrow",children:[l.jsxs("span",{className:"k kicon",children:[l.jsx(V,{name:"bulb",size:14}),"推理"]}),l.jsx("span",{className:"v",children:x.reasoning?"支持":"不支持"})]}),l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:"上下文"}),l.jsx("span",{className:"v",children:jh(x.contextWindow)})]})]}):null]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"危险操作"}),l.jsx("div",{className:"mcard",children:m?l.jsxs("div",{className:"ctl",style:{flexWrap:"wrap",padding:12},children:[l.jsx("span",{children:"确定从可用模型中移除?"}),l.jsx("button",{className:"pbtn",onClick:()=>p(!1),children:"取消"}),l.jsx("button",{className:"pbtn danger",onClick:()=>o(r.roster.filter(N=>N.ref!==a)),children:"确认移除"})]}):l.jsx("button",{className:"mline danger",disabled:b.length>0,onClick:()=>p(!0),children:"从可用模型中移除"})}),b.length?l.jsxs("div",{className:"note",children:["这是",b.join("和"),"的默认模型。要移除,请先在「默认模型」中更换。"]}):null]})]})}function dE({view:n}){const{models:a,setRoster:r,roles:o,update:c,feedback:f}=wh(),[h,m]=y.useState(""),p=new Set(a.roster.map(E=>E.ref)),[v,x]=y.useState(()=>[...new Set(n.models.filter(E=>p.has(E.ref)).map(E=>E.provider))]),b=wC(jC(n.models,h)),N=h.trim().length>0,w=E=>x(A=>A.includes(E)?A.filter(z=>z!==E):[...A,E]),T=E=>r(p.has(E.ref)?a.roster.filter(A=>A.ref!==E.ref):[...a.roster,{ref:E.ref,scores:kh(E),note:"",scoresConfirmed:!1,...E.reasoning?{thinking:Wi(E,"medium")}:{}}]);return l.jsxs(l.Fragment,{children:[l.jsx(on,{}),l.jsx(We,{title:"添加模型",desc:"「服务商」提供的全部模型,打勾的已在可用模型中。"}),l.jsx(wn,{message:f.message,toast:!0}),n.models.length===0?l.jsxs(be,{children:[l.jsx("div",{className:"empty",children:"尚无可用模型。请先在「服务商」中配置服务商并填写 API Key。"}),l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"pbtn",onClick:()=>Sl("providers"),children:"配置服务商"})})]}):l.jsxs("div",{className:"mcard",children:[l.jsxs("label",{className:"mfind",children:[l.jsx(V,{name:"search",size:15}),l.jsx("input",{value:h,placeholder:"搜索名称或引用,如 claude",onChange:E=>m(E.target.value)})]}),b.length===0?l.jsx("div",{className:"mempty",children:"没有匹配的模型。"}):b.map(E=>{const A=N||v.includes(E.provider),z=E.models.filter(U=>p.has(U.ref)).length;return l.jsxs(y.Fragment,{children:[l.jsxs("button",{className:"mgroup","aria-expanded":A,onClick:()=>w(E.provider),children:[l.jsx("span",{className:"n",children:E.provider}),l.jsx("span",{className:"c",children:z?`已加入 ${z} / ${E.models.length}`:E.models.length}),l.jsx(V,{name:A?"down":"chev",size:14})]}),A?E.models.map(U=>{const $=p.has(U.ref),j=o(U.ref).length>0,C=a.roster.find(S=>S.ref===U.ref);return l.jsxs("div",{children:[l.jsxs("button",{className:`madd${$?" on":""}`,disabled:j,title:j?"默认模型不能在这里移除":$?"从可用模型中移除":"加入可用模型",onClick:()=>T(U),children:[l.jsx("span",{className:"mname",children:U.name}),l.jsx(iy,{info:U}),l.jsx(V,{name:$?"check":"plus",size:16,className:"mtog"})]}),C?l.jsx("div",{className:"model-use-inline",children:l.jsx(cy,{entry:C,info:U,collapsible:!0,update:S=>c(U.ref,S)})}):null]},U.ref)}):null]},E.provider)})]})]})}function fE(){const a=je().settings.settings.work,r=Oa(),o=c=>r.save({work:c});return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"任务",desc:"任务并行数、无响应判定时间,以及全部任务的任务记录。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"最大并行任务数"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick",value:a.maxJobs,disabled:r.busy,onChange:c=>void o({maxJobs:Number(c.target.value)}),children:[1,2,3,4,5,6,7,8].map(c=>l.jsx("option",{value:c,children:c},c))})}),l.jsx("div",{className:"note",children:"同时运行的最大任务数,超出后排队。"}),l.jsx(wn,{message:r.message})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"无响应判定时间"}),l.jsx("div",{className:"lbl sub",children:"任务"}),l.jsxs("div",{className:"ctl",children:[l.jsx(_a,{value:String(a.jobStallMinutes),onSave:c=>o({jobStallMinutes:Number(c)})}),l.jsx("span",{className:"note",children:"分钟"})]}),l.jsx("div",{className:"lbl sub",children:"助手回复"}),l.jsxs("div",{className:"ctl",children:[l.jsx(_a,{value:String(a.routerStallMinutes),onSave:c=>o({routerStallMinutes:Number(c)})}),l.jsx("span",{className:"note",children:"分钟"})]}),l.jsx(wn,{message:r.message}),l.jsx("div",{className:"note",children:"修改后立即生效,无需重启。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"任务记录"}),l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"pbtn",onClick:()=>eh(),children:"查看全部任务"})}),l.jsx("div",{className:"note",children:"可查看每个任务的完整执行过程。"})]})]})}function hE(){const n=je(),a=Oa(),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,v]=y.useState(null),[x,b]=y.useState(!1),[N,w]=y.useState(null),[T,E]=y.useState(null),A=Gf(),z=()=>void Kf().then(O=>m(O?.endpoint??null));if(y.useEffect(()=>{Vi().then(O=>O.ok?o(O.view):f(O.error)),z()},[]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx("div",{className:"empty",children:"正在读取推送设置…"});const U=typeof Notification<"u"&&Notification.permission==="denied",$=!!(h&&r.devices.some(O=>O.endpoint===h)),j=async()=>{if(!x){b(!0),w(null),E(null);try{const O=$?await iN():await aN();if(!O.ok){w(O.error);return}o(O.view),z(),E($?"此设备将不再接收推送":"此设备将接收推送")}finally{b(!1)}}},C=async O=>{const R=await Kb(O);if(!R.ok){w(R.error);return}o(R.view),v(null),z()},S=async()=>{if(!x){b(!0),w(null),E(null);try{const O=await oN();if(!O.ok){w(O.error);return}O.sent?E("测试通知已发送"):O.removed?(w("这台设备的订阅已失效,已移除;请重新开启本机推送"),Vi().then(R=>R.ok&&o(R.view))):E("未发送:这台设备尚未订阅")}finally{b(!1)}}};return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"通知",desc:"本机推送与已订阅的设备。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"本机推送"}),A?l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"需要确认或任务受阻时推送给我"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${$?"":" off"}`,title:$?"关闭本机推送":"开启本机推送",onClick:()=>void j(),disabled:x})]}):l.jsx("div",{className:"note",children:"这个浏览器不支持推送:请使用 Chrome、Edge、Safari 16.4+,或在 iPhone 上将 Hob 添加到主屏幕。"}),U?l.jsx("div",{className:"note",children:"浏览器已拒绝通知权限:点击地址栏左侧的图标 → 通知 → 允许,然后刷新本页并重新开启。"}):null,l.jsx("div",{className:"note",children:"页面在前台时不推送,页面不在前台或锁屏时才推送。各助手还需在助手设置中开启「需要确认时通知我」。"}),l.jsx("div",{className:"note",children:"在 iPhone 上需先将 Hob 添加到主屏幕,再从主屏幕打开才能接收推送。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"已订阅的设备"}),r.devices.length?r.devices.map(O=>l.jsxs("div",{className:"dev",children:[l.jsx("span",{className:"n",children:O.label}),l.jsx("span",{className:"tm",children:Kt(O.createdAt)}),l.jsx("span",{className:"sp"}),p===O.endpoint?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"note",children:"确认删除?"}),l.jsx("button",{className:"pbtn",onClick:()=>v(null),children:"取消"}),l.jsx("button",{className:"pbtn danger",onClick:()=>void C(O.endpoint),children:"确认删除"})]}):l.jsx("button",{className:"del",title:"删除这台设备",onClick:()=>v(O.endpoint),children:"删除"})]},O.endpoint)):l.jsx("div",{className:"empty",children:"暂无已订阅的设备"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"pbtn",onClick:()=>void S(),disabled:x||!r.devices.length,children:"发送测试通知"}),T&&!N?l.jsx("span",{className:"okline",children:T}):null,N?l.jsx("span",{className:"badline",children:N}):null]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"推送服务联系邮箱(选填)"}),l.jsx(_a,{placeholder:"name@example.com",value:n.settings.settings.push.email,onSave:O=>a.save({push:{email:O.trim()}})}),l.jsx(wn,{message:a.message}),l.jsx("div",{className:"note",children:"推送服务使用此地址联系你;留空使用 Hob 的项目主页。"})]})]})}const Ii="https://api.loremem.com",mE={saas:"https://app.loremem.com/login"},pE=[{key:"saas",label:"Lore 云服务"},{key:"self",label:"自部署"}],gE=[{key:"local",label:"本地记忆"},{key:"lore",label:"Lore"},{key:"off",label:"关闭"}],wb={invalid_url:"服务地址无效。",insecure_http:"公网地址必须使用 https,明文 http 仅允许本机或局域网地址。",missing_token:"缺少 API Token。",unauthorized:"API Token 被拒绝。",unreachable:"无法连接该地址。"},If=n=>n.trim().replace(/\/+$/,"");function Nb(n){return n===null||If(n)===Ii?"saas":"self"}function vE(){const[n,a]=y.useState(null),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState("saas"),[p,v]=y.useState(Ii),[x,b]=y.useState(""),[N,w]=y.useState(!1),[T,E]=y.useState(!1),[A,z]=y.useState(null),[U,$]=y.useState(!1),[j,C]=y.useState(null),[S,O]=y.useState(!1),[R,q]=y.useState(null),[F,W]=y.useState(null),[Ee,he]=y.useState(!1);y.useEffect(()=>{if(!S)return;const te=setTimeout(()=>O(!1),3e3);return()=>clearTimeout(te)},[S]);const we=te=>{a(te),o(null),f(null),m(Nb(te.lore.baseUrl)),v(te.lore.baseUrl??Ii),b(""),w(!1),E(!1),z(null),C(null),O(!1)};if(y.useEffect(()=>{af().then(te=>{te.ok?we(te.config):o(te.error)})},[]),r)return l.jsx("div",{className:"note",children:r});if(!n)return l.jsx("div",{className:"empty",children:"正在读取记忆设置…"});const Oe=c??n.provider,se=n.lore.tokenConfigured&&If(p)===If(n.lore.baseUrl??""),ve=c==="lore"&&!N?n.lore.configured:T,me=c!==null||N,Me=async te=>{if(U)return;if(te===n.provider){f(null);return}if(C(null),O(!1),te==="lore"&&!n.lore.configured){f("lore");return}$(!0);const re=await vx(n.revision,te);if($(!1),!re.ok){C(re.error);return}we(re.config),O(!0)},Ae=te=>{U||(te(),w(!0),E(!1),z(null),C(null),O(!1))},xt=te=>Ae(()=>{m(te),v(te==="saas"?Ii:Nb(n.lore.baseUrl)==="self"?n.lore.baseUrl??"":"")}),Mt=async()=>{if(U)return;$(!0),W(null),he(!1);const te=await sN();if(!te.ok){$(!1),W(te.error);return}if(q({source:te.view.source,found:te.view.found}),!te.view.found){$(!1);return}const re=await lN();if($(!1),!re.ok){W(re.error);return}we(re.config),f("lore"),he(!0)},Ct=async()=>{if(U)return;$(!0),z(null);const te={baseUrl:p.trim(),...x?{token:x}:{}},re=await xx(te);if($(!1),!re.ok){z({ok:!1,text:re.error});return}re.result.ok?(E(!0),z({ok:!0,text:"已连接"})):z({ok:!1,text:wb[re.result.reason]})},D=async()=>{if(U||!me)return;if($(!0),C(null),Oe==="lore"&&!ve){const K=await xx({baseUrl:p.trim(),...x?{token:x}:{}});if(!K.ok){$(!1),C(K.error);return}if(!K.result.ok){$(!1),C(wb[K.result.reason]);return}E(!0)}let te=n;if(Oe==="lore"&&N){const K=await nN({baseUrl:p.trim(),...x?{token:x}:{}});if(!K.ok){$(!1),C(K.error);return}te=K.config}const re=await vx(te.revision,Oe);if($(!1),!re.ok){C(re.error),/已刷新/.test(re.error)&&af().then(K=>K.ok&&we(K.config));return}we(re.config),O(!0)},J=n.provider==="lore"?n.lore.configured?`Lore · 已连接 · 插件 ${n.lorePlugin}`:"Lore · 尚未配置完成:请填写服务地址与 API Token 后保存":n.provider==="local"?"本地记忆 · 已启用":"关闭 · 助手不使用长期记忆";return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"记忆",desc:"所有助手共用同一份长期记忆。各助手特有的做法写在助手设置的「补充说明」中。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"提供者"}),l.jsx(vs,{items:gE,value:Oe,onChange:te=>void Me(te),disabled:U}),l.jsx("div",{className:"sline",children:J}),l.jsx(wn,{message:j??(S?"已保存":null)})]}),Oe==="lore"?l.jsxs(l.Fragment,{children:[l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"部署方式"}),l.jsx(vs,{items:pE,value:h,onChange:xt,disabled:U}),l.jsx("div",{className:"lbl",children:"服务地址"}),h==="saas"?l.jsx("div",{className:"field ro",children:Ii}):l.jsx("div",{className:"field",children:l.jsx("input",{value:p,placeholder:"http://192.168.1.10:18901",onChange:te=>Ae(()=>v(te.target.value)),disabled:U})}),l.jsxs("div",{className:"lblrow",children:[l.jsx("span",{className:"lbl",children:"Token"}),l.jsx("a",{className:"link",href:mE.saas,target:"_blank",rel:"noreferrer",children:"注册 / 登录 Lore"})]}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:x,placeholder:se?"已保存,留空则沿用":"lm_…",onChange:te=>Ae(()=>b(te.target.value)),disabled:U})}),l.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"pbtn",onClick:()=>void Ct(),disabled:U||p.trim()==="",children:"测试连接"}),A?l.jsx("span",{className:A.ok?"okline":"badline",children:A.text}):null]}),l.jsxs(Fn,{saved:S&&!me,error:j,children:[!j&&me?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"pbtn",onClick:()=>void af().then(te=>te.ok?we(te.config):o(te.error)),disabled:U||!me,children:"取消"}),l.jsx("button",{className:"pbtn solid",onClick:()=>void D(),disabled:U||!me,children:U?"正在验证…":"保存"})]})]})}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"本机配置"}),l.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"pbtn",onClick:()=>void Mt(),disabled:U,children:U?"正在导入…":"从本机导入"}),Ee?l.jsx("span",{className:"okline",children:"已导入本机的连接"}):null]}),l.jsx("div",{className:"note",children:"读取这台电脑上已保存的 Lore 连接,导入后无需重新填写。"}),R?l.jsxs("div",{className:"sline",children:["来源:",R.source]}):null,R&&!R.found?l.jsx("div",{className:"note",children:"未找到可导入的配置。"}):null,F?l.jsx("div",{className:"badline",children:F}):null]})]}):null]})}const xE=[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],bE=["1024x1024","1536x1024","1024x1536","512x512"],uy=n=>n.trim().replace(/\/+$/,"");function yE(){const a=je().settings.settings.knowledge?.embedding??{source:"off"},[r,o]=y.useState(a.source),[c,f]=y.useState(a.source==="openai"?a.baseUrl:""),[h,m]=y.useState(a.source==="openai"?a.model:""),[p,v]=y.useState(""),[x,b]=y.useState(!1),[N,w]=y.useState(!1),[T,E]=y.useState(null);y.useEffect(()=>{Jw().then(U=>b(U.keyConfigured)).catch(U=>E({ok:!1,text:`读取设置失败:${U instanceof Error?U.message:String(U)}`}))},[]);const A=r==="off"?{source:"off"}:{source:"openai",baseUrl:uy(c),model:h.trim()},z=async U=>{w(!0),E(null);try{if(U){const $=await Fw(A,p.trim()||void 0);b($.keyConfigured),v(""),E({ok:!0,text:"已保存"})}else{const $=await Pw({embedding:A,...p.trim()?{apiKey:p.trim()}:{}});E($.ok?{ok:!0,text:`连接成功 · ${$.dims} 维`}:{ok:!1,text:$.error})}}catch($){E({ok:!1,text:$ instanceof Error?$.message:String($)})}finally{w(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"知识库",desc:"配置向量模型,关闭时只按关键词查找。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"向量模型"}),l.jsx(vs,{items:[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],value:r,onChange:o,disabled:N})]}),r==="openai"?l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"服务地址",value:c,onChange:U=>f(U.target.value),disabled:N,placeholder:"http://127.0.0.1:8080/v1"})}),l.jsx("div",{className:"lbl",children:"模型名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"模型名称",value:h,onChange:U=>m(U.target.value),disabled:N})}),l.jsx("div",{className:"lbl",children:"API Key"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"API Key",type:"password",value:p,onChange:U=>v(U.target.value),disabled:N,placeholder:x?"已设置,留空保持不变":"请输入 API Key"})}),l.jsx("button",{className:"pbtn",disabled:N,onClick:()=>void z(!1),children:"测试连接"})]})}):null,l.jsx(be,{children:l.jsx("div",{className:"dim",children:"建索引和查询时,文件内容和问题会发给这个接口。"})}),l.jsx(Fn,{saved:T?.ok===!0,error:T?.ok===!1?T.text:null,children:l.jsx("button",{className:"pbtn solid",disabled:N,onClick:()=>void z(!0),children:"保存"})}),T?.ok&&T.text!=="已保存"?l.jsx("div",{className:"okline",role:"status",children:T.text}):null]})}function kE(){const a=je().settings.settings.image,[r,o]=y.useState(a.source),[c,f]=y.useState(a.source==="openai"?a.baseUrl:""),[h,m]=y.useState(a.source==="openai"?a.model:""),[p,v]=y.useState(a.source==="openai"?a.size??"":""),[x,b]=y.useState(""),[N,w]=y.useState(!1),[T,E]=y.useState(null),[A,z]=y.useState(null),[U,$]=y.useState(!1),[j,C]=y.useState(null),[S,O]=y.useState(null);y.useEffect(()=>{if(!j)return;const he=setTimeout(()=>C(null),3e3);return()=>clearTimeout(he)},[j]),y.useEffect(()=>{tN().then(he=>{he&&w(he.keyConfigured)})},[]);const R=r==="openai"?{source:"openai",baseUrl:uy(c),model:h.trim(),...p?{size:p}:{}}:{source:"off"},q=JSON.stringify(R)!==JSON.stringify(a)||x.trim()!=="",F=JSON.stringify({form:R,apiKey:x.trim()});y.useEffect(()=>{E(null),z(null)},[F]);const W=async()=>{if(U)return;$(!0),E(null);const he=await gx({image:R,...x.trim()?{apiKey:x.trim()}:{}});$(!1),he.ok?(z(F),E({ok:!0,text:"生成成功",path:he.path})):(z(null),E({ok:!1,text:he.error}))},Ee=async()=>{if(U||!q)return;if($(!0),O(null),C(null),R.source==="openai"&&A!==F){const we=await gx({image:R,...x.trim()?{apiKey:x.trim()}:{}});if(!we.ok){$(!1),z(null),O(`测试连接失败:${we.error}`);return}z(F),E({ok:!0,text:"生成成功",path:we.path})}const he=await px(R,x.trim()||void 0);if($(!1),!he.ok){O(he.error);return}R.source==="openai"&&(f(R.baseUrl),m(R.model)),b(""),w(he.keyConfigured),E(null),C("已保存")};return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"图像生成",desc:"选择图像生成方式:关闭,或使用 OpenAI 兼容接口。配置完成后,开启了图像生成能力的助手可以在任务中生成图片。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"生成方式"}),l.jsx(vs,{items:xE,value:r,onChange:he=>{E(null),O(null),C(null),he==="off"&&a.source!=="off"?($(!0),px({source:"off"}).then(we=>{if($(!1),!we.ok){O(we.error);return}o("off"),b(""),C("已保存")})):o(he)},disabled:U})]}),r==="openai"?l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:c,placeholder:"http://127.0.0.1:8080/v1",onChange:he=>f(he.target.value),disabled:U})}),l.jsx("div",{className:"lbl",children:"模型名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:h,placeholder:"gpt-image-1",onChange:he=>m(he.target.value),disabled:U})}),l.jsx("div",{className:"lbl",children:"默认尺寸"}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:p,onChange:he=>v(he.target.value),disabled:U,children:[l.jsx("option",{value:"",children:"不指定,使用接口默认值"}),bE.map(he=>l.jsx("option",{value:he,children:he},he))]})}),l.jsx("div",{className:"lbl",children:"API Key"}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:x,placeholder:N?"已保存,留空则沿用":"sk-…",onChange:he=>b(he.target.value),disabled:U})}),l.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。保存前会生成测试图片,可能产生费用。"}),l.jsx("div",{className:"lbl",children:"测试"}),l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"pbtn",onClick:()=>void W(),disabled:U,children:U?"正在生成…":"生成测试图片"}),T?l.jsxs("div",{className:"testout",children:[l.jsx("span",{className:T.ok?"okline":"badline",children:T.text}),T.ok&&T.path?l.jsx("button",{className:"imgcard testshot",onClick:()=>window.open(Ut(T.path),"_blank","noopener"),title:"查看原图",children:l.jsx("img",{src:Ut(T.path),alt:"生成的图片"})}):null]}):null]}),l.jsxs(Fn,{saved:j!==null&&!q,error:S,children:[!S&&q?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"pbtn",disabled:U||!q,onClick:()=>{o(a.source),f(a.source==="openai"?a.baseUrl:""),m(a.source==="openai"?a.model:""),v(a.source==="openai"?a.size??"":""),b(""),E(null),z(null),O(null)},children:"取消"}),l.jsx("button",{className:"pbtn solid",onClick:()=>void Ee(),disabled:U||!q,children:U?"正在验证…":"保存"})]})]})}):l.jsx(wn,{message:S??j})]})}const jE={hob:"Hob 的技能",common:"通用技能 · ~/.agents/skills",lore:"Lore 技能"},wE=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"pi",label:"pi"}],bf=n=>`${n.source}:${n.id}`,Vt=n=>n instanceof Error?n.message:String(n);function NE(){const n=je(),a=n.sub,[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),p=async()=>{try{o(await Rw()),f(null)}catch(w){f(Vt(w))}};y.useEffect(()=>{p()},[]),y.useEffect(()=>{a&&m(null)},[a]);const v=async w=>{const T=`${w.source}:${w.name}`,E=n.settings.settings.skills?.disabled??[],A=w.enabled?[...E,T]:E.filter(z=>z!==T);await Zf({skills:{disabled:A}})?await p():f(Vs().notice??"保存失败")},x=w=>{p(),m(w),Lt()};if(!r)return c?l.jsx("div",{className:"badline",children:c}):l.jsx("div",{className:"empty",children:"正在读取技能…"});if(a?.kind==="skill")return l.jsx(SE,{skill:r.skills.find(w=>bf(w)===a.key),onDeleted:x});if(a?.kind==="importSkills")return l.jsx(TE,{onDone:x});const b=(w,T)=>w.length?w.map(E=>l.jsxs("div",{className:`rrow${E.enabled?"":" gone"}`,children:[l.jsxs("button",{className:"rmain rbtn",onClick:()=>Nn({kind:"skill",key:bf(E),title:E.name}),children:[l.jsxs("div",{className:"rname",children:[E.name,E.overridden?l.jsx("span",{className:"rtag",children:"被同名技能覆盖"}):null]}),l.jsx("div",{className:"rprov rclamp",children:E.description})]}),l.jsx("button",{className:`tog${E.enabled?"":" off"}`,"aria-label":`${E.name}启用`,"aria-pressed":E.enabled,onClick:()=>void v(E)})]},bf(E))):l.jsx("div",{className:"rempty",children:T}),N=r.skills.filter(w=>w.source==="hob");return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"技能",desc:"技能是写好的做法说明,任务按需读取。同名时 Hob 的技能优先,其次是 Lore,最后是通用技能。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"Hob 的技能"}),l.jsxs("div",{className:"roster",children:[b(N,"还没有技能,可以从其他工具导入"),l.jsxs("button",{className:"maddrow",onClick:()=>Nn({kind:"importSkills",title:"导入技能"}),children:[l.jsx(V,{name:"plus",size:16}),"从 Claude Code、Codex、pi 导入"]})]}),h?l.jsx("div",{className:"okline",children:h}):null]}),l.jsxs(be,{children:[l.jsxs("div",{className:"lbl",children:["通用技能 ",l.jsx("span",{className:"lbl-aside",children:"~/.agents/skills"})]}),l.jsx("div",{className:"roster",children:b(r.skills.filter(w=>w.source==="common"),"目录中没有技能")})]}),l.jsxs(be,{children:[l.jsxs("div",{className:"lbl",children:["Lore 技能",r.loreActive&&r.loreUrl?l.jsx("a",{className:"lbl-aside",href:r.loreUrl,target:"_blank",rel:"noreferrer",children:"在 Lore 控制台管理"}):null]}),r.loreActive?l.jsx("div",{className:"roster",children:b(r.skills.filter(w=>w.source==="lore"),"Lore 中没有技能")}):l.jsx("div",{className:"note",children:"在 设置 → 记忆 中连接 Lore 后,这里会列出 Lore 中的技能。"})]}),c?l.jsx("div",{className:"badline",role:"alert",children:c}):null]})}function SE({skill:n,onDeleted:a}){const[r,o]=y.useState(null);if(!n)return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"技能"}),l.jsx("div",{className:"note",children:"技能不存在或已删除。"})]});const c=async()=>{if(window.confirm(`删除技能「${n.name}」?此操作不能撤销。`))try{await Uw(n.id),a(`已删除「${n.name}」`)}catch(f){o(Vt(f))}};return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"技能"}),l.jsx(We,{title:n.name,desc:n.description}),l.jsxs("div",{className:"sline",children:[jE[n.source],n.overridden?" · 被优先级更高的同名技能覆盖":"",n.enabled?"":" · 已停用"]}),l.jsx(Ua,{className:"skill-doc fp-md markdown-body",text:n.content}),n.source==="hob"?l.jsx(Fn,{saved:!1,error:r,children:l.jsx("button",{className:"pbtn danger",onClick:()=>void c(),children:"删除技能"})}):null]})}function TE({onDone:n}){const[a,r]=y.useState("claude"),[o,c]=y.useState(null),[f,h]=y.useState([]),[m,p]=y.useState(!1),[v,x]=y.useState(!1),[b,N]=y.useState(null);y.useEffect(()=>{let T=!0;return c(null),h([]),N(null),Dw(a).then(E=>{T&&c(E)}).catch(E=>{T&&N(Vt(E))}),()=>{T=!1}},[a]);const w=async()=>{x(!0),N(null);try{const T=await $w(a,f,m),E=[...T.skipped,...T.errors];E.length?N(E.join(";")):n(`已导入 ${T.imported.length} 个技能`)}catch(T){N(Vt(T))}finally{x(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"技能"}),l.jsx(We,{title:"导入技能",desc:"从其他工具的技能目录复制到 Hob,来源只读。"}),l.jsx(be,{children:l.jsx(vs,{items:wE,value:a,onChange:r,disabled:v})}),l.jsxs(be,{children:[o===null?b?null:l.jsx("div",{className:"empty",children:"正在读取…"}):o.found?l.jsx("div",{className:"roster",children:o.skills.length?o.skills.map(T=>l.jsxs("label",{className:"rrow",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:f.includes(T.id),disabled:v,onChange:E=>h(E.target.checked?[...f,T.id]:f.filter(A=>A!==T.id))}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[T.name,T.exists?l.jsx("span",{className:"rtag",children:"已存在"}):null]}),l.jsx("div",{className:"rprov rclamp",children:T.description})]})]},T.id)):l.jsx("div",{className:"rempty",children:"目录中没有技能"})}):l.jsx("div",{className:"empty",children:"未找到这个工具的技能目录。"}),o?.skipped.map(T=>l.jsx("div",{className:"note",children:T},T))]}),o?.skills.some(T=>T.exists)?l.jsxs("label",{className:"ctl skill-overwrite",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:m,onChange:T=>p(T.target.checked)}),"覆盖已存在的同名技能"]}):null,l.jsxs(Fn,{saved:!1,error:b,children:[l.jsx("button",{className:"pbtn",onClick:Lt,disabled:v,children:"取消"}),l.jsx("button",{className:"pbtn solid",disabled:v||!f.length,onClick:()=>void w(),children:v?"正在导入…":f.length?`导入 ${f.length} 个`:"导入所选"})]})]})}const CE={pi:"pi",claude:"Claude Code",cursor:"Cursor"};function EE(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 AE(){const n=je().sub,[a,r]=y.useState(null),[o,c]=y.useState(null),[f,h]=y.useState(null),[m,p]=y.useState({}),v=y.useRef(new Set);y.useEffect(()=>{mx().then(r).catch(T=>c(Vt(T)))},[]),y.useEffect(()=>{n&&h(null)},[n]);const x=async(T,E=!1)=>{if(T.valid){p(A=>({...A,[T.name]:{state:"probing"}}));try{const A=await Gw(T.name,E);p(z=>({...z,[T.name]:A.ok?{state:"connected",tools:A.tools}:{state:A.state,error:A.error,stderrTail:A.stderrTail}}))}catch{p(A=>({...A,[T.name]:{state:"failed",error:"无法测试连接"}}))}}};y.useEffect(()=>{if(a)for(const T of a.servers)!T.valid||!T.enabled||v.current.has(T.name)||(v.current.add(T.name),x(T))},[a]);const b=T=>{mx().then(r).catch(()=>{}),h(T),Lt()};if(o)return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具。"}),l.jsx("div",{className:"badline",role:"alert",children:o}),l.jsx("div",{className:"note",children:"请修复数据目录 engine/mcp.json 后重试;修复前任务不会加载 MCP 服务。"})]});if(!a)return l.jsx("div",{className:"empty",children:"正在读取 MCP 服务…"});if(n?.kind==="mcpServer")return l.jsx(_E,{server:a.servers.find(T=>T.name===n.name),setView:r,probe:m[n.name],onProbe:x,onDone:b});if(n?.kind==="addMcp")return l.jsx(OE,{onDone:b});if(n?.kind==="importMcp")return l.jsx(RE,{onDone:b});const N=T=>T.kind==="http"?"远程地址":"本地命令",w=async T=>{try{const E=await Gb(T.name,{enabled:!T.enabled});if(r(E),!T.enabled)for(const A of E.servers)A.name===T.name&&A.valid&&x(A,!0)}catch(E){h(Vt(E))}};return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具,所有助手派出的任务共用这份配置;对话不直接使用。配置改动对之后新开的任务生效,进行中的任务不受影响。"}),l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"pbtn solid",onClick:()=>Nn({kind:"addMcp",title:"添加 MCP 服务"}),children:"添加服务"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"pbtn",onClick:()=>Nn({kind:"importMcp",title:"从本机导入 MCP 服务"}),children:"从本机导入"})]}),l.jsx("div",{className:"lbl",children:"已配置的服务"}),l.jsxs("div",{className:"roster",children:[a.servers.map(T=>l.jsxs("div",{className:`rrow${T.enabled&&T.valid?"":" gone"}`,children:[l.jsxs("button",{className:"rmain rbtn",onClick:()=>Nn({kind:"mcpServer",name:T.name,title:T.name}),children:[l.jsxs("div",{className:"rname",children:[T.name,T.valid?null:l.jsx("span",{className:"rtag",children:"配置无效"})]}),l.jsx("div",{className:"rprov rclamp",children:T.valid?T.kind==="http"?T.url:[T.command,...T.args??[]].join(" "):T.invalidReason})]}),l.jsx("span",{className:"note",style:{flex:"none"},children:`${N(T)} · ${EE(T,m[T.name])}`}),T.valid?l.jsx("button",{className:`tog${T.enabled?"":" off"}`,"aria-label":`${T.name}启用`,"aria-pressed":T.enabled,onClick:()=>void w(T)}):null]},T.name)),a.servers.length?null:l.jsx("div",{className:"rempty",children:"还没有配置 MCP 服务"})]}),f?l.jsx("div",{className:f.startsWith("已")?"okline":"badline",role:"status",children:f}):null,l.jsx("div",{className:"note",children:"环境变量和请求头的值只保存在本机,保存后不再显示。远程服务需要 OAuth 登录时这版暂不支持。"})]})]})}function Sb(n){return Object.entries(n??{}).map(([a,r])=>({key:a,value:r.redacted?"":r.value??"",secret:r.redacted}))}function Tb(n,a){const r={},o=new Set(a.filter(c=>c.key.trim()).map(c=>c.key.trim()));for(const c of Object.keys(n??{}))o.has(c)||(r[c]={mode:"remove"});for(const c of a){const f=c.key.trim();f&&(c.value===""&&c.secret?r[f]={mode:"preserve"}:c.value!==""&&(r[f]={mode:"replace",value:c.value}))}return Object.keys(r).length?r:void 0}function Cb({rows:n,onChange:a,keyLabel:r,valueLabel:o}){const c=(f,h)=>a(n.map((m,p)=>p===f?{...m,...h}:m));return l.jsxs("div",{className:"pairlist",children:[n.map((f,h)=>l.jsxs("div",{className:"pairrow",children:[l.jsx("label",{className:"field",children:l.jsx("input",{className:"mono",value:f.key,placeholder:r,onChange:m=>c(h,{key:m.target.value})})}),l.jsx("label",{className:"field",children:l.jsx("input",{className:"mono",type:"password",value:f.value,placeholder:f.secret&&f.value===""?"已保存,留空则沿用":o,onChange:m=>c(h,{value:m.target.value})})}),l.jsx("button",{className:"ib",title:"删除这一项",onClick:()=>a(n.filter((m,p)=>p!==h)),children:l.jsx(V,{name:"close",size:15})})]},h)),l.jsx("div",{children:l.jsx("button",{className:"pbtn",onClick:()=>a([...n,{key:"",value:"",secret:!1}]),children:"添加一项"})})]})}const zE={kind:"stdio",command:"",args:"",env:[],cwd:"",url:"",headers:[],description:""};function ME(n){return{kind:n.kind??"stdio",command:n.command??"",args:(n.args??[]).join(`
|
|
264
|
+
`),env:Sb(n.env),cwd:n.cwd??"",url:n.url??"",headers:Sb(n.headers),description:n.description??""}}function dy({initial:n,name:a,onName:r,fixedName:o,onSaved:c,saveLabel:f}){const[h,m]=y.useState(n),[p,v]=y.useState(!1),[x,b]=y.useState(null),N=T=>m(E=>({...E,...T})),w=async()=>{b(null);const T=a.trim();if(!/^[A-Za-z0-9_-]{1,64}$/.test(T)){b("名称只能用字母、数字、_ 和 -,最长 64 字符。");return}const E=Object.fromEntries(n.env.map($=>[$.key,$.secret?{redacted:!0}:{redacted:!1,value:$.value}])),A=Object.fromEntries(n.headers.map($=>[$.key,$.secret?{redacted:!0}:{redacted:!1,value:$.value}])),z=Tb(n.env.length?E:void 0,h.env),U=Tb(n.headers.length?A:void 0,h.headers);v(!0);try{await Iw(T,{kind:h.kind,...h.kind==="stdio"?{command:h.command.trim(),...h.args.trim()?{args:h.args.split(/\r?\n/).map($=>$.trim()).filter(Boolean)}:{},...h.cwd.trim()?{cwd:h.cwd.trim()}:{},...z?{env:z}:{}}:{url:h.url.trim(),...U?{headers:U}:{}},...h.description.trim()?{description:h.description.trim()}:{}}),c(o?`已保存「${T}」`:`已添加「${T}」`)}catch($){b(Vt($))}finally{v(!1)}};return l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:a,readOnly:o,placeholder:"如 filesystem",onChange:T=>r?.(T.target.value)})}),o?null:l.jsx("div",{className:"note",children:"字母、数字、_ 和 -;- 和 _ 视为同名。改名请删除后重新添加。"}),l.jsx("div",{className:"lbl",children:"类型"}),l.jsx(vs,{items:[{key:"stdio",label:"本地命令"},{key:"http",label:"远程地址"}],value:h.kind,onChange:T=>N({kind:T}),disabled:p}),h.kind==="stdio"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"命令"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.command,placeholder:"如 npx 或 uvx(一个可执行文件,不是整条命令行)",onChange:T=>N({command:T.target.value})})}),l.jsx("div",{className:"lbl",children:"参数"}),l.jsx("div",{className:"field",children:l.jsx("textarea",{className:"mono",rows:3,value:h.args,placeholder:`-y
|
|
265
|
+
@modelcontextprotocol/server-filesystem
|
|
266
|
+
.`,onChange:T=>N({args:T.target.value})})}),l.jsx("div",{className:"note",children:"一行一个参数。"}),l.jsx("div",{className:"lbl",children:"环境变量"}),l.jsx(Cb,{rows:h.env,onChange:T=>N({env:T}),keyLabel:"变量名",valueLabel:"值"}),l.jsx("div",{className:"lbl",children:"工作目录"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.cwd,placeholder:"可空;相对路径按任务的工作目录解析",onChange:T=>N({cwd:T.target.value})})})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.url,placeholder:"https://example.com/mcp(streamable HTTP,不支持 /sse 结尾)",onChange:T=>N({url:T.target.value})})}),l.jsx("div",{className:"lbl",children:"请求头"}),l.jsx(Cb,{rows:h.headers,onChange:T=>N({headers:T}),keyLabel:"名称",valueLabel:"值"})]}),l.jsx("div",{className:"lbl",children:"说明"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:h.description,placeholder:"这个服务提供什么,一句话(可空)",onChange:T=>N({description:T.target.value})})}),x?l.jsx("div",{className:"badline",role:"alert",children:x}):null,l.jsx(Fn,{saved:!1,error:null,children:l.jsx("button",{className:"pbtn solid",disabled:p,onClick:()=>void w(),children:p?"正在保存…":f})})]})}function OE({onDone:n}){const[a,r]=y.useState("");return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"MCP"}),l.jsx(We,{title:"添加 MCP 服务",desc:"本地命令(stdio)或远程地址(streamable HTTP)。保存后可以在详情里测试连接并开关单个工具。"}),l.jsx(be,{children:l.jsx(dy,{initial:zE,name:a,onName:r,fixedName:!1,onSaved:n,saveLabel:"添加"})})]})}function _E({server:n,setView:a,probe:r,onProbe:o,onDone:c}){const[f,h]=y.useState(null),[m,p]=y.useState(!1),[v,x]=y.useState(!1),[b,N]=y.useState(null);if(y.useEffect(()=>{n||Lt()},[n]),!n)return null;const w=b??n.hiddenTools??[],T=r?.state==="connected"?r.tools??[]:void 0,E=async $=>{p(!0),h(null);try{const j=await Gb(n.name,$);return a(j),j}catch(j){return h(Vt(j)),null}finally{p(!1)}},A=async()=>{x(!0);try{await o(n,!0)}finally{x(!1)}},z=async()=>{if(window.confirm(`删除 MCP 服务「${n.name}」?此操作不能撤销。`))try{a(await Yw(n.name)),c(`已删除「${n.name}」`)}catch($){h(Vt($))}},U=n.kind==="http"?"远程地址":"本地命令";return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"MCP"}),l.jsx(We,{title:n.name,desc:n.description??(n.valid?`${U}的 MCP 服务`:n.invalidReason)}),n.valid?l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${n.name}启用`,"aria-pressed":n.enabled,disabled:m,onClick:()=>void E({enabled:!n.enabled})})]}),l.jsx("div",{className:"lbl",children:"提供方式"}),l.jsx(vs,{items:[{key:"direct",label:"直接提供"},{key:"deferred",label:"按需搜索"}],value:n.exposure,disabled:m,onChange:$=>void E({exposure:$})}),l.jsx("div",{className:"note",children:"直接提供:工具和内置工具一样声明给模型,适合工具少的服务。按需搜索:模型先搜索再调用,适合工具多的服务。"})]}):l.jsxs(be,{children:[l.jsxs("div",{className:"badline",role:"alert",children:["配置无效:",n.invalidReason]}),l.jsx("div",{className:"note",children:"删除后重新添加,或在下方按表单保存一次即可修复。"})]}),n.valid?l.jsxs(be,{children:[l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"pbtn",onClick:()=>void A(),disabled:v,children:v?"正在测试…":"测试连接"}),r?l.jsx("span",{className:r.state==="connected"?"okline":"badline",children:r.state==="connected"?`已连接 · ${r.tools?.length??0} 个工具`:r.state==="needs_auth"?"需要登录,暂不支持":r.error??"连接失败"}):l.jsx("span",{className:"note",children:"连接后列出服务提供的工具"})]}),r&&r.state!=="connected"&&r.stderrTail?.length?l.jsx("div",{className:"note mono",children:r.stderrTail.join(`
|
|
267
|
+
`)}):null,T?T.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"lbl",children:["工具(",T.length,")"]}),l.jsx("div",{className:"roster",children:T.map($=>{const j=w.includes($.name);return l.jsxs("div",{className:`rrow${j?" gone":""}`,children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname mono",children:$.name}),l.jsx("div",{className:"rprov rclamp",children:$.description||"(没有说明)"})]}),l.jsx("button",{className:`tog${j?" off":""}`,"aria-label":`${$.name}启用`,"aria-pressed":!j,disabled:m,onClick:()=>{const C=j?w.filter(S=>S!==$.name):[...w,$.name];N(C),E({hiddenTools:C})}})]},$.name)})}),l.jsx("div",{className:"note",children:"关掉的工具不声明给模型;改动对之后新开的任务生效。"})]}):l.jsx("div",{className:"note",children:"服务已连接,但没有提供工具。"}):l.jsx("div",{className:"note",children:"先测试连接,取得服务的工具列表后可以单独开关每个工具。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:n.valid?"编辑":"重新保存"}),l.jsx(dy,{initial:ME(n),name:n.name,fixedName:!0,onSaved:c,saveLabel:"保存"})]}),l.jsxs(be,{children:[l.jsx("button",{className:"pbtn danger",disabled:m,onClick:()=>void z(),children:"删除服务"}),f?l.jsx("div",{className:"badline",role:"alert",children:f}):null]}),l.jsx("div",{className:"note",children:"环境变量和请求头的值不回显;留空表示沿用已保存的值。删除整行表示删掉这个值。"})]})}function RE({onDone:n}){const[a,r]=y.useState(null),[o,c]=y.useState([]),[f,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{let b=!0;return Kw().then(N=>{b&&r(N)}).catch(N=>{b&&p(Vt(N))}),()=>{b=!1}},[]);const v=async()=>{h(!0),p(null);try{const b=await Xw(o),N=b.skipped.length?`,跳过 ${b.skipped.length} 个(同名)`:"";n(`已导入 ${b.imported.length} 个服务${N}`)}catch(b){p(Vt(b))}finally{h(!1)}},x=a?.items??[];return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"MCP"}),l.jsx(We,{title:"从本机导入 MCP 服务",desc:"读取本机 pi、Claude Code、Cursor 里已配置的 MCP 服务,复制到 Hob;来源只读,同名跳过。"}),l.jsxs(be,{children:[a?.sources.length?l.jsxs("div",{className:"note",children:["读取位置:",a.sources.join(";")]}):null,l.jsx("div",{className:"roster",children:x.length?x.map(b=>l.jsxs("label",{className:"rrow",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:o.includes(b.id),disabled:f||!b.selectable,onChange:N=>c(N.target.checked?[...o,b.id]:o.filter(w=>w!==b.id))}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[b.name,l.jsx("span",{className:"rtag",children:CE[b.source]}),b.exists?l.jsx("span",{className:"rtag",children:"同名跳过"}):null]}),l.jsxs("div",{className:"rprov rclamp",children:[b.kind==="http"?"远程地址":"本地命令",b.note?` · ${b.note}`:""]})]})]},b.id)):l.jsx("div",{className:"rempty",children:"没有找到可导入的 MCP 服务"})}),l.jsxs(Fn,{saved:!1,error:m,children:[l.jsx("button",{className:"pbtn",onClick:Lt,disabled:f,children:"取消"}),l.jsx("button",{className:"pbtn solid",disabled:f||!o.length,onClick:()=>void v(),children:f?"正在导入…":o.length?`导入 ${o.length} 个`:"导入所选"})]})]})]})}const yl={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 DE(){const n=je(),a=n.sub,r=n.settings.settings.search,[o,c]=y.useState(null),[f,h]=y.useState(null),[m,p]=y.useState(!1),v=async()=>c(await Vw());y.useEffect(()=>{v().catch(E=>h(Vt(E)))},[]),y.useEffect(()=>{a&&h(null)},[a]);const x=E=>o?.providers.find(A=>A.name===E)?.keyConfigured??!1,b=async(E,A)=>{p(!0);try{const z=await Qw(E,A);return z?(h(z),z):(await v(),null)}catch(z){const U=Vt(z);return h(U),U}finally{p(!1)}},N=r.filter(E=>E.enabled),w=(E,A)=>{const z=N.map(j=>j.name),U=z.indexOf(E),$=U+A;$<0||$>=z.length||([z[U],z[$]]=[z[$],z[U]],b([...z.map(j=>r.find(C=>C.name===j)),...r.filter(j=>!j.enabled)]))};if(a?.kind==="searchProvider"){const E=r.find(A=>A.name===a.name);return E?l.jsx($E,{provider:E,configured:x(E.name),busy:m,save:(A,z)=>b(r.map(U=>U.name===A.name?A:U),z===void 0?void 0:{[A.name]:z})}):l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"联网搜索"}),l.jsx("div",{className:"note",children:"没有这个服务商。"})]})}const T=E=>x(E.name)?"已配置 Key":E.baseUrl?"已填服务地址":"未配置";return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"联网搜索",desc:"助手和任务通过这里的服务商搜索网页、读取正文。可以启用多个,按顺序使用,前一个失败时自动换下一个。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"已启用"}),N.length?l.jsx("div",{className:"roster",children:N.map((E,A)=>l.jsxs("div",{className:"rrow",children:[l.jsx("span",{className:"rorder",children:A+1}),l.jsxs("button",{className:"rmain rbtn",onClick:()=>Nn({kind:"searchProvider",name:E.name,title:yl[E.name].label}),children:[l.jsx("div",{className:"rname",children:yl[E.name].label}),l.jsx("div",{className:"rprov",children:yl[E.name].desc})]}),l.jsx("button",{className:"ib rmove",title:"上移",disabled:m||A===0,onClick:()=>w(E.name,-1),children:l.jsx(V,{name:"down",size:15,className:"up"})}),l.jsx("button",{className:"ib rmove",title:"下移",disabled:m||A===N.length-1,onClick:()=>w(E.name,1),children:l.jsx(V,{name:"down",size:15})})]},E.name))}):l.jsx("div",{className:"note",children:"尚未启用服务商,助手和任务暂时不能联网搜索。"}),f?l.jsx("div",{className:"badline",children:f}):null]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:N.length?"其他服务商":"选择服务商"}),l.jsx("div",{className:"roster",children:r.filter(E=>!E.enabled).map(E=>l.jsxs("button",{className:"rrow",onClick:()=>Nn({kind:"searchProvider",name:E.name,title:yl[E.name].label}),children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname",children:yl[E.name].label}),l.jsx("div",{className:"rprov",children:yl[E.name].desc})]}),l.jsx("span",{className:"note",children:T(E)}),l.jsx(V,{name:"chev",size:15,className:"rgo"})]},E.name))})]})]})}function $E({provider:n,configured:a,busy:r,save:o}){const c=yl[n.name],[f,h]=y.useState(n.baseUrl??""),[m,p]=y.useState(""),[v,x]=y.useState(null),[b,N]=y.useState(!1),[w,T]=y.useState(null),[E,A]=y.useState(!1);y.useEffect(()=>h(n.baseUrl??""),[n.baseUrl]);const z=f.trim()!==(n.baseUrl??"")||!!m.trim(),U=a||!!m.trim()||c.keyOptional&&!!f.trim(),$=async()=>{N(!0),x(null);try{const S=await Zw(n.name,f.trim(),m.trim()||void 0);return x({ok:S.ok,text:S.ok?`搜索成功,返回 ${S.count} 条结果`:S.error??"搜索失败"}),S.ok}catch(S){return x({ok:!1,text:Vt(S)}),!1}finally{N(!1)}},j=async(S,O)=>{T(null),A(!1);const R=await o(S,O);return R?(T(R),!1):(A(!0),!0)},C=async()=>{await $()&&await j({...n,baseUrl:f.trim()||void 0},m.trim()||void 0)&&p("")};return l.jsxs(l.Fragment,{children:[l.jsx(on,{label:"联网搜索"}),l.jsx(We,{title:c.label,desc:c.desc}),l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${c.label}启用`,"aria-pressed":n.enabled,disabled:r||!n.enabled&&!U,onClick:()=>void j({...n,enabled:!n.enabled})})]}),!n.enabled&&!U?l.jsxs("div",{className:"note",children:[c.url?"填写服务地址":"填写 API Key","并保存后即可启用。"]}):null]}),l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[c.url?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:f,onChange:S=>{h(S.target.value),x(null)},placeholder:"http://127.0.0.1:8888",disabled:r})})]}):null,l.jsxs("div",{className:"lbl",children:["API Key",c.keyOptional?"(可选)":""]}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:m,onChange:S=>{p(S.target.value),x(null)},placeholder:a?"已保存,留空则沿用":"填写 API Key",disabled:r})}),l.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。"}),l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"pbtn",onClick:()=>void $(),disabled:r||b,children:b?"正在搜索…":"测试搜索"}),v?l.jsx("span",{className:v.ok?"okline":"badline",children:v.text}):null]}),l.jsxs(Fn,{saved:E&&!z,error:w,children:[a?l.jsx("button",{className:"pbtn",disabled:r,onClick:()=>void j(n,""),children:"删除 Key"}):null,l.jsx("button",{className:"pbtn solid",disabled:r||b||!z,onClick:()=>void C(),children:"保存"})]})]})})]})}function UE(){const[n,a]=y.useState(null);if(y.useEffect(()=>{Sw().then(a)},[]),!n)return l.jsx("div",{className:"empty",children:"正在读取版本信息…"});const r=[["Hob 版本",n.version],["数据目录",n.home]];return l.jsxs(l.Fragment,{children:[l.jsx(We,{title:"关于",desc:"Hob 的版本与数据目录。"}),l.jsx("div",{className:"kvcard",children:r.map(([o,c])=>l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:o}),l.jsx("span",{className:"v",children:c})]},o))})]})}const LE=n=>n.id;function HE(){const n=je(),a=n.assistants.filter(c=>c.pinned&&!c.hidden&&Ki(c,n.query)),r=M1(a,LE),o=ey(a.length);return l.jsxs("aside",{className:"side",children:[l.jsxs("div",{className:"side-top",children:[l.jsxs("div",{className:"search",children:[l.jsx(V,{name:"search",size:15}),l.jsx("input",{value:n.query,placeholder:"搜索助手",onChange:c=>r0(c.target.value)})]}),l.jsx("button",{className:"ib",title:"创建专属助手",onClick:l0,children:l.jsx(V,{name:"plus",size:18})})]}),l.jsxs("div",{className:"side-scroll",children:[l.jsx("div",{className:`pins${o.cls}`,children:r.map(c=>l.jsx("div",{className:`srow${c.state==="still"?"":` ${c.state}`}`,children:l.jsx("div",{className:"srowclip",children:l.jsx(W0,{a:c.item,sel:c.item.id===n.sel,size:o.size})})},c.key))}),l.jsx(ty,{size:42,markSel:!0})]}),l.jsxs("div",{className:"side-foot",children:[l.jsxs("button",{className:"frow",onClick:nh,children:[l.jsx(V,{name:"archive",size:18}),l.jsx("span",{className:"sp",children:"知识库"})]}),l.jsxs("button",{className:"frow",onClick:fc,children:[l.jsx(V,{name:"gear",size:18}),l.jsx("span",{className:"sp",children:"设置"})]})]})]})}function BE(){"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(n=>{const a=r=>{r&&r.addEventListener("statechange",()=>{r.state==="installed"&&navigator.serviceWorker.controller&&qN()})};a(n.installing),n.addEventListener("updatefound",()=>a(n.installing))}).catch(()=>{})})}async function qE(){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 yf(n){return`${n.kind}:${"id"in n?n.id:"path"in n?n.liveId??n.path:""}`}function IE(n){return n.replace(/^无法连接 Hob:/,"")}function YE(){const n=je(),[a,r]=y.useState(()=>window.innerWidth<768),o=Dn(n.mobile==="chat"&&!!n.sel,240),c=Dn(n.page==="settings",180),f=Dn(n.page==="knowledge",180),h=Dn(n.sheet,180),m=n.panelStack.at(-1),p=m?yf(m):"root",v=y.useRef({key:p,depth:n.panelStack.length,direction:""});if(v.current.key!==p&&(v.current={key:p,depth:n.panelStack.length,direction:n.panelStack.length>v.current.depth?"from-right":"from-left"}),a&&!n.sheet&&!m&&(v.current.direction=""),y.useLayoutEffect(()=>{Ub(n,a)},[n.phase,n.page,n.mobile,n.sheet,n.panelStack,n.theme,a]),y.useEffect(()=>{cN()},[]),y.useEffect(()=>{if(!n.panelStack.length)return;const w=T=>{T.key==="Escape"&&!T.defaultPrevented&&er()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[n.panelStack]),y.useEffect(()=>{const w=()=>r(window.innerWidth<768);return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),y.useEffect(()=>{const w=setInterval(()=>IN(),3e4);return()=>clearInterval(w)},[]),y.useEffect(()=>{const w=n.assistants.reduce((T,E)=>T+E.unread,0);document.title=w>0?`(${w}) Hob`:"Hob"},[n.assistants]),y.useEffect(()=>{if(!n.notice)return;const w=setTimeout(()=>BN(),6e3);return()=>clearTimeout(w)},[n.notice]),n.phase==="login")return l.jsx(VT,{});if(n.phase==="error")return l.jsx("div",{className:"boot",children:l.jsxs("div",{className:"boot-card",children:[l.jsx("div",{className:"t",children:"无法连接 Hob"}),l.jsx("div",{className:"d",children:"请检查网络,或确认 Hob 服务已启动。"}),l.jsx("button",{className:"btn solid",onClick:()=>location.reload(),children:"重试"}),n.error?l.jsx("div",{className:"raw",children:IE(n.error)}):null]})});if(n.phase==="loading")return l.jsx("div",{className:"boot",children:l.jsxs("div",{className:"boot-loading",children:[l.jsx(it,{sprite:"hob",size:92,motion:"think"}),l.jsx("span",{className:"activity-shimmer",children:"正在连接 Hob…"})]})});const x=n.notice?l.jsx("div",{className:"toast",children:n.notice}):n.updateReady?l.jsx("button",{className:"upd",onClick:()=>void qE(),children:"有新版本,点击更新"}):null;if(c.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(VC,{narrow:a,leaving:c.leaving}),l.jsx(pf,{direction:a?v.current.direction:""}),l.jsx(Bi,{direction:a?v.current.direction:""}),x]});if(f.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(aC,{narrow:a,leaving:f.leaving}),a?l.jsx(Bi,{direction:v.current.direction}):null,x]});const b=m?.kind==="file"?m:null,N=m?.kind==="job"||m?.kind==="jobs";return a?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mapp",children:[l.jsx("div",{className:`mpane list${n.mobile==="chat"?" back":""}`,children:l.jsx(YC,{})}),o.mounted?l.jsx("div",{className:`mpane chat${o.leaving?" out":""}`,children:l.jsx(hT,{})}):null,h.mounted?l.jsx("div",{style:{display:m?"none":void 0},children:l.jsx(bb,{leaving:h.leaving,page:null,layered:!m&&v.current.direction==="from-left",direction:"from-left"})}):null,n.panelStack.map((w,T)=>{const E=T===n.panelStack.length-1,A=E?v.current.direction:"";return l.jsx("div",{style:{display:E?void 0:"none"},children:w.kind==="file"?l.jsx(Bi,{page:w,direction:A}):w.kind==="job"||w.kind==="jobs"?l.jsx(pf,{page:w,direction:A}):l.jsx(bb,{page:w,leaving:!1,layered:!0,direction:A})},yf(w))})]}),l.jsx(Rx,{}),x]}):l.jsxs("div",{className:`app${b?.full?" preview-full":""}`,children:[l.jsx(HE,{}),l.jsx(fT,{}),l.jsxs("div",{className:`panelwrap${b?.full?" full":""}${b||N||!m&&n.nowWide?" wide":""}${!m&&n.collapsed?" off":""}`,children:[l.jsx("div",{className:`panel-page${!m&&v.current.direction?` ${v.current.direction}`:""}`,style:{display:m?"none":void 0},children:l.jsx(Hf,{page:null})}),n.panelStack.map((w,T)=>{const E=T===n.panelStack.length-1;return l.jsx("div",{className:`panel-page${E&&v.current.direction?` ${v.current.direction}`:""}`,style:{display:E?void 0:"none"},children:w.kind==="file"?l.jsx(Bi,{embedded:!0,page:w}):w.kind==="job"||w.kind==="jobs"?l.jsx(pf,{embedded:!0,page:w}):l.jsx(Hf,{page:w})},yf(w))})]}),l.jsx(Rx,{}),n.offline?l.jsx("div",{className:"toast",children:n.offline}):null,x]})}function kf(n,a){if(!a)return[];const r=[];n.page==="knowledge"?r.push("knowledge"):n.page==="settings"?(r.push("settings"),n.section&&r.push("section"),n.sub&&r.push("sub")):(n.mobile==="chat"&&n.sel&&r.push("chat"),n.sheet&&r.push("sheet"));for(const o of n.panelStack)r.push("panelPage");return r}const GE={panelPage:er,sheet:o0,knowledge:()=>{Qi(),Ef("list")},chat:()=>Ef("list"),sub:Lt,section:()=>Sl(null),settings:Cf};function KE(n=()=>window.innerWidth<768){let a=0,r=0,o=!1;const c=()=>location.pathname+location.search+b1(Vs(),n());history.replaceState({hobDepth:0},"",c());const f=()=>{if(o||r>0)return;const h=kf(Vs(),n()).length;if(a>h){r++,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(r>0){r--,f();return}const m=Number(h.state?.hobDepth??0);a=m,o=!0;for(let p=0;p<10;p++){const v=kf(Vs(),n()).at(-1);if(!v||kf(Vs(),n()).length<=m)break;GE[v]()}o=!1,f()}),Yb(f),f()}g1.createRoot(document.getElementById("root")).render(l.jsx(YE,{}));KE();document.addEventListener("gesturestart",n=>n.preventDefault());BE();export{V as I,Cl as M,NC as a,nr as b,ec as d,l as j,y as r,VE as s,je as u};
|