hob-bot 1.3.0 → 1.5.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.
Files changed (48) hide show
  1. package/README.md +42 -23
  2. package/README.zh-CN.md +43 -24
  3. package/bin/hob.mjs +8 -2
  4. package/dist/web/assets/{DesktopView-lixZfbYr.js → DesktopView-3QDYo0UU.js} +1 -1
  5. package/dist/web/assets/index-Dzxrt9T3.js +283 -0
  6. package/dist/web/assets/index-FUtuyxyO.css +1 -0
  7. package/dist/web/index.html +2 -2
  8. package/dist/web/mock/readme-cover.svg +13 -0
  9. package/dist/web/mock/readme-page.html +7 -0
  10. package/package.json +2 -1
  11. package/server/src/actions.ts +2 -1
  12. package/server/src/assistant-skills.ts +2 -2
  13. package/server/src/boot.ts +8 -0
  14. package/server/src/config.ts +52 -11
  15. package/server/src/cron-text.ts +14 -1
  16. package/server/src/delete-skill.ts +19 -0
  17. package/server/src/desktop-tools.ts +6 -6
  18. package/server/src/files.ts +27 -7
  19. package/server/src/http.ts +41 -9
  20. package/server/src/job-view.ts +2 -2
  21. package/server/src/jobs.ts +108 -62
  22. package/server/src/knowledge-tools.ts +1 -1
  23. package/server/src/knowledge.ts +9 -4
  24. package/server/src/layout-cli.ts +25 -0
  25. package/server/src/layout.ts +749 -0
  26. package/server/src/main.ts +5 -0
  27. package/server/src/mcp.ts +3 -2
  28. package/server/src/memory.ts +2 -2
  29. package/server/src/now.ts +1 -1
  30. package/server/src/overview.ts +1 -2
  31. package/server/src/pages.ts +9 -7
  32. package/server/src/prompt.ts +47 -110
  33. package/server/src/push.ts +3 -2
  34. package/server/src/router-tools.ts +96 -40
  35. package/server/src/router.ts +5 -4
  36. package/server/src/routines.ts +177 -22
  37. package/server/src/runtime.ts +12 -1
  38. package/server/src/search.ts +1 -1
  39. package/server/src/secrets.ts +3 -2
  40. package/server/src/settings.ts +44 -6
  41. package/server/src/store.ts +123 -40
  42. package/server/src/transcript.ts +25 -7
  43. package/server/src/usage-prices.ts +166 -0
  44. package/server/src/usage.ts +291 -0
  45. package/server/src/worker-tools.ts +6 -9
  46. package/shared/types.ts +110 -3
  47. package/dist/web/assets/index-BZhge0qe.js +0 -267
  48. package/dist/web/assets/index-DIo1ArRa.css +0 -1
@@ -0,0 +1,283 @@
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 l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function i(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=i(c);fetch(c.href,d)}})();var gf={exports:{}},Yi={};/**
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 Nx;function nw(){if(Nx)return Yi;Nx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(o,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:n,type:o,key:h,ref:c!==void 0?c:null,props:d}}return Yi.Fragment=l,Yi.jsx=i,Yi.jsxs=i,Yi}var Sx;function sw(){return Sx||(Sx=1,gf.exports=nw()),gf.exports}var s=sw(),vf={exports:{}},Gi={},xf={exports:{}},bf={};/**
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 Tx;function lw(){return Tx||(Tx=1,(function(n){function l(ue,xe){var ge=ue.length;ue.push(xe);e:for(;0<ge;){var Re=ge-1>>>1,Te=ue[Re];if(0<c(Te,xe))ue[Re]=xe,ue[ge]=Te,ge=Re;else break e}}function i(ue){return ue.length===0?null:ue[0]}function o(ue){if(ue.length===0)return null;var xe=ue[0],ge=ue.pop();if(ge!==xe){ue[0]=ge;e:for(var Re=0,Te=ue.length,pt=Te>>>1;Re<pt;){var wt=2*(Re+1)-1,gt=ue[wt],$=wt+1,le=ue[$];if(0>c(gt,ge))$<Te&&0>c(le,gt)?(ue[Re]=le,ue[$]=ge,Re=$):(ue[Re]=gt,ue[wt]=ge,Re=wt);else if($<Te&&0>c(le,ge))ue[Re]=le,ue[$]=ge,Re=$;else break e}}return xe}function c(ue,xe){var ge=ue.sortIndex-xe.sortIndex;return ge!==0?ge:ue.id-xe.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,x=null,w=3,C=!1,T=!1,N=!1,A=!1,M=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function J(ue){for(var xe=i(g);xe!==null;){if(xe.callback===null)o(g);else if(xe.startTime<=ue)o(g),xe.sortIndex=xe.expirationTime,l(p,xe);else break;xe=i(g)}}function ee(ue){if(N=!1,J(ue),!T)if(i(p)!==null)T=!0,B||(B=!0,oe());else{var xe=i(g);xe!==null&&Ce(ee,xe.startTime-ue)}}var B=!1,k=-1,j=5,E=-1;function U(){return A?!0:!(n.unstable_now()-E<j)}function X(){if(A=!1,B){var ue=n.unstable_now();E=ue;var xe=!0;try{e:{T=!1,N&&(N=!1,R(k),k=-1),C=!0;var ge=w;try{t:{for(J(ue),x=i(p);x!==null&&!(x.expirationTime>ue&&U());){var Re=x.callback;if(typeof Re=="function"){x.callback=null,w=x.priorityLevel;var Te=Re(x.expirationTime<=ue);if(ue=n.unstable_now(),typeof Te=="function"){x.callback=Te,J(ue),xe=!0;break t}x===i(p)&&o(p),J(ue)}else o(p);x=i(p)}if(x!==null)xe=!0;else{var pt=i(g);pt!==null&&Ce(ee,pt.startTime-ue),xe=!1}}break e}finally{x=null,w=ge,C=!1}xe=void 0}}finally{xe?oe():B=!1}}}var oe;if(typeof O=="function")oe=function(){O(X)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ye=ce.port2;ce.port1.onmessage=X,oe=function(){ye.postMessage(null)}}else oe=function(){M(X,0)};function Ce(ue,xe){k=M(function(){ue(n.unstable_now())},xe)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(ue){ue.callback=null},n.unstable_forceFrameRate=function(ue){0>ue||125<ue?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<ue?Math.floor(1e3/ue):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_next=function(ue){switch(w){case 1:case 2:case 3:var xe=3;break;default:xe=w}var ge=w;w=xe;try{return ue()}finally{w=ge}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(ue,xe){switch(ue){case 1:case 2:case 3:case 4:case 5:break;default:ue=3}var ge=w;w=ue;try{return xe()}finally{w=ge}},n.unstable_scheduleCallback=function(ue,xe,ge){var Re=n.unstable_now();switch(typeof ge=="object"&&ge!==null?(ge=ge.delay,ge=typeof ge=="number"&&0<ge?Re+ge:Re):ge=Re,ue){case 1:var Te=-1;break;case 2:Te=250;break;case 5:Te=1073741823;break;case 4:Te=1e4;break;default:Te=5e3}return Te=ge+Te,ue={id:v++,callback:xe,priorityLevel:ue,startTime:ge,expirationTime:Te,sortIndex:-1},ge>Re?(ue.sortIndex=ge,l(g,ue),i(p)===null&&ue===i(g)&&(N?(R(k),k=-1):N=!0,Ce(ee,ge-Re))):(ue.sortIndex=Te,l(p,ue),T||C||(T=!0,B||(B=!0,oe()))),ue},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(ue){var xe=w;return function(){var ge=w;w=xe;try{return ue.apply(this,arguments)}finally{w=ge}}}})(bf)),bf}var Cx;function aw(){return Cx||(Cx=1,xf.exports=lw()),xf.exports}var yf={exports:{}},Se={};/**
19
+ * @license React
20
+ * react.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Ex;function iw(){if(Ex)return Se;Ex=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),C=Symbol.iterator;function T($){return $===null||typeof $!="object"?null:($=C&&$[C]||$["@@iterator"],typeof $=="function"?$:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,M={};function R($,le,L){this.props=$,this.context=le,this.refs=M,this.updater=L||N}R.prototype.isReactComponent={},R.prototype.setState=function($,le){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,le,"setState")},R.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function O(){}O.prototype=R.prototype;function J($,le,L){this.props=$,this.context=le,this.refs=M,this.updater=L||N}var ee=J.prototype=new O;ee.constructor=J,A(ee,R.prototype),ee.isPureReactComponent=!0;var B=Array.isArray;function k(){}var j={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function U($,le,L){var Y=L.ref;return{$$typeof:n,type:$,key:le,ref:Y!==void 0?Y:null,props:L}}function X($,le){return U($.type,le,$.props)}function oe($){return typeof $=="object"&&$!==null&&$.$$typeof===n}function ce($){var le={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(L){return le[L]})}var ye=/\/+/g;function Ce($,le){return typeof $=="object"&&$!==null&&$.key!=null?ce(""+$.key):le.toString(36)}function ue($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(k,k):($.status="pending",$.then(function(le){$.status==="pending"&&($.status="fulfilled",$.value=le)},function(le){$.status==="pending"&&($.status="rejected",$.reason=le)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function xe($,le,L,Y,_){var te=typeof $;(te==="undefined"||te==="boolean")&&($=null);var ae=!1;if($===null)ae=!0;else switch(te){case"bigint":case"string":case"number":ae=!0;break;case"object":switch($.$$typeof){case n:case l:ae=!0;break;case v:return ae=$._init,xe(ae($._payload),le,L,Y,_)}}if(ae)return _=_($),ae=Y===""?"."+Ce($,0):Y,B(_)?(L="",ae!=null&&(L=ae.replace(ye,"$&/")+"/"),xe(_,le,L,"",function(tt){return tt})):_!=null&&(oe(_)&&(_=X(_,L+(_.key==null||$&&$.key===_.key?"":(""+_.key).replace(ye,"$&/")+"/")+ae)),le.push(_)),1;ae=0;var fe=Y===""?".":Y+":";if(B($))for(var ve=0;ve<$.length;ve++)Y=$[ve],te=fe+Ce(Y,ve),ae+=xe(Y,le,L,te,_);else if(ve=T($),typeof ve=="function")for($=ve.call($),ve=0;!(Y=$.next()).done;)Y=Y.value,te=fe+Ce(Y,ve++),ae+=xe(Y,le,L,te,_);else if(te==="object"){if(typeof $.then=="function")return xe(ue($),le,L,Y,_);throw le=String($),Error("Objects are not valid as a React child (found: "+(le==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":le)+"). If you meant to render a collection of children, use an array instead.")}return ae}function ge($,le,L){if($==null)return $;var Y=[],_=0;return xe($,Y,"","",function(te){return le.call(L,te,_++)}),Y}function Re($){if($._status===-1){var le=$._result,L=le();L.then(function(Y){($._status===0||$._status===-1)&&($._status=1,$._result=Y,L.status===void 0&&(L.status="fulfilled",L.value=Y))},function(Y){($._status===0||$._status===-1)&&($._status=2,$._result=Y,L.status===void 0&&(L.status="rejected",L.reason=Y))}),$._status===-1&&($._status=0,$._result=L)}if($._status===1)return $._result.default;throw $._result}var Te=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var le=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(le))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)};function pt($){var le=j.T,L={};L.types=le!==null?le.types:null,j.T=L;try{var Y=$(),_=j.S;_!==null&&_(L,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(k,Te)}catch(te){Te(te)}finally{le!==null&&L.types!==null&&(le.types=L.types),j.T=le}}function wt($){var le=j.T;if(le!==null){var L=le.types;L===null?le.types=[$]:L.indexOf($)===-1&&L.push($)}else pt(wt.bind(null,$))}var gt={map:ge,forEach:function($,le,L){ge($,function(){le.apply(this,arguments)},L)},count:function($){var le=0;return ge($,function(){le++}),le},toArray:function($){return ge($,function(le){return le})||[]},only:function($){if(!oe($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return Se.Activity=x,Se.Children=gt,Se.Component=R,Se.Fragment=i,Se.Profiler=c,Se.PureComponent=J,Se.StrictMode=o,Se.Suspense=p,Se.ViewTransition=w,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Se.__COMPILER_RUNTIME={__proto__:null,c:function($){return j.H.useMemoCache($)}},Se.addTransitionType=wt,Se.cache=function($){return function(){return $.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function($,le,L){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var Y=A({},$.props),_=$.key;if(le!=null)for(te in le.key!==void 0&&(_=""+le.key),le)!E.call(le,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&le.ref===void 0||(Y[te]=le[te]);var te=arguments.length-2;if(te===1)Y.children=L;else if(1<te){for(var ae=Array(te),fe=0;fe<te;fe++)ae[fe]=arguments[fe+2];Y.children=ae}return U($.type,_,Y)},Se.createContext=function($){return $={$$typeof:h,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:d,_context:$},$},Se.createElement=function($,le,L){var Y,_={},te=null;if(le!=null)for(Y in le.key!==void 0&&(te=""+le.key),le)E.call(le,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(_[Y]=le[Y]);var ae=arguments.length-2;if(ae===1)_.children=L;else if(1<ae){for(var fe=Array(ae),ve=0;ve<ae;ve++)fe[ve]=arguments[ve+2];_.children=fe}if($&&$.defaultProps)for(Y in ae=$.defaultProps,ae)_[Y]===void 0&&(_[Y]=ae[Y]);return U($,te,_)},Se.createRef=function(){return{current:null}},Se.forwardRef=function($){return{$$typeof:m,render:$}},Se.isValidElement=oe,Se.lazy=function($){return{$$typeof:v,_payload:{_status:-1,_result:$},_init:Re}},Se.memo=function($,le){return{$$typeof:g,type:$,compare:le===void 0?null:le}},Se.startTransition=pt,Se.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Se.use=function($){return j.H.use($)},Se.useActionState=function($,le,L){return j.H.useActionState($,le,L)},Se.useCallback=function($,le){return j.H.useCallback($,le)},Se.useContext=function($){return j.H.useContext($)},Se.useDebugValue=function(){},Se.useDeferredValue=function($,le){return j.H.useDeferredValue($,le)},Se.useEffect=function($,le){return j.H.useEffect($,le)},Se.useEffectEvent=function($){return j.H.useEffectEvent($)},Se.useId=function(){return j.H.useId()},Se.useImperativeHandle=function($,le,L){return j.H.useImperativeHandle($,le,L)},Se.useInsertionEffect=function($,le){return j.H.useInsertionEffect($,le)},Se.useLayoutEffect=function($,le){return j.H.useLayoutEffect($,le)},Se.useMemo=function($,le){return j.H.useMemo($,le)},Se.useOptimistic=function($,le){return j.H.useOptimistic($,le)},Se.useReducer=function($,le,L){return j.H.useReducer($,le,L)},Se.useRef=function($){return j.H.useRef($)},Se.useState=function($){return j.H.useState($)},Se.useSyncExternalStore=function($,le,L){return j.H.useSyncExternalStore($,le,L)},Se.useTransition=function(){return j.H.useTransition()},Se.version="19.3.1",Se}var Ax;function vh(){return Ax||(Ax=1,yf.exports=iw()),yf.exports}var kf={exports:{}},Mt={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Mx;function rw(){if(Mx)return Mt;Mx=1;var n=vh();function l(v){var x="https://react.dev/errors/"+v;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)x+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+v+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal"),d=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function m(v,x,w){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:C==null?null:C===h?h:""+C,children:v,containerInfo:x,implementation:w}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,x){if(v==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return Mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Mt.browser=function(v){return{$$typeof:d,_reason:v}},Mt.createPortal=function(v,x){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(l(299));return m(v,x,null,w)},Mt.flushSync=function(v){var x=p.T,w=o.p;try{if(p.T=null,o.p=2,v)return v()}finally{p.T=x,o.p=w,o.d.f()}},Mt.preconnect=function(v,x){typeof v=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,o.d.C(v,x))},Mt.prefetchDNS=function(v){typeof v=="string"&&o.d.D(v)},Mt.preinit=function(v,x){if(typeof v=="string"&&x&&typeof x.as=="string"){var w=x.as,C=g(w,x.crossOrigin),T=typeof x.integrity=="string"?x.integrity:void 0,N=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;w==="style"?o.d.S(v,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:C,integrity:T,fetchPriority:N}):w==="script"&&o.d.X(v,{crossOrigin:C,integrity:T,fetchPriority:N,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},Mt.preinitModule=function(v,x){if(typeof v=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var w=g(x.as,x.crossOrigin);o.d.M(v,{crossOrigin:w,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}}else x==null&&o.d.M(v)},Mt.preload=function(v,x){if(typeof v=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var w=x.as,C=g(w,x.crossOrigin);o.d.L(v,w,{crossOrigin:C,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},Mt.preloadModule=function(v,x){if(typeof v=="string")if(x){var w=g(x.as,x.crossOrigin);o.d.m(v,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:w,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}else o.d.m(v)},Mt.requestFormReset=function(v){o.d.r(v)},Mt.unstable_batchedUpdates=function(v,x){return v(x)},Mt.useFormState=function(v,x,w){return p.H.useFormState(v,x,w)},Mt.useFormStatus=function(){return p.H.useHostTransitionStatus()},Mt.version="19.3.1",Mt}var zx;function f0(){if(zx)return kf.exports;zx=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(l){console.error(l)}}return n(),kf.exports=rw(),kf.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 Rx;function ow(){if(Rx)return Gi;Rx=1;var n=aw(),l=vh(),i=f0();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){for(var t=e,a=t;a&&!a.alternate;)t=a,(t.flags&4098)!==0&&(e=t.return),a=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(o(188));return t!==e?null:e}for(var a=e,r=t;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(r=u.return,r!==null){a=r;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return p(u),e;if(f===r)return p(u),t;f=f.sibling}throw Error(o(188))}if(a.return!==r.return)a=u,r=f;else{for(var b=!1,S=u.child;S;){if(S===a){b=!0,a=u,r=f;break}if(S===r){b=!0,r=u,a=f;break}S=S.sibling}if(!b){for(S=f.child;S;){if(S===a){b=!0,a=f,r=u;break}if(S===r){b=!0,r=f,a=u;break}S=S.sibling}if(!b)throw Error(o(189))}}if(a.alternate!==r)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}function x(e,t,a,r,u,f){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&a(e,r,u,f)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&x(e.child,t,a,r,u,f))return!0;e=e.sibling}return!1}function w(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function C(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],a=w(e);return a===null||N(t,e,a.child,{foundSelf:!1}),t}function N(e,t,a,r){for(;a!==null;){if(a===t)r.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(r.foundSelf)return e[1]=a,!0;e[0]=a}else if((a.tag!==22||a.memoizedState===null)&&N(e,t,a.child,r))return!0;a=a.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 M=null,R=null;function O(e,t,a){return e===a?!0:e===t?(M=e,!0):!1}function J(e,t,a){return e===a?(R=e,!1):e===t?(R!==null&&(M=e),!0):!1}function ee(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function B(e,t,a){for(var r=0,u=e;u;u=a(u))r++;u=0;for(var f=t;f;f=a(f))u++;for(;0<r-u;)e=a(e),r--;for(;0<u-r;)t=a(t),u--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=a(e),t=a(t)}return null}var k=Object.assign,j=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),X=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),ce=Symbol.for("react.profiler"),ye=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),ge=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),Te=Symbol.for("react.lazy"),pt=Symbol.for("react.activity"),wt=Symbol.for("react.legacy_hidden"),gt=Symbol.for("react.memo_cache_sentinel"),$=Symbol.for("react.view_transition"),le=Symbol.for("react.recoverable"),L=Symbol.iterator;function Y(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var _=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case X:return"Fragment";case ce:return"Profiler";case oe:return"StrictMode";case xe:return"Suspense";case ge:return"SuspenseList";case pt:return"Activity";case $:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case U:return"Portal";case Ce:return e.displayName||"Context";case ye:return(e._context.displayName||"Context")+".Consumer";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ae=Array.isArray,fe=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,tt={pending:!1,data:null,method:null,action:null},at=[],ct=-1;function $t(e){return{current:e}}function nt(e){0>ct||(e.current=at[ct],at[ct]=null,ct--)}function qe(e,t){ct++,at[ct]=e.current,e.current=t}var Ut=$t(null),Lt=$t(null),An=$t(null),el=$t(null);function kr(e,t){switch(qe(An,t),qe(Lt,e),qe(Ut,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ov(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ov(t),e=_v(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}nt(Ut),qe(Ut,e)}function Bl(){nt(Ut),nt(Lt),nt(An)}function Dc(e){var t=e.memoizedState;t!==null&&(Ca._currentValue=t.memoizedState,qe(el,e)),t=Ut.current;var a=_v(t,e.type);t!==a&&(qe(Lt,e),qe(Ut,a))}function jr(e){Lt.current===e&&(nt(Ut),nt(Lt)),el.current===e&&(nt(el),Ca._currentValue=tt)}var $c,em;function ws(e){if($c===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);$c=t&&t[1]||"",em=-1<a.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+$c+e+em}var Uc=!1;function Lc(e,t){if(!e||Uc)return"";Uc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(de){var H=de}Reflect.construct(e,[],W)}else{try{W.call()}catch(de){H=de}W=!1;try{var Z=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),W=!0,new e}finally{W&&(Z!==void 0?Object.defineProperty(e.prototype,"props",Z):delete e.prototype.props)}}}else{try{throw Error()}catch(de){H=de}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(de){if(de&&H&&typeof de.stack=="string")return[de.stack,H.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=r.DetermineComponentFrameRoot(),b=f[0],S=f[1];if(b&&S){var z=b.split(`
45
+ `),I=S.split(`
46
+ `);for(u=r=0;r<z.length&&!z[r].includes("DetermineComponentFrameRoot");)r++;for(;u<I.length&&!I[u].includes("DetermineComponentFrameRoot");)u++;if(r===z.length||u===I.length)for(r=z.length-1,u=I.length-1;1<=r&&0<=u&&z[r]!==I[u];)u--;for(;1<=r&&0<=u;r--,u--)if(z[r]!==I[u]){if(r!==1||u!==1)do if(r--,u--,0>u||z[r]!==I[u]){var V=`
47
+ `+z[r].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=r&&0<=u);break}}}finally{Uc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ws(a):""}function ik(e,t){switch(e.tag){case 26:case 27:case 5:return ws(e.type);case 16:return ws("Lazy");case 13:return e.child!==t&&t!==null?ws("Suspense Fallback"):ws("Suspense");case 19:return ws("SuspenseList");case 0:case 15:return Lc(e.type,!1);case 11:return Lc(e.type.render,!1);case 1:return Lc(e.type,!0);case 31:return ws("Activity");case 30:return ws("ViewTransition");default:return""}}function tm(e){try{var t="",a=null;do t+=ik(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
48
+ Error generating stack: `+r.message+`
49
+ `+r.stack}}var Hc=Object.prototype.hasOwnProperty,Bc=n.unstable_scheduleCallback,qc=n.unstable_cancelCallback,rk=n.unstable_shouldYield,ok=n.unstable_requestPaint,Wt=n.unstable_now,ck=n.unstable_getCurrentPriorityLevel,nm=n.unstable_ImmediatePriority,sm=n.unstable_UserBlockingPriority,wr=n.unstable_NormalPriority,uk=n.unstable_LowPriority,lm=n.unstable_IdlePriority,dk=n.log,fk=n.unstable_setDisableYieldValue,Ja=null,en=null;function Ns(e){if(typeof dk=="function"&&fk(e),en&&typeof en.setStrictMode=="function")try{en.setStrictMode(Ja,e)}catch{}}var tn=Math.clz32?Math.clz32:pk,hk=Math.log,mk=Math.LN2;function pk(e){return e>>>=0,e===0?32:31-(hk(e)/mk|0)|0}var Nr=256,Sr=262144,Tr=4194304;function tl(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Cr(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var u=0,f=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var S=r&134217727;return S!==0?(r=S&~f,r!==0?u=tl(r):(b&=S,b!==0?u=tl(b):a||(a=S&~e,a!==0&&(u=tl(a))))):(S=r&~f,S!==0?u=tl(S):b!==0?u=tl(b):a||(a=r&~e,a!==0&&(u=tl(a)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,a=t&-t,f>=a||f===32&&(a&4194048)!==0)?t:u}function Pa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function am(e,t){(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-tn(a),u=1<<r;t|=e[r],a&=~u}return t}function gk(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 im(){var e=Tr;return Tr<<=1,(Tr&62914560)===0&&(Tr=4194304),e}function Ic(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Fa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vk(e,t,a,r,u,f){var b=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var S=e.entanglements,z=e.expirationTimes,I=e.hiddenUpdates;for(a=b&~a;0<a;){var V=31-tn(a),W=1<<V;S[V]=0,z[V]=-1;var H=I[V];if(H!==null)for(I[V]=null,V=0;V<H.length;V++){var Z=H[V];Z!==null&&(Z.lane&=-536870913)}a&=~W}r!==0&&rm(e,r,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(b&~t))}function rm(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tn(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function om(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-tn(a),u=1<<r;u&t|e[r]&t&&(e[r]|=t),a&=~u}}function cm(e,t){var a=t&-t;return a=(a&42)!==0?1:Yc(a),(a&(e.suspendedLanes|t))!==0?0:a}function Yc(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 Gc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function um(){var e=ve.p;return e!==0?e:(e=window.event,e===void 0?32:vx(e.type))}function dm(e,t){var a=ve.p;try{return ve.p=e,t()}finally{ve.p=a}}var ss=Math.random().toString(36).slice(2),Nt="__reactFiber$"+ss,Kt="__reactProps$"+ss,ql="__reactContainer$"+ss,fm="__reactEvents$"+ss,xk="__reactListeners$"+ss,bk="__reactHandles$"+ss,hm="__reactResources$"+ss,Wa="__reactMarker$"+ss,Er="__reactLoad$"+ss;function Ar(e){delete e[Nt],delete e[Kt],delete e[xk],delete e[bk]}function nl(e){var t;if(t=e[Nt])return t;for(var a=e.parentNode;a;){if(t=a[ql]||a[Nt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Pv(e);e!==null;){if(a=e[Nt])return a;e=Pv(e)}return t}e=a,a=e.parentNode}return null}function Il(e){if(e=e[Nt]||e[ql]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ei(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Yl(e){var t=e[hm];return t||(t=e[hm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function bt(e){e[Wa]=!0}function mm(e){e[Er]=void 0}var pm=new Set,gm={};function sl(e,t){Gl(e,t),Gl(e+"Capture",t)}function Gl(e,t){for(gm[e]=t,e=0;e<t.length;e++)pm.add(t[e])}var yk=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]*$"),vm={},xm={};function kk(e){return Hc.call(xm,e)?!0:Hc.call(vm,e)?!1:yk.test(e)?xm[e]=!0:(vm[e]=!0,!1)}var Ie=!1;function bm(){var e=Ie;return Ie=!1,e}function Mr(e,t,a){if(kk(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,a)}}function zr(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,a)}}function ls(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,r)}}function nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ym(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jk(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var u=r.get,f=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){a=""+b,f.call(this,b)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(b){a=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kc(e){if(!e._valueTracker){var t=ym(e)?"checked":"value";e._valueTracker=jk(e,t,""+e[t])}}function km(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=ym(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}var wk=/[\n"\\]/g;function mn(e){return e.replace(wk,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xc(e,t,a,r,u,f,b,S){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+nn(t)):e.value!==""+nn(t)&&(e.value=""+nn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?b==="number"&&e.value==t?Zc(e,nn(e.value)):Zc(e,nn(t)):a!=null?Zc(e,nn(a)):r!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+nn(S):e.removeAttribute("name")}function jm(e,t,a,r,u,f,b,S){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){Kc(e);return}a=a!=null?""+nn(a):"",t=t!=null?""+nn(t):a,S||t===e.value||(e.value=t),e.defaultValue=t}r=r??u,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=S?e.checked:!!r,e.defaultChecked=!!r,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Kc(e)}function Zc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Kl(e,t,a,r){if(e=e.options,t){t={};for(var u=0;u<a.length;u++)t["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=t.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&r&&(e[a].defaultSelected=!0)}else{for(a=""+nn(a),t=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,r&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function wm(e,t,a){if(t!=null&&(t=""+nn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+nn(a):""}function Nm(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(o(92));if(ae(r)){if(1<r.length)throw Error(o(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=nn(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),Kc(e)}function Xl(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Nk=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 Sm(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||Nk.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Tm(e,t,a){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="",Ie=!0);for(var u in t)r=t[u],t.hasOwnProperty(u)&&a[u]!==r&&(Sm(e,u,r),Ie=!0)}else for(var f in t)t.hasOwnProperty(f)&&Sm(e,f,t[f])}function Vc(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 Sk=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"]]),Tk=/^[\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 Rr(e){return Tk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Yn(){}var Qc=null;function Jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zl=null,Vl=null;function Cm(e){var t=Il(e);if(t&&(e=t.stateNode)){var a=e[Kt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+mn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var u=r[Kt]||null;if(!u)throw Error(o(90));Xc(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&km(r)}break e;case"textarea":wm(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Kl(e,!!a.multiple,t,!1)}}}var Pc=!1;function Em(e,t,a){if(Pc)return e(t,a);Pc=!0;try{var r=e(t);return r}finally{if(Pc=!1,(Zl!==null||Vl!==null)&&(Oo(),Zl&&(t=Zl,e=Vl,Vl=Zl=null,Cm(t),e)))for(t=0;t<e.length;t++)Cm(e[t])}}function ti(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Kt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(o(231,t,typeof a));return a}var as=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fc=!1;if(as)try{var ni={};Object.defineProperty(ni,"passive",{get:function(){Fc=!0}}),window.addEventListener("test",ni,ni),window.removeEventListener("test",ni,ni)}catch{Fc=!1}var Ss=null,Wc=null,Or=null;function Am(){if(Or)return Or;var e,t=Wc,a=t.length,r,u="value"in Ss?Ss.value:Ss.textContent,f=u.length;for(e=0;e<a&&t[e]===u[e];e++);var b=a-e;for(r=1;r<=b&&t[a-r]===u[f-r];r++);return Or=u.slice(e,1<r?1-r:void 0)}function _r(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 Dr(){return!0}function Mm(){return!1}function Ht(e){function t(a,r,u,f,b){this._reactName=a,this._targetInst=u,this.type=r,this.nativeEvent=f,this.target=b,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(a=e[S],this[S]=a?a(f):f[S]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Dr:Mm,this.isPropagationStopped=Mm,this}return k(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Dr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),t}var Ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$r=Ht(Ts),si=k({},Ts,{view:0,detail:0}),Ck=Ht(si),eu,tu,li,Ur=k({},si,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:su,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!==li&&(li&&e.type==="mousemove"?(eu=e.screenX-li.screenX,tu=e.screenY-li.screenY):tu=eu=0,li=e),eu)},movementY:function(e){return"movementY"in e?e.movementY:tu}}),zm=Ht(Ur),Ek=k({},Ur,{dataTransfer:0}),Ak=Ht(Ek),Mk=k({},si,{relatedTarget:0}),nu=Ht(Mk),zk=k({},Ts,{animationName:0,elapsedTime:0,pseudoElement:0}),Rk=Ht(zk),Ok=k({},Ts,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),_k=Ht(Ok),Dk=k({},Ts,{data:0}),Rm=Ht(Dk),$k={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uk={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"},Lk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hk(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Lk[e])?!!t[e]:!1}function su(){return Hk}var Bk=k({},si,{key:function(e){if(e.key){var t=$k[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_r(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Uk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:su,charCode:function(e){return e.type==="keypress"?_r(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_r(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qk=Ht(Bk),Ik=k({},Ur,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Om=Ht(Ik),Yk=k({},Ts,{submitter:0}),Gk=Ht(Yk),Kk=k({},si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:su}),Xk=Ht(Kk),Zk=k({},Ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vk=Ht(Zk),Qk=k({},Ur,{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}),Jk=Ht(Qk),Pk=k({},Ts,{newState:0,oldState:0,source:0}),Fk=Ht(Pk),Wk=[9,13,27,32],lu=as&&"CompositionEvent"in window,ai=null;as&&"documentMode"in document&&(ai=document.documentMode);var ej=as&&"TextEvent"in window&&!ai,_m=as&&(!lu||ai&&8<ai&&11>=ai),Dm=" ",$m=!1;function Um(e,t){switch(e){case"keyup":return Wk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ql=!1;function tj(e,t){switch(e){case"compositionend":return Lm(t);case"keypress":return t.which!==32?null:($m=!0,Dm);case"textInput":return e=t.data,e===Dm&&$m?null:e;default:return null}}function nj(e,t){if(Ql)return e==="compositionend"||!lu&&Um(e,t)?(e=Am(),Or=Wc=Ss=null,Ql=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return _m&&t.locale!=="ko"?null:t.data;default:return null}}var sj={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 Hm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sj[e.type]:t==="textarea"}function Bm(e,t,a,r){Zl?Vl?Vl.push(r):Vl=[r]:Zl=r,t=Ho(t,"onChange"),0<t.length&&(a=new $r("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var ii=null,ri=null;function lj(e){Cv(e,0)}function Lr(e){var t=ei(e);if(km(t))return e}function qm(e,t){if(e==="change")return t}var Im=!1;if(as){var au;if(as){var iu="oninput"in document;if(!iu){var Ym=document.createElement("div");Ym.setAttribute("oninput","return;"),iu=typeof Ym.oninput=="function"}au=iu}else au=!1;Im=au&&(!document.documentMode||9<document.documentMode)}function Gm(){ii&&(ii.detachEvent("onpropertychange",Km),ri=ii=null)}function Km(e){if(e.propertyName==="value"&&Lr(ri)){var t=[];Bm(t,ri,e,Jc(e)),Em(lj,t)}}function aj(e,t,a){e==="focusin"?(Gm(),ii=t,ri=a,ii.attachEvent("onpropertychange",Km)):e==="focusout"&&Gm()}function ij(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Lr(ri)}function rj(e,t){if(e==="click")return Lr(t)}function oj(e,t){if(e==="input"||e==="change")return Lr(t)}function cj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sn=typeof Object.is=="function"?Object.is:cj;function oi(e,t){if(sn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var u=a[r];if(!Hc.call(t,u)||!sn(e[u],t[u]))return!1}return!0}function ru(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 Xm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zm(e,t){var a=Xm(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Xm(a)}}function Vm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ru(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=ru(e.document)}return t}function ou(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 uj=as&&"documentMode"in document&&11>=document.documentMode,Jl=null,cu=null,ci=null,uu=!1;function Jm(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;uu||Jl==null||Jl!==ru(r)||(r=Jl,"selectionStart"in r&&ou(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ci&&oi(ci,r)||(ci=r,r=Ho(cu,"onSelect"),0<r.length&&(t=new $r("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Jl)))}function ll(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Pl={animationend:ll("Animation","AnimationEnd"),animationiteration:ll("Animation","AnimationIteration"),animationstart:ll("Animation","AnimationStart"),transitionrun:ll("Transition","TransitionRun"),transitionstart:ll("Transition","TransitionStart"),transitioncancel:ll("Transition","TransitionCancel"),transitionend:ll("Transition","TransitionEnd")},du={},Pm={};as&&(Pm=document.createElement("div").style,"AnimationEvent"in window||(delete Pl.animationend.animation,delete Pl.animationiteration.animation,delete Pl.animationstart.animation),"TransitionEvent"in window||delete Pl.transitionend.transition);function al(e){if(du[e])return du[e];if(!Pl[e])return e;var t=Pl[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Pm)return du[e]=t[a];return e}var Fm=al("animationend"),Wm=al("animationiteration"),ep=al("animationstart"),dj=al("transitionrun"),fj=al("transitionstart"),hj=al("transitioncancel"),tp=al("transitionend"),np=new Map,fu="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(" ");fu.push("scrollEnd");function Mn(e,t){np.set(e,t),sl(t,[e])}var mj=0;function is(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=_n.identifierPrefix;var a=mj++;return e="_"+e+"t_"+a.toString(32)+"_",t.autoName=e}function sp(e){if(e==null||typeof e=="string")return e;var t=null,a=va;if(a!==null)for(var r=0;r<a.length;r++){var u=e[a[r]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function rs(e,t){return e=sp(e),t=sp(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Hr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},pn=[],Fl=0,hu=0;function Br(){for(var e=Fl,t=hu=Fl=0;t<e;){var a=pn[t];pn[t++]=null;var r=pn[t];pn[t++]=null;var u=pn[t];pn[t++]=null;var f=pn[t];if(pn[t++]=null,r!==null&&u!==null){var b=r.pending;b===null?u.next=u:(u.next=b.next,b.next=u),r.pending=u}f!==0&&lp(a,u,f)}}function qr(e,t,a,r){pn[Fl++]=e,pn[Fl++]=t,pn[Fl++]=a,pn[Fl++]=r,hu|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function mu(e,t,a,r){return qr(e,t,a,r),Ir(e)}function il(e,t){return qr(e,null,null,t),Ir(e)}function lp(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var u=!1,f=e.return;f!==null;)f.childLanes|=a,r=f.alternate,r!==null&&(r.childLanes|=a),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-tn(a),e=f.hiddenUpdates,r=e[u],r===null?e[u]=[t]:r.push(t),t.lane=a|536870912),f):null}function Ir(e){if(50<zi)throw zi=0,Ro=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Wl={};function pj(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xt(e,t,a,r){return new pj(e,t,a,r)}function pu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function os(e,t){var a=e.alternate;return a===null?(a=Xt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&1206910976,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function ap(e,t){e.flags&=1206910978;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Yr(e,t,a,r,u,f){var b=0;if(r=e,typeof r=="function")pu(r)&&(b=1);else if(typeof r=="string")b=Y1(e,a,Ut.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(r){case pt:return e=Xt(31,a,t,u),e.elementType=pt,e.lanes=f,e;case X:return rl(a.children,u,f,t);case oe:b=8,u|=24;break;case ce:return e=Xt(12,a,t,u|2),e.elementType=ce,e.lanes=f,e;case xe:return e=Xt(13,a,t,u),e.elementType=xe,e.lanes=f,e;case ge:return e=Xt(19,a,t,u),e.elementType=ge,e.lanes=f,e;case wt:case $:return e=u|32,e=Xt(30,a,t,e),e.elementType=$,e.lanes=f,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Ce:b=10;break e;case ye:b=9;break e;case ue:b=11;break e;case Re:b=14;break e;case Te:b=16,r=null;break e}b=29,a=Error(o(130,e===null?"null":typeof e,"")),r=null}return t=Xt(b,a,t,u),t.elementType=e,t.type=r,t.lanes=f,t}function rl(e,t,a,r){return e=Xt(7,e,r,t),e.lanes=a,e}function gu(e,t,a){return e=Xt(6,e,null,t),e.lanes=a,e}function ip(e){var t=Xt(18,null,null,0);return t.stateNode=e,t}function vu(e,t,a){return t=Xt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var rp=new WeakMap;function gn(e,t){if(typeof e=="object"&&e!==null){var a=rp.get(e);return a!==void 0?a:(t={value:e,source:t,stack:tm(t)},rp.set(e,t),t)}return{value:e,source:t,stack:tm(t)}}var ea=[],ta=0,Gr=null,ui=0,vn=[],xn=0,Cs=null,Gn=1,Kn="";function cs(e,t){ea[ta++]=ui,ea[ta++]=Gr,Gr=e,ui=t}function op(e,t,a){vn[xn++]=Gn,vn[xn++]=Kn,vn[xn++]=Cs,Cs=e;var r=Gn;e=Kn;var u=32-tn(r)-1;r&=~(1<<u),a+=1;var f=32-tn(t)+u;if(30<f){var b=u-u%5;f=(r&(1<<b)-1).toString(32),r>>=b,u-=b,Gn=1<<32-tn(t)+u|a<<u|r,Kn=f+e}else Gn=1<<f|a<<u|r,Kn=e}function Kr(e){e.return!==null&&(cs(e,1),op(e,1,0))}function xu(e){for(;e===Gr;)Gr=ea[--ta],ea[ta]=null,ui=ea[--ta],ea[ta]=null;for(;e===Cs;)Cs=vn[--xn],vn[xn]=null,Kn=vn[--xn],vn[xn]=null,Gn=vn[--xn],vn[xn]=null}function cp(e,t){vn[xn++]=Gn,vn[xn++]=Kn,vn[xn++]=Cs,Gn=t.id,Kn=t.overflow,Cs=e}var yt=null,We=null,Oe=!1,Es=null,bn=!1,bu=Error(o(519));function As(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw di(gn(t,e)),bu}function up(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Nt]=e,t[Kt]=r,a){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(a=0;a<Oi.length;a++)De(Oi[a],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),jm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),Nm(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||zv(t.textContent,a)?(r.popover!=null&&(De("beforetoggle",t),De("toggle",t)),r.onScroll!=null&&De("scroll",t),r.onScrollEnd!=null&&De("scrollend",t),r.onClick!=null&&(t.onclick=Yn),t=!0):t=!1,t||As(e,!0)}function Xr(e){for(yt=e.return;yt;)switch(yt.tag){case 5:case 31:case 13:bn=!1;return;case 27:case 3:bn=!0;return;default:yt=yt.return}}function na(e){if(e!==yt)return!1;if(!Oe)return Xr(e),Oe=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Qd(e.type,e.memoizedProps)),a=!a),a&&We&&As(e),Xr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Jv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Jv(e)}else t===27?(t=We,Ks(e.type)?(e=lf,lf=null,We=e):We=t):We=yt?kn(e.stateNode.nextSibling):null;return!0}function ol(){We=yt=null,Oe=!1}function yu(){var e=Es;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),Es=null),e}function di(e){Es===null?Es=[e]:Es.push(e)}var ku=$t(null),cl=null,us=null;function Ms(e,t,a){qe(ku,t._currentValue),t._currentValue=a}function ds(e){e._currentValue=ku.current,nt(ku)}function Zr(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function ju(e,t,a,r){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var b=u.child;f=f.firstContext;e:for(;f!==null;){var S=f;f=u;for(var z=0;z<t.length;z++)if(S.context===t[z]){f.lanes|=a,S=f.alternate,S!==null&&(S.lanes|=a),Zr(f.return,a,e),r||(b=null);break e}f=S.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(o(341));b.lanes|=a,f=b.alternate,f!==null&&(f.lanes|=a),Zr(b,a,e),b=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=a,b=u.alternate,b!==null&&(b.lanes|=a),Zr(u.return,a,e),b=u.child,b=b!==null?b.sibling:null):b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function ul(e,t,a,r){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var S=u.type;sn(u.pendingProps.value,b.value)||(e!==null?e.push(S):e=[S])}}else if(u===el.current){if(b=u.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ca):e=[Ca])}u=u.return}return e!==null&&ju(t,e,a,r),t.flags|=262144,e!==null}function Vr(e){for(e=e.firstContext;e!==null;){if(!sn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function dl(e){cl=e,us=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return dp(cl,e)}function Qr(e,t){return cl===null&&dl(e),dp(e,t)}function dp(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},us===null){if(e===null)throw Error(o(308));us=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else us=us.next=t;return a}var gj=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},vj=n.unstable_scheduleCallback,xj=n.unstable_NormalPriority,dt={$$typeof:Ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wu(){return{controller:new gj,data:new Map,refCount:0}}function fi(e){e.refCount--,e.refCount===0&&vj(xj,function(){e.controller.abort()})}function fp(e,t){if((e.pendingLanes&4194048)!==0){var a=e.transitionTypes;for(a===null&&(a=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];a.indexOf(r)===-1&&a.push(r)}}}var hi=null;function bj(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var mi=null,Nu=0,fl=0,sa=null;function yj(e,t){if(mi===null){var a=mi=[];Nu=0,fl=Bd(),sa={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Nu++,t.then(hp,hp),t}function hp(){if(--Nu===0&&(hi=null,mi!==null)){sa!==null&&(sa.status="fulfilled");var e=mi;mi=null,fl=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function kj(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var u=0;u<a.length;u++)(0,a[u])(t)},function(u){for(r.status="rejected",r.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),r}var mp=fe.S;fe.S=function(e,t){if(iv=Wt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&yj(e,t),hi!==null)for(var a=ka;a!==null;)fp(a,hi),a=a.next;if(a=e.types,a!==null){for(var r=ka;r!==null;)fp(r,a),r=r.next;if(fl!==0){r=hi,r===null&&(r=hi=[]);for(var u=0;u<a.length;u++){var f=a[u];r.indexOf(f)===-1&&r.push(f)}}}mp!==null&&mp(e,t)};var hl=$t(null);function Su(){var e=hl.current;return e!==null?e:Pe.pooledCache}function Jr(e,t){t===null?qe(hl,hl.current):qe(hl,t.pool)}function pp(){var e=Su();return e===null?null:{parent:dt._currentValue,pool:e}}var la=Error(o(460)),Tu=Error(o(474)),Pr=Error(o(542)),Fr={then:function(){}};function gp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function vp(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Yn,Yn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bp(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(Yn,Yn);else{if(e=Pe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=r}},function(r){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bp(e),e}throw pl=t,la}}function ml(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(pl=a,la):a}}var pl=null;function xp(){if(pl===null)throw Error(o(459));var e=pl;return pl=null,e}function bp(e){if(e===la||e===Pr)throw Error(o(483))}var aa=null,pi=0;function Wr(e){var t=pi;return pi+=1,aa===null&&(aa=[]),vp(aa,e,t)}function zs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function eo(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yp(e){function t(q,D){if(e){var G=q.deletions;G===null?(q.deletions=[D],q.flags|=16):G.push(D)}}function a(q,D){if(!e)return null;for(;D!==null;)t(q,D),D=D.sibling;return null}function r(q){for(var D=new Map;q!==null;)q.key===null?D.set(q.index,q):D.set(q.key,q),q=q.sibling;return D}function u(q,D){return q=os(q,D),q.index=0,q.sibling=null,q}function f(q,D,G){return q.index=G,e?(G=q.alternate,G!==null?(G=G.index,G<D?(q.flags|=2,D):G):(q.flags|=134217730,D)):(q.flags|=1048576,D)}function b(q){return e&&q.alternate===null&&(q.flags|=134217730),q}function S(q,D,G,F){return D===null||D.tag!==6?(D=gu(G,q.mode,F),D.return=q,D):(D=u(D,G),D.return=q,D)}function z(q,D,G,F){var pe=G.type;return pe===X?(q=V(q,D,G.props.children,F,G.key),zs(q,G),q):D!==null&&(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Te&&ml(pe)===D.type)?(D=u(D,G.props),zs(D,G),D.return=q,D):(D=Yr(G.type,G.key,G.props,null,q.mode,F),zs(D,G),D.return=q,D)}function I(q,D,G,F){return D===null||D.tag!==4||D.stateNode.containerInfo!==G.containerInfo||D.stateNode.implementation!==G.implementation?(D=vu(G,q.mode,F),D.return=q,D):(D=u(D,G.children||[]),D.return=q,D)}function V(q,D,G,F,pe){return D===null||D.tag!==7?(D=rl(G,q.mode,F,pe),D.return=q,D):(D=u(D,G),D.return=q,D)}function W(q,D,G){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=gu(""+D,q.mode,G),D.return=q,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case E:return G=Yr(D.type,D.key,D.props,null,q.mode,G),zs(G,D),G.return=q,G;case U:return D=vu(D,q.mode,G),D.return=q,D;case Te:return D=ml(D),W(q,D,G)}if(ae(D)||Y(D))return D=rl(D,q.mode,G,null),D.return=q,D;if(typeof D.then=="function")return W(q,Wr(D),G);if(D.$$typeof===Ce)return W(q,Qr(q,D),G);eo(q,D)}return null}function H(q,D,G,F){var pe=D!==null?D.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return pe!==null?null:S(q,D,""+G,F);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case E:return G.key===pe?z(q,D,G,F):null;case U:return G.key===pe?I(q,D,G,F):null;case Te:return G=ml(G),H(q,D,G,F)}if(ae(G)||Y(G))return pe!==null?null:V(q,D,G,F,null);if(typeof G.then=="function")return H(q,D,Wr(G),F);if(G.$$typeof===Ce)return H(q,D,Qr(q,G),F);eo(q,G)}return null}function Z(q,D,G,F,pe){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return q=q.get(G)||null,S(D,q,""+F,pe);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case E:return q=q.get(F.key===null?G:F.key)||null,z(D,q,F,pe);case U:return q=q.get(F.key===null?G:F.key)||null,I(D,q,F,pe);case Te:return F=ml(F),Z(q,D,G,F,pe)}if(ae(F)||Y(F))return q=q.get(G)||null,V(D,q,F,pe,null);if(typeof F.then=="function")return Z(q,D,G,Wr(F),pe);if(F.$$typeof===Ce)return Z(q,D,G,Qr(D,F),pe);eo(D,F)}return null}function de(q,D,G,F){for(var pe=null,He=null,je=D,Ne=D=0,mt=null;je!==null&&Ne<G.length;Ne++){je.index>Ne?(mt=je,je=null):mt=je.sibling;var Be=H(q,je,G[Ne],F);if(Be===null){je===null&&(je=mt);break}e&&je&&Be.alternate===null&&t(q,je),D=f(Be,D,Ne),He===null?pe=Be:He.sibling=Be,He=Be,je=mt}if(Ne===G.length)return a(q,je),Oe&&cs(q,Ne),pe;if(je===null){for(;Ne<G.length;Ne++)je=W(q,G[Ne],F),je!==null&&(D=f(je,D,Ne),He===null?pe=je:He.sibling=je,He=je);return Oe&&cs(q,Ne),pe}for(je=r(je);Ne<G.length;Ne++)mt=Z(je,q,Ne,G[Ne],F),mt!==null&&(e&&(Be=mt.alternate,Be!==null&&je.delete(Be.key===null?Ne:Be.key)),D=f(mt,D,Ne),He===null?pe=mt:He.sibling=mt,He=mt);return e&&je.forEach(function(Js){return t(q,Js)}),Oe&&cs(q,Ne),pe}function be(q,D,G,F){if(G==null)throw Error(o(151));for(var pe=null,He=null,je=D,Ne=D=0,mt=null,Be=G.next();je!==null&&!Be.done;Ne++,Be=G.next()){je.index>Ne?(mt=je,je=null):mt=je.sibling;var Js=H(q,je,Be.value,F);if(Js===null){je===null&&(je=mt);break}e&&je&&Js.alternate===null&&t(q,je),D=f(Js,D,Ne),He===null?pe=Js:He.sibling=Js,He=Js,je=mt}if(Be.done)return a(q,je),Oe&&cs(q,Ne),pe;if(je===null){for(;!Be.done;Ne++,Be=G.next())Be=W(q,Be.value,F),Be!==null&&(D=f(Be,D,Ne),He===null?pe=Be:He.sibling=Be,He=Be);return Oe&&cs(q,Ne),pe}for(je=r(je);!Be.done;Ne++,Be=G.next())Be=Z(je,q,Ne,Be.value,F),Be!==null&&(e&&(mt=Be.alternate,mt!==null&&je.delete(mt.key===null?Ne:mt.key)),D=f(Be,D,Ne),He===null?pe=Be:He.sibling=Be,He=Be);return e&&je.forEach(function(tw){return t(q,tw)}),Oe&&cs(q,Ne),pe}function Me(q,D,G,F){if(typeof G=="object"&&G!==null&&G.type===X&&G.key===null&&G.props.ref===void 0&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case E:e:{for(var pe=G.key;D!==null;){if(D.key===pe){if(pe=G.type,pe===X){if(D.tag===7){a(q,D.sibling),F=u(D,G.props.children),zs(F,G),F.return=q,q=F;break e}}else if(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Te&&ml(pe)===D.type){a(q,D.sibling),F=u(D,G.props),zs(F,G),F.return=q,q=F;break e}a(q,D);break}else t(q,D);D=D.sibling}G.type===X?(F=rl(G.props.children,q.mode,F,G.key),zs(F,G),F.return=q,q=F):(F=Yr(G.type,G.key,G.props,null,q.mode,F),zs(F,G),F.return=q,q=F)}return b(q);case U:e:{for(pe=G.key;D!==null;){if(D.key===pe)if(D.tag===4&&D.stateNode.containerInfo===G.containerInfo&&D.stateNode.implementation===G.implementation){a(q,D.sibling),F=u(D,G.children||[]),F.return=q,q=F;break e}else{a(q,D);break}else t(q,D);D=D.sibling}F=vu(G,q.mode,F),F.return=q,q=F}return b(q);case Te:return G=ml(G),Me(q,D,G,F)}if(ae(G))return de(q,D,G,F);if(Y(G)){if(pe=Y(G),typeof pe!="function")throw Error(o(150));return G=pe.call(G),be(q,D,G,F)}if(typeof G.then=="function")return Me(q,D,Wr(G),F);if(G.$$typeof===Ce)return Me(q,D,Qr(q,G),F);eo(q,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,D!==null&&D.tag===6?(a(q,D.sibling),F=u(D,G),F.return=q,q=F):(a(q,D),F=gu(G,q.mode,F),F.return=q,q=F),b(q)):a(q,D)}return function(q,D,G,F){try{pi=0;var pe=Me(q,D,G,F);return aa=null,pe}catch(je){if(je===la||je===Pr)throw je;var He=Xt(29,je,null,q.mode);return He.lanes=F,He.return=q,He}finally{}}}var gl=yp(!0),kp=yp(!1),Rs=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _s(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ye&2)!==0){var u=r.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),r.pending=t,t=Ir(e),lp(e,null,a),t}return qr(e,r,t,a),Ir(e)}function gi(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,om(e,a)}}function Au(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=b:f=f.next=b,a=a.next}while(a!==null);f===null?u=f=t:f=f.next=t}else u=f=t;a={baseState:r.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Mu=!1;function vi(){if(Mu){var e=sa;if(e!==null)throw e}}function xi(e,t,a,r){Mu=!1;var u=e.updateQueue;Rs=!1;var f=u.firstBaseUpdate,b=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var z=S,I=z.next;z.next=null,b===null?f=I:b.next=I,b=z;var V=e.alternate;V!==null&&(V=V.updateQueue,S=V.lastBaseUpdate,S!==b&&(S===null?V.firstBaseUpdate=I:S.next=I,V.lastBaseUpdate=z))}if(f!==null){var W=u.baseState;b=0,V=I=z=null,S=f;do{var H=S.lane&-536870913,Z=H!==S.lane;if(Z?(Le&H)===H:(r&H)===H){H!==0&&H===fl&&(Mu=!0),V!==null&&(V=V.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var de=e,be=S;H=t;var Me=a;switch(be.tag){case 1:if(de=be.payload,typeof de=="function"){W=de.call(Me,W,H);break e}W=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=be.payload,H=typeof de=="function"?de.call(Me,W,H):de,H==null)break e;W=k({},W,H);break e;case 2:Rs=!0}}H=S.callback,H!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[H]:Z.push(H))}else Z={lane:H,tag:S.tag,payload:S.payload,callback:S.callback,next:null},V===null?(I=V=Z,z=W):V=V.next=Z,b|=H;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);V===null&&(z=W),u.baseState=z,u.firstBaseUpdate=I,u.lastBaseUpdate=V,f===null&&(u.shared.lanes=0),qs|=b,e.lanes=b,e.memoizedState=W}}function jp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function wp(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)jp(a[e],t)}var Ds=$t(null),to=$t(0);function Np(e,t){e=gs,qe(to,e),qe(Ds,t),gs=e|t.baseLanes}function zu(){qe(to,gs),qe(Ds,Ds.current)}function Ru(){gs=to.current,nt(Ds),nt(to)}var Tt=$t(null),Rt=null;function $s(e){var t=e.alternate;qe(Ct,Ct.current&1),qe(Tt,e),Rt===null&&(t===null||Ds.current!==null||t.memoizedState!==null)&&(Rt=e)}function Ou(e){qe(Ct,Ct.current),qe(Tt,e),Rt===null&&(Rt=e)}function Sp(e){e.tag===22?(qe(Ct,Ct.current),qe(Tt,e),Rt===null&&(Rt=e)):Us()}function Us(){qe(Ct,Ct.current),qe(Tt,Tt.current)}function ln(e){nt(Tt),Rt===e&&(Rt=null),nt(Ct)}var Ct=$t(0);function bi(e,t){qe(Tt,Tt.current),qe(Ct,t)}function _u(e){nt(Ct),nt(Tt),Rt===e&&(Rt=null)}function no(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||nf(a)||sf(a)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fs=0,Ae=null,Je=null,ft=null,so=!1,ia=!1,vl=!1,lo=0,yi=0,ra=null,jj=0;function it(){throw Error(o(321))}function Du(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!sn(e[a],t[a]))return!1;return!0}function $u(e,t,a,r,u,f){return fs=f,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fe.H=e===null||e.memoizedState===null?og:cg,vl=!1,f=a(r,u),vl=!1,ia&&(f=Cp(t,a,r,u)),Tp(e),f}function Tp(e){fe.H=fo;var t=Je!==null&&Je.next!==null;if(fs=0,ft=Je=Ae=null,so=!1,yi=0,ra=null,t)throw Error(o(300));e===null||ht||(e=e.dependencies,e!==null&&Vr(e)&&(ht=!0))}function Cp(e,t,a,r){Ae=e;var u=0;do{if(ia&&(ra=null),yi=0,ia=!1,25<=u)throw Error(o(301));if(u+=1,ft=Je=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}fe.H=Mj,f=t(a,r)}while(ia);return f}function wj(){var e=fe.H,t=e.useState()[0];return t=typeof t.then=="function"?ki(t):t,e=e.useState()[0],(Je!==null?Je.memoizedState:null)!==e&&(Ae.flags|=1024),t}function Uu(){var e=lo!==0;return lo=0,e}function Lu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hu(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}fs=0,ft=Je=Ae=null,ia=!1,yi=lo=0,ra=null}function Bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Ae.memoizedState=ft=e:ft=ft.next=e,ft}function ut(){if(Je===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=ft===null?Ae.memoizedState:ft.next;if(t!==null)ft=t,Je=e;else{if(e===null)throw Ae.alternate===null?Error(o(467)):Error(o(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},ft===null?Ae.memoizedState=ft=e:ft=ft.next=e}return ft}function ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ki(e){var t=yi;return yi+=1,ra===null&&(ra=[]),e=vp(ra,e,t),t=Ae,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,fe.H=t===null||t.memoizedState===null?og:cg),e}function io(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ki(e);if(e.$$typeof===le)return;if(e.$$typeof===Ce)return St(e)}throw Error(o(438,String(e)))}function Bu(e){var t=null,a=Ae.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=Ae.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=ao(),Ae.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=gt;return t.index++,a}function hs(e,t){return typeof t=="function"?t(e):t}function ro(e){var t=ut();return qu(t,Je,e)}function qu(e,t,a){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=a;var u=e.baseQueue,f=r.pending;if(f!==null){if(u!==null){var b=u.next;u.next=f.next,f.next=b}t.baseQueue=u=f,r.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var S=b=null,z=null,I=t,V=!1;do{var W=I.lane&-536870913;if(W!==I.lane?(Le&W)===W:(fs&W)===W){var H=I.revertLane;if(H===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),W===fl&&(V=!0);else if((fs&H)===H){I=I.next,H===fl&&(V=!0);continue}else W={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},z===null?(S=z=W,b=f):z=z.next=W,Ae.lanes|=H,qs|=H;W=I.action,vl&&a(f,W),f=I.hasEagerState?I.eagerState:a(f,W)}else H={lane:W,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},z===null?(S=z=H,b=f):z=z.next=H,Ae.lanes|=W,qs|=W;I=I.next}while(I!==null&&I!==t);if(z===null?b=f:z.next=S,!sn(f,e.memoizedState)&&(ht=!0,V&&(a=sa,a!==null)))throw a;e.memoizedState=f,e.baseState=b,e.baseQueue=z,r.lastRenderedState=f}return u===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Iu(e){var t=ut(),a=t.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var r=a.dispatch,u=a.pending,f=t.memoizedState;if(u!==null){a.pending=null;var b=u=u.next;do f=e(f,b.action),b=b.next;while(b!==u);sn(f,t.memoizedState)||(ht=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,r]}function Ep(e,t,a){var r=Ae,u=ut(),f=Oe;if(f){if(a===void 0)throw Error(o(407));a=a()}else a=t();var b=!sn((Je||u).memoizedState,a);if(b&&(u.memoizedState=a,ht=!0),u=u.queue,Ku(zp.bind(null,r,u,e),[e]),e=u.getSnapshot!==t||b||ft!==null&&(ft.memoizedState.tag&1)!==0,oa(e?9:8,{destroy:void 0},Mp.bind(null,r,u,a,t),null),e){if(r.flags|=2048,Pe===null)throw Error(o(349));f||(fs&127)!==0||Ap(r,t,a)}return a}function Ap(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ae.updateQueue,t===null?(t=ao(),Ae.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Mp(e,t,a,r){t.value=a,t.getSnapshot=r,Rp(t)&&Op(e)}function zp(e,t,a){return a(function(){Rp(t)&&Op(e)})}function Rp(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!sn(e,a)}catch{return!0}}function Op(e){var t=il(e,2);t!==null&&Jt(t,e,2)}function Yu(e){var t=Bt();if(typeof e=="function"){var a=e;if(e=a(),vl){Ns(!0);try{a()}finally{Ns(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},t}function _p(e,t,a,r){return e.baseState=a,qu(e,Je,typeof r=="function"?r:hs)}function Nj(e,t,a,r,u){if(uo(e))throw Error(o(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){f.listeners.push(b)}};fe.T!==null?a(!0):f.isTransition=!1,r(f),a=t.pending,a===null?(f.next=t.pending=f,Dp(t,f)):(f.next=a.next,t.pending=a.next=f)}}function Dp(e,t){var a=t.action,r=t.payload,u=e.state;if(t.isTransition){var f=fe.T,b={};b.types=f!==null?f.types:null,fe.T=b;try{var S=a(u,r),z=fe.S;z!==null&&z(b,S),$p(e,t,S)}catch(I){Gu(e,t,I)}finally{f!==null&&b.types!==null&&(f.types=b.types),fe.T=f}}else try{f=a(u,r),$p(e,t,f)}catch(I){Gu(e,t,I)}}function $p(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){Up(e,t,r)},function(r){return Gu(e,t,r)}):Up(e,t,a)}function Up(e,t,a){t.status="fulfilled",t.value=a,Lp(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Dp(e,a)))}function Gu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,Lp(t),t=t.next;while(t!==r)}e.action=null}function Lp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hp(e,t){return t}function Bp(e,t){if(Oe){var a=Pe.formState;if(a!==null){e:{var r=Ae;if(Oe){if(We){t:{for(var u=We,f=bn;u.nodeType!==8;){if(!f){u=null;break t}if(u=kn(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){We=kn(u.nextSibling),r=u.data==="F!";break e}}As(r)}r=!1}r&&(t=a[0])}}return a=Bt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hp,lastRenderedState:t},a.queue=r,a=ag.bind(null,Ae,r),r.dispatch=a,r=Yu(!1),f=Ju.bind(null,Ae,!1,r.queue),r=Bt(),u={state:t,dispatch:null,action:e,pending:null},r.queue=u,a=Nj.bind(null,Ae,u,f,a),u.dispatch=a,r.memoizedState=e,[t,a,!1]}function qp(e){var t=ut();return Ip(t,Je,e)}function Ip(e,t,a){if(t=qu(e,t,Hp)[0],e=ro(hs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=ki(t)}catch(b){throw b===la?Pr:b}else r=t;t=ut();var u=t.queue,f=u.dispatch;return a!==t.memoizedState&&(Ae.flags|=2048,oa(9,{destroy:void 0},Sj.bind(null,u,a),null)),[r,f,e]}function Sj(e,t){e.action=t}function Yp(e){var t=ut(),a=Je;if(a!==null)return Ip(t,a,e);ut(),t=t.memoizedState,a=ut();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function oa(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=ao(),Ae.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function Gp(){return ut().memoizedState}function oo(e,t,a,r){var u=Bt();Ae.flags|=e,u.memoizedState=oa(1|t,{destroy:void 0},a,r===void 0?null:r)}function co(e,t,a,r){var u=ut();r=r===void 0?null:r;var f=u.memoizedState.inst;Je!==null&&r!==null&&Du(r,Je.memoizedState.deps)?u.memoizedState=oa(t,f,a,r):(Ae.flags|=e,u.memoizedState=oa(1|t,f,a,r))}function Kp(e,t){oo(8390656,8,e,t)}function Ku(e,t){co(2048,8,e,t)}function Tj(e){Ae.flags|=4;var t=Ae.updateQueue;if(t===null)t=ao(),Ae.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Xp(e){var t=ut().memoizedState;return Tj({ref:t,nextImpl:e}),function(){if((Ye&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Zp(e,t){return co(4,2,e,t)}function Vp(e,t){return co(4,4,e,t)}function Qp(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jp(e,t,a){a=a!=null?a.concat([e]):null,co(4,4,Qp.bind(null,t,e),a)}function Xu(){}function Pp(e,t){var a=ut();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Du(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Fp(e,t){var a=ut();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Du(t,r[1]))return r[0];if(r=e(),vl){Ns(!0);try{e()}finally{Ns(!1)}}return a.memoizedState=[r,t],r}function Zu(e,t,a){return a===void 0||(fs&1073741824)!==0&&(Le&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=ov(),Ae.lanes|=e,qs|=e,a)}function Wp(e,t,a,r){return sn(a,t)?a:Ds.current!==null?(e=Zu(e,a,r),sn(e,t)||(ht=!0),e):(fs&106)===0||(fs&1073741824)!==0&&(Le&261930)===0?(ht=!0,e.memoizedState=a):(e=ov(),Ae.lanes|=e,qs|=e,t)}function eg(e,t,a,r,u){var f=ve.p;ve.p=f!==0&&8>f?f:8;var b=fe.T,S={};S.types=b!==null?b.types:null,fe.T=S,Ju(e,!1,t,a);try{var z=u(),I=fe.S;if(I!==null&&I(S,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var V=kj(z,r);ji(e,t,V,cn(e))}else ji(e,t,r,cn(e))}catch(W){ji(e,t,{then:function(){},status:"rejected",reason:W},cn())}finally{ve.p=f,b!==null&&S.types!==null&&(b.types=S.types),fe.T=b}}function Cj(){}function Vu(e,t,a,r){if(e.tag!==5)throw Error(o(476));var u=tg(e).queue;eg(e,u,t,tt,a===null?Cj:function(){return ng(e),a(r)})}function tg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:tt,baseState:tt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:tt},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ng(e){var t=tg(e);t.next===null&&(t=e.alternate.memoizedState),ji(e,t.next.queue,{},cn())}function Qu(){return St(Ca)}function sg(){return ut().memoizedState}function lg(){return ut().memoizedState}function Ej(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=cn();e=Os(a);var r=_s(t,e,a);r!==null&&(Jt(r,t,a),gi(r,t,a)),t={cache:wu()},e.payload=t;return}t=t.return}}function Aj(e,t,a){var r=cn();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},uo(e)?ig(t,a):(a=mu(e,t,a,r),a!==null&&(Jt(a,e,r),rg(a,t,r)))}function ag(e,t,a){var r=cn();ji(e,t,a,r)}function ji(e,t,a,r){var u={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(uo(e))ig(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var b=t.lastRenderedState,S=f(b,a);if(u.hasEagerState=!0,u.eagerState=S,sn(S,b))return qr(e,t,u,0),Pe===null&&Br(),!1}catch{}finally{}if(a=mu(e,t,u,r),a!==null)return Jt(a,e,r),rg(a,t,r),!0}return!1}function Ju(e,t,a,r){if(r={lane:2,revertLane:Bd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},uo(e)){if(t)throw Error(o(479))}else t=mu(e,a,r,2),t!==null&&Jt(t,e,2)}function uo(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function ig(e,t){ia=so=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function rg(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,om(e,a)}}var fo={readContext:St,use:io,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it,useEffectEvent:it},og={readContext:St,use:io,useCallback:function(e,t){return Bt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Kp,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,oo(4194308,4,Qp.bind(null,t,e),a)},useLayoutEffect:function(e,t){return oo(4194308,4,e,t)},useInsertionEffect:function(e,t){oo(4,2,e,t)},useMemo:function(e,t){var a=Bt();t=t===void 0?null:t;var r=e();if(vl){Ns(!0);try{e()}finally{Ns(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Bt();if(a!==void 0){var u=a(t);if(vl){Ns(!0);try{a(t)}finally{Ns(!1)}}}else u=t;return r.memoizedState=r.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},r.queue=e,e=e.dispatch=Aj.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=Bt();return e={current:e},t.memoizedState=e},useState:function(e){e=Yu(e);var t=e.queue,a=ag.bind(null,Ae,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Xu,useDeferredValue:function(e,t){var a=Bt();return Zu(a,e,t)},useTransition:function(){var e=Yu(!1);return e=eg.bind(null,Ae,e.queue,!0,!1),Bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=Ae,u=Bt();if(Oe){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),Pe===null)throw Error(o(349));(Le&127)!==0||Ap(r,t,a)}u.memoizedState=a;var f={value:a,getSnapshot:t};return u.queue=f,Kp(zp.bind(null,r,f,e),[e]),r.flags|=2048,oa(9,{destroy:void 0},Mp.bind(null,r,f,a,t),null),a},useId:function(){var e=Bt(),t=Pe.identifierPrefix;if(Oe){var a=Kn,r=Gn;a=(r&~(1<<32-tn(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=lo++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=jj++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Qu,useFormState:Bp,useActionState:Bp,useOptimistic:function(e){var t=Bt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Ju.bind(null,Ae,!0,a),a.dispatch=t,[e,t]},useMemoCache:Bu,useCacheRefresh:function(){return Bt().memoizedState=Ej.bind(null,Ae)},useEffectEvent:function(e){var t=Bt(),a={impl:e};return t.memoizedState=a,function(){if((Ye&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},cg={readContext:St,use:io,useCallback:Pp,useContext:St,useEffect:Ku,useImperativeHandle:Jp,useInsertionEffect:Zp,useLayoutEffect:Vp,useMemo:Fp,useReducer:ro,useRef:Gp,useState:function(){return ro(hs)},useDebugValue:Xu,useDeferredValue:function(e,t){var a=ut();return Wp(a,Je.memoizedState,e,t)},useTransition:function(){var e=ro(hs)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ki(e),t]},useSyncExternalStore:Ep,useId:sg,useHostTransitionStatus:Qu,useFormState:qp,useActionState:qp,useOptimistic:function(e,t){var a=ut();return _p(a,Je,e,t)},useMemoCache:Bu,useCacheRefresh:lg,useEffectEvent:Xp},Mj={readContext:St,use:io,useCallback:Pp,useContext:St,useEffect:Ku,useImperativeHandle:Jp,useInsertionEffect:Zp,useLayoutEffect:Vp,useMemo:Fp,useReducer:Iu,useRef:Gp,useState:function(){return Iu(hs)},useDebugValue:Xu,useDeferredValue:function(e,t){var a=ut();return Je===null?Zu(a,e,t):Wp(a,Je.memoizedState,e,t)},useTransition:function(){var e=Iu(hs)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ki(e),t]},useSyncExternalStore:Ep,useId:sg,useHostTransitionStatus:Qu,useFormState:Yp,useActionState:Yp,useOptimistic:function(e,t){var a=ut();return Je!==null?_p(a,Je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Bu,useCacheRefresh:lg,useEffectEvent:Xp};function Pu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:k({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Fu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=cn(),u=Os(r);u.payload=t,a!=null&&(u.callback=a),t=_s(e,u,r),t!==null&&(Jt(t,e,r),gi(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=cn(),u=Os(r);u.tag=1,u.payload=t,a!=null&&(u.callback=a),t=_s(e,u,r),t!==null&&(Jt(t,e,r),gi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=cn(),r=Os(a);r.tag=2,t!=null&&(r.callback=t),t=_s(e,r,a),t!==null&&(Jt(t,e,a),gi(t,e,a))}};function ug(e,t,a,r,u,f,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,f,b):t.prototype&&t.prototype.isPureReactComponent?!oi(a,r)||!oi(u,f):!0}function dg(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Fu.enqueueReplaceState(t,t.state,null)}function xl(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=k({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function fg(e){Hr(e)}function hg(e){console.error(e)}function mg(e){Hr(e)}function ho(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function pg(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Wu(e,t,a){return a=Os(a),a.tag=3,a.payload={element:null},a.callback=function(){ho(e,t)},a}function gg(e){return e=Os(e),e.tag=3,e}function vg(e,t,a,r){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=r.value;e.payload=function(){return u(f)},e.callback=function(){pg(t,a,r)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){pg(t,a,r),typeof u!="function"&&(Is===null?Is=new Set([this]):Is.add(this));var S=r.stack;this.componentDidCatch(r.value,{componentStack:S!==null?S:""})})}function zj(e,t,a,r,u){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&ul(t,a,u,!0),a=Tt.current,a!==null){switch(a.tag){case 31:case 13:case 19:return Rt===null?_o():a.alternate===null&&rt===0&&(rt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,r===Fr?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Ud(e,r,u)),!1;case 22:return a.flags|=65536,r===Fr?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),Ud(e,r,u)),!1}throw Error(o(435,a.tag))}return Ud(e,r,u),_o(),!1}if(Oe)return t=Tt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,r!==bu&&(e=Error(o(422),{cause:r}),di(gn(e,a)))):(r!==bu&&(t=Error(o(423),{cause:r}),di(gn(t,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,r=gn(r,a),u=Wu(e.stateNode,r,u),Au(e,u),rt!==4&&(rt=2)),!1;var f=Error(o(520),{cause:r});if(f=gn(f,a),Mi===null?Mi=[f]:Mi.push(f),rt!==4&&(rt=2),t===null)return!0;r=gn(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Wu(a.stateNode,r,e),Au(a,e),!1;case 1:if(t=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Is===null||!Is.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=gg(u),vg(u,e,a,r),Au(a,u),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var ed=Error(o(461)),ht=!1;function vt(e,t,a,r){t.child=e===null?kp(t,null,a,r):gl(t,e.child,a,r)}function xg(e,t,a,r,u){a=a.render;var f=t.ref;if("ref"in r){var b={};for(var S in r)S!=="ref"&&(b[S]=r[S])}else b=r;return dl(t),r=$u(e,t,a,b,f,u),S=Uu(),e!==null&&!ht?(Lu(e,t,u),ms(e,t,u)):(Oe&&S&&Kr(t),t.flags|=1,vt(e,t,r,u),t.child)}function bg(e,t,a,r,u){if(e===null){var f=a.type;return typeof f=="function"&&!pu(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,yg(e,t,f,r,u)):(e=Yr(a.type,null,r,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!od(e,u)){var b=f.memoizedProps;if(a=a.compare,a=a!==null?a:oi,a(b,r)&&e.ref===t.ref)return ms(e,t,u)}return t.flags|=1,e=os(f,r),e.ref=t.ref,e.return=t,t.child=e}function yg(e,t,a,r,u){if(e!==null){var f=e.memoizedProps;if(oi(f,r)&&e.ref===t.ref)if(ht=!1,t.pendingProps=r=f,od(e,u))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,ms(e,t,u)}return td(e,t,a,r,u)}function kg(e,t,a,r){var u=r.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,e!==null){for(r=t.child=e.child,u=0;r!==null;)u=u|r.lanes|r.childLanes,r=r.sibling;r=u&~f}else r=0,t.child=null;return jg(e,t,f,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jr(t,f!==null?f.cachePool:null),f!==null?Np(t,f):zu(),Sp(t);else return r=t.lanes=536870912,jg(e,t,f!==null?f.baseLanes|a:a,a,r)}else f!==null?(Jr(t,f.cachePool),Np(t,f),Us(),t.memoizedState=null):(e!==null&&Jr(t,null),zu(),Us());return vt(e,t,u,a),t.child}function wi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jg(e,t,a,r,u){var f=Su();return f=f===null?null:{parent:dt._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&Jr(t,null),zu(),Sp(t),e!==null&&ul(e,t,r,!0),t.childLanes=u,null}function mo(e,t){return t=po({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function wg(e,t,a){return gl(t,e.child,null,a),e=mo(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function Rj(e,t,a){var r=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Oe){if(r.mode==="hidden")return e=mo(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},wi(null,e);if(Ou(t),(e=We)?(e=Qv(e,bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:Gn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},a=ip(e),a.return=t,t.child=a,yt=t,We=null)):e=null,e===null)throw As(t);return t.lanes=536870912,null}return mo(t,r)}var f=e.memoizedState;if(f!==null){var b=f.dehydrated;if(Ou(t),u)if(t.flags&256)t.flags&=-257,t=wg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ht||ul(e,t,a,!1),u=(a&e.childLanes)!==0,ht||u){if(Ds.current===null){if(r=Pe,r!==null&&(b=cm(r,a),b!==0&&b!==f.retryLane))throw f.retryLane=b,il(e,b),Jt(r,e,b),ed;_o()}t=wg(e,t,a)}else e=f.treeContext,We=kn(b.nextSibling),yt=t,Oe=!0,Es=null,bn=!1,e!==null&&cp(t,e),t=mo(t,r),t.flags|=134221824;return t}return e=os(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ca(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(o(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function td(e,t,a,r,u){return dl(t),a=$u(e,t,a,r,void 0,u),r=Uu(),e!==null&&!ht?(Lu(e,t,u),ms(e,t,u)):(Oe&&r&&Kr(t),t.flags|=1,vt(e,t,a,u),t.child)}function Ng(e,t,a,r,u,f){return dl(t),t.updateQueue=null,a=Cp(t,r,a,u),Tp(e),r=Uu(),e!==null&&!ht?(Lu(e,t,f),ms(e,t,f)):(Oe&&r&&Kr(t),t.flags|=1,vt(e,t,a,f),t.child)}function Sg(e,t,a,r,u){if(dl(t),t.stateNode===null){var f=Wl,b=a.contextType;typeof b=="object"&&b!==null&&(f=St(b)),f=new a(r,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Fu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=r,f.state=t.memoizedState,f.refs={},Cu(t),b=a.contextType,f.context=typeof b=="object"&&b!==null?St(b):Wl,f.state=t.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(Pu(t,a,b,r),f.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(b=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),b!==f.state&&Fu.enqueueReplaceState(f,f.state,null),xi(t,r,f,u),vi(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){f=t.stateNode;var S=t.memoizedProps,z=xl(a,S);f.props=z;var I=f.context,V=a.contextType;b=Wl,typeof V=="object"&&V!==null&&(b=St(V));var W=a.getDerivedStateFromProps;V=typeof W=="function"||typeof f.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,V||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(S||I!==b)&&dg(t,f,r,b),Rs=!1;var H=t.memoizedState;f.state=H,xi(t,r,f,u),vi(),I=t.memoizedState,S||H!==I||Rs?(typeof W=="function"&&(Pu(t,a,W,r),I=t.memoizedState),(z=Rs||ug(t,a,z,r,H,I,b))?(V||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=I),f.props=r,f.state=I,f.context=b,r=z):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{f=t.stateNode,Eu(e,t),b=t.memoizedProps,V=xl(a,b),f.props=V,W=t.pendingProps,H=f.context,I=a.contextType,z=Wl,typeof I=="object"&&I!==null&&(z=St(I)),S=a.getDerivedStateFromProps,(I=typeof S=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==W||H!==z)&&dg(t,f,r,z),Rs=!1,H=t.memoizedState,f.state=H,xi(t,r,f,u),vi();var Z=t.memoizedState;b!==W||H!==Z||Rs||e!==null&&e.dependencies!==null&&Vr(e.dependencies)?(typeof S=="function"&&(Pu(t,a,S,r),Z=t.memoizedState),(V=Rs||ug(t,a,V,r,H,Z,z)||e!==null&&e.dependencies!==null&&Vr(e.dependencies))?(I||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(r,Z,z),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(r,Z,z)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=Z),f.props=r,f.state=Z,f.context=z,r=V):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),r=!1)}return f=r,ca(e,t),r=(t.flags&128)!==0,f||r?(f=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&r?(t.child=gl(t,e.child,null,u),t.child=gl(t,null,a,u)):vt(e,t,a,u),t.memoizedState=f.state,e=t.child):e=ms(e,t,u),e}function Tg(e,t,a,r){return ol(),t.flags|=256,vt(e,t,a,r),t.child}var nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sd(e){return{baseLanes:e,cachePool:pp()}}function ld(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=on),e}function Cg(e,t,a){var r=t.pendingProps,u=!1,f=(t.flags&128)!==0,b;if((b=f)||(b=e!==null&&e.memoizedState===null?!1:(Ct.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Oe){if(u?$s(t):Us(),(e=We)?(e=Qv(e,bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:Gn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},a=ip(e),a.return=t,t.child=a,yt=t,We=null)):e=null,e===null)throw As(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}return f=r.children,r=r.fallback,u?(Us(),u=t.mode,f=po({mode:"hidden",children:f},u),r=rl(r,u,a,null),f.return=t,r.return=t,f.sibling=r,t.child=f,r=t.child,r.memoizedState=sd(a),r.childLanes=ld(e,b,a),t.memoizedState=nd,wi(null,r)):($s(t),ad(t,f))}var S=e.memoizedState;if(S!==null){var z=S.dehydrated;if(z!==null)return Oj(e,t,f,b,r,z,S,a)}return u?(Us(),u=r.fallback,f=t.mode,S=e.child,z=S.sibling,r=os(S,{mode:"hidden",children:r.children}),r.subtreeFlags=S.subtreeFlags&1206910976,z!==null?u=os(z,u):(u=rl(u,f,a,null),u.flags|=2),u.return=t,r.return=t,r.sibling=u,t.child=r,wi(null,r),r=t.child,u=e.child.memoizedState,u===null?u=sd(a):(f=u.cachePool,f!==null?(S=dt._currentValue,f=f.parent!==S?{parent:S,pool:S}:f):f=pp(),u={baseLanes:u.baseLanes|a,cachePool:f}),r.memoizedState=u,r.childLanes=ld(e,b,a),t.memoizedState=nd,wi(e.child,r)):($s(t),a=e.child,e=a.sibling,a=os(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=a,t.memoizedState=null,a)}function ad(e,t){return t=po({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function po(e,t){return e=Xt(22,e,null,t),e.lanes=0,e}function go(e,t,a){return gl(t,e.child,null,a),e=ad(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oj(e,t,a,r,u,f,b,S){if(a)return t.flags&256?($s(t),t.flags&=-257,go(e,t,S)):t.memoizedState!==null?(Us(),t.child=e.child,t.flags|=128,null):(Us(),f=u.fallback,b=t.mode,u=po({mode:"visible",children:u.children},b),f=rl(f,b,S,null),f.flags|=2,u.return=t,f.return=t,u.sibling=f,t.child=u,gl(t,e.child,null,S),u=t.child,u.memoizedState=sd(S),u.childLanes=ld(e,r,S),t.memoizedState=nd,wi(null,u));if($s(t),sf(f)){if(r=f.nextSibling&&f.nextSibling.dataset,r)var z=r.dgst;return r=z,r!==""&&(u=Error(o(419)),u.stack="",u.digest=r,di({value:u,source:null,stack:null})),go(e,t,S)}if(ht||ul(e,t,S,!1),r=(S&e.childLanes)!==0,ht||r){if(Ds.current!==null)return go(e,t,S);if(r=Pe,r!==null&&(u=cm(r,S),u!==0&&u!==b.retryLane))throw b.retryLane=u,il(e,u),Jt(r,e,u),ed;return nf(f)||_o(),go(e,t,S)}return nf(f)?(t.flags|=192,t.child=e.child,null):(e=b.treeContext,We=kn(f.nextSibling),yt=t,Oe=!0,Es=null,bn=!1,e!==null&&cp(t,e),t=ad(t,u.children),t.flags|=134221824,t)}function Eg(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zr(e.return,t,a)}function Ag(e){for(var t=null;e!==null;){var a=e.alternate;a!==null&&no(a)===null&&(t=e),e=e.sibling}return t}function vo(e,t,a,r,u,f){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:u,treeForkCount:f}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=r,b.tail=a,b.tailMode=u,b.treeForkCount=f)}function id(e){var t=e.child;for(e.child=null;t!==null;){var a=t.sibling;t.sibling=e.child,e.child=t,t=a}}function rd(e,t,a){var r=t.pendingProps,u=r.revealOrder,f=r.tail;r=r.children;var b=Ct.current;if(t.flags&128)return bi(t,b),null;var S=(b&2)!==0;if(S?(b=b&1|2,t.flags|=128):b&=1,bi(t,b),u==="backwards"&&e!==null?(id(e),vt(e,t,r,a),id(e)):vt(e,t,r,a),r=Oe?ui:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Eg(e,a,t);else if(e.tag===19)Eg(e,a,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":a=Ag(t.child),a===null?(u=t.child,t.child=null):(u=a.sibling,a.sibling=null,id(t)),vo(t,!0,u,null,f,r);break;case"unstable_legacy-backwards":for(a=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&no(e)===null){t.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}vo(t,!0,a,null,f,r);break;case"together":vo(t,!1,null,null,void 0,r);break;case"independent":t.memoizedState=null;break;default:a=Ag(t.child),a===null?(u=t.child,t.child=null):(u=a.sibling,a.sibling=null),vo(t,!1,u,a,f,r)}return t.child}function Mg(e,t,a){var r=t.pendingProps;return Ms(t,t.type,r.value),vt(e,t,r.children,a),t.child}function ms(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),qs|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(ul(e,t,a,!1),(a&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,a=os(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=os(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function od(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Vr(e)))}function _j(e,t,a){switch(t.tag){case 3:kr(t,t.stateNode.containerInfo),Ms(t,dt,e.memoizedState.cache),ol();break;case 27:case 5:Dc(t);break;case 4:kr(t,t.stateNode.containerInfo);break;case 10:Ms(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ou(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return $s(t),t.flags|=128,null;r=ul(e,t,a,!1);var u=t.child.childLanes;return r||(a&u)!==0?Cg(e,t,a):($s(t),e=ms(e,t,a),e!==null?e.sibling:null)}$s(t);break;case 19:if(t.flags&128)return rd(e,t,a);if(u=(e.flags&128)!==0,r=(a&t.childLanes)!==0,r||(ul(e,t,a,!1),r=(a&t.childLanes)!==0),u){if(r)return rd(e,t,a);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),bi(t,Ct.current),r)break;return null;case 22:return t.lanes=0,kg(e,t,a,t.pendingProps);case 24:Ms(t,dt,e.memoizedState.cache)}return ms(e,t,a)}function zg(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!od(e,a)&&(t.flags&128)===0)return ht=!1,_j(e,t,a);ht=(e.flags&131072)!==0}else ht=!1,Oe&&(t.flags&1048576)!==0&&op(t,ui,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ml(t.elementType),t.type=e,typeof e=="function")pu(e)?(r=xl(e,r),t.tag=1,t=Sg(null,t,e,r,a)):(t.tag=0,t=td(null,t,e,r,a));else{if(e!=null){var u=e.$$typeof;if(u===ue){t.tag=11,t=xg(null,t,e,r,a);break e}else if(u===Re){t.tag=14,t=bg(null,t,e,r,a);break e}else if(u===Ce){t.tag=10,t.type=e,t=Mg(null,t,a);break e}}throw t=te(e)||e,Error(o(306,t,""))}}return t;case 0:return td(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,u=xl(r,t.pendingProps),Sg(e,t,r,u,a);case 3:e:{if(kr(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var f=t.memoizedState;u=f.element,Eu(e,t),xi(t,r,null,a);var b=t.memoizedState;if(r=b.cache,Ms(t,dt,r),r!==f.cache&&ju(t,[dt],a,!0),vi(),r=b.element,f.isDehydrated)if(f={element:r,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Tg(e,t,r,a);break e}else if(r!==u){u=gn(Error(o(424)),t),di(u),t=Tg(e,t,r,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=kn(e.firstChild),yt=t,Oe=!0,Es=null,bn=!0,a=kp(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling}else{if(ol(),r===u){t=ms(e,t,a);break e}vt(e,t,r,a)}t=t.child}return t;case 26:return ca(e,t),e===null?(a=nx(t.type,null,t.pendingProps,null))?t.memoizedState=a:Oe||(t.stateNode=Dv(t.type,t.pendingProps,An.current,t)):t.memoizedState=nx(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Dc(t),e===null&&Oe&&(r=t.stateNode=Fv(t.type,t.pendingProps,An.current),yt=t,bn=!0,u=We,Ks(t.type)?(lf=u,We=kn(r.firstChild)):We=u),vt(e,t,t.pendingProps.children,a),ca(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oe&&((u=r=We)&&(r=E1(r,t.type,t.pendingProps,bn),r!==null?(t.stateNode=r,yt=t,We=kn(r.firstChild),bn=!1,u=!0):u=!1),u||As(t)),Dc(t),u=t.type,f=t.pendingProps,b=e!==null?e.memoizedProps:null,r=f.children,Qd(u,f)?r=null:b!==null&&Qd(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=$u(e,t,wj,null,null,a),Ca._currentValue=u),ca(e,t),vt(e,t,r,a),t.child;case 6:return e===null&&Oe&&((e=a=We)&&(a=A1(a,t.pendingProps,bn),a!==null?(t.stateNode=a,yt=t,We=null,e=!0):e=!1),e||As(t)),null;case 13:return Cg(e,t,a);case 4:return kr(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gl(t,null,r,a):vt(e,t,r,a),t.child;case 11:return xg(e,t,t.type,t.pendingProps,a);case 7:return r=t.pendingProps,ca(e,t),vt(e,t,r,a),t.child;case 8:return vt(e,t,t.pendingProps.children,a),t.child;case 12:return vt(e,t,t.pendingProps.children,a),t.child;case 10:return Mg(e,t,a);case 9:return u=t.type._context,r=t.pendingProps.children,dl(t),u=St(u),r=r(u),t.flags|=1,vt(e,t,r,a),t.child;case 14:return bg(e,t,t.type,t.pendingProps,a);case 15:return yg(e,t,t.type,t.pendingProps,a);case 19:return rd(e,t,a);case 31:return Rj(e,t,a);case 22:return kg(e,t,a,t.pendingProps);case 24:return dl(t),r=St(dt),e===null?(u=Su(),u===null&&(u=Pe,f=wu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),t.memoizedState={parent:r,cache:u},Cu(t),Ms(t,dt,u)):((e.lanes&a)!==0&&(Eu(e,t),xi(t,null,null,a),vi()),u=e.memoizedState,f=t.memoizedState,u.parent!==r?(u={parent:r,cache:r},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Ms(t,dt,r)):(r=f.cache,Ms(t,dt,r),r!==u.cache&&ju(t,[dt],a,!0))),vt(e,t,t.pendingProps.children,a),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!=="auto"?t.flags|=e===null?18882560:18874368:Oe&&Kr(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:ca(e,t),vt(e,t,r.children,a),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ps(e){e.flags|=4}function cd(e,t,a,r,u){var f;if((f=(e.mode&32)!==0)&&(f=a===null?ix(t,r):ix(t,r)&&(r.src!==a.src||r.srcSet!==a.srcSet)),f){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(fv())e.flags|=8192;else throw pl=Fr,Tu}else e.flags&=-16777217}function Rg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!rx(t))if(fv())e.flags|=8192;else throw pl=Fr,Tu}function xo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?im():536870912,e.lanes|=t,ma|=t)}function Ni(e,t){if(!Oe)switch(e.tailMode){case"visible":break;case"collapsed":for(var a=e.tail,r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,r|=u.subtreeFlags&1206910976,r|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,r|=u.subtreeFlags,r|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function Dj(e,t,a){var r=t.pendingProps;switch(xu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ds(dt),Bl(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(na(t)?ps(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,yu())),et(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(ps(t),f!==null?(et(t),Rg(t,f)):(et(t),cd(t,u,null,r,a))):f?f!==e.memoizedState?(ps(t),et(t),Rg(t,f)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ps(t),et(t),cd(t,u,e,r,a)),null;case 27:if(jr(t),a=An.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}e=Ut.current,na(t)?up(t):(e=Fv(u,r,a),t.stateNode=e,ps(t))}return et(t),t.subtreeFlags&=-33554433,null;case 5:if(jr(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}if(f=Ut.current,na(t))up(t);else{var b=Di(An.current);switch(f){case 1:f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=b.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof r.is=="string"?b.createElement("select",{is:r.is}):b.createElement("select"),r.multiple?f.multiple=!0:r.size&&(f.size=r.size);break;default:f=typeof r.is=="string"?b.createElement(u,{is:r.is}):b.createElement(u)}}f[Nt]=t,f[Kt]=r;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)f.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=f;e:switch(At(f,u,r),u){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ps(t)}}return et(t),t.subtreeFlags&=-33554433,cd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ps(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(o(166));if(e=An.current,na(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,u=yt,u!==null)switch(u.tag){case 27:case 5:r=u.memoizedProps}e[Nt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||zv(e.nodeValue,a)),e||As(t,!0)}else e=Di(e).createTextNode(r),e[Nt]=t,t.stateNode=e}return et(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=na(t),a!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Nt]=t}else ol(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else a=yu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(o(558))}return et(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=na(t),r!==null&&r.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Nt]=t}else ol(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),u=!1}else u=yu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,u=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(u=r.alternate.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==u&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),xo(t,t.updateQueue),et(t),null);case 4:return Bl(),e===null&&Gd(t.stateNode.containerInfo),t.flags|=67108864,et(t),null;case 10:return ds(t.type),et(t),null;case 19:if(_u(t),r=t.memoizedState,r===null)return et(t),null;if(u=(t.flags&128)!==0,f=r.rendering,f===null)if(u)Ni(r,!1);else{if(rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=no(e),f!==null){for(t.flags|=128,Ni(r,!1),e=f.updateQueue,t.updateQueue=e,xo(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)ap(a,e),a=a.sibling;return bi(t,Ct.current&1|2),Oe&&cs(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Wt()>Mo&&(t.flags|=128,u=!0,Ni(r,!1),t.lanes=4194304)}else{if(!u)if(e=no(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,xo(t,e),Ni(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!f.alternate&&!Oe)return et(t),null}else 2*Wt()-r.renderingStartTime>Mo&&a!==536870912&&(t.flags|=128,u=!0,Ni(r,!1),t.lanes=4194304);r.isBackwards?(f.sibling=t.child,t.child=f):(e=r.last,e!==null?e.sibling=f:t.child=f,r.last=f)}if(r.tail!==null){e=r.tail;e:{for(a=e;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Wt(),e.sibling=null,f=Ct.current,f=u?f&1|2:f&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!a||Oe?bi(t,f):(a=f,qe(Tt,t),qe(Ct,a),Rt===null&&(Rt=t)),Oe&&cs(t,r.treeForkCount),e}return et(t),null;case 22:case 23:return ln(t),Ru(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),a=t.updateQueue,a!==null&&xo(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&nt(hl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ds(dt),et(t),null;case 25:return null;case 30:return t.flags|=33554432,et(t),null}throw Error(o(156,t.tag))}function $j(e,t){switch(xu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ds(dt),Bl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return jr(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(o(340));ol()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ol()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _u(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Bl(),null;case 10:return ds(t.type),null;case 22:case 23:return ln(t),Ru(),e!==null&&nt(hl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ds(dt),null;case 25:return null;default:return null}}function Og(e,t){switch(xu(t),t.tag){case 3:ds(dt),Bl();break;case 26:case 27:case 5:jr(t);break;case 4:Bl();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:_u(t);break;case 10:ds(t.type);break;case 22:case 23:ln(t),Ru(),e!==null&&nt(hl);break;case 24:ds(dt)}}function Si(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var u=r.next;a=u;do{if((a.tag&e)===e){r=void 0;var f=a.create,b=a.inst;r=f(),b.destroy=r}a=a.next}while(a!==u)}}catch(S){Xe(t,t.return,S)}}function Ls(e,t,a){try{var r=t.updateQueue,u=r!==null?r.lastEffect:null;if(u!==null){var f=u.next;r=f;do{if((r.tag&e)===e){var b=r.inst,S=b.destroy;if(S!==void 0){b.destroy=void 0,u=t;var z=a,I=S;try{I()}catch(V){Xe(u,z,V)}}}r=r.next}while(r!==f)}}catch(V){Xe(t,t.return,V)}}function _g(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{wp(t,a)}catch(r){Xe(e,e.return,r)}}}function Dg(e,t,a){a.props=xl(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Xe(e,t,r)}}function Xn(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var u=e.stateNode,f=is(e.memoizedProps,u);(u.ref===null||u.ref.name!==f)&&(u.ref=Iv(f)),r=u.ref;break;case 7:if(e.stateNode===null){var b=new un(e);x(e.child,!1,T1,b,void 0,void 0),e.stateNode=b}r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(S){Xe(e,t,S)}}function Et(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(u){Xe(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Xe(e,t,u)}else a.current=null}function bo(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var a=0;a<t.length;a++)Vv(e.stateNode,t[a])}function $g(e){for(var t=e.return;t!==null&&(dd(t)&&Vv(e.stateNode,t.stateNode),!ud(t));)t=t.return}function Ti(e){for(var t=e.return;t!==null&&(dd(t)&&C1(e.stateNode,t.stateNode),!ud(t));)t=t.return}function ud(e){return e.tag===5||e.tag===3||e.tag===27}function dd(e){return e&&e.tag===7&&e.stateNode!==null}function fd(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(u){Xe(e,e.return,u)}}function hd(e,t,a){try{var r=e.stateNode;o1(r,e.type,a,t),r[Kt]=t}catch(u){Xe(e,e.return,u)}}function Ug(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ks(e.type)||e.tag===4}function md(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ug(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ks(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function pd(e,t,a,r){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(u,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(u),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Yn)),bo(e,r),Ie=!0;else if(u!==4&&(u===27&&(bo(e,r),r=null,Ks(e.type)&&(a=e.stateNode,t=null)),e=e.child,e!==null))for(pd(e,t,a,r),e=e.sibling;e!==null;)pd(e,t,a,r),e=e.sibling}function yo(e,t,a,r){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?a.insertBefore(u,t):a.appendChild(u),bo(e,r),Ie=!0;else if(u!==4&&(u===27&&(bo(e,r),r=null,Ks(e.type)&&(a=e.stateNode)),e=e.child,e!==null))for(yo(e,t,a,r),e=e.sibling;e!==null;)yo(e,t,a,r),e=e.sibling}function Lg(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);At(t,r,a),t[Nt]=e,t[Kt]=a}catch(f){Xe(e,e.return,f)}}var ko=!1,an=null;function Hg(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(ko=!0)}var Zn=null;function Bg(){var e=Zn;return Zn=null,e}var Zt=0;function ua(e,t,a,r,u){return Zt=0,qg(e.child,t,a,r,u)}function qg(e,t,a,r,u){for(var f=!1;e!==null;){if(e.tag===5){var b=e.stateNode;if(r!==null){var S=Fd(b);r.push(S),S.view&&(f=!0)}else f||Fd(b).view&&(f=!0);ko=!0,Bv(b,Zt===0?t:t+"_"+Zt,a),Zt++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||qg(e.child,t,a,r,u)&&(f=!0));e=e.sibling}return f}function Vn(e,t){for(;e!==null;)e.tag===5?qv(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Vn(e.child,t)),e=e.sibling}function jo(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(jo(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 a=t.name;t=rs(t.default,t.share),t!=="none"&&(ua(e,a,t,null,!1)||Vn(e.child,!1))}e=e.sibling}}function gd(e,t){if(e.tag===30){var a=e.stateNode,r=e.memoizedProps,u=is(r,a),f=rs(r.default,a.paired?r.share:r.enter);f!=="none"?ua(e,u,f,null,!1)?(jo(e),a.paired||t||xa(e,r.onEnter)):Vn(e.child,!1):jo(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)gd(e,t),e=e.sibling;else jo(e)}function vd(e){if(an!==null&&an.size!==0){var t=an;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var a=e.memoizedProps,r=a.name;if(r!=null&&r!=="auto"){var u=t.get(r);if(u!==void 0){var f=rs(a.default,a.share);if(f!=="none"&&(ua(e,r,f,null,!1)?(f=e.stateNode,u.paired=f,f.paired=u,xa(e,a.onShare)):Vn(e.child,!1)),t.delete(r),t.size===0)break}}}vd(e)}e=e.sibling}}}function xd(e){if(e.tag===30){var t=e.memoizedProps,a=is(t,e.stateNode),r=an!==null?an.get(a):void 0,u=rs(t.default,r!==void 0?t.share:t.exit);u!=="none"&&(ua(e,a,u,null,!1)?r!==void 0?(u=e.stateNode,r.paired=u,u.paired=r,an.delete(a),xa(e,t.onShare)):xa(e,t.onExit):Vn(e.child,!1)),an!==null&&vd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)xd(e),e=e.sibling;else an!==null&&vd(e)}function Ig(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,a=is(t,e.stateNode);t=rs(t.default,t.update),e.flags&=-5,t!=="none"&&ua(e,a,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Ig(e);e=e.sibling}}function bd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Vn(e.child,!1))}bd(e)}e=e.sibling}}function wo(e){if(e.tag===30)e.stateNode.paired=null,Vn(e.child,!1),bd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)wo(e),e=e.sibling;else bd(e)}function Yg(e){for(e=e.child;e!==null;)e.tag===30?Vn(e.child,!1):(e.subtreeFlags&33554432)!==0&&Yg(e),e=e.sibling}function yd(e,t,a,r,u,f,b){for(var S=!1;t!==null;){if(t.tag===5){var z=t.stateNode;if(f!==null&&Zt<f.length){var I=f[Zt],V=Fd(z);(I.view||V.view)&&(S=!0);var W;if(W=(e.flags&4)===0)if(V.clip)W=!0;else{W=I.rect;var H=V.rect;W=W.y!==H.y||W.x!==H.x||W.height!==H.height||W.width!==H.width}W&&(e.flags|=4),V.abs?V=!I.abs:(I=I.rect,V=V.rect,V=I.height!==V.height||I.width!==V.width),V&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Bv(z,Zt===0?a:a+"_"+Zt,u),S&&(e.flags&4)!==0||(Zn===null&&(Zn=[]),Zn.push(z,Zt===0?r:r+"_"+Zt,t.memoizedProps)),Zt++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&b?e.flags|=t.flags&32:yd(e,t.child,a,r,u,f,b)&&(S=!0));t=t.sibling}return S}function Gg(e,t){for(e=e.child;e!==null;){if(e.tag===30){var a=e.memoizedProps,r=e.stateNode,u=is(a,r),f=rs(a.default,a.update),b;b=e.memoizedState,e.memoizedState=null,r=e;var S=e.child;Zt=0,u=yd(r,S,u,u,f,b,!1),(e.flags&4)!==0&&u&&xa(e,a.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Gg(e);e=e.sibling}}var kt=!1,Ge=!1,Qn=!1,kd=!1,Kg=typeof WeakSet=="function"?WeakSet:Set,jt=null,Jn=!1,Ci=!1,No=!1,jd=!1;function Uj(e,t,a){if(e=e.containerInfo,Zd=Ea,e=Qm(e),ou(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var u=r.getSelection&&r.getSelection();if(u&&u.rangeCount!==0){r=u.anchorNode;var f=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{r.nodeType,b.nodeType}catch{r=null;break e}var S=0,z=-1,I=-1,V=0,W=0,H=e,Z=null;t:for(;;){for(var de;H!==r||f!==0&&H.nodeType!==3||(z=S+f),H!==b||u!==0&&H.nodeType!==3||(I=S+u),H.nodeType===3&&(S+=H.nodeValue.length),(de=H.firstChild)!==null;)Z=H,H=de;for(;;){if(H===e)break t;if(Z===r&&++V===f&&(z=S),Z===b&&++W===u&&(I=S),(de=H.nextSibling)!==null)break;H=Z,Z=H.parentNode}H=de}r=z===-1||I===-1?null:{start:z,end:I}}else r=null}r=r||{start:0,end:0}}else r=null;for(Vd={focusedElem:e,selectionRange:r},Ea=!1,a=(a&335544064)===a,jt=t,t=a?9270:1024;jt!==null;){if(e=jt,a&&(r=e.deletions,r!==null))for(f=0;f<r.length;f++)a&&xd(r[f]);if(e.alternate===null&&(e.flags&2)!==0)a&&Hg(e),So(a);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&a&&xd(r),So(a);continue}else if(r!==null&&r.memoizedState!==null){a&&Hg(e),So(a);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,jt=r):(a&&Ig(e),So(a))}}an=null}function So(e){for(;jt!==null;){var t=jt,a=e,r=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&r!==null){a=void 0,u=r.memoizedProps,r=r.memoizedState;var f=t.stateNode;try{var b=xl(t.type,u);a=f.getSnapshotBeforeUpdate(b,r),f.__reactInternalSnapshotBeforeUpdate=a}catch(S){Xe(t,t.return,S)}}break;case 3:if((u&1024)!==0){if(r=t.stateNode.containerInfo,a=r.nodeType,a===9)tf(r);else if(a===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":tf(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&r!==null&&(a=is(r.memoizedProps,r.stateNode),u=t.memoizedProps,u=rs(u.default,u.update),u!=="none"&&ua(r,a,u,r.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,jt=r;break}jt=t.return}}function Xg(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Pn(e,a),r&4&&Si(5,a);break;case 1:if(Pn(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(b){Xe(a,a.return,b)}else{var u=xl(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Xe(a,a.return,b)}}r&64&&_g(a),r&512&&Xn(a,a.return);break;case 3:if(Pn(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{wp(e,t)}catch(b){Xe(a,a.return,b)}}break;case 27:t===null&&r&4&&Lg(a);case 26:case 5:Pn(e,a),t===null&&r&4&&fd(a),r&512&&Xn(a,a.return);break;case 12:Pn(e,a);break;case 31:Pn(e,a),r&4&&Jg(e,a);break;case 13:Pn(e,a),r&4&&Pg(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Qj.bind(null,a),M1(e,a))));break;case 22:if(r=a.memoizedState!==null||kt,!r){var f=t!==null&&t.memoizedState!==null||Ge;t=kt,u=Ge,kt=r,(Ge=f)&&!u?(r=2,(a.subtreeFlags&8772)!==0&&(r|=1),On(e,a,r)):Pn(e,a),kt=t,Ge=u}break;case 30:Pn(e,a),r&512&&Xn(a,a.return);break;case 7:r&512&&Xn(a,a.return);default:Pn(e,a)}}function wd(e,t){for(e=e.child;e!==null;)Zg(e,t),e=e.sibling}function Zg(e,t){switch(e.tag){case 5:case 26:try{var a=e.stateNode;if(t){var r=a.style;typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none"}else{var u=e.stateNode,f=e.memoizedProps.style,b=f!=null&&f.hasOwnProperty("display")?f.display:null;u.style.display=b==null||typeof b=="boolean"?"":(""+b).trim()}}catch(z){Xe(e,e.return,z)}Nd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Ie=!0}catch(z){Xe(e,e.return,z)}break;case 18:try{var S=e.stateNode;t?Hv(S,!0):Hv(e.stateNode,!1)}catch(z){Xe(e,e.return,z)}break;case 22:case 23:e.memoizedState===null&&wd(e,t);break;default:wd(e,t)}}function Nd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var a=e,r=t;switch(a.tag){case 4:Zg(a,r);break e;case 22:a.memoizedState===null&&Nd(a,r);break e;default:Nd(a,r)}}e=e.sibling}}function Vg(e){var t=e.alternate;t!==null&&(e.alternate=null,Vg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ar(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Vt=!1;function zn(e,t,a){for(a=a.child;a!==null;)Qg(e,t,a),a=a.sibling}function Qg(e,t,a){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(Ja,a)}catch{}switch(a.tag){case 26:Ge||Et(a,t),zn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Ge&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ge||Et(a,t),Ti(a);var r=st,u=Vt;Ks(a.type)&&(st=a.stateNode,Vt=!1),zn(e,t,a),Wv(a.stateNode,a.type,a.memoizedProps),st=r,Vt=u;break;case 5:Ge||Et(a,t),Ti(a);case 6:if(a.tag===6&&Ti(a),r=st,u=Vt,st=null,zn(e,t,a),st=r,Vt=u,st!==null)if(Vt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(a.stateNode),Ie=!0}catch(f){Xe(a,t,f)}else try{st.removeChild(a.stateNode),Ie=!0}catch(f){Xe(a,t,f)}break;case 18:st!==null&&(Vt?(e=st,Lv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Aa(e)):Lv(st,a.stateNode));break;case 4:r=st,u=Vt,st=a.stateNode.containerInfo,Vt=!0,zn(e,t,a),st=r,Vt=u;break;case 0:case 11:case 14:case 15:Ls(2,a,t),Ge||Ls(4,a,t),zn(e,t,a);break;case 1:Ge||(Et(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Dg(a,t,r)),zn(e,t,a);break;case 21:zn(e,t,a);break;case 22:Ge=(r=Ge)||a.memoizedState!==null,zn(e,t,a),Ge=r;break;case 30:Et(a,t),zn(e,t,a);break;case 7:Ge||Et(a,t),zn(e,t,a);break;default:zn(e,t,a)}}function Jg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Aa(e)}catch(a){Xe(t,t.return,a)}}}function Pg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Aa(e)}catch(a){Xe(t,t.return,a)}}function Lj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Kg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Kg),t;default:throw Error(o(435,e.tag))}}function To(e,t){var a=Lj(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var u=Jj.bind(null,e,r);r.then(u,u)}})}function qt(e,t,a){var r=t.deletions;if(r!==null)for(var u=0;u<r.length;u++){var f=r[u],b=e,S=t,z=S;e:for(;z!==null;){switch(z.tag){case 27:if(Ks(z.type)){st=z.stateNode,Vt=!1;break e}break;case 5:st=z.stateNode,Vt=!1;break e;case 3:case 4:st=z.stateNode.containerInfo,Vt=!0;break e}z=z.return}if(st===null)throw Error(o(160));Qg(b,S,f),st=null,Vt=!1,b=f.alternate,b!==null&&(b.return=null),f.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fg(t,e,a),t=t.sibling}var Rn=null;function Fg(e,t,a){var r=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(r=e.updateQueue,r=r!==null?r.events:null,r!==null))for(var f=0;f<r.length;f++){var b=r[f];b.ref.impl=b.nextImpl}qt(t,e,a),It(e),u&4&&(Ls(3,e,e.return),Si(3,e),Ls(5,e,e.return));break;case 1:qt(t,e,a),It(e),u&512&&(Ge||r===null||Et(r,r.return)),u&64&&kt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?t:a.concat(t))));break;case 26:if(f=Rn,qt(t,e,a),It(e),u&512&&(Ge||r===null||Et(r,r.return)),u&4)if(u=r!==null?r.memoizedState:null,a=e.memoizedState,r===null)if(a===null)if(e.stateNode===null)if(kt)e.stateNode=Dv(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,a=e.memoizedProps,u=f.ownerDocument||f;t:switch(t){case"title":r=u.getElementsByTagName("title")[0],(!r||r[Wa]||r[Nt]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=u.createElement(t),u.head.insertBefore(r,u.querySelector("head > title"))),At(r,t,a),r[Nt]=e,bt(r),t=r;break e;case"link":if(f=ax("link","href",u).get(t+(a.href||""))){for(b=0;b<f.length;b++)if(r=f[b],r.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&r.getAttribute("rel")===(a.rel==null?null:a.rel)&&r.getAttribute("title")===(a.title==null?null:a.title)&&r.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(b,1);break t}}r=u.createElement(t),At(r,t,a),u.head.appendChild(r);break;case"meta":if(f=ax("meta","content",u).get(t+(a.content||""))){for(b=0;b<f.length;b++)if(r=f[b],r.getAttribute("content")===(a.content==null?null:""+a.content)&&r.getAttribute("name")===(a.name==null?null:a.name)&&r.getAttribute("property")===(a.property==null?null:a.property)&&r.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&r.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(b,1);break t}}r=u.createElement(t),At(r,t,a),u.head.appendChild(r);break;default:throw Error(o(468,t))}r[Nt]=e,bt(r),t=r}e.stateNode=t}else kt||cf(f,e.type,e.stateNode);else e.stateNode=lx(f,a,e.memoizedProps);else u!==a?(u===null?(t=r.stateNode,t===null||Ge||t.parentNode.removeChild(t)):u.count--,a===null?kt||cf(f,e.type,e.stateNode):lx(f,a,e.memoizedProps)):a===null&&e.stateNode!==null&&hd(e,e.memoizedProps,r.memoizedProps);break;case 27:qt(t,e,a),It(e),u&512&&(Ge||r===null||Et(r,r.return)),r!==null&&u&4&&hd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(f=Qn,Qn=!1,qt(t,e,a),Qn=f,It(e),u&512&&(Ge||r===null||Et(r,r.return)),e.flags&32){t=e.stateNode;try{Xl(t,""),Ie=!0}catch(V){Xe(e,e.return,V)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,hd(e,t,r!==null?r.memoizedProps:t)),u&1024&&(kd=!0);break;case 6:if(qt(t,e,a),It(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,a=e.stateNode;try{a.nodeValue=t,Ie=!0}catch(V){Xe(e,e.return,V)}}break;case 3:if(Ie=!1,qo=null,f=Rn,Rn=$i(t.containerInfo),qt(t,e,a),Rn=f,It(e),u&4&&r!==null&&r.memoizedState.isDehydrated)try{Aa(t.containerInfo)}catch(V){Xe(e,e.return,V)}kd&&(kd=!1,Wg(e)),Ie=!1;break;case 4:u=Qn,Qn=kt,r=bm(),f=Rn,Rn=$i(e.stateNode.containerInfo),qt(t,e,a),It(e),Rn=f,Ie&&Ci&&(No=!0),Ie=r,Qn=u;break;case 12:qt(t,e,a),It(e);break;case 31:qt(t,e,a),It(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,To(e,t)));break;case 13:qt(t,e,a),It(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Ao=Wt()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,To(e,t)));break;case 22:f=e.memoizedState!==null,b=r!==null&&r.memoizedState!==null;var S=kt,z=Ge,I=Qn;kt=S||f,Qn=I||f,Ge=z||b,qt(t,e,a),Ge=z,Qn=I,kt=S,It(e),u&8192&&(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,!f||r===null||b||kt||Ge||(t=b||Ge,a=kt,r=Ge,kt=f||kt,Ge=t,Hs(e,2),kt=a,Ge=r),!f&&Qn||wd(e,f)),u&4&&(t=e.updateQueue,t!==null&&(a=t.retryQueue,a!==null&&(t.retryQueue=null,To(e,a))));break;case 19:qt(t,e,a),It(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,To(e,t)));break;case 30:u&512&&(Ge||r===null||Et(r,r.return)),u=bm(),f=Ci,b=(a&335544064)===a,S=e.memoizedProps,Ci=b&&rs(S.default,S.update)!=="none",qt(t,e,a),It(e),b&&r!==null&&Ie&&(e.flags|=4),Ci=f,Ie=u;break;case 21:break;case 7:u&512&&(Ge||r===null||Et(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:qt(t,e,a),It(e)}}function It(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(Ug(r)){a=r;break}r=r.return}r=null;for(var u=e.return;u!==null;){if(dd(u)){var f=u.stateNode;r===null?r=[f]:r.push(f)}if(ud(u))break;u=u.return}var b=r;if(a==null)throw Error(o(160));switch(a.tag){case 27:var S=a.stateNode,z=md(e);yo(e,z,S,b);break;case 5:var I=a.stateNode;a.flags&32&&(Xl(I,""),a.flags&=-33);var V=md(e);yo(e,V,I,b);break;case 3:case 4:var W=a.stateNode.containerInfo,H=md(e);pd(e,H,W,b);break;default:throw Error(o(161))}}catch(Z){Xe(e,e.return,Z)}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,Ea=!0,t.reset(),Ea=!1),e=e.sibling}}function da(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)ev(t,e),t=t.sibling;else Gg(t)}function ev(e,t){var a=e.alternate;if(a===null)gd(e,!1);else switch(e.tag){case 3:if(jd=Jn=!1,Bg(),da(t,e),!Jn&&!No){if(e=Zn,e!==null)for(var r=0;r<e.length;r+=3){a=e[r];var u=e[r+1];qv(a,e[r+2]),a=a.ownerDocument.documentElement,a!==null&&a.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"})),jd=!0}Zn=null;break;case 5:da(t,e);break;case 4:r=Jn,Jn=!1,da(t,e),Jn&&(No=!0),Jn=r;break;case 22:e.memoizedState===null&&(a.memoizedState!==null?gd(e,!1):da(t,e));break;case 30:r=Jn,u=Bg(),Jn=!1,da(t,e),Jn&&(e.flags|=4);var f=e.memoizedProps,b=e.stateNode;t=is(f,b),b=is(a.memoizedProps,b);var S=rs(f.default,f.update);S==="none"?t=!1:(f=a.memoizedState,a.memoizedState=null,a=e.child,Zt=0,t=yd(e,a,t,b,S,f,!0),Zt!==(f===null?0:f.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(xa(e,e.memoizedProps.onUpdate),Zn=u):u!==null&&(u.push.apply(u,Zn),Zn=u),Jn=(e.flags&32)!==0?!0:r;break;default:da(t,e)}}function Pn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Xg(e,t.alternate,t),t=t.sibling}function Hs(e,t){for(e=e.child;e!==null;){var a=e,r=t;switch(a.tag){case 0:case 11:case 14:case 15:Ls(4,a,a.return),Hs(a,r);break;case 1:Et(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Dg(a,a.return,u),Hs(a,r);break;case 27:(r&2)!==0&&Wv(a.stateNode,a.type,a.memoizedProps);case 5:Et(a,a.return),a.tag!==5&&a.tag!==27||Ti(a),Hs(a,r);break;case 6:Ti(a);break;case 26:Et(a,a.return),u=a.stateNode,a.memoizedState!==null||u===null||Ge||u.parentNode.removeChild(u),Hs(a,r);break;case 22:a.memoizedState===null&&Hs(a,r);break;case 30:Et(a,a.return),Hs(a,r);break;case 7:Et(a,a.return);default:Hs(a,r)}e=e.sibling}}function On(e,t,a){for(a=(t.subtreeFlags&8772)!==0?a:a&-2,t=t.child;t!==null;){var r=t.alternate,u=e,f=t,b=f.flags,S=(a&1)!==0;switch(f.tag){case 0:case 11:case 15:On(u,f,a),Si(4,f);break;case 1:if(On(u,f,a),r=f,u=r.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(V){Xe(r,r.return,V)}if(r=f,u=r.updateQueue,u!==null){var z=r.stateNode;try{var I=u.shared.hiddenCallbacks;if(I!==null)for(u.shared.hiddenCallbacks=null,u=0;u<I.length;u++)jp(I[u],z)}catch(V){Xe(r,r.return,V)}}S&&b&64&&_g(f),Xn(f,f.return);break;case 27:(a&2)!==0&&Lg(f);case 5:f.tag!==5&&f.tag!==27||$g(f),On(u,f,a),S&&r===null&&b&4&&fd(f),Xn(f,f.return);break;case 6:$g(f);break;case 26:z=f.stateNode,f.memoizedState!==null||z===null||kt||cf($i(z.ownerDocument),f.type,z),On(u,f,a),S&&r===null&&b&4&&fd(f),Xn(f,f.return);break;case 12:On(u,f,a);break;case 31:On(u,f,a),S&&b&4&&Jg(u,f);break;case 13:On(u,f,a),S&&b&4&&Pg(u,f);break;case 22:f.memoizedState===null&&On(u,f,a),Xn(f,f.return);break;case 30:On(u,f,a),Xn(f,f.return);break;case 7:Xn(f,f.return);default:On(u,f,a)}t=t.sibling}}function Sd(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&fi(a))}function Td(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fi(e))}function yn(e,t,a,r){var u=(a&335544064)===a;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)tv(e,t,a,r),t=t.sibling;else u&&Yg(t)}function tv(e,t,a,r){var u=(a&335544064)===a;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&wo(t);var f=t.flags;switch(t.tag){case 0:case 11:case 15:yn(e,t,a,r),f&2048&&Si(9,t);break;case 1:yn(e,t,a,r);break;case 3:yn(e,t,a,r),u&&jd&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),f&2048&&(f=null,t.alternate!==null&&(f=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==f&&(t.refCount++,f!=null&&fi(f)));break;case 12:if(f&2048){yn(e,t,a,r),f=t.stateNode;try{var b=t.memoizedProps,S=b.id,z=b.onPostCommit;typeof z=="function"&&z(S,t.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(I){Xe(t,t.return,I)}}else yn(e,t,a,r);break;case 31:yn(e,t,a,r);break;case 13:yn(e,t,a,r);break;case 23:break;case 22:b=t.stateNode,S=t.alternate,t.memoizedState!==null?(u&&S!==null&&S.memoizedState===null&&wo(S),b._visibility&2?yn(e,t,a,r):Ei(e,t)):(u&&S!==null&&S.memoizedState!==null&&wo(t),b._visibility&2?yn(e,t,a,r):(b._visibility|=2,fa(e,t,a,r,(t.subtreeFlags&10256)!==0||!1))),f&2048&&Sd(S,t);break;case 24:yn(e,t,a,r),f&2048&&Td(t.alternate,t);break;case 30:u&&(f=t.alternate,f!==null&&(Vn(f.child,!0),Vn(t.child,!0))),yn(e,t,a,r);break;default:yn(e,t,a,r)}}function fa(e,t,a,r,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,b=t,S=a,z=r,I=b.flags;switch(b.tag){case 0:case 11:case 15:fa(f,b,S,z,u),Si(8,b);break;case 23:break;case 22:var V=b.stateNode;b.memoizedState!==null?V._visibility&2?fa(f,b,S,z,u):Ei(f,b):(V._visibility|=2,fa(f,b,S,z,u)),u&&I&2048&&Sd(b.alternate,b);break;case 24:fa(f,b,S,z,u),u&&I&2048&&Td(b.alternate,b);break;default:fa(f,b,S,z,u)}t=t.sibling}}function Ei(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,u=r.flags;switch(r.tag){case 22:Ei(a,r),u&2048&&Sd(r.alternate,r);break;case 24:Ei(a,r),u&2048&&Td(r.alternate,r);break;default:Ei(a,r)}t=t.sibling}}var bl=8192;function yl(e,t,a){if(e.subtreeFlags&bl)for(e=e.child;e!==null;)nv(e,t,a),e=e.sibling}function nv(e,t,a){switch(e.tag){case 26:yl(e,t,a),e.flags&bl&&(e.memoizedState!==null?G1(a,Rn,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&cx(a,e)));break;case 5:yl(e,t,a),e.flags&bl&&(e=e.stateNode,(t&335544128)===t&&cx(a,e));break;case 3:case 4:var r=Rn;Rn=$i(e.stateNode.containerInfo),yl(e,t,a),Rn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=bl,bl=16777216,yl(e,t,a),bl=r):yl(e,t,a));break;case 30:if((e.flags&bl)!==0&&(r=e.memoizedProps.name,r!=null&&r!=="auto")){var u=e.stateNode;u.paired=null,an===null&&(an=new Map),an.set(r,u)}yl(e,t,a);break;default:yl(e,t,a)}}function sv(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 Ai(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];jt=r,av(r,e)}sv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lv(e),e=e.sibling}function lv(e){switch(e.tag){case 0:case 11:case 15:Ai(e),e.flags&2048&&Ls(9,e,e.return);break;case 3:Ai(e);break;case 12:Ai(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Co(e)):Ai(e);break;default:Ai(e)}}function Co(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];jt=r,av(r,e)}sv(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ls(8,t,t.return),Co(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Co(t));break;default:Co(t)}e=e.sibling}}function av(e,t){for(;jt!==null;){var a=jt;switch(a.tag){case 0:case 11:case 15:Ls(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:fi(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,jt=r;else e:for(a=e;jt!==null;){r=jt;var u=r.sibling,f=r.return;if(Vg(r),r===a){jt=null;break e}if(u!==null){u.return=f,jt=u;break e}jt=f}}}var Hj={getCacheForType:function(e){var t=St(dt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return St(dt).controller.signal}},Bj=typeof WeakMap=="function"?WeakMap:Map,Ye=0,Pe=null,_e=null,Le=0,Ke=0,rn=null,Bs=!1,ha=!1,Cd=!1,gs=0,rt=0,qs=0,kl=0,Eo=0,on=0,ma=0,Mi=null,Qt=null,Ed=!1,Ao=0,iv=0,Mo=1/0,zo=null,Is=null,lt=0,_n=null,jl=null,Fn=0,Ad=0,Md=null,rv=null,pa=null,ga=null,va=null,zi=0,Ro=null;function cn(){return(Ye&2)!==0&&Le!==0?Le&-Le:fe.T!==null?Bd():um()}function ov(){if(on===0)if((Le&536870912)===0||Oe){var e=Sr;Sr<<=1,(Sr&3932160)===0&&(Sr=262144),on=e}else on=536870912;return e=Tt.current,e!==null&&(e.flags|=32),on}function xa(e,t){if(t!=null){var a=e.stateNode,r=a.ref;r===null&&(r=a.ref=Iv(is(e.memoizedProps,a))),ga===null&&(ga=[]),ga.push(t.bind(null,r))}}function Jt(e,t,a){(e===Pe&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(ba(e,0),Ys(e,Le,on,!1)),Fa(e,a),((Ye&2)===0||e!==Pe)&&(e===Pe&&((Ye&2)===0&&(kl|=a),rt===4&&Ys(e,Le,on,!1)),Wn(e))}function cv(e,t,a){if((Ye&6)!==0)throw Error(o(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Pa(e,t),u=r?Yj(e,t):Rd(e,t,!0),f=r;do{if(u===0){ha&&!r&&Ys(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!qj(a)){u=Rd(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var S=e;u=Mi;var z=S.current.memoizedState.isDehydrated;if(z&&(ba(S,b).flags|=256),b=Rd(S,b,!1),b!==2&&b!==6){if(Cd&&!z){S.errorRecoveryDisabledLanes|=f,kl|=f,u=4;break e}f=Qt,Qt=u,f!==null&&(Qt===null?Qt=f:Qt.push.apply(Qt,f))}u=b}if(f=!1,u!==2)continue}}if(u===1){ba(e,0),Ys(e,t,0,!0);break}e:{switch(r=e,f=u,f){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Ys(r,t,on,!Bs);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Ao+300-Wt(),10<u)){if(Ys(r,t,on,!Bs),Cr(r,0,!0)!==0)break e;Fn=t,r.timeoutHandle=Pd(uv.bind(null,r,a,Qt,zo,Ed,t,on,kl,ma,Bs,f,"Throttled",-0,0),u);break e}uv(r,a,Qt,zo,Ed,t,on,kl,ma,Bs,f,null,-0,0)}}break}while(!0);Wn(e)}function uv(e,t,a,r,u,f,b,S,z,I,V,W,H,Z){e.timeoutHandle=-1;var de=t.subtreeFlags,be=(f&335544064)===f;if(W=null,(be||de&8192||(de&16785408)===16785408)&&(W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yn},an=null,nv(t,f,W),be&&(de=W,be=e.containerInfo,be=(be.nodeType===9?be:be.ownerDocument).__reactViewTransition,be!=null&&(de.count++,de.waitingForViewTransition=!0,de=Hi.bind(de),be.finished.then(de,de))),de=(f&62914560)===f?Ao-Wt():(f&4194048)===f?iv-Wt():0,de=K1(W,de),de!==null)){Fn=f,e.cancelPendingCommit=de(xv.bind(null,e,t,f,a,r,u,b,S,z,I,V,W,null,H,Z)),Ys(e,f,b,!I);return}xv(e,t,f,a,r,u,b,S,z,I,V,W)}function qj(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var u=a[r],f=u.getSnapshot;u=u.value;try{if(!sn(f(),u))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Ys(e,t,a,r){t=am(e,t),t&=~Eo,t&=~kl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var u=t;0<u;){var f=31-tn(u),b=1<<f;r[f]=-1,u&=~b}a!==0&&rm(e,a,t)}function Oo(){return(Ye&6)===0?(Ri(0),!1):!0}function zd(){if(_e!==null){if(Ke===0)var e=_e.return;else e=_e,us=cl=null,Hu(e),aa=null,pi=0,e=_e;for(;e!==null;)Og(e.alternate,e),e=e.return;_e=null}}function ba(e,t){var a=e.timeoutHandle;return a!==-1&&(e.timeoutHandle=-1,d1(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Fn=0,zd(),Pe=e,_e=a=os(e.current,null),Le=t,Ke=0,rn=null,Bs=!1,ha=Pa(e,t),Cd=!1,ma=on=Eo=kl=qs=rt=0,Qt=Mi=null,Ed=!1,gs=am(e,t),Br(),a}function dv(e,t){Ae=null,fe.H=fo,t===la||t===Pr?(t=xp(),Ke=3):t===Tu?(t=xp(),Ke=4):Ke=t===ed?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,_e===null&&(rt=1,ho(e,gn(t,e.current)))}function fv(){var e=Tt.current;return e===null?!0:(Le&4194048)===Le?Rt===null:(Le&62914560)===Le||(Le&536870912)!==0?e===Rt:!1}function hv(){var e=fe.H;return fe.H=fo,e===null?fo:e}function mv(){var e=fe.A;return fe.A=Hj,e}function _o(){rt=4,Bs||(Le&4194048)!==Le&&Tt.current!==null||(ha=!0),(qs&134217727)===0&&(kl&134217727)===0||Pe===null||Ys(Pe,Le,on,!1)}function Rd(e,t,a){var r=Ye;Ye|=2;var u=hv(),f=mv();(Pe!==e||Le!==t)&&(zo=null,ba(e,t)),t=!1;var b=rt;e:do try{if(Ke!==0&&_e!==null){var S=_e,z=rn;switch(Ke){case 8:zd(),b=6;break e;case 3:case 2:case 9:case 6:Tt.current===null&&(t=!0);var I=Ke;if(Ke=0,rn=null,ya(e,S,z,I),a&&ha){b=0;break e}break;default:I=Ke,Ke=0,rn=null,ya(e,S,z,I)}}Ij(),b=rt;break}catch(V){dv(e,V)}while(!0);return t&&e.shellSuspendCounter++,us=cl=null,Ye=r,fe.H=u,fe.A=f,_e===null&&(Pe=null,Le=0,Br()),b}function Ij(){for(;_e!==null;)pv(_e)}function Yj(e,t){var a=Ye;Ye|=2;var r=hv(),u=mv();Pe!==e||Le!==t?(zo=null,Mo=Wt()+500,ba(e,t)):ha=Pa(e,t);e:do try{if(Ke!==0&&_e!==null){t=_e;var f=rn;t:switch(Ke){case 1:Ke=0,rn=null,ya(e,t,f,1);break;case 2:case 9:if(gp(f)){Ke=0,rn=null,gv(t);break}t=function(){Ke!==2&&Ke!==9||Pe!==e||(Ke=7),Wn(e)},f.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:gp(f)?(Ke=0,rn=null,gv(t)):(Ke=0,rn=null,ya(e,t,f,7));break;case 5:var b=null;switch(_e.tag){case 26:b=_e.memoizedState;case 5:case 27:var S=_e;if(b?rx(b):S.stateNode.complete){Ke=0,rn=null;var z=S.sibling;if(z!==null)_e=z;else{var I=S.return;I!==null?(_e=I,Do(I)):_e=null}break t}}Ke=0,rn=null,ya(e,t,f,5);break;case 6:Ke=0,rn=null,ya(e,t,f,6);break;case 8:zd(),rt=6;break e;default:throw Error(o(462))}}Gj();break}catch(V){dv(e,V)}while(!0);return us=cl=null,fe.H=r,fe.A=u,Ye=a,_e!==null?0:(Pe=null,Le=0,Br(),rt)}function Gj(){for(;_e!==null&&!rk();)pv(_e)}function pv(e){var t=zg(e.alternate,e,gs);e.memoizedProps=e.pendingProps,t===null?Do(e):_e=t}function gv(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Ng(a,t,t.pendingProps,t.type,void 0,Le);break;case 11:t=Ng(a,t,t.pendingProps,t.type.render,t.ref,Le);break;case 5:Hu(t);var r=t;r===yt&&(Oe?(Xr(r),r.tag===5&&r.stateNode!=null&&(We=r.stateNode)):(Xr(r),Oe=!0));default:Og(a,t),t=_e=ap(t,gs),t=zg(a,t,gs)}e.memoizedProps=e.pendingProps,t===null?Do(e):_e=t}function ya(e,t,a,r){us=cl=null,Hu(t),aa=null,pi=0;var u=t.return;try{if(zj(e,u,t,a,Le)){rt=1,ho(e,gn(a,e.current)),_e=null;return}}catch(f){if(u!==null)throw _e=u,f;rt=1,ho(e,gn(a,e.current)),_e=null;return}t.flags&32768?(Oe||r===1?e=!0:ha||(Le&536870912)!==0?e=!1:(Bs=e=!0,(r===2||r===9||r===3||r===6)&&(r=Tt.current,r!==null&&r.tag===13&&(r.flags|=16384))),vv(t,e)):Do(t)}function Do(e){var t=e;do{if((t.flags&32768)!==0){vv(t,Bs);return}e=t.return;var a=Dj(t.alternate,t,gs);if(a!==null){_e=a;return}if(t=t.sibling,t!==null){_e=t;return}_e=t=e}while(t!==null);rt===0&&(rt=5)}function vv(e,t){do{var a=$j(e.alternate,e);if(a!==null){a.flags&=32767,_e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){_e=e;return}_e=e=a}while(e!==null);rt=6,_e=null}function xv(e,t,a,r,u,f,b,S,z,I,V,W){e.cancelPendingCommit=null;do $o();while(lt!==0);if((Ye&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Pe&&(_e=Pe=null,Le=0),jl=t,_n=e,Fn=a,Md=u,rv=r,Kj(e,t,a,b,S,z,W)}}function Kj(e,t,a,r,u,f,b){var S=t.lanes|t.childLanes;if(Ad=S,S|=hu,vk(e,a,S,r,u,f),ga=null,(a&335544064)===a?(va=bj(e),r=10262):(va=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Pj(wr,function(){return $d(),null})):(e.callbackNode=null,e.callbackPriority=0),ko=!1,r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=fe.T,fe.T=null,u=ve.p,ve.p=2,f=Ye,Ye|=4;try{Uj(e,t,a)}finally{Ye=f,ve.p=u,fe.T=r}}lt=1,ko?pa=v1(b,e.containerInfo,va,Od,_d,Zj,Dd,$d,Xj):(Od(),_d(),Dd())}function Xj(e){if(lt!==0){var t=_n.onRecoverableError;t(e,{componentStack:null})}}function Zj(){lt===3&&(lt=0,ev(jl,_n),lt=4)}function Od(){if(lt===1){lt=0;var e=_n,t=jl,a=Fn,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=fe.T,fe.T=null;var u=ve.p;ve.p=2;var f=Ye;Ye|=4;try{Ci=No=!1,Fg(t,e,a),a=Vd;var b=Qm(e.containerInfo),S=a.focusedElem,z=a.selectionRange;if(b!==S&&S&&S.ownerDocument&&Vm(S.ownerDocument.documentElement,S)){if(z!==null&&ou(S)){var I=z.start,V=z.end;if(V===void 0&&(V=I),"selectionStart"in S)S.selectionStart=I,S.selectionEnd=Math.min(V,S.value.length);else{var W=S.ownerDocument||document,H=W&&W.defaultView||window;if(H.getSelection){var Z=H.getSelection(),de=S.textContent.length,be=Math.min(z.start,de),Me=z.end===void 0?be:Math.min(z.end,de);!Z.extend&&be>Me&&(b=Me,Me=be,be=b);var q=Zm(S,be),D=Zm(S,Me);if(q&&D&&(Z.rangeCount!==1||Z.anchorNode!==q.node||Z.anchorOffset!==q.offset||Z.focusNode!==D.node||Z.focusOffset!==D.offset)){var G=W.createRange();G.setStart(q.node,q.offset),Z.removeAllRanges(),be>Me?(Z.addRange(G),Z.extend(D.node,D.offset)):(G.setEnd(D.node,D.offset),Z.addRange(G))}}}}for(W=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&W.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<W.length;S++){var F=W[S];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}Ea=!!Zd,Vd=Zd=null}finally{Ye=f,ve.p=u,fe.T=r}}e.current=t,lt=2}}function _d(){if(lt===2){lt=0;var e=_n,t=jl,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=fe.T,fe.T=null;var r=ve.p;ve.p=2;var u=Ye;Ye|=4;try{Xg(e,t.alternate,t)}finally{Ye=u,ve.p=r,fe.T=a}}lt=3}}function Dd(){if(lt===4||lt===3){lt=0;var e=pa;pa=null,ok();var t=_n,a=jl,r=Fn,u=rv,f=(r&335544064)===r?10262:10256;if((a.subtreeFlags&f)!==0||(a.flags&f)!==0?lt=5:(lt=0,jl=_n=null,bv(t,t.pendingLanes)),f=t.pendingLanes,f===0&&(Is=null),Gc(r),a=a.stateNode,en&&typeof en.onCommitFiberRoot=="function")try{en.onCommitFiberRoot(Ja,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=fe.T,f=ve.p,ve.p=2,fe.T=null;try{for(var b=t.onRecoverableError,S=0;S<u.length;S++){var z=u[S];b(z.value,{componentStack:z.stack})}}finally{fe.T=a,ve.p=f}}if(u=ga,b=va,va=null,u!==null&&(ga=null,b===null&&(b=[]),e!==null))for(z=0;z<u.length;z++)a=(0,u[z])(b),a!==void 0&&e.finished.finally(a);(Fn&3)!==0&&$o(),Wn(t),f=t.pendingLanes,(r&261930)!==0&&(f&42)!==0?t===Ro?zi++:(zi=0,Ro=t):(zi=0,Ro=null),Ri(0)}}function bv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fi(t)))}function $o(){return pa!==null&&(pa.skipTransition(),pa=null),Od(),_d(),Dd(),$d()}function $d(){if(lt!==5)return!1;var e=_n,t=Ad;Ad=0;var a=Gc(Fn),r=fe.T,u=ve.p;try{ve.p=32>a?32:a,fe.T=null,a=Md,Md=null;var f=_n,b=Fn;if(lt=0,jl=_n=null,Fn=0,(Ye&6)!==0)throw Error(o(331));var S=Ye;if(Ye|=4,lv(f.current),tv(f,f.current,b,a),Ye=S,Ri(0,!1),en&&typeof en.onPostCommitFiberRoot=="function")try{en.onPostCommitFiberRoot(Ja,f)}catch{}return!0}finally{ve.p=u,fe.T=r,bv(e,t)}}function yv(e,t,a){t=gn(a,t),t=Wu(e.stateNode,t,2),e=_s(e,t,2),e!==null&&(Fa(e,2),Wn(e))}function Xe(e,t,a){if(e.tag===3)yv(e,e,a);else for(;t!==null;){if(t.tag===3){yv(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Is===null||!Is.has(r))){e=gn(a,e),a=gg(2),r=_s(t,a,2),r!==null&&(vg(a,r,t,e),Fa(r,2),Wn(r));break}}t=t.return}}function Ud(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Bj;var u=new Set;r.set(t,u)}else u=r.get(t),u===void 0&&(u=new Set,r.set(t,u));u.has(a)||(Cd=!0,u.add(a),e=Vj.bind(null,e,t,a),t.then(e,e))}function Vj(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Pe===e&&(Le&a)===a&&((rt===4||rt===3&&(Le&62914560)===Le&&300>Wt()-Ao)&&(Ye&2)===0?ba(e,0):Eo|=a,ma===Le&&(ma=0)),Wn(e)}function kv(e,t){t===0&&(t=im()),e=il(e,t),e!==null&&(Fa(e,t),Wn(e))}function Qj(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),kv(e,a)}function Jj(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),kv(e,a)}function Pj(e,t){return Bc(e,t)}var ka=null,ja=null,Ld=!1,Uo=!1,Hd=!1,Gs=0;function Wn(e){e!==ja&&e.next===null&&(ja===null?ka=ja=e:ja=ja.next=e),Uo=!0,Ld||(Ld=!0,Wj())}function Ri(e,t){if(!Hd&&Uo){Hd=!0;do for(var a=!1,r=ka;r!==null;){if(e!==0){var u=r.pendingLanes;if(u===0)var f=0;else{var b=r.suspendedLanes,S=r.pingedLanes;f=(1<<31-tn(42|e)+1)-1,f&=u&~(b&~S),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Sv(r,f))}else f=Le,f=Cr(r,r===Pe?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(f&3)===0||Pa(r,f)||(a=!0,Sv(r,f));r=r.next}while(a);Hd=!1}}function Fj(){jv()}function jv(){Uo=Ld=!1;var e=0;Gs!==0&&u1()&&(e=Gs);for(var t=Wt(),a=null,r=ka;r!==null;){var u=r.next,f=wv(r,t);f===0?(r.next=null,a===null?ka=u:a.next=u,u===null&&(ja=a)):(a=r,(e!==0||(f&3)!==0)&&(Uo=!0)),r=u}lt!==0&&lt!==5||Ri(e),Gs!==0&&(Gs=0)}function wv(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var b=31-tn(f),S=1<<b,z=u[b];z===-1?((S&a)===0||(S&r)!==0)&&(u[b]=gk(S,t)):z<=t&&(e.expiredLanes|=S),f&=~S}if(t=Pe,a=Le,a=Cr(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&qc(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Pa(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&qc(r),Gc(a)){case 2:case 8:a=sm;break;case 32:a=wr;break;case 268435456:a=lm;break;default:a=wr}return r=Nv.bind(null,e),a=Bc(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&qc(r),e.callbackPriority=2,e.callbackNode=null,2}function Nv(e,t){if(lt!==0&&lt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if($o()&&e.callbackNode!==a)return null;var r=Le;return r=Cr(e,e===Pe?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(cv(e,r,t),wv(e,Wt()),e.callbackNode!=null&&e.callbackNode===a?Nv.bind(null,e):null)}function Sv(e,t){if($o())return null;cv(e,t,!0)}function Wj(){f1(function(){(Ye&6)!==0?Bc(nm,Fj):jv()})}function Bd(){if(Gs===0){var e=fl;e===0&&(e=Nr,Nr<<=1,(Nr&261888)===0&&(Nr=256)),Gs=e}return Gs}function Tv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Rr(e)}function e1(e,t,a,r,u){if(t==="submit"&&a&&a.stateNode===u){var f=Tv((u[Kt]||null).action),b=r.submitter;b&&(t=(t=b[Kt]||null)?Tv(t.formAction):b.getAttribute("formAction"),t!==null&&(f=t,b=null));var S=new $r("action","action",null,r,u);e.push({event:S,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Gs!==0){var z=new FormData(u,b);Vu(a,{pending:!0,data:z,method:u.method,action:f},null,z)}}else typeof f=="function"&&(S.preventDefault(),z=new FormData(u,b),Vu(a,{pending:!0,data:z,method:u.method,action:f},f,z))},currentTarget:u}]})}}for(var qd=0;qd<fu.length;qd++){var Id=fu[qd],t1=Id.toLowerCase(),n1=Id[0].toUpperCase()+Id.slice(1);Mn(t1,"on"+n1)}Mn(Fm,"onAnimationEnd"),Mn(Wm,"onAnimationIteration"),Mn(ep,"onAnimationStart"),Mn("dblclick","onDoubleClick"),Mn("focusin","onFocus"),Mn("focusout","onBlur"),Mn(dj,"onTransitionRun"),Mn(fj,"onTransitionStart"),Mn(hj,"onTransitionCancel"),Mn(tp,"onTransitionEnd"),Gl("onMouseEnter",["mouseout","mouseover"]),Gl("onMouseLeave",["mouseout","mouseover"]),Gl("onPointerEnter",["pointerout","pointerover"]),Gl("onPointerLeave",["pointerout","pointerover"]),sl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sl("onBeforeInput",["compositionend","keypress","textInput","paste"]),sl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oi="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(" "),s1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oi));function Cv(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],u=r.event;r=r.listeners;e:{var f=void 0;if(t)for(var b=r.length-1;0<=b;b--){var S=r[b],z=S.instance,I=S.currentTarget;if(S=S.listener,z!==f&&u.isPropagationStopped())break e;f=S,u.currentTarget=I;try{f(u)}catch(V){Hr(V)}u.currentTarget=null,f=z}else for(b=0;b<r.length;b++){if(S=r[b],z=S.instance,I=S.currentTarget,S=S.listener,z!==f&&u.isPropagationStopped())break e;f=S,u.currentTarget=I;try{f(u)}catch(V){Hr(V)}u.currentTarget=null,f=z}}}}function De(e,t){var a=t[fm];a===void 0&&(a=t[fm]=new Set);var r=e+"__bubble";a.has(r)||(Ev(t,e,2,!1),a.add(r))}function Yd(e,t,a){var r=0;t&&(r|=4),Ev(a,e,r,t)}var Lo="_reactListening"+Math.random().toString(36).slice(2);function Gd(e){if(!e[Lo]){e[Lo]=!0,pm.forEach(function(a){a!=="selectionchange"&&(s1.has(a)||Yd(a,!1,e),Yd(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lo]||(t[Lo]=!0,Yd("selectionchange",!1,t))}}function Ev(e,t,a,r){switch(vx(t)){case 2:var u=Q1;break;case 8:u=J1;break;default:u=df}a=u.bind(null,t,a,e),u=void 0,!Fc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),r?u!==void 0?e.addEventListener(t,a,{capture:!0,passive:u}):e.addEventListener(t,a,!0):u!==void 0?e.addEventListener(t,a,{passive:u}):e.addEventListener(t,a,!1)}function Kd(e,t,a,r,u){var f=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var b=r.tag;if(b===3||b===4){var S=r.stateNode.containerInfo;if(S===u)break;if(b===4)for(b=r.return;b!==null;){var z=b.tag;if((z===3||z===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;S!==null;){if(b=nl(S),b===null)return;if(z=b.tag,z===5||z===6||z===26||z===27){r=f=b;continue e}S=S.parentNode}}r=r.return}Em(function(){var I=f,V=Jc(a),W=[];e:{var H=np.get(e);if(H!==void 0){var Z=$r,de=e;switch(e){case"keypress":if(_r(a)===0)break e;case"keydown":case"keyup":Z=qk;break;case"focusin":de="focus",Z=nu;break;case"focusout":de="blur",Z=nu;break;case"beforeblur":case"afterblur":Z=nu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=zm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=Ak;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=Xk;break;case Fm:case Wm:case ep:Z=Rk;break;case tp:Z=Vk;break;case"scroll":case"scrollend":Z=Ck;break;case"wheel":Z=Jk;break;case"copy":case"cut":case"paste":Z=_k;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=Om;break;case"submit":Z=Gk;break;case"toggle":case"beforetoggle":Z=Fk}var be=(t&4)!==0,Me=!be&&(e==="scroll"||e==="scrollend"),q=be?H!==null?H+"Capture":null:H;be=[];for(var D=I,G;D!==null;){var F=D;if(G=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||G===null||q===null||(F=ti(D,q),F!=null&&be.push(_i(D,F,G))),Me)break;D=D.return}0<be.length&&(H=new Z(H,de,null,a,V),W.push({event:H,listeners:be}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",Z&&a!==Qc&&(de=a.relatedTarget||a.fromElement)&&(nl(de)||de[ql]))break e;(H||Z)&&(de=V.window===V?V:(Z=V.ownerDocument)?Z.defaultView||Z.parentWindow:window,H?(Z=a.relatedTarget||a.toElement,H=I,Z=Z?nl(Z):null,Z!==null&&(Me=d(Z),be=Z.tag,Z!==Me||be!==5&&be!==27&&be!==6)&&(Z=null)):(H=null,Z=I),H!==Z&&(be=zm,F="onMouseLeave",q="onMouseEnter",D="mouse",(e==="pointerout"||e==="pointerover")&&(be=Om,F="onPointerLeave",q="onPointerEnter",D="pointer"),Me=H==null?de:ei(H),G=Z==null?de:ei(Z),de=new be(F,D+"leave",H,a,V),de.target=Me,de.relatedTarget=G,F=null,nl(V)===I&&(be=new be(q,D+"enter",Z,a,V),be.target=G,be.relatedTarget=Me,F=be),Me=F,be=H&&Z?B(H,Z,l1):null,H!==null&&Av(W,de,H,be,!1),Z!==null&&Me!==null&&Av(W,Me,Z,be,!0)))}e:{if(H=I?ei(I):window,Z=H.nodeName&&H.nodeName.toLowerCase(),Z==="select"||Z==="input"&&H.type==="file")var pe=qm;else if(Hm(H))if(Im)pe=oj;else{pe=ij;var He=aj}else Z=H.nodeName,!Z||Z.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?I&&Vc(I.elementType)&&(pe=qm):pe=rj;if(pe&&(pe=pe(e,I))){Bm(W,pe,a,V);break e}He&&He(e,H,I)}switch(He=I?ei(I):window,e){case"focusin":(Hm(He)||He.contentEditable==="true")&&(Jl=He,cu=I,ci=null);break;case"focusout":ci=cu=Jl=null;break;case"mousedown":uu=!0;break;case"contextmenu":case"mouseup":case"dragend":uu=!1,Jm(W,a,V);break;case"selectionchange":if(uj)break;case"keydown":case"keyup":Jm(W,a,V)}var je;if(lu)e:{switch(e){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Ql?Um(e,a)&&(Ne="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ne="onCompositionStart");Ne&&(_m&&a.locale!=="ko"&&(Ql||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Ql&&(je=Am()):(Ss=V,Wc="value"in Ss?Ss.value:Ss.textContent,Ql=!0)),He=Ho(I,Ne),0<He.length&&(Ne=new Rm(Ne,e,null,a,V),W.push({event:Ne,listeners:He}),je?Ne.data=je:(je=Lm(a),je!==null&&(Ne.data=je)))),(je=ej?tj(e,a):nj(e,a))&&(Ne=Ho(I,"onBeforeInput"),0<Ne.length&&(He=new Rm("onBeforeInput","beforeinput",null,a,V),W.push({event:He,listeners:Ne}),He.data=je)),e1(W,e,I,a,V)}Cv(W,t)})}function _i(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Ho(e,t){for(var a=t+"Capture",r=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=ti(e,a),u!=null&&r.unshift(_i(e,u,f)),u=ti(e,t),u!=null&&r.push(_i(e,u,f))),e.tag===3)return r;e=e.return}return[]}function l1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Av(e,t,a,r,u){for(var f=t._reactName,b=[];a!==null&&a!==r;){var S=a,z=S.alternate,I=S.stateNode;if(S=S.tag,z!==null&&z===r)break;S!==5&&S!==26&&S!==27||I===null||(z=I,u?(I=ti(a,f),I!=null&&b.unshift(_i(a,I,z))):u||(I=ti(a,f),I!=null&&b.push(_i(a,I,z)))),a=a.return}b.length!==0&&e.push({event:t,listeners:b})}var a1=/\r\n?/g,i1=/\u0000|\uFFFD/g;function Mv(e){return(typeof e=="string"?e:""+e).replace(a1,`
50
+ `).replace(i1,"")}function zv(e,t){return t=Mv(t),Mv(e)===t}function Ze(e,t,a,r,u,f){switch(a){case"children":if(typeof r=="string")t==="body"||t==="textarea"&&r===""||Xl(e,r);else if(typeof r=="number"||typeof r=="bigint")t!=="body"&&Xl(e,""+r);else return;break;case"className":zr(e,"class",r);break;case"tabIndex":zr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":zr(e,a,r);break;case"style":Tm(e,r,f);return;case"data":if(t!=="object"){zr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Rr(r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(t!=="input"&&Ze(e,t,"name",u.name,u,null),Ze(e,t,"formEncType",u.formEncType,u,null),Ze(e,t,"formMethod",u.formMethod,u,null),Ze(e,t,"formTarget",u.formTarget,u,null)):(Ze(e,t,"encType",u.encType,u,null),Ze(e,t,"method",u.method,u,null),Ze(e,t,"target",u.target,u,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Rr(r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=Yn);return;case"onScroll":r!=null&&De("scroll",e);return;case"onScrollEnd":r!=null&&De("scrollend",e);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(u.children!=null)throw Error(o(60));f?.__html!==a&&(e.innerHTML=a)}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Rr(r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":De("beforetoggle",e),De("toggle",e),Mr(e,"popover",r);break;case"xlinkActuate":ls(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ls(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ls(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ls(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ls(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ls(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ls(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ls(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ls(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Mr(e,"is",r);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=Sk.get(a)||a,Mr(e,a,r);else return}Ie=!0}function Xd(e,t,a,r,u,f){switch(a){case"style":Tm(e,r,f);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(u.children!=null)throw Error(o(60));f?.__html!==a&&(e.innerHTML=a)}}break;case"children":if(typeof r=="string")Xl(e,r);else if(typeof r=="number"||typeof r=="bigint")Xl(e,""+r);else return;break;case"onScroll":r!=null&&De("scroll",e);return;case"onScrollEnd":r!=null&&De("scrollend",e);return;case"onClick":r!=null&&(e.onclick=Yn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!gm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),f=a.slice(2,u?a.length-7:void 0),t=e[Kt]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(f,t,u),typeof r=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(f,r,u);break e}Ie=!0,a in e?e[a]=r:r===!0?e.setAttribute(a,""):Mr(e,a,r)}return}Ie=!0}function At(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var r=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var b=a[f];if(b!=null)switch(f){case"src":r=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ze(e,t,f,b,a,null)}}u&&Ze(e,t,"srcSet",a.srcSet,a,null),r&&Ze(e,t,"src",a.src,a,null);return;case"input":De("invalid",e);var S=f=b=u=null,z=null,I=null;for(r in a)if(a.hasOwnProperty(r)){var V=a[r];if(V!=null)switch(r){case"name":u=V;break;case"type":b=V;break;case"checked":z=V;break;case"defaultChecked":I=V;break;case"value":f=V;break;case"defaultValue":S=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(137,t));break;default:Ze(e,t,r,V,a,null)}}jm(e,f,S,z,I,b,u,!1);return;case"select":De("invalid",e),r=b=f=null;for(u in a)if(a.hasOwnProperty(u)&&(S=a[u],S!=null))switch(u){case"value":f=S;break;case"defaultValue":b=S;break;case"multiple":r=S;default:Ze(e,t,u,S,a,null)}t=f,a=b,e.multiple=!!r,t!=null?Kl(e,!!r,t,!1):a!=null&&Kl(e,!!r,a,!0);return;case"textarea":De("invalid",e),f=u=r=null;for(b in a)if(a.hasOwnProperty(b)&&(S=a[b],S!=null))switch(b){case"value":r=S;break;case"defaultValue":u=S;break;case"children":f=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(91));break;default:Ze(e,t,b,S,a,null)}Nm(e,r,u,f);return;case"option":for(z in a)if(a.hasOwnProperty(z)&&(r=a[z],r!=null))switch(z){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Ze(e,t,z,r,a,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(r=0;r<Oi.length;r++)De(Oi[r],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(I in a)if(a.hasOwnProperty(I)&&(r=a[I],r!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ze(e,t,I,r,a,null)}return;default:if(Vc(t)){for(V in a)a.hasOwnProperty(V)&&(r=a[V],r!==void 0&&Xd(e,t,V,r,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(r=a[S],r!=null&&Ze(e,t,S,r,a,null))}var r1={};function o1(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,b=null,S=null,z=null,I=null,V=null;for(Z in a){var W=a[Z];if(a.hasOwnProperty(Z)&&W!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":z=W;default:r.hasOwnProperty(Z)||Ze(e,t,Z,null,r,W)}}for(var H in r){var Z=r[H];if(W=a[H],r.hasOwnProperty(H)&&(Z!=null||W!=null))switch(H){case"type":Z!==W&&(Ie=!0),f=Z;break;case"name":Z!==W&&(Ie=!0),u=Z;break;case"checked":Z!==W&&(Ie=!0),I=Z;break;case"defaultChecked":Z!==W&&(Ie=!0),V=Z;break;case"value":Z!==W&&(Ie=!0),b=Z;break;case"defaultValue":Z!==W&&(Ie=!0),S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:Z!==W&&Ze(e,t,H,Z,r,W)}}Xc(e,b,S,z,I,V,f,u);return;case"select":Z=b=S=H=null;for(f in a)if(z=a[f],a.hasOwnProperty(f)&&z!=null)switch(f){case"value":break;case"multiple":Z=z;default:r.hasOwnProperty(f)||Ze(e,t,f,null,r,z)}for(u in r)if(f=r[u],z=a[u],r.hasOwnProperty(u)&&(f!=null||z!=null))switch(u){case"value":f!==z&&(Ie=!0),H=f;break;case"defaultValue":f!==z&&(Ie=!0),S=f;break;case"multiple":f!==z&&(Ie=!0),b=f;default:f!==z&&Ze(e,t,u,f,r,z)}t=S,a=b,r=Z,H!=null?Kl(e,!!a,H,!1):!!r!=!!a&&(t!=null?Kl(e,!!a,t,!0):Kl(e,!!a,a?[]:"",!1));return;case"textarea":Z=H=null;for(S in a)if(u=a[S],a.hasOwnProperty(S)&&u!=null&&!r.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:Ze(e,t,S,null,r,u)}for(b in r)if(u=r[b],f=a[b],r.hasOwnProperty(b)&&(u!=null||f!=null))switch(b){case"value":u!==f&&(Ie=!0),H=u;break;case"defaultValue":u!==f&&(Ie=!0),Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==f&&Ze(e,t,b,u,r,f)}wm(e,H,Z);return;case"option":for(var de in a)if(H=a[de],a.hasOwnProperty(de)&&H!=null&&!r.hasOwnProperty(de))switch(de){case"selected":e.selected=!1;break;default:Ze(e,t,de,null,r,H)}for(z in r)if(H=r[z],Z=a[z],r.hasOwnProperty(z)&&H!==Z&&(H!=null||Z!=null))switch(z){case"selected":H!==Z&&(Ie=!0),e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:Ze(e,t,z,H,r,Z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var be in a)H=a[be],a.hasOwnProperty(be)&&H!=null&&!r.hasOwnProperty(be)&&Ze(e,t,be,null,r,H);for(I in r)if(H=r[I],Z=a[I],r.hasOwnProperty(I)&&H!==Z&&(H!=null||Z!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:Ze(e,t,I,H,r,Z)}return;default:if(Vc(t)){for(var Me in a)H=a[Me],a.hasOwnProperty(Me)&&H!==void 0&&!r.hasOwnProperty(Me)&&Xd(e,t,Me,void 0,r,H);for(V in r)H=r[V],Z=a[V],!r.hasOwnProperty(V)||H===Z||H===void 0&&Z===void 0||Xd(e,t,V,H,r,Z);return}}for(var q in a)H=a[q],a.hasOwnProperty(q)&&H!=null&&!r.hasOwnProperty(q)&&Ze(e,t,q,null,r,H);for(W in r)H=r[W],Z=a[W],!r.hasOwnProperty(W)||H===Z||H==null&&Z==null||Ze(e,t,W,H,r,Z)}function Rv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var u=a[r],f=u.transferSize,b=u.initiatorType,S=u.duration;if(f&&S&&Rv(b)){for(b=0,S=u.responseEnd,r+=1;r<a.length;r++){var z=a[r],I=z.startTime;if(I>S)break;var V=z.transferSize,W=z.initiatorType;V&&Rv(W)&&(z=z.responseEnd,b+=V*(z<S?1:(S-I)/(z-I)))}if(--r,t+=8*(f+b)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Zd=null,Vd=null;function Di(e){return e.nodeType===9?e:e.ownerDocument}function Ov(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 _v(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 Dv(e,t,a,r){return a=Di(a).createElement(e),a[Nt]=r,a[Kt]=t,At(a,e,t),bt(a),a}function Qd(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 Jd=null;function u1(){var e=window.event;return e&&e.type==="popstate"?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Pd=typeof setTimeout=="function"?setTimeout:void 0,d1=typeof clearTimeout=="function"?clearTimeout:void 0,$v=typeof Promise=="function"?Promise:void 0,Uv=typeof requestAnimationFrame=="function"?requestAnimationFrame:Pd,f1=typeof queueMicrotask=="function"?queueMicrotask:typeof $v<"u"?function(e){return $v.resolve(null).then(e).catch(h1)}:Pd;function h1(e){setTimeout(function(){throw e})}function Ks(e){return e==="head"}function Lv(e,t){var a=t,r=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(u),Aa(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")af(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,af(a);for(var f=a.firstChild;f;){var b=f.nextSibling,S=f.nodeName;f[Wa]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=b}}else a==="body"&&af(e.ownerDocument.body);a=u}while(a);Aa(t)}function Hv(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function Bv(e,t,a){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,a!=null&&(e.style.viewTransitionClass=a),a=getComputedStyle(e),a.display==="inline"){if(t=e.getClientRects(),t.length===1)var r=1;else for(var u=r=0;u<t.length;u++){var f=t[u];0<f.width&&0<f.height&&r++}r===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function qv(e,t){e=e.style,t=t.style;var a=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(a=t.display,e.display=a==null||typeof a=="boolean"?"":a,a=t.margin,a!=null?e.margin=a:(a=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=a==null||typeof a=="boolean"?"":a,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function m1(e,t,a){return a=a.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<=a.innerHeight&&e.left<=a.innerWidth}}function Fd(e){var t=e.getBoundingClientRect(),a=getComputedStyle(e);return m1(t,a,e)}function p1(e){return e.documentElement.clientHeight}function g1(e){this.addEventListener("load",e),this.addEventListener("error",e)}function v1(e,t,a,r,u,f,b,S,z){var I=t.nodeType===9?t:t.ownerDocument;try{var V=I.startViewTransition({update:function(){var H=I.defaultView,Z=H.navigation&&H.navigation.transition,de=I.fonts.status;r();var be=[];if(de==="loaded"&&(p1(I),I.fonts.status==="loading"&&be.push(I.fonts.ready)),de=be.length,e!==null)for(var Me=e.suspenseyImages,q=0,D=0;D<Me.length;D++){var G=Me[D];if(!G.complete){var F=G.getBoundingClientRect();if(0<F.bottom&&0<F.right&&F.top<H.innerHeight&&F.left<H.innerWidth){if(q+=ox(G),q>Io){be.length=de;break}G=new Promise(g1.bind(G)),be.push(G)}}}if(0<be.length)return H=Promise.race([Promise.all(be),new Promise(function(pe){return setTimeout(pe,500)})]).then(u,u),(Z?Promise.allSettled([Z.finished,H]):H).then(f,f);if(u(),Z)return Z.finished.then(f,f);f()},types:a});I.__reactViewTransition=V;var W=[];return V.ready.then(function(){for(var H=I.documentElement.getAnimations({subtree:!0}),Z=0;Z<H.length;Z++){var de=H[Z],be=de.effect,Me=be.pseudoElement;if(Me!=null&&Me.startsWith("::view-transition")){W.push(de),de=be.getKeyframes();for(var q=Me=void 0,D=!0,G=0;G<de.length;G++){var F=de[G],pe=F.width;if(Me===void 0)Me=pe;else if(Me!==pe){D=!1;break}if(pe=F.height,q===void 0)q=pe;else if(q!==pe){D=!1;break}delete F.width,delete F.height,F.transform==="none"&&delete F.transform}D&&Me!==void 0&&q!==void 0&&(be.setKeyframes(de),D=getComputedStyle(be.target,be.pseudoElement),D.width!==Me||D.height!==q)&&(D=de[0],D.width=Me,D.height=q,D=de[de.length-1],D.width=Me,D.height=q,be.setKeyframes(de))}}b()},function(H){I.__reactViewTransition===V&&(I.__reactViewTransition=null);try{if(typeof H=="object"&&H!==null)switch(H.name){case"InvalidStateError":(H.message==="View transition was skipped because document visibility state is hidden."||H.message==="Skipping view transition because document visibility state has become hidden."||H.message==="Skipping view transition because viewport size changed."||H.message==="Transition was aborted because of invalid state")&&(H=null)}H!==null&&z(H)}finally{r(),u(),b()}}),V.finished.finally(function(){for(var H=0;H<W.length;H++)W[H].cancel();I.__reactViewTransition===V&&(I.__reactViewTransition=null),S()}),V}catch{return r(),u(),b(),null}}function wl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}wl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:k({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},wl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),r=[],u=0;u<a.length;u++){var f=a[u].effect;f!==null&&f.target===e&&f.pseudoElement===t&&r.push(a[u])}return r},wl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Iv(e){return{name:e,group:new wl("group",e),imagePair:new wl("image-pair",e),old:new wl("old",e),new:new wl("new",e)}}function un(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}un.prototype.addEventListener=function(e,t,a){var r=null,u=null;if(!(a!=null&&typeof a!="boolean"&&(r=a.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(Gv(f,e,t,a)===-1){var b=this,S=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(S=function(z){b.removeEventListener(e,t,a),typeof t=="function"?t.call(this,z):t.handleEvent(z)}),r!==null&&(u=b.removeEventListener.bind(b,e,t,a),r.addEventListener("abort",u,{once:!0}),u=r.removeEventListener.bind(r,"abort",u)),r=wa(a),f.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:S,cleanup:u}),x(this._fragmentFiber.child,!1,x1,e,S,r)}this._eventListeners=f}};function x1(e,t,a,r){return A(e).addEventListener(t,a,r),!1}un.prototype.removeEventListener=function(e,t,a){var r=this._eventListeners;if(r!==null&&(t=Gv(r,e,t,a),t!==-1)){var u=r[t];a=u.attachedListener;var f=u.cleanup;u=wa(u.optionsOrUseCapture),x(this._fragmentFiber.child,!1,b1,e,a,u),r.splice(t,1),f!==null&&f()}};function b1(e,t,a,r){return A(e).removeEventListener(t,a,r),!1}function wa(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Yv(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Gv(e,t,a,r){if(e.length===0)return-1;r=Yv(r);for(var u=0;u<e.length;u++){var f=e[u];if(f.type===t&&f.listener===a&&Yv(f.optionsOrUseCapture)===r)return u}return-1}un.prototype.dispatchEvent=function(e){var t=w(this._fragmentFiber);if(t===null)return!0;t=A(t);var a=this._eventListeners;if(a!==null&&0<a.length||!e.bubbles){var r=t.nodeType===9?t.createComment(""):document.createTextNode("");if(a)for(var u=0;u<a.length;u++){var f=a[u];r.addEventListener(f.type,f.attachedListener,wa(f.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),a)for(u=0;u<a.length;u++)f=a[u],r.removeEventListener(f.type,f.attachedListener,wa(f.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},un.prototype.focus=function(e){x(this._fragmentFiber.child,!0,Kv,e,void 0,void 0)};function Kv(e,t){return e.tag===6?!1:(e=A(e),z1(e,t))}un.prototype.focusLast=function(e){var t=[];x(this._fragmentFiber.child,!0,Wd,t,void 0,void 0);for(var a=t.length-1;0<=a&&!Kv(t[a],e);a--);};function Wd(e,t){return t.push(e),!1}un.prototype.blur=function(){var e=w(this._fragmentFiber);e!==null&&(e=A(e),e=Di(e).activeElement,e!==null&&x(this._fragmentFiber.child,!1,y1,e,void 0,void 0))};function y1(e,t){return e.tag===6?!1:(e=A(e),e===t||e.contains(t)?(t.blur(),!0):!1)}un.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),x(this._fragmentFiber.child,!1,k1,e,void 0,void 0)};function k1(e,t){return e.tag===6||(e=A(e),t.observe(e)),!1}un.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),x(this._fragmentFiber.child,!1,j1,e,void 0,void 0);for(var a=t=0;a<Dn.length;a++){var r=Dn[a];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Dn[t++]=r}Dn.length=t}};function j1(e,t){return e.tag===6||(e=A(e),t.unobserve(e)),!1}var Dn=[],ef=!1;function w1(e,t,a){Dn.push({fragmentInstance:e,observer:t,instance:a}),ef||(ef=!0,R1(function(){ef=!1;var r=Dn;Dn=[];for(var u=0;u<r.length;u++){var f=r[u];f.observer.unobserve(f.instance)}}))}un.prototype.getClientRects=function(){var e=[];return x(this._fragmentFiber.child,!1,N1,e,void 0,void 0),e};function N1(e,t){if(e.tag===6){e=e.stateNode;var a=e.ownerDocument.createRange();a.selectNodeContents(e),t.push.apply(t,a.getClientRects())}else e=A(e),t.push.apply(t,e.getClientRects());return!1}un.prototype.getRootNode=function(e){var t=w(this._fragmentFiber);return t===null?this:A(t).getRootNode(e)},un.prototype.compareDocumentPosition=function(e){var t=w(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];x(this._fragmentFiber.child,!1,Wd,a,void 0,void 0);var r=A(t);if(a.length===0){if(a=r,C(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&&(a=t)}t=this._fragmentFiber;var u=r=a.compareDocumentPosition(e);return a===e?u=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=T(t)[1],a===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=A(a).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(a[0]),u=A(a[a.length-1]);var f=C(this._fragmentFiber)?t.parentElement:r;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=f.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var b=t.compareDocumentPosition(e),S=u.compareDocumentPosition(e),z=b&Node.DOCUMENT_POSITION_CONTAINED_BY||S&Node.DOCUMENT_POSITION_CONTAINED_BY;return S=r&&f&&b&Node.DOCUMENT_POSITION_FOLLOWING&&S&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||f&&u===e||z||S?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!f&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:b,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||S1(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function S1(e,t,a,r,u){var f=nl(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===t||f.alternate===t)){a=!0;break e}f=f.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=u.ownerDocument,u===f||u===f.documentElement||u===f.body;e:{for(f=t,t=w(t);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==t&&f.alternate!==t)){f=!0;break e}f=f.return}f=!1}return f}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!f)&&!(t=f===a)&&(t=B(a,f,ee),t===null?t=!1:(x(t,!0,O,f,a),f=M,M=null,t=f!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!f)&&!(t=f===r)&&(t=B(r,f,ee),t===null?t=!1:(x(t,!0,J,f,r),f=M,R=M=null,t=f!==null)),t):!1}function Xv(e,t){var a=e.ownerDocument.createRange();a.selectNodeContents(e),e=a.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}un.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];x(this._fragmentFiber.child,!1,Wd,t,void 0,void 0);var a=e!==!1;if(t.length===0){var r=T(this._fragmentFiber);if(r=a?r[1]||r[0]||w(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=A(r),Xv(e,a);return}if(r=A(r),r.nodeType!==9){if(r.nodeType===11){a="host"in r?r.host:null,a!==null&&a.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=a?t.length-1:0;r!==(a?-1:t.length);){var u=t[r];u.tag===6?(u=A(u),Xv(u,a)):A(u).scrollIntoView(e),r+=a?-1:1}};function T1(e,t){return e=A(e),Zv(e,t),!1}function Zv(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Vv(e,t){var a=t._eventListeners;if(a!==null)for(var r=0;r<a.length;r++){var u=a[r];e.addEventListener(u.type,u.attachedListener,wa(u.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(f){for(var b=0,S=0;S<Dn.length;S++){var z=Dn[S];(z.fragmentInstance!==t||z.observer!==f||z.instance!==e)&&(Dn[b++]=z)}Dn.length=b,f.observe(e)}),Zv(e,t))}function C1(e,t){var a=t._eventListeners;if(a!==null)for(var r=0;r<a.length;r++){var u=a[r];e.removeEventListener(u.type,u.attachedListener,wa(u.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(f){typeof f.rootMargin=="string"?w1(t,f,e):f.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function tf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":tf(a),Ar(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function E1(e,t,a,r){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Wa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=kn(e.nextSibling),e===null)break}return null}function A1(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=kn(e.nextSibling),e===null))return null;return e}function Qv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=kn(e.nextSibling),e===null))return null;return e}function nf(e){return e.data==="$?"||e.data==="$~"}function sf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function M1(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function kn(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 lf=null;function Jv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return kn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Pv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function z1(e,t){function a(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener("focus",a,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",a,!0)}return r}function R1(e){Uv(function(){Uv(function(t){return e(t)})})}function Fv(e,t,a){switch(t=Di(a),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,a){for(var r in a){var u=a[r];a.hasOwnProperty(r)&&u!=null&&Ze(e,t,r,null,r1,u)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Yn&&(e.onclick=null),Ar(e)}function af(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ar(e)}var jn=new Map,ex=new Set;function $i(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var vs=ve.d;ve.d={f:O1,r:_1,D:D1,C:$1,L:U1,m:L1,X:B1,S:H1,M:q1};function O1(){var e=vs.f(),t=Oo();return e||t}function _1(e){var t=Il(e);t!==null&&t.tag===5&&t.type==="form"?ng(t):vs.r(e)}var Na=typeof document>"u"?null:document;function tx(e,t,a){var r=Na;if(r&&typeof t=="string"&&t){var u=mn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),ex.has(u)||(ex.add(u),e={rel:e,crossOrigin:a,href:t},r.querySelector(u)===null&&(t=r.createElement("link"),At(t,"link",e),bt(t),r.head.appendChild(t)))}}function D1(e){vs.D(e),tx("dns-prefetch",e,null)}function $1(e,t){vs.C(e,t),tx("preconnect",e,t)}function U1(e,t,a){vs.L(e,t,a);var r=Na;if(r&&e&&t){var u='link[rel="preload"][as="'+mn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+mn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+mn(a.imageSizes)+'"]')):u+='[href="'+mn(e)+'"]';var f=u;switch(t){case"style":f=Sa(e);break;case"script":f=Ta(e)}if(!(jn.has(f)||(e=k({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),jn.set(f,e),r.querySelector(u)!==null||t==="style"&&r.querySelector(Ui(f))||t==="script"&&r.querySelector(Li(f))))){var b=r.createElement("link");At(b,"link",e),t==="style"&&(b[Er]=!0,b.onload=b.onerror=function(){mm(b)}),bt(b),r.head.appendChild(b)}}}function L1(e,t){vs.m(e,t);var a=Na;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+mn(r)+'"][href="'+mn(e)+'"]',f=u;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ta(e)}if(!jn.has(f)&&(e=k({rel:"modulepreload",href:e},t),jn.set(f,e),a.querySelector(u)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Li(f)))return}r=a.createElement("link"),At(r,"link",e),bt(r),a.head.appendChild(r)}}}function H1(e,t,a){vs.S(e,t,a);var r=Na;if(r&&e){var u=Yl(r).hoistableStyles,f=Sa(e);t=t||"default";var b=u.get(f);if(!b){var S={loading:0,preload:null};if(b=r.querySelector(Ui(f)))S.loading=5;else{e=k({rel:"stylesheet",href:e,"data-precedence":t},a),(a=jn.get(f))&&rf(e,a);var z=b=r.createElement("link");bt(z),At(z,"link",e),z._p=new Promise(function(I,V){z.onload=I,z.onerror=V}),z.addEventListener("load",function(){S.loading|=1}),z.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Bo(b,t,r)}b={type:"stylesheet",instance:b,count:1,state:S},u.set(f,b)}}}function B1(e,t){vs.X(e,t);var a=Na;if(a&&e){var r=Yl(a).hoistableScripts,u=Ta(e),f=r.get(u);f||(f=a.querySelector(Li(u)),f||(e=k({src:e,async:!0},t),(t=jn.get(u))&&of(e,t),f=a.createElement("script"),bt(f),At(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function q1(e,t){vs.M(e,t);var a=Na;if(a&&e){var r=Yl(a).hoistableScripts,u=Ta(e),f=r.get(u);f||(f=a.querySelector(Li(u)),f||(e=k({src:e,async:!0,type:"module"},t),(t=jn.get(u))&&of(e,t),f=a.createElement("script"),bt(f),At(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(u,f))}}function nx(e,t,a,r){var u=(u=An.current)?$i(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Sa(a.href),t=Yl(u).hoistableStyles,r=t.get(a),r||(r={type:"style",instance:null,count:0,state:null},t.set(a,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Sa(a.href);var f=Yl(u).hoistableStyles,b=f.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,b),(f=u.querySelector(Ui(e)))?f._p||(b.instance=f,b.state.loading=5):(f=jn.get(e),f||(f={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},jn.set(e,f)),I1(u,e,f,b.state))),t&&r===null)throw Error(o(528,""));return b}if(t&&r!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=Ta(a),t=Yl(u).hoistableScripts,r=t.get(a),r||(r={type:"script",instance:null,count:0,state:null},t.set(a,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Sa(e){return'href="'+mn(e)+'"'}function Ui(e){return'link[rel="stylesheet"]['+e+"]"}function sx(e){return k({},e,{"data-precedence":e.precedence,precedence:null})}function I1(e,t,a,r){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Er]!==!0){r.loading=1;return}}else t=e.createElement("link"),t[Er]=!0,t.onload=t.onerror=mm.bind(null,t),At(t,"link",a),bt(t),e.head.appendChild(t);r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2})}function Ta(e){return'[src="'+mn(e)+'"]'}function Li(e){return"script[async]"+e}function lx(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+mn(a.href)+'"]');if(r)return t.instance=r,bt(r),r;var u=k({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),bt(r),At(r,"style",u),Bo(r,a.precedence,e),t.instance=r;case"stylesheet":u=Sa(a.href);var f=e.querySelector(Ui(u));if(f)return t.state.loading|=4,t.instance=f,bt(f),f;r=sx(a),(u=jn.get(u))&&rf(r,u),f=(e.ownerDocument||e).createElement("link"),bt(f);var b=f;return b._p=new Promise(function(S,z){b.onload=S,b.onerror=z}),At(f,"link",r),t.state.loading|=4,Bo(f,a.precedence,e),t.instance=f;case"script":return f=Ta(a.src),(u=e.querySelector(Li(f)))?(t.instance=u,bt(u),u):(r=a,(u=jn.get(f))&&(r=k({},a),of(r,u)),e=e.ownerDocument||e,u=e.createElement("script"),bt(u),At(u,"link",r),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Bo(r,a.precedence,e));return t.instance}function Bo(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=r.length?r[r.length-1]:null,f=u,b=0;b<r.length;b++){var S=r[b];if(S.dataset.precedence===t)f=S;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function rf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function of(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var qo=null;function ax(e,t,a){if(qo===null){var r=new Map,u=qo=new Map;u.set(a,r)}else u=qo,r=u.get(a),r||(r=new Map,u.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var f=a[u];if(!(f[Wa]||f[Nt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(t)||"";b=e+b;var S=r.get(b);S?S.push(f):r.set(b,[f])}}return r}function cf(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Y1(e,t,a){if(a===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 ix(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function rx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ox(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function cx(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=ox(t),e.suspenseyImages.push(t)),e=X1.bind(e),t.decode().then(e,e))}function G1(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Sa(r.href),f=t.querySelector(Ui(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Hi.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,bt(f);return}f=t.ownerDocument||t,r=sx(r),(u=jn.get(u))&&rf(r,u),f=f.createElement("link"),bt(f);var b=f;b._p=new Promise(function(S,z){b.onload=S,b.onerror=z}),At(f,"link",r),a.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Hi.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Io=0;function K1(e,t){return e.stylesheets&&e.count===0&&Go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Io===0&&(Io=62500*c1());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Io?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(u)}}:null}function ux(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Go(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Hi(){this.count--,ux(this)}function X1(){this.imgCount--,ux(this)}var Yo=null;function Go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yo=new Map,t.forEach(Z1,e),Yo=null,Hi.call(e))}function Z1(e,t){if(!(t.state.loading&4)){var a=Yo.get(e);if(a)var r=a.get(null);else{a=new Map,Yo.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var b=u[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),r=b)}r&&a.set(null,r)}u=t.instance,b=u.getAttribute("data-precedence"),f=a.get(b)||r,f===r&&a.set(null,u),a.set(b,u),this.count++,r=Hi.bind(this),u.addEventListener("load",r),u.addEventListener("error",r),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Ca={$$typeof:Ce,Provider:null,Consumer:null,_currentValue:tt,_currentValue2:tt,_threadCount:0};function V1(e,t,a,r,u,f,b,S,z){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ic(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ic(0),this.hiddenUpdates=Ic(null),this.identifierPrefix=r,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.transitionTypes=null,this.incompleteTransitions=new Map}function dx(e,t,a,r,u,f,b,S,z,I,V,W){return e=new V1(e,t,a,b,z,I,V,W,S),t=1,f===!0&&(t|=24),f=Xt(3,null,null,t),e.current=f,f.stateNode=e,t=wu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:r,isDehydrated:a,cache:t},Cu(f),e}function fx(e){return e?(e=Wl,e):Wl}function hx(e,t,a,r,u,f){u=fx(u),r.context===null?r.context=u:r.pendingContext=u,r=Os(t),r.payload={element:a},f=f===void 0?null:f,f!==null&&(r.callback=f),a=_s(e,r,t),a!==null&&(Jt(a,e,t),gi(a,e,t))}function mx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function uf(e,t){mx(e,t),(e=e.alternate)&&mx(e,t)}function px(e){if(e.tag===13||e.tag===31){var t=il(e,67108864);t!==null&&Jt(t,e,67108864),uf(e,67108864)}}function gx(e){if(e.tag===13||e.tag===31){var t=cn();t=Yc(t);var a=il(e,t);a!==null&&Jt(a,e,t),uf(e,t)}}var Ea=!0;function Q1(e,t,a,r){var u=fe.T;fe.T=null;var f=ve.p;try{ve.p=2,df(e,t,a,r)}finally{ve.p=f,fe.T=u}}function J1(e,t,a,r){var u=fe.T;fe.T=null;var f=ve.p;try{ve.p=8,df(e,t,a,r)}finally{ve.p=f,fe.T=u}}function df(e,t,a,r){if(Ea){var u=ff(r);if(u===null)Kd(e,t,r,Ko,a),xx(e,r);else if(F1(u,e,t,a,r))r.stopPropagation();else if(xx(e,r),t&4&&-1<P1.indexOf(e)){for(;u!==null;){var f=Il(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=tl(f.pendingLanes);if(b!==0){var S=f;for(S.pendingLanes|=2,S.entangledLanes|=2;b;){var z=1<<31-tn(b);S.entanglements[1]|=z,b&=~z}Wn(f),(Ye&6)===0&&(Mo=Wt()+500,Ri(0))}}break;case 31:case 13:S=il(f,2),S!==null&&Jt(S,f,2),Oo(),uf(f,2)}if(f=ff(r),f===null&&Kd(e,t,r,Ko,a),f===u)break;u=f}u!==null&&r.stopPropagation()}else Kd(e,t,r,null,a)}}function ff(e){return e=Jc(e),hf(e)}var Ko=null;function hf(e){if(Ko=null,e=nl(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ko=e,null}function vx(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(ck()){case nm:return 2;case sm:return 8;case wr:case uk:return 32;case lm:return 268435456;default:return 32}default:return 32}}var mf=!1,Xs=null,Zs=null,Vs=null,Bi=new Map,qi=new Map,Qs=[],P1="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 xx(e,t){switch(e){case"focusin":case"focusout":Xs=null;break;case"dragenter":case"dragleave":Zs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Bi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":qi.delete(t.pointerId)}}function Ii(e,t,a,r,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Il(t),t!==null&&px(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function F1(e,t,a,r,u){switch(t){case"focusin":return Xs=Ii(Xs,e,t,a,r,u),!0;case"dragenter":return Zs=Ii(Zs,e,t,a,r,u),!0;case"mouseover":return Vs=Ii(Vs,e,t,a,r,u),!0;case"pointerover":var f=u.pointerId;return Bi.set(f,Ii(Bi.get(f)||null,e,t,a,r,u)),!0;case"gotpointercapture":return f=u.pointerId,qi.set(f,Ii(qi.get(f)||null,e,t,a,r,u)),!0}return!1}function bx(e){var t=nl(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,dm(e.priority,function(){gx(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,dm(e.priority,function(){gx(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ff(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Qc=r,a.target.dispatchEvent(r),Qc=null}else return t=Il(a),t!==null&&px(t),e.blockedOn=a,!1;t.shift()}return!0}function yx(e,t,a){Xo(e)&&a.delete(t)}function W1(){mf=!1,Xs!==null&&Xo(Xs)&&(Xs=null),Zs!==null&&Xo(Zs)&&(Zs=null),Vs!==null&&Xo(Vs)&&(Vs=null),Bi.forEach(yx),qi.forEach(yx)}function Zo(e,t){e.blockedOn===t&&(e.blockedOn=null,mf||(mf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,W1)))}var Vo=null;function kx(e){Vo!==e&&(Vo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Vo===e&&(Vo=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],u=e[t+2];if(typeof r!="function"){if(hf(r||a)===null)continue;break}var f=Il(a);f!==null&&(e.splice(t,3),t-=3,Vu(f,{pending:!0,data:u,method:a.method,action:r},r,u))}}))}function Aa(e){function t(z){return Zo(z,e)}Xs!==null&&Zo(Xs,e),Zs!==null&&Zo(Zs,e),Vs!==null&&Zo(Vs,e),Bi.forEach(t),qi.forEach(t);for(var a=0;a<Qs.length;a++){var r=Qs[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Qs.length&&(a=Qs[0],a.blockedOn===null);)bx(a),a.blockedOn===null&&Qs.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var u=a[r],f=a[r+1],b=u[Kt]||null;if(typeof f=="function")b||kx(a);else if(b){var S=null;if(f&&f.hasAttribute("formAction")){if(u=f,b=f[Kt]||null)S=b.formAction;else if(hf(u)!==null)continue}else S=b.action;typeof S=="function"?a[r+1]=S:(a.splice(r,3),r-=3),kx(a)}}}function jx(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function pf(e){this._internalRoot=e}Qo.prototype.render=pf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var a=t.current,r=cn();hx(a,r,e,t,null,null)},Qo.prototype.unmount=pf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hx(e.current,2,null,e,null,null),Oo(),t[ql]=null}};function Qo(e){this._internalRoot=e}Qo.prototype.unstable_scheduleHydration=function(e){if(e){var t=um();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Qs.length&&t!==0&&t<Qs[a].priority;a++);Qs.splice(a,0,e),a===0&&bx(e)}};var wx=l.version;if(wx!=="19.3.1")throw Error(o(527,wx,"19.3.1"));ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ew={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:fe,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jo.isDisabled&&Jo.supportsFiber)try{Ja=Jo.inject(ew),en=Jo}catch{}}return Gi.createRoot=function(e,t){if(!c(e))throw Error(o(299));var a=!1,r="",u=fg,f=hg,b=mg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=dx(e,1,!1,null,null,a,r,null,u,f,b,jx),e[ql]=t.current,Gd(e),new pf(t)},Gi.hydrateRoot=function(e,t,a){if(!c(e))throw Error(o(299));var r=!1,u="",f=fg,b=hg,S=mg,z=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(z=a.formState)),t=dx(e,1,!0,t,a??null,r,u,z,f,b,S,jx),t.context=fx(null),a=t.current,r=cn(),r=Yc(r),u=Os(r),u.callback=null,_s(a,u,r),a=r,t.current.lanes=a,Fa(t,a),Wn(t),e[ql]=t.current,Gd(e),new Qo(t)},Gi.version="19.3.1",Gi}var Ox;function cw(){if(Ox)return vf.exports;Ox=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(l){console.error(l)}}return n(),vf.exports=ow(),vf.exports}var uw=cw(),y=vh();const dw=["general","rules","providers","models","memory","image","knowledge","search","skills","mcp","desktop","work","usage","push","about"];function _x(n){try{return n?decodeURIComponent(n):null}catch{return null}}function fw(n,l){if(n==="job"||n==="routine")return l?{kind:n,id:l}:void 0;if(n==="file")return l?{kind:n,path:l,full:!1}:void 0;if(n==="routines"||n==="skills"||n==="knowledge"||n==="rules"||n==="assistant"||n==="jobs"||n==="newRoutine")return{kind:n}}function hw(n){return n.kind==="job"||n.kind==="routine"?`/${n.kind}/${encodeURIComponent(n.id)}`:n.kind==="file"?n.liveId||!n.path?"":`/file/${encodeURIComponent(n.path)}`:`/${n.kind}`}function mw(n){const[l,i,o,c]=n.replace(/^#\/?/,"").split("/"),d=_x(i);return l==="knowledge"?{sel:null,settings:!1,section:null,knowledge:!0}:l==="chat"&&d?{sel:d,settings:!1,section:null,panel:fw(o,_x(c))}:l==="settings"?{sel:null,settings:!0,section:dw.find(m=>m===d)??null}:{sel:null,settings:!1,section:null}}function pw(n,l){if(n.page==="knowledge")return"#/knowledge";if(n.page==="settings")return n.section?`#/settings/${n.section}`:"#/settings";if(!n.sel||l&&n.mobile!=="chat")return"";const i=n.panelStack?.at(-1);return`#/chat/${encodeURIComponent(n.sel)}${i?hw(i):""}`}const gw=["searxng","exa","tavily","brave","serper","jina","firecrawl","perplexity","youcom","ollama"];function h0(){return gw.map(n=>({name:n,enabled:!1}))}class Ue extends Error{status;constructor(l,i){super(i),this.status=l}}async function re(n,l){let i;try{i=await fetch(n,{credentials:"same-origin",...l})}catch(c){throw new Ue(0,`无法连接 Hob:${c instanceof Error?c.message:String(c)}`)}if(!i.ok){let c=`${i.status} ${i.statusText}`;try{const d=await i.json();d?.error&&(c=d.error)}catch{}throw new Ue(i.status,c)}if(i.status===204)return;const o=await i.text();return o?JSON.parse(o):void 0}function $e(n,l="POST"){return{method:l,headers:{"content-type":"application/json"},body:JSON.stringify(n)}}const vw=["rules","assistant","assistant_removed","item","delta","job","delegation","job_step","activity","approval","draft","routine","routine_removed","profile","knowledge","skills"],xw={knowledge:(n={})=>{const l=new URLSearchParams;for(const[i,o]of Object.entries(n))o!==void 0&&o!==""&&l.set(i,String(o));return re(`/api/knowledge?${l}`)},knowledgeEntry:(n,l)=>re(`/api/knowledge/entries/${encodeURIComponent(n)}${l!==void 0?`?chunk=${l}`:""}`),reindexKnowledge:n=>re(`/api/knowledge/collections/${encodeURIComponent(n)}/reindex`,{method:"POST"}),embeddingKey:()=>re("/api/knowledge/embedding"),putEmbedding:(n,l,i)=>re("/api/knowledge/embedding",$e({revision:n,embedding:l,...i?{apiKey:i}:{}},"PUT")),embeddingTest:n=>re("/api/knowledge/embedding/test",$e(n)),createKnowledgeCollection:n=>re("/api/knowledge/collections",$e({name:n})).then(l=>l.collection),renameKnowledgeCollection:(n,l)=>re(`/api/knowledge/collections/${encodeURIComponent(n)}`,$e({name:l},"PATCH")).then(i=>i.collection),deleteKnowledgeCollection:n=>re(`/api/knowledge/collections/${encodeURIComponent(n)}`,{method:"DELETE"}),patchKnowledgeEntry:(n,l)=>re(`/api/knowledge/entries/${encodeURIComponent(n)}`,$e(l,"PATCH")).then(i=>i.entry),deleteKnowledgeEntry:n=>re(`/api/knowledge/entries/${encodeURIComponent(n)}`,{method:"DELETE"}),uploadKnowledge:(n,l)=>{const i=new FormData;for(const o of l)i.append("files",o);return re(`/api/knowledge/upload?collection=${encodeURIComponent(n)}`,{method:"POST",body:i})},me:()=>re("/api/me"),login:n=>re("/api/login",$e({password:n})),logout:()=>re("/api/logout",{method:"POST"}),bootstrap:()=>re("/api/bootstrap"),settings:()=>re("/api/settings"),rules:()=>re("/api/rules"),saveRules:n=>re("/api/rules",$e({rules:n},"PUT")),models:()=>re("/api/models"),putSettings:(n,l)=>re("/api/settings",$e({revision:n,patch:l},"PUT")),providers:()=>re("/api/providers"),claude:()=>re("/api/claude"),saveClaude:(n,l)=>re("/api/claude",$e({revision:n,claude:l},"PUT")),putProvider:(n,l)=>re(`/api/providers/${encodeURIComponent(n)}`,$e(l,"PUT")),putThinking:n=>re("/api/models/thinking",$e(n,"PUT")),deleteProvider:n=>re(`/api/providers/${encodeURIComponent(n)}`,{method:"DELETE"}),testProvider:n=>re("/api/providers/test",$e(n)),discoverProvider:n=>re("/api/providers/discover",$e(n)),providersImport:()=>re("/api/providers/import"),importProviders:n=>re("/api/providers/import",$e({ids:n})),assistantSkills:n=>re(`/api/assistants/${encodeURIComponent(n)}/skills`),patchAssistantSkill:(n,l,i)=>re(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(l)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:i})}),rollbackAssistantSkill:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(l)}/rollback`,{method:"POST"}),deleteAssistantSkill:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(l)}`,{method:"DELETE"}),sedimentJob:n=>re(`/api/jobs/${encodeURIComponent(n)}/sediment`,{method:"POST"}),skills:()=>re("/api/skills"),skillsImport:n=>re(`/api/skills/import/${n}`),importSkills:(n,l,i)=>re(`/api/skills/import/${n}`,$e({ids:l,overwrite:i})),deleteSkill:n=>re(`/api/skills/${encodeURIComponent(n)}`,{method:"DELETE"}),desktop:()=>re("/api/desktop"),saveDesktop:n=>re("/api/desktop",$e(n,"PUT")),saveDesktopPublic:(n,l)=>re("/api/desktop/public",$e({revision:n,assistants:l},"PUT")),testDesktop:()=>re("/api/desktop/test",$e({})),mcp:()=>re("/api/mcp"),putMcp:(n,l)=>re(`/api/mcp/${encodeURIComponent(n)}`,$e(l,"PUT")),patchMcp:(n,l)=>re(`/api/mcp/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(l)}),deleteMcp:n=>re(`/api/mcp/${encodeURIComponent(n)}`,{method:"DELETE"}),testMcp:(n,l)=>re(`/api/mcp/${encodeURIComponent(n)}/test`,$e({refresh:l})),mcpImports:()=>re("/api/mcp/import"),importMcp:n=>re("/api/mcp/import",$e({ids:n})),search:()=>re("/api/search"),putSearch:(n,l,i)=>re("/api/search",$e({revision:n,providers:l,keys:i},"PUT")),testSearch:(n,l,i)=>re("/api/search/test",$e({name:n,baseUrl:l,apiKey:i})),imageKey:()=>re("/api/image"),putImage:(n,l,i)=>re("/api/image",$e({revision:n,image:l,...i?{apiKey:i}:{}},"PUT")),imageTest:n=>re("/api/image/test",$e(n)),changePassword:(n,l)=>re("/api/password",$e({old:n,new:l})),about:()=>re("/api/about"),usage:()=>re("/api/usage"),putUsagePrice:n=>re("/api/usage/price",$e(n,"PUT")),memory:()=>re("/api/memory"),putMemory:(n,l)=>re("/api/memory",$e({revision:n,provider:l},"PUT")),putLore:n=>re("/api/memory/lore",$e(n,"PUT")),loreTest:n=>re("/api/memory/lore-test",$e(n)),loreImport:()=>re("/api/memory/lore/import"),importLore:()=>re("/api/memory/lore/import",{method:"POST"}),items:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}/items?limit=60${l?`&before=${encodeURIComponent(l)}`:""}`),profile:n=>re(`/api/assistants/${encodeURIComponent(n)}/profile`),sendMessage:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}/messages`,$e(l)),stopAssistant:n=>re(`/api/assistants/${encodeURIComponent(n)}/stop`,{method:"POST"}),markRead:n=>re(`/api/assistants/${encodeURIComponent(n)}/read`,{method:"POST"}),patchAssistant:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(l)}),archiveAssistant:n=>re(`/api/assistants/${encodeURIComponent(n)}/archive`,{method:"POST"}),deleteRule:(n,l)=>re(`/api/assistants/${encodeURIComponent(n)}/rules/${encodeURIComponent(l)}`,{method:"DELETE"}),retryDelegation:n=>re(`/api/delegations/${encodeURIComponent(n)}/retry`,{method:"POST"}),answerApproval:(n,l)=>re(`/api/approvals/${encodeURIComponent(n)}`,$e(l)),createDraft:n=>re(`/api/drafts/${encodeURIComponent(n)}/create`,{method:"POST"}),dismissDraft:n=>re(`/api/drafts/${encodeURIComponent(n)}/dismiss`,{method:"POST"}),createRoutine:n=>re("/api/routines",$e(n)),patchRoutine:(n,l)=>re(`/api/routines/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(l)}),deleteRoutine:n=>re(`/api/routines/${encodeURIComponent(n)}`,{method:"DELETE"}),runRoutine:n=>re(`/api/routines/${encodeURIComponent(n)}/run`,{method:"POST"}),replyJob:(n,l)=>re(`/api/jobs/${encodeURIComponent(n)}/reply`,$e({text:l})),stopJob:n=>re(`/api/jobs/${encodeURIComponent(n)}/stop`,{method:"POST"}),transcript:n=>re(`/api/jobs/${encodeURIComponent(n)}/transcript`),jobs:(n={})=>{const l=new URLSearchParams;n.assistantId&&l.set("assistantId",n.assistantId),n.status&&l.set("status",n.status),n.before&&l.set("before",n.before),n.limit&&l.set("limit",String(n.limit));const i=l.toString();return re(`/api/jobs${i?`?${i}`:""}`)},upload:async(n,l)=>{const i=new FormData;i.append("file",n);const o=await re(`/api/uploads?assistantId=${encodeURIComponent(l)}`,{method:"POST",body:i});if(!o.file?.path)throw new Error("上传响应缺少文件路径");return o.file.path},fileUrl:(n,l)=>`/api/files?path=${encodeURIComponent(n)}${l?.inline?"&inline=1":""}${l?.truncate?"&truncate=1":""}${l?.thumb?"&thumb=1":""}`,fileMeta:n=>re(`/api/files/meta?path=${encodeURIComponent(n)}`),jobFiles:(n,l)=>re(`/api/jobs/${encodeURIComponent(n)}/files${l?`?path=${encodeURIComponent(l)}`:""}`),push:()=>re("/api/push"),subscribePush:(n,l)=>re("/api/push/subscribe",$e({subscription:n,label:l})).then(i=>i.push),unsubscribePush:n=>re("/api/push/subscribe",{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})}),testPush:n=>re("/api/push/test",$e(n?{endpoint:n}:{})),visibility:(n,l)=>re("/api/visibility",$e({clientId:n,visible:l})),events:({onEvent:n,onReconnect:l,onDown:i},o)=>{const c=new EventSource(`/api/events${o?`?clientId=${encodeURIComponent(o)}`:""}`);let d=!1;const h=m=>{try{n(JSON.parse(m.data))}catch{}};c.onmessage=h;for(const m of vw)c.addEventListener(m,h);return c.onerror=()=>{d=!0,i(c.readyState===EventSource.CLOSED?"实时连接已断开":"实时连接中断,正在重连")},c.onopen=()=>{d&&(d=!1,l())},()=>c.close()}},bw=60;function yw(n,l){return n.at===l.at?0:n.at<l.at?-1:1}function m0(n,l,i=bw){const o=Array.isArray(l)?l:[l];if(!o.length)return n;const c=n.slice(),d=new Map;c.forEach((h,m)=>d.set(h.id,m));for(const h of o){const m=d.get(h.id);m===void 0?(d.set(h.id,c.length),c.push(h)):c[m]=h}return c.sort(yw),c.length>i?c.slice(-i):c}function kw(n,l,i){const o=n.findIndex(h=>h.id===l);if(o<0)return n;const c=n[o];if(c.kind!=="assistant")return n;const d=n.slice();return d[o]={...c,text:c.text+i},d}function p0(n){const l=n[n.length-1];return l?.kind==="assistant"&&!!l.streaming}function jw(n,l){return n.state==="writing"&&!l.seen&&!l.closed&&l.inChat&&n.assistantId===l.assistantId}function ww(n,l){return n.filter(i=>i.assistantId===l&&i.state==="writing")}const Nw=900,$a=new Map;function g0(n){for(const l of n)$a.has(l)||$a.set(l,window.setTimeout(()=>$a.delete(l),Nw))}function Sw(n){return $a.has(n)}function Tw(){for(const n of $a.values())window.clearTimeout(n);$a.clear()}function v0(n){const l=n.querySelector(".hov.msg > .u, .hov.msg > .b")??n;l.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",block:"center"}),l.classList.remove("quote-flash"),l.offsetWidth,l.classList.add("quote-flash"),window.setTimeout(()=>l.classList.remove("quote-flash"),1100)}function fn(n,l=180){const[i,o]=y.useState(n);return y.useEffect(()=>{if(n){o(!0);return}const c=window.setTimeout(()=>o(!1),l);return()=>window.clearTimeout(c)},[n,l]),{mounted:i,leaving:i&&!n}}function Cw(n,l,i="",o=200){const[c,d]=y.useState([]),[h,m]=y.useState([]),p=y.useRef(null),g=y.useRef(i),v=y.useRef([]),x=y.useRef([]);return y.useEffect(()=>{const C=n.map(l);if(p.current===null||g.current!==i){p.current=new Set(C),g.current=i,v.current=n;return}const T=C.filter(A=>!p.current.has(A)),N=v.current.filter(A=>!C.includes(l(A)));if(p.current=new Set(C),v.current=n,T.length&&(d(A=>[...A,...T]),x.current.push(window.setTimeout(()=>d(A=>A.filter(M=>!T.includes(M))),1e3))),N.length){const A=N.map(M=>({item:M,key:l(M),state:"leave"}));m(M=>[...M,...A]),x.current.push(window.setTimeout(()=>m(M=>M.filter(R=>!A.some(O=>O.key===R.key))),o))}},[n,l,i,o]),y.useEffect(()=>{const C=x.current;return()=>{for(const T of C)window.clearTimeout(T)}},[]),[...n.map(C=>{const T=l(C);return{item:C,key:T,state:c.includes(T)?"enter":"still"}}),...h]}function zc(n){return`pending/${n.id}/${n.name}`}function Ew(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(l=>l.path??zc(l))}:{}}}function Aw(n,l){if(l.kind!=="user"||n.status!=="sending"||l.text!==n.text)return!1;const i=n.attachments.map(c=>c.path),o=l.files??[];return i.length===o.length&&i.every((c,d)=>c===o[d])}const Mw={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"};function er(n){const l=n.lastIndexOf(".");return l===-1?!1:n.slice(l).toLowerCase()in Mw}function Ki(n){return(n.split("/").pop()??n).replace(/^u-[a-z0-9]{6}-/,"")}function x0(n){const l=/^#k\/(k-[\w-]+)(?:\/(\d+))?$/.exec(n.trim());return l?{entryId:l[1],...l[2]!==void 0?{chunk:Number(l[2])}:{}}:null}function b0(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 xc=["off","minimal","low","medium","high","xhigh","max"],uc={off:"关闭",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},zw=40;function Rw(n,l){return l?/gpt/i.test(n)?xc.slice(0,6):[...xc]:["off"]}function Ow(n,l){return l==="google-generative-ai"||l==="google-vertex"?"high":n}function _w(n,l,i,o){if(!l)return{levels:["off"],chars:{},map:{}};const c=Rw(n,l),d=[],h={},m={};for(const p of xc){const g=i?.[p];if(!(g!==void 0?g!==null:c.includes(p))){m[p]=null;continue}d.push(p);const x=typeof g=="string"?g.trim():"";h[p]=x,x?m[p]=x:(p==="xhigh"||p==="max")&&(m[p]=Ow(p,o))}return{levels:d,chars:h,map:m}}function Dw(n){if(!n||typeof n!="object"||Array.isArray(n))return;const l=n,i={};let o=!1;for(const c of xc){if(!(c in l))continue;o=!0;const d=l[c];if(d===null){i[c]=null;continue}const h=typeof d=="string"?d.trim():"";i[c]=h.length<=zw?h:""}if(o)return i.off===null&&(i.off=""),i}const y0={"readme-chat":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-cards":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"readme-rules":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-desktop":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-page":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-knowledge":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-list":{sel:null,panel:"now",collapsed:!1,dark:!1,mobile:"list"},"readme-question":{sel:"page",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"readme-profile":{sel:"page",panel:"assistant",collapsed:!1,dark:!1,mobile:"chat"},image:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-demo":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-think":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-tool":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"act-home":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},boot:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},bubbles:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"bubbles-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"card-130":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"card-130-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"routine-check-dark":{sel:"hob",panel:"routine:r-pr-watch",collapsed:!1,dark:!0,mobile:"chat"},"routine-once":{sel:"hob",panel:"routine:r-pay-rent",collapsed:!1,dark:!1,mobile:"chat"},"routine-once-dark":{sel:"hob",panel:"routine:r-watch-files",collapsed:!1,dark:!0,mobile:"chat"},"routine-once-list":{sel:"hob",panel:"routines",collapsed:!1,dark:!1,mobile:"chat"},s1:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},s2:{sel:"bird",panel:"routine:r-daily",collapsed:!1,dark:!1,mobile:"list"},s3:{sel:"page",panel:"assistant",collapsed:!1,dark:!1,mobile:"list"},s4:{sel:"hob",panel:"now",collapsed:!0,dark:!1,mobile:"list"},s6:{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"list"},mlist:{sel:null,panel:"now",collapsed:!1,dark:!1,mobile:"list"},mchat:{sel:"page",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-running":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-waiting":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-done":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"d-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-hob":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"h-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-settings":{sel:"server",panel:"assistant",collapsed:!1,dark:!1,mobile:"chat"},"h-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"}},wn=(()=>{let n=0;return l=>`${l}${++n}`})();function ne(n,l,i=0){const o=new Date;return o.setDate(o.getDate()-n),o.setHours(l,i,0,0),o.toISOString()}function P(n){return new Date(Date.now()-n*6e4).toISOString()}function $w(n,l,i=0){const o=new Date;return o.setDate(o.getDate()-n),`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}T${String(l).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function he(n){return JSON.parse(JSON.stringify(n))}const Gf=[{id:"claude-sonnet-4-5",provider:"anthropic",input:3200,output:350,cache:.68,weight:1,price:{input:3,output:15,cacheRead:.3,cacheWrite:3.75}},{id:"gpt-5",provider:"openai",input:2900,output:320,cache:.55,weight:.62,price:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{id:"deepseek-chat",provider:"deepseek",input:2100,output:260,cache:.71,weight:.3,price:{input:.28,output:.42,cacheRead:.028,cacheWrite:0}},{id:"glm-4.6",provider:"zhipuai",input:1300,output:150,cache:.4,weight:.12,price:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0}}],Dx=[{id:"hob",name:"Hob",archived:!1,weight:.55,chat:.61},{id:"page",name:"写稿搭子",archived:!1,weight:.3,chat:.22},{id:"ledger",name:"记账管家",archived:!0,weight:.15,chat:.35}];function Uw(n){const l=new Intl.DateTimeFormat("sv-SE",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date),i=Date.parse(`${l}T00:00:00Z`),o=Array.from({length:365},(p,g)=>new Date(i-(364-g)*864e5).toISOString().slice(0,10));let c=7;const d=()=>(c=(c*9301+49297)%233280)/233280,h=Gf.reduce((p,g)=>p+g.weight,0),m=[];return o.forEach((p,g)=>{const v=o.length-1-g,x=v>300?0:v>200?.35:v>90?.7:1,w=(new Date(`${p}T00:00:00Z`).getUTCDay()+6)%7>=5;let C=x*(w?.35:1)*(.3+d()*1.1)*520;d()<.12&&(C=0);for(const T of Gf)for(const N of Dx)for(const A of["chat","job"]){const M=Math.round(C*T.weight*N.weight*(A==="chat"?N.chat:1-N.chat)/h);if(M<=0)continue;const R=M*T.input,O=Math.round(R*T.cache);m.push({day:p,assistantId:N.id,source:A,provider:T.provider,model:T.id,requests:M,input:R-O,output:Math.round(M*T.output),cacheRead:O,cacheWrite:Math.round((R-O)*.15)})}}),{rows:m,assistants:Dx.map(({id:p,name:g,archived:v})=>({id:p,name:g,archived:v}))}}function bc(){const n=new URLSearchParams(globalThis.location?.search??"").get("desktop");return n==="ready"||n==="deployed"||n==="failed"?n:"none"}const Lw={version:"1.7.0",display:{width:1280,height:800},screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}]},Hw={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:[]}},Bw=[{at:P(6),verb:"$",text:"npm run typecheck"},{at:P(5),verb:"读",text:"protocol/src/projection.ts"},{at:P(4),verb:"读",text:"client/src/runtime/store.ts"},{at:P(3),verb:"跑",text:"浏览器 打开 http://localhost:3000/pricing"},{at:P(3),verb:"跑",text:"npm test -w protocol"},{at:P(2),verb:"读",text:"client/src/chat/Transcript.tsx"},{at:P(1),verb:"读",text:"client/src/chat/ToolRow.tsx"}];function qw(n){const l=n==="s1"||n==="s6",i=n==="s4",o=l||n==="mlist",c=!o&&n!=="mchat",d=[{id:"hob",name:"Hob",duty:"主助手",sprite:"hob",primary:!0,pinned:!0,hidden:!1,notify:!0,instructions:"输出用中文短句;编写代码的任务先询问项目目录。",createdAt:ne(30,9,0),last:{text:"已交给任务处理,完成后通知你。",at:ne(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:ne(30,9,0),last:{text:"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。",at:ne(0,10,20)},unread:2,busy:!1},{id:"server",name:"服务器",duty:"线上和机器",sprite:"server",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"清理日志前先查看保留天数的规则。",createdAt:ne(28,9,0),last:{text:"凌晨 3 点清理 2.1GB 旧日志",at:ne(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:ne(7,9,0),splitFrom:{from:"hob",at:ne(7,9,0),conversations:8},last:{text:"今天 6 条,挑选了 2 条重点",at:ne(0,9,0)},unread:0,busy:!1},{id:"house",name:"家里 NAS",duty:"相册和备份",sprite:"house",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:ne(25,9,0),last:{text:"相册备份完成,新增 312 张",at:ne(0,7,30)},unread:0,busy:!1},{id:"coin",name:"记账",duty:"账单和预算",sprite:"coin",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:ne(24,9,0),last:{text:"10 月账单已整理完成,比上月减少 12%",at:ne(1,21,10)},unread:0,busy:!1},{id:"book",name:"读书",duty:"读书笔记",sprite:"book",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:ne(20,9,0),last:{text:"本周读书笔记已整理完成",at:ne(3,20,0)},unread:0,busy:!1},{id:"leaf",name:"健身",duty:"每周训练",sprite:"leaf",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:ne(18,9,0),last:{text:"本周三次训练已记录",at:ne(2,19,0)},unread:0,busy:!1}],h=(E,U,X,oe,ce,ye,Ce,ue,xe)=>({id:E,assistantId:U,title:X,detail:oe,options:ce,status:ye?"answered":"pending",chosen:ye?Ce:void 0,source:"router",ruleText:xe,createdAt:ue,answeredAt:ye?ue:void 0}),p={"ap-publish":h("ap-publish","page","发到公众号吗?",void 0,he([{key:"A",label:"发布"},{key:"B",label:"暂不发布"},{key:"C",label:"以后同类内容直接发布,无需确认",always:!0}]),c,"C",ne(0,7,42),"发公众号"),"ap-split":h("ap-split","hob","是否创建一个专属助手「行业动态」?",l?"这两周你让我查询了 8 次模型和 agent 产品的动态。创建后它会记住你关注的内容,每天早上 9 点提供一份简报。":"这两周你让我查询了 8 次模型和 agent 产品的动态。",[{key:"A",label:"创建专属助手"},{key:"B",label:"暂不创建"}],!o,"A",ne(0,10,15))},g={id:"d-bird",assistantId:"hob",status:i?"pending":"created",name:"行业动态",sprite:"bird",duty:"跟踪模型发布、agent 产品和开源项目",dutyLong:"跟踪模型发布、agent 产品和开源项目",routines:[{name:"每日简报",instruction:"挑最值得看的几条,最多 6 条",schedule:"0 9 * * *"}],routinesText:"每天 09:00 简报,最多 6 条;重要发布随时提醒",askFirst:["花钱订阅","替你对外发消息"],instructions:["关心 agent 编排和本地部署","不看融资新闻"],carry:{conversations:8},createdAssistantId:i?void 0:"bird",createdAt:ne(0,10,17)},v={id:"t-0931",assistantId:"hob",title:"排查页面卡顿",instruction:"排查页面卡顿的原因,不要修改代码。",status:"running",createdAt:P(6),startedAt:P(6),stats:{reads:14,commands:3,edits:0},cwd:"/srv/example/site",activity:he(Bw)},x={id:"t-rounds",assistantId:"hob",title:"整理项目资料",instruction:"整理项目资料并列出缺失项。",status:"running",createdAt:P(40),startedAt:P(5),stats:{reads:5,commands:2,edits:0},rounds:[{status:"done",startedAt:P(40),endedAt:P(30),durationMs:6e5,summary:"已整理资料清单。",files:["/srv/example/list.md"],followUp:"核对缺失的文档。"},{status:"stuck",startedAt:P(25),endedAt:P(15),durationMs:6e5,summary:"缺少接口文档,暂时无法核对。",followUp:"先根据现有资料继续。"}],activity:[{at:P(35),verb:"读",text:"/srv/example/资料"},{at:P(20),verb:"搜",text:"接口文档"},{at:P(3),verb:"读",text:"/srv/example/项目说明"}]},w={id:"t-0927",assistantId:"server",title:"清理旧日志",instruction:"清理三天前的旧日志,不要影响正在运行的服务。",status:"done",createdAt:ne(1,3,0),startedAt:ne(1,3,0),endedAt:ne(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:ne(1,3,0),verb:"$",text:"du -sh /var/log/*"},{at:ne(1,3,1),verb:"读",text:"/var/log/nginx"},{at:ne(1,3,3),verb:"跑",text:"find /var/log -mtime +3 -delete"},...Array.from({length:9},(E,U)=>({at:ne(1,3,4),verb:"读",text:`/srv/example/reports/src/check-${U}.ts`})),{at:ne(1,3,5),verb:"说",text:"已清理 2.1GB,服务均正常运行。"}]},C={id:"t-0929",assistantId:"house",title:"整理相册备份",instruction:"把手机里这个月的照片备份到 NAS,重复的跳过。",status:"done",createdAt:P(58),startedAt:P(58),endedAt:P(51),stats:{reads:6,commands:2,edits:0},summary:"新增 312 张,重复跳过 87 张,占用 4.2GB。",activity:[{at:P(57),verb:"读",text:"/mnt/nas/photos"},{at:P(55),verb:"跑",text:"rsync -a --ignore-existing /sdcard/DCIM /mnt/nas/photos/"},{at:P(51),verb:"说",text:"新增 312 张,占用 4.2GB。"}]},T=[{id:"r-morning",assistantId:"hob",name:"早报",instruction:"汇总昨天交代的事项和今天的重要事项,早上汇报一次。",schedules:["0 8 * * *"],active:!0,createdAt:ne(20,21,0),runs:[{jobId:"t-0901",at:ne(0,8,0),status:"done"}]},{id:"r-weekly-reminder",assistantId:"hob",name:"周报提醒",instruction:"周五下午提醒查看本周周报。",schedules:["0 17 * * 5"],active:!0,createdAt:ne(20,21,2),runs:[]},{id:"r-reconcile",assistantId:"hob",name:"月底对账",instruction:"月末核对账单,列出不一致的项目。",schedules:["0 9 28 * *"],active:!1,createdAt:ne(19,10,0),runs:[{jobId:"t-0820",at:ne(4,9,0),status:"done"}]},{id:"r-daily",skill:"daily-brief",assistantId:"bird",name:"每日简报",instruction:"挑模型发布、agent 产品和开源项目里最值得看的几条,每条一句话说清为什么重要。最多 6 条,不看融资新闻。",schedules:["0 9 * * *"],active:!0,createdAt:ne(7,9,0),runs:[{jobId:"t-0926",at:ne(0,9,0),status:"done",durationMs:372e3,tools:95,tokens:198e3},{jobId:"t-0925",at:ne(1,9,0),status:"done"},{jobId:"t-0924",at:ne(2,9,1),status:"done"},{jobId:"t-0923",at:ne(3,9,0),status:"done"}]},{id:"r-weekly-draft",assistantId:"page",name:"周报初稿",instruction:"每周五 17:00 撰写周报初稿,存入草稿箱,完成后通知我。",schedules:["0 17 * * 5"],active:!0,createdAt:ne(0,10,21),runs:[]},{id:"r-pr-watch",assistantId:"hob",name:"盯新 PR",instruction:"有新的 PR 就看改了哪些文件、值不值得细看,告诉我要不要评审。",schedules:["*/10 * * * *"],active:!0,createdAt:ne(3,14,20),runs:[{jobId:"t-0901",at:ne(1,11,20),status:"done"}],check:{then:"notify",script:String.raw`#!/bin/bash
51
+ # 只报上次之后新开的 PR
52
+ seen=.seen
53
+ touch "$seen"
54
+ curl -s "https://api.github.com/repos/FFatTiger/hob/pulls?state=open&sort=created&direction=desc" |
55
+ jq -r '.[] | "#\(.number) \(.title) · \(.user.login)"' > now.txt
56
+ grep -Fxv -f "$seen" now.txt
57
+ cat now.txt >> "$seen"`},checks:{total:288,hits:3,lastAt:P(4)}},{id:"r-issue-watch",assistantId:"hob",name:"盯 issue 回复",instruction:"有新回复的 issue 看一下,要我回的就拟一份回复草稿。",schedules:["*/30 * * * *"],active:!0,createdAt:ne(6,9,40),runs:[],check:{then:"job",script:"gh api repos/FFatTiger/hob/issues --jq '.[] | select(.comments | length > 0)'"},checks:{total:96,hits:1,lastAt:P(6),failing:"退出码 128:fatal: could not read Username for 'https://github.com': terminal prompts disabled"}},{id:"r-pay-rent",assistantId:"hob",name:"交房租",instruction:"提醒我这个月交房租,别忘了把转账截图存下来。",schedules:[$w(1,9)],active:!1,createdAt:ne(5,20,12),runs:[{jobId:"t-0902",at:ne(1,9,0),status:"done",durationMs:96e3,tools:12,tokens:24e3}],stoppedAt:ne(1,9,1),stopReason:"finished"},{id:"r-watch-files",assistantId:"hob",name:"盯下载目录",instruction:"下载目录里出现新的报销单就告诉我一声。",schedules:["*/15 * * * *"],active:!1,createdAt:ne(2,10,5),runs:[],once:!0,stoppedAt:P(31),stopReason:"hit",check:{then:"notify",script:String.raw`#!/bin/bash
58
+ # 只报上次之后新放进来的报销单
59
+ seen=.seen
60
+ mkdir -p ~/Downloads
61
+ ls ~/Downloads | grep 报销单 > now.txt
62
+ comm -13 <(sort "$seen" 2>/dev/null) <(sort now.txt)
63
+ cp now.txt "$seen"`},checks:{total:42,hits:1,lastAt:P(31)}}],N=(E,U,X,oe)=>({kind:"assistant",id:E,at:U,text:X,routine:oe}),M=[N("i-h1",ne(0,8,0),`早上好。昨晚交代的两件事均已完成:
64
+
65
+ - 写作已将周报初稿存入草稿箱
66
+ - 服务器凌晨 3 点清理了 2.1GB 旧日志`),{kind:"user",id:"i-h3",at:ne(0,10,5),text:"页面为什么这么卡?排查一下原因,不要修改代码。"},N("i-h4",ne(0,10,5),"已交给任务处理,完成后通知你。"),{kind:"job",id:"i-h5",at:ne(0,10,5),jobId:"t-0931"},{kind:"question",id:"i-h6",at:ne(0,10,l?9:15),approvalId:"ap-split"},{kind:"job",id:"i-round-1",at:P(40),jobId:"t-rounds",round:0},{kind:"job",id:"i-round-2",at:P(25),jobId:"t-rounds",round:1},{kind:"job",id:"i-round-3",at:P(5),jobId:"t-rounds",round:2}];l||M.push({kind:"user",id:"i-h7",at:ne(0,10,16),text:"创建专属助手吧。最多 6 条即可,不要包含融资新闻。"},N("i-h8",ne(0,10,17),"草稿如下,需要修改请直接说明:"),{kind:"draft",id:"i-h9",at:ne(0,10,17),draftId:"d-bird"});const R=i?M.filter(E=>!["i-h2","i-h3","i-h4","i-h5"].includes(E.id)):M,O=[N("i-p1",ne(1,17,5),"周报初稿已完成,存放在草稿箱。"),{kind:"user",id:"i-p2",at:ne(1,17,6),text:n==="mchat"?"好,周一发布。":"标题再短一些。"},N("i-p3",ne(1,17,8),n==="mchat"?"好的,周一发布时我会再提醒你。":"已改为《这周:Hob 立项》。"),N("i-p4",ne(0,7,40),"《Grok Bot 能借鉴什么》已完成,3200 字,包含 4 张配图。"),{kind:"file",id:"i-p5",at:ne(0,7,41),path:"/srv/example/notes/Grok Bot 能借鉴什么.md",name:"Grok Bot 能借鉴什么.md",meta:"3200 字 · 4 张图"},{kind:"question",id:"i-p6",at:ne(0,7,42),approvalId:"ap-publish"}];n!=="mchat"&&O.push({kind:"note",id:"i-p7",at:ne(0,7,43),icon:"rule",text:"已记入写作的规则 · 发布公众号无需确认"},N("i-p8",ne(0,7,44),"已发布。[查看文章](https://mp.weixin.qq.com/)"),{kind:"user",id:"i-p9",at:ne(0,10,20),text:"以后周报也由你负责,周五下午提供初稿。"},N("i-p10",ne(0,10,20),"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。"),{kind:"note",id:"i-p11",at:ne(0,10,21),icon:"routine",text:"新增定时任务 · 周报初稿 · 每周五 17:00"});const J=[{kind:"note",id:"i-b0",at:ne(7,9,0),icon:"split",text:`${new Date(ne(7,9,0)).getMonth()+1}月${new Date(ne(7,9,0)).getDate()}日 由 Hob 创建 · 迁移 8 段对话、14 条记忆`},N("i-b1",ne(1,9,0),"昨天 5 条,没有特别要紧的。[看全部 5 条](https://example.com/)",{id:"r-daily",name:"每日简报"}),{kind:"job",id:"i-b-job",at:ne(0,9,0),jobId:"t-0926"},N("i-b2",ne(0,9,0),"今天 6 条,挑选 2 条重点:",{id:"r-daily",name:"每日简报",jobId:"t-0926"}),N("i-b3",ne(0,9,0),`1. DeepSeek 公开 Super-agent 设计:路由只分派,任务隔离执行。
67
+ 2. xAI 的 Grok Bot:常驻 Bot 加定时任务,结果直接回到对话。
68
+
69
+ [看全部 6 条](https://example.com/)`),{kind:"user",id:"i-b4",at:ne(0,9,12),text:"这个和 Hob 相比,差异在哪里?",quote:{itemId:"i-b3",text:"xAI 的 Grok Bot:常驻 Bot 加定时任务…"}},N("i-b5",ne(0,9,12),"它的 Bot 有一台云电脑,能直接操作网页;Bot 之间也能互相发消息。定时任务、审批、助手创建,我们均已具备。"),{kind:"user",id:"i-b6",at:ne(0,9,14),text:"以后不需要包含融资新闻。"},N("i-b7",ne(0,9,14),"好的,已记录。"),{kind:"note",id:"i-b8",at:ne(0,9,14),icon:"memory",text:"记忆已更新 · 不包含融资新闻,优先关注人工智能产品和模型的重要更新与实际应用"},{kind:"note",id:"i-b8-en",at:ne(0,9,14),icon:"memory",text:"记忆已更新 · Follow important AI product and model updates, focusing on practical applications."},{kind:"note",id:"i-b9",at:ne(0,9,15),icon:"skill",text:"已沉淀技能「每日行业简报」,以后定时执行按它做",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md"}],ee=(E,U,X,oe)=>[N(`${E}-1`,ne(1,20,0),U),{kind:"user",id:`${E}-2`,at:ne(1,20,2),text:X},N(`${E}-3`,ne(1,20,3),oe)],B={hob:R,page:O,bird:J,server:[...ee("i-s","凌晨清理日志的任务已完成,清理 2.1GB,服务均正常运行。","好的,以后每月清理一次。","已记录:每月 1 号凌晨 3 点清理一次。"),{kind:"job",id:"i-s4",at:ne(1,3,5),jobId:"t-0927"}],house:ee("i-ho","相册备份已完成,新增 312 张,占用 4.2GB。","硬盘还剩多少?","剩余 1.8TB,可用约半年。"),coin:ee("i-c","10 月账单已整理完成,比上月减少 12%。","哪一类支出较多?","餐饮和打车,比上月增加 800。"),book:ee("i-bk","本周读书笔记已整理完成,共三条。","发给我看看。","已放入文件中。"),leaf:ee("i-lf","本周三次训练已记录。","下周增加到四次。","好的,下周安排四次。")};n==="image"&&(B.hob=[{kind:"user",id:"image-user",at:P(3),text:"画几张图片给我看看。"},{kind:"image",id:"image-done",at:P(3),startedAt:P(3),prompt:"海边的日落",size:"1536x1024",status:"done",path:"/mock/photo.jpg"},{kind:"image",id:"image-failed",at:P(2),startedAt:P(2),prompt:"山间的早晨",status:"failed",error:"图像服务暂时不可用,请稍后重试。"},{kind:"image",id:"image-pending",at:P(1),startedAt:P(1),prompt:"安静的街道",status:"pending"}]),(n==="bubbles"||n==="bubbles-dark")&&(B.hob=[{kind:"user",id:"bubble-user",at:P(3),text:"给我看看公式、代码和媒体。"},N("bubble-text",P(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。"),N("bubble-md",P(2),"我把刚才的示意图整理成 `.md` 文件,图用 Mermaid 写,方便你看源码或直接预览。"),{kind:"job",id:"bubble-job",at:P(2),jobId:"t-0927"},{kind:"file",id:"bubble-file",at:P(2),path:"/mock/火星日落示意图.md",name:"火星日落示意图.md",meta:"349 字"},N("bubble-after-file",P(2),"《火星日落示意图.md》已发给你。直接打开能看 Markdown 源码,用支持 Mermaid 的预览器可以看到光路图。"),{kind:"file",id:"bubble-page",at:P(2),path:"/mock/sunset.html",name:"如果在地球和火星同时看日落",meta:"两幅同视角示意图:看太阳周围,再看远离太阳的天空。"},N("bubble-list",P(2),`五个模块:
70
+
71
+ 1. **两层架构。** Router 长期在线,只负责人机交互、全局协调和派发,**故意不执行任务,甚至可以没有 Bash 工具**;Worker 上下文隔离,**但从不直接对人说话**,只向 Router 报告。
72
+ 2. **全双工。** 把同步 \`run()\` 换成异步 \`start()\` / \`stop()\`,立刻回一句"已开始"。
73
+ - 工具跑完再作为新事件送回来
74
+ - **这个机制默认没开。**
75
+ 3. 普通的一行
76
+ 4. 第四
77
+ 5. 第五
78
+ 6. 第六
79
+ 7. 第七
80
+ 8. 第八
81
+ 9. 第九
82
+ 10. 第十项,两位数的序号也要对齐`),{kind:"file",id:"bubble-audio",at:P(1),path:"/mock/audio.mp3",name:"语音样本.mp3"},{kind:"file",id:"bubble-video",at:P(1),path:"/mock/video.mp4",name:"视频样本.mp4"},{kind:"user",id:"bubble-photo",at:P(1),text:"这个是什么",files:["/mock/photo.jpg"]},{kind:"user",id:"bubble-photo-only",at:P(1),text:"",files:["/mock/photo2.jpg"]},{kind:"user",id:"bubble-photos",at:P(1),text:"两张对比一下",files:["/mock/photo.jpg","/mock/photo2.jpg"]},{kind:"user",id:"bubble-user-file",at:P(1),text:"帮我看看这份报告",files:["/mock/u-k2m9xq-季度报告.pdf"]},{kind:"user",id:"bubble-user-2",at:P(1),text:"画个简单的表格给我,有几种方式?"},N("bubble-table",P(0),`主要有四种:
83
+
84
+ | 方式 | 适合什么情况 | 能不能改 |
85
+ | --- | --- | --- |
86
+ | 聊天里直接画 | 简单的表,看一眼就行 | 让我重画 |
87
+ | 发 Excel 或 CSV 文件 | 要下载、自己改或者算 | 能 |
88
+ | 做成页面 | 能排序、筛选,以后还要更新 | 能 |
89
+ | 做成图片 | 要转发给别人或者发朋友圈 | 不能 |
90
+
91
+ 想要哪种?告诉我放什么内容。`)]);const k={},j={"t-0931":v,"t-rounds":x,"t-0927":w,"t-0929":C,"t-0926":{id:"t-0926",assistantId:"bird",title:"每日简报",instruction:"整理每日简报",status:"done",createdAt:ne(0,8,54),startedAt:ne(0,8,54),endedAt:ne(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")&&(k["dg-sidebar-running"]={id:"dg-sidebar-running",from:"hob",to:"page",text:"整理文章。",createdAt:P(6),status:"running",jobIds:[]},k["dg-sidebar-waiting"]={id:"dg-sidebar-waiting",from:"hob",to:"server",text:"检查服务器。",createdAt:P(5),status:"waiting",jobIds:[]},B.hob.push({kind:"delegation",id:"sidebar-running",at:P(6),delegationId:"dg-sidebar-running"},{kind:"delegation",id:"sidebar-waiting",at:P(5),delegationId:"dg-sidebar-waiting"})),n.startsWith("d-")){const E=n==="d-waiting"||n==="d-mobile"?"waiting":n==="d-done"?"done":"running",U={id:"dg-demo",from:"hob",to:"server",text:"检查服务器磁盘和服务状态,清理前先确认,不要影响正在运行的服务。",createdAt:P(6),status:E,jobIds:["t-delegated"],approvalIds:[]};k[U.id]=U,j["t-delegated"]={...v,id:"t-delegated",assistantId:"server",delegationId:U.id,title:"检查服务器状态",status:E==="waiting"?"waiting":E},E==="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:P(2)}),B.hob=[{kind:"user",id:"d-user",at:P(7),text:"检查一下服务器的磁盘和服务状态。"},{kind:"delegation",id:"d-card",at:P(6),delegationId:U.id}],B.server=[{kind:"user",id:"d-forward",at:P(6),text:U.text,from:{assistantId:"hob",name:"Hob",delegationId:U.id}},{kind:"job",id:"d-job",at:P(5),jobId:"t-delegated"},...E==="waiting"?[{kind:"question",id:"d-question",at:P(2),approvalId:"ap-delegation"}]:[]]}if(n.startsWith("h-")){const E=d.find(U=>U.id==="server");E&&(E.dutyLong="维护服务器、监控服务状态和磁盘空间;代理配置由其他助手负责。"),k["dg-returned"]={id:"dg-returned",from:"hob",to:"server",text:"检查代理节点为什么无法连接。",createdAt:P(4),status:"returned",reply:"退回:代理配置不属于服务器维护职责。",jobIds:[]},B.hob=[{kind:"user",id:"h-forward",at:P(8),text:"检查代理节点为什么无法连接。",from:{assistantId:"server",name:"服务器",delegationId:"hb-demo"}},{kind:"delegation",id:"h-card",at:P(4),delegationId:"dg-returned"}],B.server=[{kind:"user",id:"h-user",at:P(9),text:"检查代理节点为什么无法连接。"},{kind:"note",id:"h-note",at:P(8),icon:"info",text:"已交回 Hob:代理配置不属于我的职责。",handbackId:"hb-demo"},{kind:"user",id:"h-delegation-forward",at:P(4),text:"检查代理节点为什么无法连接。",from:{assistantId:"hob",name:"Hob",delegationId:"dg-returned"}}]}if(n.startsWith("act-")){const E=d.find(U=>U.id==="hob");E.busy=!0,E.activity=n==="act-think"||n==="act-demo"?{state:"thinking",label:"正在想…"}:{state:"tool",label:"搜索:最新 AI 动态"},B.hob=[{kind:"user",id:"act-user",at:P(1),text:"帮我搜索最新 AI 动态。"}],n==="act-home"&&(d.find(U=>U.id==="page").busy=!0)}if(n.startsWith("readme-")){const E=d.find(ce=>ce.id==="page");E.instructions="周报发到团队群;素材在共享盘的周报文件夹。",E.models={work:{ref:"anthropic/claude-sonnet",thinking:"high"},allowed:["anthropic/claude-sonnet","openai/gpt-5"]},E.last={text:"周报已整理好,发送前请确认。",at:P(2)};const U=d.find(ce=>ce.id==="hob");U.busy=!1,U.instructions="",U.last={text:"整理好了,适合用共享文档协作。",at:P(1)},d.splice(0,d.length,...d.filter(ce=>["hob","page","bird","coin"].includes(ce.id)));const X={id:"readme-job",assistantId:"hob",title:"比较团队知识整理方案",instruction:"比较团队资料的整理方式。",status:"done",createdAt:P(8),startedAt:P(8),endedAt:P(2),durationMs:36e4,stats:{reads:3,commands:1,edits:0},summary:"已比较三种方案并整理建议。",activity:[{at:P(7),verb:"读",text:"团队资料/需求.md"},{at:P(6),verb:"搜",text:"团队知识整理方案"},{at:P(4),verb:"读",text:"团队资料/现有流程.md"},{at:P(2),verb:"说",text:"已完成三种方案的比较。"}]},oe={...X,id:"readme-active",assistantId:"bird",title:"整理行业动态",status:"running",endedAt:void 0,durationMs:void 0,createdAt:P(4),startedAt:P(4),activity:[{at:P(1),verb:"搜",text:"本周行业动态"}]};for(const ce of Object.keys(j))delete j[ce];j[X.id]=X,j["readme-weekly"]={id:"readme-weekly",assistantId:"page",title:"整理本周周报",instruction:"整理本周周报初稿。",status:"done",createdAt:P(5),startedAt:P(5),endedAt:P(3),durationMs:12e4,stats:{reads:3,commands:0,edits:1},summary:"已整理周报初稿,等待确认后发送。",activity:[{at:P(4),verb:"读",text:"周报/本周素材.md"},{at:P(3),verb:"说",text:"周报初稿已整理。"}]},n==="readme-list"&&(j[oe.id]=oe),n==="readme-chat"&&(j["readme-active"]={...oe,assistantId:"hob",title:"整理实施清单",instruction:"整理团队资料的实施清单。",activity:[{at:P(1),verb:"读",text:"团队资料/需求.md"}]});for(const ce of Object.keys(p))delete p[ce];p["readme-approval"]={id:"readme-approval",assistantId:"page",title:"将周报发到团队群吗?",detail:"周报初稿已整理好,发送前请确认。",options:[{key:"A",label:"发送"},{key:"B",label:"暂不发送"}],status:"pending",source:"router",createdAt:P(1)},B.hob=[{kind:"user",id:"readme-user",at:P(9),text:"我们团队的资料有点散,比较几种整理方案,给我一个建议。"},N("readme-reply",P(8),"我会比较几种方式,整理成一页给你。"),{kind:"job",id:"readme-job-card",at:P(8),jobId:X.id},N("readme-result",P(1),"建议先用共享文档统一入口,现有资料不用搬家;下面是三种方案的比较。"),{kind:"file",id:"readme-page-card",at:P(1),path:"/mock/readme-page.html",name:"团队资料整理方案",meta:"三种方式的对比与实施建议"}],n==="readme-desktop"&&(B.hob=[{kind:"user",id:"readme-browser-user",at:P(3),text:"打开示例网站,发一张截图给我看看。"},N("readme-browser-reply",P(2),"已在浏览器中打开示例网站,这是当前页面的截图。"),{kind:"file",id:"readme-browser-shot",at:P(1),path:"/mock/desktop.jpg",name:"网页截图.jpg"}]),n==="readme-chat"&&(p["readme-chat-approval"]={id:"readme-chat-approval",assistantId:"hob",title:"将方案发给团队吗?",options:[{key:"A",label:"发送"},{key:"B",label:"暂不发送"}],status:"pending",source:"router",createdAt:P(1)},B.hob=[{kind:"user",id:"readme-user",at:P(9),text:"比较团队资料的整理方式,给我一个建议和实施清单。"},{kind:"job",id:"readme-job-card",at:P(8),jobId:X.id},N("readme-result",P(3),`建议先用**共享文档**统一入口,现有资料不用搬家。
92
+
93
+ - 先建立目录,明确负责人
94
+ - 再逐步整理高频使用的资料`),{kind:"file",id:"readme-page-card",at:P(3),path:"/mock/readme-page.html",name:"团队资料整理方案",meta:"三种方式的对比与实施建议"},{kind:"file",id:"readme-file-card",at:P(2),path:"/mock/knowledge/资料目录.md",name:"资料目录.md",meta:"团队常用资料入口"},{kind:"job",id:"readme-active-card",at:P(2),jobId:"readme-active"},{kind:"question",id:"readme-chat-question",at:P(1),approvalId:"readme-chat-approval"}]),n==="readme-cards"&&(Object.assign(g,{status:"pending",createdAssistantId:void 0,name:"资料助手",dutyLong:"整理团队资料,维护共享目录",routinesText:"每周整理资料",askFirst:["对外发送"],instructions:["优先整理常用资料"],carry:{conversations:3}}),k["readme-delegation"]={id:"readme-delegation",from:"hob",to:"page",text:"整理团队资料的使用说明。",createdAt:P(3),status:"running",jobIds:[]},B.hob=[{kind:"image",id:"readme-image",at:P(4),startedAt:P(4),status:"done",prompt:"团队资料封面",size:"1536x1024",path:"/mock/readme-cover.svg"},{kind:"delegation",id:"readme-delegation-card",at:P(3),delegationId:"readme-delegation"},{kind:"draft",id:"readme-draft-card",at:P(2),draftId:g.id},{kind:"note",id:"readme-note",at:P(1),icon:"memory",text:"记忆已更新 · 优先整理常用资料"}]),B.page=[{kind:"user",id:"readme-weekly-user",at:P(5),text:"整理本周周报,完成后发到团队群。"},{kind:"job",id:"readme-weekly-card",at:P(5),jobId:"readme-weekly"},N("readme-weekly-reply",P(3),"周报初稿已整理好。对外发送前,请先确认。"),{kind:"question",id:"readme-question-card",at:P(1),approvalId:"readme-approval"}]}if(n==="card-130"||n==="card-130-dark"){const E=(X,oe,ce)=>({id:X,assistantId:"hob",title:oe,instruction:oe,status:"done",createdAt:P(50),startedAt:P(50),endedAt:P(40),durationMs:6e5,stats:{reads:4,commands:2,edits:0},activity:[],...ce}),U=[E("t-130-stop","整理项目资料",{status:"stopped",statusReason:"你叫停了",summary:"整理到一半停下了。"}),E("t-130-stuck","核对接口文档",{status:"stuck",statusReason:"沙箱里没有网络,装不上依赖,换镜像也一样;接口文档在共享盘里也没找到,问了两个同事都说不知道放在哪里,先把已经核对过的部分记下来,等你处理网络和文档之后再继续。"}),E("t-130-running","写周报初稿",{sediment:{status:"running"}}),E("t-130-saved","整理行业动态",{sediment:{status:"saved",name:"daily-brief",title:"每日行业简报",version:1,updated:!1}}),E("t-130-updated","对比团队资料方案",{sediment:{status:"saved",name:"daily-brief",title:"每日行业简报",version:3,updated:!0}}),E("t-130-failed","清理旧日志",{sediment:{status:"failed",reason:"技能目录不可写"}}),E("t-130-empty","备份相册",{sediment:{status:"empty",reason:"一次性的事情"}})];for(const X of U)j[X.id]=X;B.hob=[{kind:"user",id:"c-130-user",at:P(60),text:"看看任务卡现在的样子。"},...U.map((X,oe)=>({kind:"job",id:`c-130-${oe}`,at:X.endedAt??X.createdAt,jobId:X.id}))]}return{assistants:d,items:B,jobs:j,delegations:k,approvals:p,drafts:{"d-bird":g},routines:n.startsWith("readme-")?T.filter(E=>E.id==="r-weekly-draft"||E.id==="r-daily"):T,assistantSkills:{bird:[{name:"daily-brief",title:"每日行业简报",description:"整理值得关注的行业动态。",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md",version:2,createdAt:ne(7,9),updatedAt:ne(1,9),uses:3,lastUsedAt:ne(0,9),enabled:!0},{name:"release-watch",title:"重要发布追踪",description:"追踪模型和产品的重要发布。",path:"/mock/assistants/bird/skills/release-watch/SKILL.md",version:1,createdAt:ne(2,9),updatedAt:ne(2,9),uses:0,enabled:!0}]},rules:{hob:[{id:"rule-1",text:"花钱",mode:"ask",changedAt:ne(10,9,0)},{id:"rule-2",text:"改线上服务",mode:"ask",changedAt:ne(10,9,0)},{id:"rule-3",text:"清理我的文件",mode:"ask",changedAt:ne(3,9,0)}],page:n.startsWith("readme-")?[{id:"readme-rule",text:"向团队群发送周报",mode:"ask",changedAt:ne(9,9)}]:[{id:"rule-4",text:"删除草稿",mode:"ask",changedAt:ne(9,9,0)},{id:"rule-5",text:"花钱",mode:"ask",changedAt:ne(9,9,0)},{id:"rule-6",text:"发公众号",mode:"allow",changedAt:P(120)}],bird:[{id:"rule-7",text:"花钱订阅",mode:"ask",changedAt:ne(7,9,0)}]},worklog:{hob:[{at:ne(0,10,5),text:"任务已完成:排查页面卡顿",jobId:"t-0931"},{at:ne(0,8,2),text:"转述写作的审批:发布公众号"},{at:ne(0,8,0),text:"早报:两件事均已完成"}],page:[{at:ne(0,10,21),text:"新增定时任务:周报初稿",jobId:"r-weekly-draft"},{at:ne(0,7,44),text:"发布的文章:Grok Bot 能借鉴什么"},{at:ne(0,7,40),text:"完成《Grok Bot 能借鉴什么》,3200 字"},{at:ne(1,17,8),text:"周报初稿修改标题"}],bird:[{at:ne(0,9,0),text:"每日简报:今天 6 条",jobId:"t-0926"},{at:ne(1,9,0),text:"每日简报:昨天 5 条",jobId:"t-0925"}],server:[{at:ne(1,3,5),text:"任务已完成:清理旧日志",jobId:"t-0927"}],house:[{at:ne(0,7,30),text:"相册备份:新增 312 张"}],coin:[{at:ne(1,21,10),text:"10 月账单已整理"}],book:[],leaf:[]},settings:{revision:1,settings:{general:{theme:n==="d-dark"||n==="h-dark"||n==="act-dark"||n==="readme-dark"||n==="card-130-dark"||n==="routine-check-dark"||n==="routine-once-dark"?"dark":"system",timezone:"Asia/Tokyo",aboutYou:{name:"小林",language:"中文",notes:""}},providers:[{kind:"builtin",id:"anthropic"},{kind:"custom",id:"my-proxy",name:"我的代理",api:"openai-completions",baseUrl:"http://127.0.0.1:8080/v1",models:[{id:"gpt-x",name:"GPT X",input:["text","image"],reasoning:!0,contextWindow:2e5}]}],models:n.startsWith("readme-")?{roster:[{ref:"openai/gpt-5",note:"日常对话",thinking:"low"},{ref:"anthropic/claude-sonnet",note:"整理资料",thinking:"high"}],conversation:{ref:"openai/gpt-5",thinking:"low"},work:{ref:"anthropic/claude-sonnet",thinking:"high"}}:{roster:[{ref:"faux/fast",note:"响应快、成本低,适合日常对话",thinking:"low"},{ref:"faux/smart",note:"能力最强但速度较慢,适合复杂问题",thinking:"high"},{ref:"faux/vision",note:"支持图像输入,适合截图和图片",thinking:"medium"}],conversation:{ref:"faux/fast",thinking:"low"},work:{ref:"faux/smart",thinking:"high"}},image:{source:"off"},search:[{name:"searxng",enabled:!0,baseUrl:"http://127.0.0.1:8888"},{name:"exa",enabled:!0},...h0().filter(E=>E.name!=="searxng"&&E.name!=="exa")],work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}}}}}const jf={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:[]},$x={keyConfigured:!0},Iw=[{id:"anthropic",name:"Anthropic"},{id:"openai",name:"OpenAI"},{id:"google",name:"Google"},{id:"deepseek",name:"DeepSeek"},{id:"openrouter",name:"OpenRouter"}],Yw={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 wf(n,l){return(n.kind==="custom"?n.models.map(o=>({id:o.id,name:o.name?.trim()||o.id,reasoning:o.reasoning===!0})):Yw[n.id]??[]).map(o=>{const c=`${n.id}/${o.id}`,d=l?.[c],h=_w(o.id,o.reasoning,d,n.kind==="custom"?n.api:void 0);return{ref:c,id:o.id,name:o.name,reasoning:o.reasoning,levels:h.levels.map(m=>({level:m,text:h.chars[m]??""})),custom:d!==void 0}})}const Gw="/Users/me/.pi/agent",Kw="/Users/me/.lore",Xw=[{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:"登录授权类凭据无法导入。"}],Zw={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"}]}},Ux=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 Vw(n="s1"){const l=qw(n);let i=n.startsWith("readme-")?[...["删除或覆盖文件、数据和备份","对外发送(消息、邮件、发布)、付费、充值、改计费","停止或重启别人正在使用的服务和设备","修改可能让你失去远程访问的设置(网络、防火墙、登录方式)"].map((k,j)=>({id:`ask-${j}`,text:k,mode:"ask",changedAt:ne(10,9)})),...["过去的记录是线索不是现状:动手前先核实实际状态。","改配置、改数据前先留好退路(备份或记下原值);改完用实际效果验证,不只看命令返回。","凭据(密码、密钥、令牌、Cookie)只在用的时候读取,不回显,不写进文件和报告,也不存起来。"].map((k,j)=>({id:`allow-${j}`,text:k,mode:"allow",changedAt:ne(10,9)}))]:[];new URLSearchParams(globalThis.location?.search??"").has("citation")&&(l.items.hob??=[]).push({kind:"assistant",id:"mock-citation",at:new Date().toISOString(),text:"这里是资料里的结论:[工作记录.md](#k/k-2/0)。"});let o=[{id:"kc-1",name:"工作资料",createdAt:P(1e3),count:0},{id:"kc-2",name:"灵感收藏",createdAt:P(900),count:0}],c=["项目封面.png","产品设计页面.html","工作记录.md","数据汇总.csv","参考文档.pdf","插画.png","会议纪要.md","网站方案.html","预算表.csv","资料.txt","附件.json","录音.mp3"].map((k,j)=>({id:`k-${j}`,origin:j%3===0?"chat":j%3===1?"output":"upload",name:k,description:`项目资料 · ${k},记录设计与工作进展。`,kind:k.endsWith(".png")?"image":k.endsWith(".html")?"html":k.endsWith(".csv")?"csv":k.endsWith(".pdf")?"pdf":k.endsWith(".json")?"json":k.endsWith(".mp3")?"audio":"markdown",path:`/mock/knowledge/${k}`,hash:`hash-${j}`,size:2048+j*1e3,createdAt:P(j<6?j*60:336*60+j),updatedAt:P(j<6?j*60:336*60+j),source:{assistantId:"hob",itemId:n==="bubbles"||n==="bubbles-dark"?["bubble-file","bubble-page","bubble-audio","bubble-video","bubble-job"][j%5]:n==="image"?"image-done":l.items.hob?.[0]?.id},collections:j%2?["kc-1"]:["kc-2"]}));const d=["queued","indexing","ready","failed","unsupported"];c.forEach((k,j)=>{k.index={state:d[j%d.length],...j%d.length===3?{error:"无法读取文件"}:{}}}),n==="readme-knowledge"&&(o=[{id:"kc-1",name:"工作资料",createdAt:P(1e3),count:0}],c=[{name:"团队资料整理方案.html",description:"比较共享文档、知识库和文件夹的适用场景。",kind:"html"},{name:"周报进度表.csv",description:"汇总本周各项工作、负责人和进度。",kind:"csv"},{name:"团队活动封面.png",description:"团队活动通知使用的封面图片。",kind:"image"},{name:"项目会议纪要.md",description:"记录项目讨论的决定与后续安排。",kind:"markdown"},{name:"资料目录.md",description:"收录团队常用资料及其访问入口。",kind:"markdown"}].map((j,E)=>({...j,id:`readme-k-${E}`,origin:E===2?"upload":"output",path:`/mock/knowledge/${j.name}`,hash:`readme-hash-${E}`,size:2048+E*1e3,createdAt:P(E*60),updatedAt:P(E*60),source:{assistantId:"hob"},collections:["kc-1"],index:{state:"ready",chunks:1}})));const h=l.assistants.find(k=>k.id==="hob");h&&(h.knowledge=["kc-1"]);let m=!1;const p=new Set,g=k=>p.forEach(j=>j(k)),v=k=>l.assistants.find(j=>j.id===k),x=new Set(["anthropic","my-proxy"]);let w=he(Hw[bc()]);const C=()=>({providers:l.settings.settings.providers.map(k=>({...k,keyConfigured:x.has(k.id)})),builtin:he(Iw),settings:he(l.settings),models:Object.fromEntries(l.settings.settings.providers.map(k=>[k.id,wf(k,l.settings.settings.models.thinking)]))}),T={revision:l.settings.revision,provider:"local",providerExplicit:!1,lorePlugin:"1.12.5",lore:{configured:!1,baseUrl:null,source:"none",tokenConfigured:!1}},N=[{endpoint:"https://push.example/mock-iphone",label:"iPhone",createdAt:new Date(Date.now()-3*864e5).toISOString()}],A=()=>({publicKey:"BOmockVapidPublicKeyForPreviewOnly",email:l.settings.settings.push.email,devices:he(N)}),M=k=>{const j=[];return k.activity.forEach((E,U)=>{if(E.verb==="$")return;const X=E.text.match(/^浏览器 打开 (\S+)$/),oe=X?"browser_open":E.verb==="读"?"read":E.verb==="跑"?"bash":E.verb==="改"?"edit":E.verb==="说"?"report":"ls";j.push({id:`mock-${k.id}-${U}`,kind:"tool",at:E.at,name:oe,title:oe==="report"?"提交结果":`${E.verb} ${E.text}`,args:X?{url:X[1]}:oe==="bash"?{command:E.text}:oe==="report"?{outcome:"done",summary:E.text}:{path:E.text},output:oe==="report"?"结果已记录。":X?"已打开页面。":`${E.text}
95
+ `,durationMs:120})}),k.id==="t-0931"&&j.push({id:"mock-search",kind:"tool",at:k.createdAt,name:"web_search",title:"联网搜索:浏览器页面性能优化",args:{query:"浏览器页面性能优化"},output:"演示结果:网页性能优化指南。",durationMs:120}),j};function R(k,j){const E=v(k);E&&(Object.assign(E,j),g({type:"assistant",assistant:he(E)}))}function O(k,j){const E=l.items[k]??=[],U=E.findIndex(X=>X.id===j.id);U>=0?E[U]=j:E.push(j),g({type:"item",assistantId:k,item:j})}function J(k,j){R(k,{last:{text:j,at:new Date().toISOString()}})}const ee=()=>{const k=l.settings.settings.usage?.prices??{},j={};for(const E of Gf){const U=k[E.id];j[E.id]=U?{price:U,custom:!0,default:E.price}:{price:E.price,custom:!1}}return{updatedAt:P(90),error:null,models:j}};let B;return{usage:async()=>{const k=l.settings.settings.general.timezone;return B?.timezone!==k&&(B={timezone:k,...Uw(k)}),{timezone:k,rows:B.rows,assistants:B.assistants,prices:ee()}},putUsagePrice:async k=>{if(k.revision!==l.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");const j={...l.settings.settings.usage?.prices??{}};return k.price?j[k.model]=k.price:delete j[k.model],l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,...Object.keys(j).length?{usage:{prices:j}}:{usage:void 0}}},{settings:he(l.settings),price:ee().models[k.model]??null}},knowledge:async(k={})=>{const j=k.q?.toLowerCase(),E=c.filter(X=>(!k.origin||X.origin===k.origin)&&(!k.collection||X.collections.includes(k.collection))&&(!k.kind||b0(X.kind)===k.kind)&&(!k.assistantId||X.source?.assistantId===k.assistantId)&&(!k.before||X.updatedAt<k.before)&&(!j||`${X.name} ${X.description}`.toLowerCase().includes(j))),U=k.limit??50;return{entries:he(E.slice(0,U).map(X=>j?{...X,snippet:X.description??X.name}:X)),hasMore:E.length>U,collections:he(o.map(X=>({...X,count:c.filter(oe=>oe.collections.includes(X.id)).length,indexed:c.filter(oe=>oe.collections.includes(X.id)&&oe.index?.state==="ready").length,failed:c.filter(oe=>oe.collections.includes(X.id)&&oe.index?.state==="failed").length,unsupported:c.filter(oe=>oe.collections.includes(X.id)&&oe.index?.state==="unsupported").length})))}},knowledgeEntry:async(k,j)=>{const E=c.find(U=>U.id===k);if(!E)throw new Ue(404,"文件不存在");return{entry:he(E),...j!==void 0?{chunk:{index:j,heading:E.name,text:"模拟模式中的项目资料。"}}:{}}},reindexKnowledge:async k=>{if(!o.some(j=>j.id===k))throw new Ue(404,"知识库不存在");return c.filter(j=>j.collections.includes(k)&&j.index?.state==="failed").forEach(j=>{j.index={state:"queued"}}),g({type:"knowledge"}),{ok:!0}},embeddingKey:async()=>({keyConfigured:m}),putEmbedding:async(k,j,E)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已在别处修改");return l.settings={revision:k+1,settings:{...l.settings.settings,knowledge:{embedding:j}}},E&&(m=!0),{settings:he(l.settings),keyConfigured:m}},embeddingTest:async()=>({ok:!0,dims:1024}),createKnowledgeCollection:async k=>{const j={id:`kc-${Date.now()}`,name:k,createdAt:new Date().toISOString(),count:0};return o.push(j),g({type:"knowledge"}),he(j)},renameKnowledgeCollection:async(k,j)=>{const E=o.find(U=>U.id===k);if(!E)throw new Ue(404,"知识库不存在");return E.name=j,g({type:"knowledge"}),he(E)},deleteKnowledgeCollection:async k=>{o=o.filter(E=>E.id!==k);const j=c.length;return c=c.filter(E=>!(E.origin==="upload"&&E.collections.length===1&&E.collections[0]===k)).map(E=>({...E,collections:E.collections.filter(U=>U!==k)})),g({type:"knowledge"}),{deleted:j-c.length}},patchKnowledgeEntry:async(k,j)=>{const E=c.find(U=>U.id===k);if(!E)throw new Ue(404,"文件不存在");return Object.assign(E,j),g({type:"knowledge"}),he(E)},deleteKnowledgeEntry:async k=>(c=c.filter(j=>j.id!==k),g({type:"knowledge"}),{ok:!0}),uploadKnowledge:async(k,j)=>{const E=j.map((U,X)=>({id:`k-${Date.now()}-${X}`,origin:"upload",name:U.name,kind:"other",path:URL.createObjectURL(U),hash:`mock-${Date.now()}-${X}`,size:U.size,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),collections:[k]}));return c.unshift(...E),g({type:"knowledge"}),{entries:he(E)}},me:async()=>{},login:async()=>{},logout:async()=>{},bootstrap:async()=>({assistants:he(l.assistants),jobs:he(Object.values(l.jobs)),delegations:he(Object.values(l.delegations)),routines:he(l.routines),approvals:he(Object.values(l.approvals).filter(k=>k.status==="pending")),settings:he(l.settings)}),settings:async()=>he(l.settings),rules:async()=>({rules:he(i)}),saveRules:async k=>(i=k.map(j=>({...j,id:j.id??`rule-${crypto.randomUUID()}`,changedAt:i.find(E=>E.id===j.id&&E.text===j.text&&E.mode===j.mode)?.changedAt??new Date().toISOString()})),g({type:"rules"}),{rules:he(i)}),models:async()=>({...he(jf),models:n.startsWith("readme-")?he(jf.models.slice(0,2)).map((k,j)=>({...k,ref:j?"anthropic/claude-sonnet":"openai/gpt-5",name:j?"Claude Sonnet":"GPT-5"})):he(jf.models),roster:he(l.settings.settings.models.roster)}),providers:async()=>C(),claude:async()=>({settings:he(l.settings),status:{found:!1,loggedIn:!1}}),saveClaude:async(k,j)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已更改,请刷新后重试。");return l.settings={revision:k+1,settings:{...l.settings.settings,claude:j}},{settings:he(l.settings),status:{found:!1,loggedIn:!1}}},putThinking:async k=>{const j=l.settings.settings.providers.find(ce=>k.ref.startsWith(`${ce.id}/`)),E=j?wf(j,l.settings.settings.models.thinking).find(ce=>ce.ref===k.ref):void 0;if(!j||!E)throw new Ue(400,`模型 ${k.ref} 不在已配置的服务商里。`);const U={...l.settings.settings.models.thinking??{}},X=k.levels===null?void 0:Dw(k.levels);X?U[k.ref]=X:delete U[k.ref],l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,models:{roster:l.settings.settings.models.roster,conversation:l.settings.settings.models.conversation,work:l.settings.settings.models.work,...Object.keys(U).length?{thinking:U}:{}}}};const oe=wf(j,l.settings.settings.models.thinking).find(ce=>ce.ref===k.ref);return{settings:he(l.settings),thinking:oe}},putProvider:async(k,j)=>{const E=j,U={...E,id:k};delete U.key;const X=l.settings.settings.providers.filter(oe=>oe.id!==k);return l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,providers:[...X,U]}},E.key&&x.add(k),C()},deleteProvider:async k=>(l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,providers:l.settings.settings.providers.filter(j=>j.id!==k)}},x.delete(k),C()),discoverProvider:async()=>({models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini",name:"GPT X mini"},{id:"gpt-x-vision"}]}),providersImport:async()=>({source:Gw,items:Xw.map(k=>({...k,exists:k.exists||l.settings.settings.providers.some(j=>j.id===k.id)}))}),importProviders:async k=>{const j=k.map(U=>Zw[U]).filter(U=>U!==void 0);if(!j.length)throw new Ue(400,"没有可导入的服务商:请选择状态为可导入的项目。");const E=l.settings.settings.providers.filter(U=>!j.some(X=>X.id===U.id));l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,providers:[...E,...j]}};for(const U of j)x.add(U.id);return C()},testProvider:async()=>{},imageKey:async()=>he($x),putImage:async(k,j,E)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return l.settings={revision:l.settings.revision+1,settings:{...l.settings.settings,image:j}},{settings:he(l.settings),keyConfigured:!!E||$x.keyConfigured}},assistantSkills:async k=>he(l.assistantSkills[k]??[]),patchAssistantSkill:async(k,j,E)=>{const U=l.assistantSkills[k]?.find(X=>X.name===j);if(!U)throw new Error("技能不存在");return U.enabled=E,g({type:"skills",assistantId:k}),he(U)},rollbackAssistantSkill:async(k,j)=>{const E=l.assistantSkills[k]?.find(U=>U.name===j);if(!E||E.version<=1)throw new Error("没有上一版");return E.version--,g({type:"skills",assistantId:k}),he(E)},deleteAssistantSkill:async(k,j)=>(l.assistantSkills[k]=(l.assistantSkills[k]??[]).filter(E=>E.name!==j),g({type:"skills",assistantId:k}),{ok:!0}),sedimentJob:async k=>{if(!l.jobs[k])throw new Error("任务不存在");if(l.jobs[k].status!=="done")throw new Error("任务尚未完成");return l.jobs[k].sediment={status:"running"},g({type:"job",job:he(l.jobs[k])}),setTimeout(()=>{l.jobs[k].sediment={status:"empty",reason:"没有需要沉淀的"},g({type:"job",job:he(l.jobs[k])})},0),{ok:!0}},skills:async()=>{const k=l.settings.settings.skills?.disabled??[],j=(E,U,X,oe,ce=!1)=>({id:E,name:E,description:X,source:U,content:oe,enabled:!k.includes(`${U}:${E}`),overridden:ce});return{skills:[j("weekly-report","hob","按固定结构整理本周进展、风险和下周计划,生成可直接发出的周报。",`# 周报
96
+
97
+ 1. 汇总本周完成的事项
98
+ 2. 列出风险和需要的支持
99
+ 3. 写下周计划`),j("research","hob","查阅可靠来源,交叉核对后整理结论,并为每条结论注明出处。",`# 研究
100
+
101
+ 查阅可靠来源,整理结论并注明出处。`),j("server-checkup","hob","检查主机的磁盘、内存、服务状态和最近的错误日志,给出处理建议。",`# 主机巡检
102
+
103
+ 逐台检查磁盘、内存、服务与日志。`),j("browser","common","在浏览器中打开页面、操作并截图,验证改动是否生效。",`# 浏览器
104
+
105
+ 通过浏览器检查和验证页面。`),j("pdf","common","读取、拆分、合并 PDF,提取其中的表格和文字。",`# PDF
106
+
107
+ 处理 PDF 文件。`),j("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(k,j)=>({imported:j,skipped:[],errors:[]}),deleteSkill:async()=>{},desktop:async()=>he(w),saveDesktop:async k=>(w={...w,revision:w.revision+1,url:k.url,enabled:k.enabled,tokenConfigured:w.tokenConfigured||!!k.token},he(w)),saveDesktopPublic:async(k,j)=>{if(k!==w.revision)throw new Ue(409,"设置已在别处修改,已刷新");return w={...w,revision:w.revision+1,publicAssistants:[...j]},he(w)},testDesktop:async()=>bc()==="failed"?{ok:!1,error:`无法连接 ${w.url},请确认云桌面已部署并启动。`}:w.url?{ok:!0,health:he(Lw)}:{ok:!1,error:"请先填写云桌面地址。"},mcp:async()=>({servers:Nf.servers.map(k=>({...k}))}),putMcp:async()=>({servers:Nf.servers.map(k=>({...k}))}),patchMcp:async()=>({servers:Nf.servers.map(k=>({...k}))}),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 k=>({imported:k,skipped:[]}),search:async()=>({providers:l.settings.settings.search.map(k=>({...k,keyConfigured:k.name==="exa"||k.name==="tavily"}))}),putSearch:async(k,j)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");return l.settings={revision:k+1,settings:{...l.settings.settings,search:j}},he(l.settings)},testSearch:async()=>({ok:!1,error:"演示模式不连接搜索服务商。"}),imageTest:async()=>({ok:!1,error:"演示模式不连接图像生成接口;正式运行时会实际生成图片。"}),putSettings:async(k,j)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");const E=j.models??{};return l.settings={revision:l.settings.revision+1,settings:{general:{...l.settings.settings.general,...j.general??{},aboutYou:{...l.settings.settings.general.aboutYou,...j.general?.aboutYou??{}}},models:{roster:E.roster??l.settings.settings.models.roster,conversation:E.conversation??l.settings.settings.models.conversation,work:E.work??l.settings.settings.models.work,thinkingChoice:E.thinkingChoice??l.settings.settings.models.thinkingChoice,...E.thinking??l.settings.settings.models.thinking?{thinking:E.thinking??l.settings.settings.models.thinking}:{}},providers:l.settings.settings.providers,image:l.settings.settings.image,search:l.settings.settings.search,skills:j.skills??l.settings.settings.skills,usage:l.settings.settings.usage,work:{...l.settings.settings.work,...j.work??{}},push:{...l.settings.settings.push,...j.push??{}}}},he(l.settings)},changePassword:async k=>{if(k!=="test")throw new Ue(403,"旧密码不正确")},about:async()=>({version:"0.1.0",home:"/var/lib/hob"}),memory:async()=>he({...T,revision:l.settings.revision}),putMemory:async(k,j)=>{if(k!==l.settings.revision)throw new Ue(409,"设置已在别处修改,已刷新");if(j==="lore"&&!T.lore.configured)throw new Ue(400,"Lore 尚未配置:请先填写服务地址和 Token 并测试连接");return T.provider=j,T.providerExplicit=!0,l.settings.revision+=1,T.revision=l.settings.revision,he(T)},putLore:async k=>{const j=k.baseUrl.trim().replace(/\/+$/,"");if(!j)throw new Ue(400,"Lore 服务地址不能为空");const E=T.lore.baseUrl===j;return T.lore={configured:E?T.lore.tokenConfigured:!!k.token,baseUrl:j,source:"config",tokenConfigured:E?T.lore.tokenConfigured:!!k.token},he({...T,revision:l.settings.revision})},loreTest:async k=>{const j=(k.baseUrl??T.lore.baseUrl??"").trim().replace(/\/+$/,"");return j?j.startsWith("http://")&&!/^http:\/\/(localhost|127\.0\.0\.1|192\.168\.|10\.)/.test(j)?{ok:!1,reason:"insecure_http"}:!k.token&&!T.lore.tokenConfigured?{ok:!1,reason:"missing_token"}:{ok:!0,baseUrl:j}:{ok:!1,reason:"invalid_url"}},loreImport:async()=>({source:Kw,found:!0,baseUrl:"https://api.loremem.com",tokenPresent:!0}),importLore:async()=>(T.lore={configured:!0,baseUrl:"https://api.loremem.com",source:"config",tokenConfigured:!0},he({...T,revision:l.settings.revision})),items:async k=>({items:he(l.items[k]??[]),approvals:he(Object.values(l.approvals)),jobs:he(Object.values(l.jobs)),drafts:he(Object.values(l.drafts)),delegations:he(Object.values(l.delegations)),hasMore:!1}),profile:async k=>{const j=v(k);if(!j)throw new Error(`没有这个助手:${k}`);return{assistant:he(j),rules:he(l.rules[k]??[]),routines:he(l.routines.filter(U=>U.assistantId===k)),worklog:he(l.worklog[k]??[])}},sendMessage:async(k,j)=>{if(j.text==="模拟发送失败")throw new Error("网络连接已断开");const E=new Date().toISOString();for(const X of Object.values(l.delegations))X.to!==k||X.reportedAt||X.status==="interrupted"||(Object.assign(X,{status:"takenOver",endedAt:E,reportedAt:E}),g({type:"delegation",delegation:he(X)}));for(const X of Object.values(l.approvals))X.assistantId!==k||X.source!=="router"||X.status!=="pending"||(X.status="expired",g({type:"approval",approval:he(X)}));const U={kind:"user",id:wn("mock-u"),at:E,text:j.text,quote:j.quote,files:j.files&&j.files.length?j.files:void 0};return O(k,U),J(k,j.text),R(k,{busy:!0}),setTimeout(()=>{O(k,{kind:"assistant",id:wn("mock-a"),at:new Date().toISOString(),text:"收到。"}),J(k,"收到。"),R(k,{busy:!1})},320),{item:U}},stopAssistant:async k=>R(k,{busy:!1}),markRead:async k=>R(k,{unread:0}),patchAssistant:async(k,j)=>{if(!v(k))throw new Ue(404,"助手不存在。");if(j.rule){const E=l.rules[k]??=[],U=j.rule.id===void 0?void 0:E.find(ye=>ye.id===j.rule.id);if(j.rule.id!==void 0&&!U)throw new Ue(404,"规则不存在。");const X=j.rule.text===void 0?U?.text??"":j.rule.text.trim();if(!X||X.length>1e3)throw new Ue(400,"规则内容不能为空或超过 1000 字。");if(E.some(ye=>ye.id!==j.rule.id&&ye.text===X))throw new Ue(400,"规则内容已存在。");const oe=j.rule.mode??U?.mode;if(oe!=="ask"&&oe!=="allow")throw new Ue(400,"规则模式无效。");const ce={id:U?.id??wn("r-"),text:X,mode:oe,changedAt:new Date().toISOString()};return U?Object.assign(U,ce):E.push(ce),g({type:"profile",assistantId:k}),{rule:he(ce)}}R(k,j)},archiveAssistant:async k=>{const j=v(k);if(!j)throw new Ue(404,"助手不存在");if(j.primary)throw new Ue(400,"主助手不能归档");if(Object.values(l.jobs).filter(U=>U.assistantId===k&&(U.status==="running"||U.status==="queued"||U.status==="waiting")).length)throw new Ue(409,"请等任务结束后再归档");for(const U of l.routines.filter(X=>X.assistantId===k))g({type:"routine_removed",id:U.id});l.routines=l.routines.filter(U=>U.assistantId!==k),l.assistants=l.assistants.filter(U=>U.id!==k),g({type:"assistant_removed",id:k})},deleteRule:async(k,j)=>{l.rules[k]=(l.rules[k]??[]).filter(E=>E.id!==j),g({type:"profile",assistantId:k})},answerApproval:async(k,j)=>{const E=l.approvals[k];if(!E||E.status!=="pending")return;E.status="answered",j.key?E.chosen=j.key:E.answerText=(j.text??"").trim(),E.answeredAt=new Date().toISOString(),E.options.find(X=>X.key===j.key)?.always&&E.ruleText&&((l.rules[E.assistantId]??=[]).push({id:wn("rule"),text:E.ruleText,mode:"allow",changedAt:E.answeredAt}),O(E.assistantId,{kind:"note",id:wn("mock-n"),at:E.answeredAt,icon:"rule",text:`已记入${v(E.assistantId)?.name??""}的规则 · ${E.ruleText}无需确认`}),g({type:"profile",assistantId:E.assistantId})),g({type:"approval",approval:he(E)});for(const X of Object.values(l.delegations))!X.reportedAt&&((X.approvalIds??[]).includes(E.id)||E.jobId&&X.jobIds.includes(E.jobId))&&(X.status="running",E.jobId&&l.jobs[E.jobId]?.status==="waiting"&&(l.jobs[E.jobId].status="running",g({type:"job",job:he(l.jobs[E.jobId])})),g({type:"delegation",delegation:he(X)}))},retryDelegation:async k=>{const j=l.delegations[k];if(!j||j.status!=="interrupted")throw new Ue(400,"只有已中断的委派可以重新转交");const E={...j,id:wn("dg-"),status:"running",createdAt:new Date().toISOString(),jobIds:[],approvalIds:[],reportedAt:void 0,endedAt:void 0};l.delegations[E.id]=E,g({type:"delegation",delegation:he(E)}),O("hob",{kind:"delegation",id:wn("item-"),at:E.createdAt,delegationId:E.id}),O(E.to,{kind:"user",id:wn("item-"),at:E.createdAt,text:E.text,from:{assistantId:"hob",name:"Hob",delegationId:E.id}})},createDraft:async k=>{const j=l.drafts[k];j&&(j.status="created",j.createdAssistantId="bird",g({type:"draft",draft:he(j)}),O(j.assistantId,{kind:"note",id:wn("mock-n"),at:new Date().toISOString(),icon:"split",text:`专属助手已创建 · ${j.name}`}))},dismissDraft:async k=>{const j=l.drafts[k];j&&(j.status="dismissed",g({type:"draft",draft:he(j)}))},createRoutine:async k=>{const j={...k,id:wn("r"),createdAt:new Date().toISOString(),runs:[]};return l.routines.push(j),g({type:"routine",routine:he(j)}),he(j)},patchRoutine:async(k,j)=>{const E=l.routines.find(oe=>oe.id===k);if(!E)return;const{skill:U,...X}=j;Object.assign(E,X),U===null?delete E.skill:U!==void 0&&(E.skill=U),g({type:"routine",routine:he(E)})},deleteRoutine:async k=>{l.routines=l.routines.filter(j=>j.id!==k),g({type:"routine_removed",id:k})},runRoutine:async k=>{const j=l.routines.find(oe=>oe.id===k);if(!j)return;const E=new Date().toISOString(),U={id:wn("t-"),assistantId:j.assistantId,title:`${j.name}(立即运行)`,instruction:j.instruction,status:"running",createdAt:E,startedAt:E,stats:{reads:0,commands:0,edits:0},routineId:j.id,activity:[{at:E,verb:"$",text:`立即运行 ${j.name}`}]};l.jobs[U.id]=U;const X={jobId:U.id,at:E,status:"running"};return j.runs=[X,...j.runs].slice(0,20),O(j.assistantId,{kind:"job",id:wn("mock-j"),at:E,jobId:U.id}),g({type:"job",job:he(U)}),g({type:"routine",routine:he(j)}),J(j.assistantId,`运行定时任务:${j.name}`),{outcome:"job",job:he(U)}},replyJob:async(k,j)=>{const E=l.jobs[k];if(!E)return;E.activity=[...E.activity,{at:new Date().toISOString(),verb:"说",text:j}],g({type:"activity",jobId:k,line:E.activity[E.activity.length-1],stats:he(E.stats)});const U=new Date().toISOString();g({type:"job_step",jobId:k,step:{id:`q${Date.now()}`,kind:"text",at:U,from:"user",text:j,queued:!0}}),setTimeout(()=>g({type:"job_step",jobId:k,step:{id:`u${Date.now()}`,kind:"text",at:new Date().toISOString(),from:"user",text:j}}),4e3)},transcript:async k=>{const j=l.jobs[k];if(!j)throw new Error(`没有这个任务:${k}`);return{job:he(j),steps:M(j)}},jobs:async(k={})=>{let j=Object.values(l.jobs).sort((X,oe)=>oe.createdAt.localeCompare(X.createdAt));if(k.assistantId&&(j=j.filter(X=>X.assistantId===k.assistantId)),k.status&&(j=j.filter(X=>X.status===k.status)),k.before){const X=j.findIndex(oe=>oe.id===k.before);X!==-1&&(j=j.slice(X+1))}const E=k.limit??30;return{jobs:he(j.slice(0,E)),hasMore:j.length>E}},stopJob:async k=>{const j=l.jobs[k];j&&(j.status="stopped",j.endedAt=new Date().toISOString(),g({type:"job",job:he(j)}))},upload:async k=>{await new Promise(E=>setTimeout(E,1200));const j=`/mock/uploads/u-${Math.random().toString(36).slice(2,8).padEnd(6,"0")}-${k.name}`;return Ux.set(j,URL.createObjectURL(k)),j},fileUrl:(k,j)=>k==="/mock/readme-page.html"||n==="readme-knowledge"&&k==="/mock/knowledge/团队资料整理方案.html"?"/mock/readme-page.html":Ux.get(k)??(k==="/srv/example/reports/stats.csv"?`data:text/plain;charset=utf-8,${encodeURIComponent(`项目,大小
108
+ 旧日志,2.1GB
109
+ 服务,正常`)}`:k==="/srv/example/reports/log-cleanup-1031.md"?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 清理报告
110
+
111
+ 已清理旧日志,服务运行正常。`)}`:k.startsWith("/mock/assistants/")?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 每日行业简报
112
+
113
+ 整理值得关注的行业动态。`)}`:k.startsWith("blob:")?k:k.startsWith("/mock/knowledge/")?k.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>')}`:k.endsWith(".html")?`data:text/html;charset=utf-8,${encodeURIComponent("<h1>产品设计页面</h1><p>这是模拟模式中的项目资料。</p>")}`:`data:text/plain;charset=utf-8,${encodeURIComponent("模拟模式中的项目资料。")}`:k.startsWith("/mock/")?k:`data:text/plain;charset=utf-8,${encodeURIComponent(`mock 模式没有真实文件。
114
+
115
+ ${k}`)}`),fileMeta:async k=>{const j=k.split("/").pop()??k,E=j.lastIndexOf("."),U=E>0?j.slice(E).toLowerCase():"",X=[".png",".jpg",".jpeg",".webp",".gif"].includes(U)?"image":U===".md"?"markdown":U===".csv"?"csv":U===".html"?"html":U===".json"?"json":"text";return{path:k,name:j,size:2048,modifiedAt:new Date().toISOString(),mime:X==="image"?`image/${U===".jpg"?"jpeg":U.slice(1)}`:"text/plain; charset=utf-8",kind:X,...k==="/mock/readme-page.html"?{page:!0}:{},text:X!=="image"}},jobFiles:async(k,j)=>{const E=l.jobs[k];if(!E)throw new Ue(404,"任务不存在");const U="/srv/example/reports",X=ye=>({type:"file",path:`${U}/${ye}`,rel:ye,name:ye.split("/").pop(),size:2048,modifiedAt:E.createdAt,kind:ye.endsWith(".md")?"markdown":ye.endsWith(".csv")?"csv":"code"}),oe=k!=="t-0927"?[]:j?j==="src"?[{type:"directory",path:`${U}/src/checks`,rel:"src/checks",name:"checks",count:1},X("src/main.ts")]:j==="src/checks"?[X("src/checks/logs.ts")]:[]:[{type:"directory",path:`${U}/src`,rel:"src",name:"src",count:2},X("log-cleanup-1031.md"),X("stats.csv"),X("notes.txt")],ce=oe.filter(ye=>ye.type==="directory").length;return{files:oe,total:oe.length,directoryCount:ce,fileCount:oe.length-ce}},push:async()=>A(),subscribePush:async(k,j)=>{const E=N.filter(U=>U.endpoint!==k.endpoint);return N.splice(0,N.length,...E,{endpoint:k.endpoint,label:j.trim()||"本机",createdAt:new Date().toISOString()}),A()},unsubscribePush:async k=>{const j=N.findIndex(E=>E.endpoint===k);return j>=0&&N.splice(j,1),A()},testPush:async()=>({sent:1,removed:0}),visibility:async()=>{},events:k=>{p.add(k.onEvent);const j=[];return n==="act-demo"&&(j.push(setTimeout(()=>g({type:"router-activity",assistantId:"hob",activity:{state:"tool",label:"搜索:最新 AI 动态"}}),2500)),j.push(setTimeout(()=>{g({type:"router-activity",assistantId:"hob",activity:null}),g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"正在整理搜索结果…",streaming:!0}})},5500)),j.push(setTimeout(()=>{g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"已整理好最新动态。"}}),g({type:"assistant",assistant:{...l.assistants.find(E=>E.id==="hob"),busy:!1,activity:null}})},7500))),()=>{j.forEach(clearTimeout),p.delete(k.onEvent)}}}}function Qw(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 Jw(n){const l=n.replace(/-/g,"+").replace(/_/g,"/"),i=l.padEnd(Math.ceil(l.length/4)*4,"="),o=atob(i),c=new Uint8Array(o.length);for(let d=0;d<o.length;d+=1)c[d]=o.charCodeAt(d);return c}function xh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function Pw(n,l){return!n||n.byteLength!==l.length?!1:new Uint8Array(n).every((o,c)=>o===l[c])}function Fw(n){const l=n.toJSON(),i=l.keys?.p256dh??"",o=l.keys?.auth??"";return!l.endpoint||!i||!o?null:{endpoint:l.endpoint,keys:{p256dh:i,auth:o}}}async function bh(){return xh()?await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription()??null:null}async function Ww(n){if(!xh())return{error:"这个浏览器不支持推送"};let l=Notification.permission;if(l==="default")try{l=await Notification.requestPermission()}catch{return{error:"浏览器拒绝授予通知权限"}}if(l!=="granted")return{error:"浏览器未授予通知权限"};const i=await navigator.serviceWorker.getRegistration();if(!i)return{error:"离线页面尚未就绪,请刷新后重试"};const o=Jw(n);let c=await i.pushManager.getSubscription();if(c&&!Pw(c.options.applicationServerKey,o)){try{await c.unsubscribe()}catch{}c=null}if(!c)try{c=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:o.buffer})}catch(h){return{error:`浏览器订阅推送失败:${h instanceof Error?h.message:String(h)}`}}const d=Fw(c);return d?{subscription:d}:{error:"浏览器返回的订阅信息不完整"}}function Ba(n){return n.replace(/```[^\n]*\n?([\s\S]*?)```/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^[ \t]*#{1,6}[ \t]+/gm,"").replace(/^[ \t]*>[ \t]?/gm,"").replace(/^[ \t]*(?:[-*+]|\d+[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/gm,"").replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)*\|?[ \t]*$/gm,"").replace(/[ \t]*\|[ \t]*/g," ").replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gm,"").replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,"$2").replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1").replace(/(^|[^\w*])\*(?=\S)([^*\n]*?\S)\*(?![\w*])/g,"$1$2").replace(/(^|[^\w])_(?=\S)([^_\n]*?\S)_(?!\w)/g,"$1$2").replace(/`([^`\n]+)`/g,"$1").replace(/\s+/g," ").trim()}function eN(n,l){if(l.from==="user"&&!l.queued){const c=n.findIndex(d=>d.queued&&d.text===l.text);c>=0&&(n=n.filter((d,h)=>h!==c))}const i=n.findIndex(c=>c.id===l.id);if(i<0)return[...n,l];const o=n.slice();return o[i]=l,o}function tN(n,l){const i=new Set(l.map(c=>c.id)),o=l.slice();for(const c of n)!i.has(c.id)&&!c.queued&&o.push(c);return o}function Lx(n){const l=[];let i=[];const o=()=>{if(!i.length)return;const c=i.join(`
116
+
117
+ `);return i=[],c};for(const c of n){if(c.kind==="thinking"){const h=c.text?.trim();h&&i.push(h);continue}if(c.kind==="text"&&c.from==="user"){l.push(c);continue}const d=o();l.push(d?{...c,thinking:d}:c)}return{rows:l,thinking:o()??null}}function Po(n,l,i){const o=l&&!i?n.slice(0,8):n;return{rows:o,remaining:n.length-o.length}}const Hx=400,nN=2e5,Bx=3;function sN(n,l){const i=n===""?[]:n.split(`
118
+ `),o=l===""?[]:l.split(`
119
+ `);let c=0;for(;c<i.length&&c<o.length&&i[c]===o[c];)c+=1;let d=i.length,h=o.length;for(;d>c&&h>c&&i[d-1]===o[h-1];)d-=1,h-=1;const m=Math.min(c,Bx),p=Math.min(i.length-d,Bx),g=i.slice(c-m,c).map(v=>({sign:" ",text:v}));return g.push(...lN(i.slice(c,d),o.slice(c,h))),g.push(...i.slice(d,d+p).map(v=>({sign:" ",text:v}))),g.length<=Hx?g:[...g.slice(0,Hx),{sign:" ",text:"…"}]}function lN(n,l){if(!n.length)return l.map(h=>({sign:"+",text:h}));if(!l.length)return n.map(h=>({sign:"-",text:h}));if(n.length*l.length>nN)return[...n.slice(0,190).map(m=>({sign:"-",text:m})),...n.length>190||l.length>190?[{sign:" ",text:"…"}]:[],...l.slice(0,190).map(m=>({sign:"+",text:m}))];const i=Array.from({length:n.length+1},()=>new Int32Array(l.length+1));for(let h=n.length-1;h>=0;h-=1)for(let m=l.length-1;m>=0;m-=1)i[h][m]=n[h]===l[m]?i[h+1][m+1]+1:Math.max(i[h+1][m],i[h][m+1]);const o=[];let c=0,d=0;for(;c<n.length&&d<l.length;)n[c]===l[d]?(o.push({sign:" ",text:n[c]}),c+=1,d+=1):i[c+1][d]>=i[c][d+1]?(o.push({sign:"-",text:n[c]}),c+=1):(o.push({sign:"+",text:l[d]}),d+=1);for(;c<n.length;)o.push({sign:"-",text:n[c++]});for(;d<l.length;)o.push({sign:"+",text:l[d++]});return o}function aN(n,l){const i=n.rounds??[];return[...i,n].map((o,c)=>{const d=c===i.length,h=o.startedAt??(c===0?n.createdAt:i[c-1].endedAt),m=d?void 0:o.endedAt,p=d?void 0:i[c+1]?.startedAt??(c+1===i.length?n.startedAt:void 0);return{job:{...n,...o,statusReason:o.statusReason,summary:d&&["running","queued","waiting"].includes(n.status)?void 0:o.summary,files:d&&["running","queued","waiting"].includes(n.status)?void 0:o.files},instruction:c===0?n.instruction:i[c-1].followUp,steps:l?.filter(g=>(!h||g.at>=h)&&(!m||g.at<=m)&&(!p||g.at<p))}})}const iN=new Set(["排队中","进行中","待确认","等你确认","已完成","受阻","失败","已停止"]);function rN(n,l=0){const i=n.rounds?.[l];return i?{...n,status:i.status,statusReason:i.statusReason,startedAt:i.startedAt,endedAt:i.endedAt,durationMs:i.durationMs}:n}function yh(n){const l=n.statusReason?Ba(n.statusReason):"";if(!(!l||iN.has(l)))return l}function oN(n){return n.split(/`/).map((l,i)=>({text:l,mono:i%2===1})).filter(l=>l.text.length>0)}function cN(n,l){const i=n==="dark"||n==="system"&&l;return{dark:i,color:i?"#1b1b1d":"#f6f6f4"}}function uN(n,l){if(n.phase!=="ready")return l?"bg":"side";const i=n.panelStack.at(-1);return i?.kind==="file"&&(l||i.full)?"bg":l?i?.kind==="job"||i?.kind==="jobs"||n.page==="settings"||n.page==="knowledge"?"bg":i||n.sheet?"panel":"bg":n.page==="settings"||n.page==="knowledge"?"bg":"side"}function k0(n,l){const i=document.documentElement;i.style.setProperty("--status-background",`var(--${uN(n,l)})`);const o=getComputedStyle(i).backgroundColor;document.querySelector('meta[name="theme-color"]')?.setAttribute("content",o)}function dN(n,l){return n.kind!==l.kind?!1:n.kind==="routine"&&l.kind==="routine"||n.kind==="job"&&l.kind==="job"?n.id===l.id:n.kind==="file"&&l.kind==="file"?n.liveId||l.liveId?n.liveId===l.liveId:n.path===l.path:!0}function ts(n,l){const i=n.findIndex(o=>dN(o,l));return[...i<0?n:n.slice(0,i),l]}function fN(n,l,i,o){return l!==i&&!o?[]:n}function j0(n){return n.slice(0,-1)}function w0(n,l){return ts(j0(n),l)}function qa(n){return`${n.kind}:${"id"in n?n.id:"path"in n?n.liveId??n.path:""}`}function hN(n,l){const i=new Set(l.map(qa)),o=l.length<n.length;return n.flatMap((c,d)=>i.has(qa(c))?[]:[{page:c,index:d,leaving:o}])}function mN(n,l){const i=n.map(o=>({page:o,leaving:!1}));for(const o of l)i.splice(Math.min(o.index,i.length),0,{page:o.page,leaving:o.leaving});return i}function pN(n,l){return n.filter(i=>i.kind!=="file"||!i.liveId||!!l[i.liveId])}const gN={general:{theme:"system",timezone:"UTC",aboutYou:{name:"",language:"",notes:""}},providers:[],models:{roster:[],conversation:{ref:"",thinking:"low"},work:{ref:"",thinking:"high"}},image:{source:"off"},search:h0(),work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}},Ml=new URLSearchParams(location.search),Ol=Ml.get("mock")==="1",vN=["readme-chat","readme-cards","readme-dark","readme-rules","readme-desktop","readme-page","readme-knowledge","readme-list","readme-question","readme-profile","image","act-demo","act-think","act-tool","act-dark","act-home","boot","bubbles","bubbles-dark","card-130","card-130-dark","routine-check-dark","routine-once","routine-once-dark","routine-once-list","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"],Sf=Ml.get("scene"),Rc=Sf&&vN.includes(Sf)?Sf:"s1",se=Ol?Vw(Rc):xw,kh="hob.theme",N0=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;let qx=!1;function Ix(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 S0(){const n=localStorage.getItem(kh);return n==="light"||n==="dark"||n==="system"?n:null}const T0=Ml.get("dark")==="1",Ws=mw(location.hash);function xN(){const n=y0[Ol?Rc:"s1"],l={phase:"loading",error:null,notice:null,offline:null,assistants:[],jobs:{},delegations:{},routines:[],approvals:{},drafts:{},settings:{revision:0,settings:gN},globalRules:{rules:null,error:null,busy:!1},page:"main",knowledge:{category:"all",q:"",kind:"",assistantId:"",entries:[],collections:[],collectionsLoaded:!1,hasMore:!1,loading:!1,error:null},section:null,sub:null,items:{},itemGen:{},itemPages:{},profiles:{},assistantSkills:{},sidebarJobs:{},sidebarFiles:{},sel:"hob",panelStack:[],livePages:{},steps:{},worklog:null,collapsed:!1,nowWide:!1,theme:S0()??"system",query:"",quote:null,text:"",attachments:[],pending:{},nonce:0,mobile:"list",sheet:!1,search:!1,menu:null,tick:0,updateReady:!1,loggingIn:!1};if(Ol){l.sel=n.sel;const c=Ix(n.panel);l.panelStack=c.kind==="now"?[]:[c],l.collapsed=n.collapsed,l.mobile=n.mobile,l.theme=n.dark?"dark":"light"}const i=Ml.get("a");i&&(l.sel=i),Ws.sel&&(l.sel=Ws.sel),Ws.panel&&(l.panelStack=[Ws.panel]),Ws.knowledge&&(l.page="knowledge"),Ws.settings&&(l.page="settings",l.section=Ws.section);const o=Ml.get("panel");if(o){const c=Ix(o);l.panelStack=c.kind==="now"?[]:[c]}return Ml.get("collapsed")==="1"&&(l.collapsed=!0),T0&&(l.theme="dark"),l}let ie=xN();function bN(){return Ws.sel?!0:Ol?y0[Rc].mobile==="chat":!!Ml.get("a")||window.innerWidth>=768}Ol||T0||S0();const Kf=new Set;function K(n){ie={...ie,...typeof n=="function"?n(ie):n},Kf.forEach(l=>l())}function C0(n){return Kf.add(n),()=>Kf.delete(n)}const ys=()=>ie;function we(){return y.useSyncExternalStore(C0,ys,ys)}function me(n){return n instanceof Ue||n instanceof Error?n.message:String(n)}function Tn(n){const l={};for(const i of n)l[i.id]=i;return l}function Yx(n,l){const i=n.findIndex(c=>c.id===l.id);if(i<0)return[...n,l];const o=n.slice();return o[i]=l,o}function yN(n,l){const i=l.models??{};return{general:{...n.general,...l.general??{},aboutYou:{...n.general.aboutYou,...l.general?.aboutYou??{}}},models:{roster:i.roster??n.models.roster,conversation:i.conversation??n.models.conversation,work:i.work??n.models.work,thinkingChoice:i.thinkingChoice??n.models.thinkingChoice,...i.thinking??n.models.thinking?{thinking:i.thinking??n.models.thinking}:{}},image:n.image,search:n.search,providers:n.providers,work:{...n.work,...l.work??{}},push:{...n.push,...l.push??{}}}}let Gx=Promise.resolve();function jh(n){const l=Gx.then(()=>kN(typeof n=="function"?n(ie.settings.settings):n));return Gx=l.then(()=>{},()=>{}),l}async function kN(n){const l=ie.settings,i={revision:l.revision,settings:yN(l.settings,n)};K({settings:i,theme:i.settings.general.theme}),n.general?.theme&&El(n.general.theme);try{const o=await se.putSettings(l.revision,n);return K({settings:o,theme:o.settings.general.theme}),El(o.settings.general.theme),localStorage.setItem(kh,o.settings.general.theme),!0}catch(o){if(o instanceof Ue&&o.status===409){try{const c=await se.settings();K({settings:c,theme:c.settings.general.theme}),El(c.settings.general.theme)}catch{K({settings:l})}return K({notice:"设置已在别处修改,已刷新"}),!1}return K({settings:l,theme:l.settings.general.theme,notice:`保存失败:${me(o)}`}),El(l.settings.general.theme),!1}}async function jN(n,l){try{return await se.changePassword(n,l),null}catch(i){return me(i)}}async function wN(){try{return await se.about()}catch(n){return K({notice:`无法读取版本信息:${me(n)}`}),null}}async function NN(){try{return{ok:!0,view:await se.usage()}}catch(n){return{ok:!1,error:`无法读取消耗统计:${me(n)}`}}}async function Kx(n,l){try{const i=await se.putUsagePrice({revision:ys().settings.revision,model:n,price:l});return K({settings:i.settings}),{ok:!0,price:i.price}}catch(i){return{ok:!1,error:me(i)}}}async function wh(){try{return await se.models()}catch(n){return K({notice:`无法读取模型列表:${me(n)}`}),null}}let dc=0;async function Xf(){const n=++dc;try{const{rules:l}=await se.rules();n===dc&&K(i=>({globalRules:{...i.globalRules,rules:l,error:null}}))}catch(l){n===dc&&K(i=>({globalRules:{...i.globalRules,error:`无法读取全局规则:${me(l)}`}}))}}async function SN(n){if(ie.globalRules.busy)return!1;K(l=>({globalRules:{...l.globalRules,busy:!0,error:null}}));try{const l=await se.saveRules(n);return++dc,K({globalRules:{rules:l.rules,error:null,busy:!1}}),!0}catch(l){return K(i=>({globalRules:{...i.globalRules,busy:!1,error:`保存失败:${me(l)}`}})),!1}}async function TN(){const n=await se.claude();return K({settings:n.settings}),n}async function CN(n){const l=await se.saveClaude(ie.settings.revision,n);return K({settings:l.settings}),l}async function Nh(n){return K({settings:n.settings}),n}async function EN(){try{return{ok:!0,view:await se.providers()}}catch(n){return{ok:!1,error:me(n)}}}async function Xx(n,l){try{return{ok:!0,view:await Nh(await se.putProvider(n,l))}}catch(i){return{ok:!1,error:me(i)}}}async function AN(n,l){try{const i=await se.putThinking({ref:n,levels:l});return K({settings:i.settings}),{ok:!0,settings:i.settings,thinking:i.thinking}}catch(i){return{ok:!1,error:me(i)}}}async function MN(n){try{return{ok:!0,view:await Nh(await se.deleteProvider(n))}}catch(l){return{ok:!1,error:me(l)}}}async function Zx(n){try{return await se.testProvider(n),null}catch(l){return me(l)}}async function zN(n){try{return{ok:!0,models:(await se.discoverProvider(n)).models}}catch(l){return{ok:!1,error:me(l)}}}async function RN(){try{return{ok:!0,view:await se.providersImport()}}catch(n){return{ok:!1,error:me(n)}}}async function ON(n){try{return{ok:!0,view:await Nh(await se.importProviders(n))}}catch(l){return{ok:!1,error:me(l)}}}const _N=()=>se.skills(),DN=n=>se.skillsImport(n),$N=(n,l,i)=>se.importSkills(n,l,i),UN=n=>se.deleteSkill(n),LN=()=>se.desktop();async function HN(n){const l=await se.saveDesktop(n);return K({settings:await se.settings()}),l}async function BN(n,l){const i=await se.saveDesktopPublic(n,l);return K({settings:await se.settings()}),i}const qN=()=>se.testDesktop(),Vx=()=>se.mcp(),IN=(n,l)=>se.putMcp(n,l),E0=(n,l)=>se.patchMcp(n,l),YN=n=>se.deleteMcp(n),GN=(n,l=!0)=>se.testMcp(n,l),KN=()=>se.mcpImports(),XN=n=>se.importMcp(n),ZN=()=>se.search(),VN=(n,l,i)=>se.testSearch(n,l,i);async function QN(n,l){try{const i=await se.putSearch(ie.settings.revision,n,l);return K({settings:i}),null}catch(i){return i instanceof Ue&&i.status===409&&K({settings:await se.settings()}),me(i)}}const JN=()=>se.embeddingKey(),PN=n=>se.embeddingTest(n);async function FN(n,l){try{const i=await se.putEmbedding(ie.settings.revision,n,l);return K({settings:i.settings}),i}catch(i){throw i instanceof Ue&&i.status===409&&K({settings:await se.settings()}),i}}const WN=(n,l)=>se.knowledgeEntry(n,l),eS=n=>se.reindexKnowledge(n);async function tS(){try{return await se.imageKey()}catch(n){return K({notice:`无法读取图像生成设置:${me(n)}`}),null}}async function Qx(n,l){try{const i=await se.putImage(ie.settings.revision,n,l);return K({settings:i.settings}),{ok:!0,keyConfigured:i.keyConfigured}}catch(i){if(i instanceof Ue&&i.status===409){try{K({settings:await se.settings()})}catch{}return{ok:!1,error:"设置已在别处修改,已刷新,请重新保存",conflict:!0}}return{ok:!1,error:me(i),conflict:!1}}}async function Jx(n){try{return await se.imageTest(n)}catch(l){return{ok:!1,error:`生成测试图片的请求失败:${me(l)}`}}}async function Tf(){try{return{ok:!0,config:await se.memory()}}catch(n){return{ok:!1,error:`无法读取记忆设置:${me(n)}`}}}async function Px(n,l){try{const i=await se.putMemory(n,l);return K(o=>({settings:{...o.settings,revision:Math.max(o.settings.revision,i.revision)}})),{ok:!0,config:i}}catch(i){return{ok:!1,error:me(i)}}}async function nS(n){try{return{ok:!0,config:await se.putLore(n)}}catch(l){return{ok:!1,error:me(l)}}}async function Fx(n){try{return{ok:!0,result:await se.loreTest(n)}}catch(l){return{ok:!1,error:`测试请求失败:${me(l)}`}}}async function sS(){try{return{ok:!0,view:await se.loreImport()}}catch(n){return{ok:!1,error:me(n)}}}async function lS(){try{return{ok:!0,config:await se.importLore()}}catch(n){return{ok:!1,error:me(n)}}}async function lr(){try{return{ok:!0,view:await se.push()}}catch(n){return{ok:!1,error:`无法读取推送设置:${me(n)}`}}}async function aS(){const n=await lr();if(!n.ok)return n;try{const l=await Ww(n.view.publicKey);return"error"in l?{ok:!1,error:l.error}:{ok:!0,view:await se.subscribePush(l.subscription,Qw(navigator.userAgent))}}catch(l){return{ok:!1,error:`订阅推送失败:${me(l)}`}}}async function iS(){try{const n=await bh();if(n)try{await n.unsubscribe()}catch{}return A0(n?.endpoint??await rS())}catch(n){return{ok:!1,error:`关闭推送失败:${me(n)}`}}}async function rS(){const n=await lr();return n.ok?n.view.devices[0]?.endpoint??"":""}async function A0(n){if(!n)return lr();try{return{ok:!0,view:await se.unsubscribePush(n)}}catch(l){return{ok:!1,error:`删除设备失败:${me(l)}`}}}async function oS(){const n=await bh();try{const l=await se.testPush(n?.endpoint);return{ok:!0,sent:l.sent,removed:l.removed}}catch(l){return{ok:!1,error:me(l)}}}const M0=window.matchMedia("(prefers-color-scheme: dark)");function El(n){const{dark:l}=cN(n,M0.matches);document.documentElement.classList.toggle("dark",l),document.documentElement.style.colorScheme=l?"dark":"light",k0(ie,window.innerWidth<768)}M0.addEventListener("change",()=>El(ie.theme));let Wx=!1,eb=null;async function cS(){if(!Wx){if(Wx=!0,El(ie.theme),Ol){if(Rc==="boot")return;await yc();return}try{await se.me()}catch(n){if(n instanceof Ue&&n.status===401){K({phase:"login"});return}K({phase:"error",error:me(n)});return}await yc()}}async function uS(n){if(!ie.loggingIn){K({loggingIn:!0,error:null});try{await se.login(n)}catch(l){K({loggingIn:!1,error:l instanceof Ue&&l.status===401?"密码不正确":`登录失败:${me(l)}`});return}K({loggingIn:!1,phase:"loading"}),await yc()}}async function yc(){try{const n=await se.bootstrap();K({phase:"ready",error:null,offline:null,assistants:n.assistants,jobs:Tn(n.jobs),delegations:Tn(n.delegations??[]),routines:n.routines,approvals:Tn(n.approvals),settings:n.settings,theme:n.settings.settings.general.theme}),El(n.settings.settings.general.theme),localStorage.setItem(kh,n.settings.settings.general.theme),eb||(eb=se.events({onEvent:Zf,onReconnect:()=>{K({offline:null}),yc()},onDown:o=>K({offline:o})},N0),fS());const l=ie.sel&&n.assistants.some(o=>o.id===ie.sel)?ie.sel:n.assistants.find(o=>o.primary)?.id??n.assistants[0]?.id??null;l&&await Pt(l,bN()),ie.page==="knowledge"&&_t();const i=ie.panelStack.at(-1);i?.kind==="job"&&Ah(i.id),i?.kind==="jobs"&&!ie.worklog&&wc()}catch(n){K({phase:"error",error:me(n)})}}const Sh=new Set;function Zf(n){switch((n.type==="item"||n.type==="delta")&&Qi.get(n.assistantId)?.push(n),n.type){case"rules":ie.page==="settings"&&ie.section==="rules"&&Xf();break;case"page-live":{const l=!ie.livePages[n.callId];K(i=>({livePages:{...i.livePages,[n.callId]:n},...jw(n,{seen:!l,closed:Sh.has(n.callId),assistantId:i.sel,inChat:i.page==="main"&&(i.mobile==="chat"||!window.matchMedia("(max-width: 767px)").matches)})?{panelStack:ts(i.panelStack,{kind:"file",path:"",full:!1,liveId:n.callId})}:{}}));break}case"assistant":{const l=n.assistant.unread>0&&z0(n.assistant.id);l&&se.markRead(n.assistant.id).catch(()=>{});const i=l?{...n.assistant,unread:0}:n.assistant;K(o=>({assistants:Yx(o.assistants,i),profiles:o.profiles[i.id]?{...o.profiles,[i.id]:{...o.profiles[i.id],assistant:i}}:o.profiles}));break}case"router-activity":K(l=>({assistants:l.assistants.map(i=>i.id===n.assistantId?{...i,activity:n.activity}:i)}));break;case"assistant_removed":K(l=>({assistants:l.assistants.filter(i=>i.id!==n.id),sel:l.sel===n.id?l.assistants.find(i=>i.primary)?.id??null:l.sel}));break;case"item":{const l=ie.items[n.assistantId];if(!l)break;const i=ie.pending[n.assistantId]??[],o=i.find(c=>Aw(c,n.item));!o&&!l.some(c=>c.id===n.item.id)&&g0([n.item.id]),K(c=>({items:{...c.items,[n.assistantId]:m0(l,n.item)},...o?{pending:{...c.pending,[n.assistantId]:i.filter(d=>d!==o)}}:{}}));break}case"delta":{const l=ie.items[n.assistantId];if(!l)break;const i=kw(l,n.itemId,n.text);i!==l&&K(o=>({items:{...o.items,[n.assistantId]:i}}));break}case"job":K(l=>({jobs:{...l.jobs,[n.job.id]:n.job}})),dS(n.job.status)&&ie.panelStack.some(l=>l.kind==="job"&&l.id===n.job.id)&&ie.steps[n.job.id]&&Ah(n.job.id);break;case"delegation":K(l=>({delegations:{...l.delegations,[n.delegation.id]:n.delegation}}));break;case"job_step":{const l=ie.steps[n.jobId];if(!l)break;K(i=>({steps:{...i.steps,[n.jobId]:eN(l,n.step)}}));break}case"activity":{const l=ie.jobs[n.jobId];if(!l)break;K(i=>({jobs:{...i.jobs,[n.jobId]:{...l,stats:n.stats,activity:[...l.activity,n.line].slice(-200)}}}));break}case"approval":K(l=>({approvals:{...l.approvals,[n.approval.id]:n.approval}}));break;case"draft":K(l=>({drafts:{...l.drafts,[n.draft.id]:n.draft}}));break;case"routine":K(l=>({routines:Yx(l.routines,n.routine)}));break;case"routine_removed":K(l=>({routines:l.routines.filter(i=>i.id!==n.id),panelStack:l.panelStack.filter(i=>i.kind!=="routine"||i.id!==n.id)}));break;case"skills":ks(n.assistantId);break;case"knowledge":ie.page==="knowledge"&&_t(!1,!0);break;case"profile":R0(n.assistantId);break}}function dS(n){return n==="done"||n==="stuck"||n==="failed"||n==="stopped"}function tb(){se.visibility(N0,document.visibilityState==="visible").catch(()=>{});const n=ie.assistants.find(l=>l.id===ie.sel);n&&n.unread>0&&z0(n.id)&&(K(l=>({assistants:l.assistants.map(i=>i.id===n.id?{...i,unread:0}:i)})),se.markRead(n.id).catch(()=>{}))}function z0(n){return ie.sel===n&&ie.page==="main"&&globalThis.document?.visibilityState==="visible"&&(window.innerWidth>=768||ie.mobile==="chat")}function fS(){qx||(qx=!0,document.addEventListener("visibilitychange",tb),tb())}async function Pt(n,l=!0,i=!1){K(c=>({sel:n,panelStack:fN(c.panelStack,c.sel,n,i),...c.sel!==n&&!i?{worklog:null}:{},...l?{mobile:"chat",...i?{}:{sheet:!1},search:!1}:{},quote:null}));const o=ie.assistants.find(c=>c.id===n);o&&o.unread>0&&(K(c=>({assistants:c.assistants.map(d=>d.id===n?{...d,unread:0}:d)})),se.markRead(n).catch(()=>{})),await Promise.all([hS(n),R0(n)])}const Al=new Map,Vi=new Map,Qi=new Map;async function hS(n){const l=(Al.get(n)??0)+1;Al.set(n,l),Vi.delete(n),Qi.set(n,[]),K(o=>({itemPages:{...o.itemPages,[n]:{hasMore:!1,loading:!1,error:null}}}));const i=new Set(Object.keys(ie.livePages));try{const o=await se.items(n);if(Al.get(n)!==l)return;const c=Qi.get(n)??[];Qi.delete(n),Tw();const d=new Set((o.pageLive??[]).map(h=>h.callId));K(h=>{const m=Object.fromEntries(Object.entries(h.livePages).filter(([p,g])=>g.assistantId!==n||g.state==="done"||!i.has(p)||d.has(p)));return{livePages:m,panelStack:pN(h.panelStack,m)}});for(const h of o.pageLive??[])Zf({type:"page-live",...h});K(h=>({items:{...h.items,[n]:o.items},itemGen:{...h.itemGen,[n]:(h.itemGen[n]??0)+1},itemPages:{...h.itemPages,[n]:{hasMore:o.hasMore,loading:!1,error:null}},jobs:{...h.jobs,...Tn(o.jobs)},approvals:{...h.approvals,...Tn(o.approvals)},drafts:{...h.drafts,...Tn(o.drafts)},delegations:{...h.delegations,...Tn(o.delegations??[])}}));for(const h of c)Zf(h)}catch(o){if(Al.get(n)!==l)return;Qi.delete(n),K({notice:`无法加载对话:${me(o)}`})}}function Th(n,l=!1){const i=Vi.get(n);if(i)return i;const o=ie.itemPages[n],c=ie.items[n]?.[0]?.id;if(!o?.hasMore||!c||o.error&&!l)return Promise.resolve();const d=Al.get(n);K(m=>({itemPages:{...m.itemPages,[n]:{...o,loading:!0,error:null}}}));const h=(async()=>{try{const m=await se.items(n,c);if(Al.get(n)!==d||ie.sel!==n)return;K(p=>{const g=p.items[n]??[],v=new Set(g.map(x=>x.id));return{items:{...p.items,[n]:[...m.items.filter(x=>!v.has(x.id)),...g]},itemPages:{...p.itemPages,[n]:{hasMore:m.hasMore,loading:!1,error:null}},jobs:{...Tn(m.jobs),...p.jobs},approvals:{...Tn(m.approvals),...p.approvals},drafts:{...Tn(m.drafts),...p.drafts},delegations:{...Tn(m.delegations??[]),...p.delegations}}})}catch(m){Al.get(n)===d&&ie.sel===n&&K(p=>({itemPages:{...p.itemPages,[n]:{...p.itemPages[n],loading:!1,error:me(m)}}}))}})();return Vi.set(n,h),h.finally(()=>{Vi.get(n)===h&&Vi.delete(n)}),h}async function R0(n){try{const l=await se.profile(n);K(i=>({profiles:{...i.profiles,[n]:l}}))}catch(l){K({notice:`无法加载档案:${me(l)}`})}}function Ch(n){K({text:n})}function kc(n){K({quote:n,nonce:ie.nonce+1})}const O0=new Map,Vf=new Map,jc=new Map;function $l(n){return jc.get(n)??se.fileUrl(n,{thumb:!0})}function nb(n,l){const i=o=>o.some(c=>c.id===n)?o.map(c=>c.id===n?{...c,...l}:c):o;K(o=>({attachments:i(o.attachments),pending:Object.fromEntries(Object.entries(o.pending).map(([c,d])=>[c,d.map(h=>({...h,attachments:i(h.attachments)}))]))}))}function _0(n,l){const i=O0.get(n.id),o=se.upload(i,l).then(c=>{const d=jc.get(zc(n));return d&&jc.set(c,d),nb(n.id,{status:"done",path:c}),c},c=>{throw Vf.delete(n.id),nb(n.id,{status:"failed"}),c});return o.catch(()=>{}),Vf.set(n.id,o),o}function Qf(n,l){const i=Array.from(n).map(o=>{const c={id:`att-${Math.random().toString(36).slice(2,10)}`,name:o.name,status:"uploading"};return O0.set(c.id,o),er(o.name)&&jc.set(zc(c),URL.createObjectURL(o)),c});K(o=>({attachments:[...o.attachments,...i]})),i.forEach(o=>void _0(o,l))}function sb(n){K(l=>({attachments:l.attachments.filter(i=>i.id!==n)}))}async function mS(n){return Promise.all(n.attachments.map(l=>Vf.get(l.id)??_0(l,n.assistantId)))}function Jf(n,l,i){K(o=>{const c=o.pending[n]??[],d=i?c.map(h=>h.localId===l?{...h,...i}:h):c.filter(h=>h.localId!==l);return{pending:{...o.pending,[n]:d}}})}async function D0(n){Jf(n.assistantId,n.localId,{status:"sending",error:void 0});try{const l=await mS(n),i=await se.sendMessage(n.assistantId,{text:n.text,quote:n.quote,files:l.length?l:void 0});K(o=>({pending:{...o.pending,[n.assistantId]:(o.pending[n.assistantId]??[]).filter(c=>c.localId!==n.localId)},...i?.item?{items:{...o.items,[n.assistantId]:m0(o.items[n.assistantId]??[],i.item)}}:{}}))}catch(l){Jf(n.assistantId,n.localId,{status:"failed",error:me(l)})}}async function lb(){const n=ie.sel,l=ie.text.trim();if(!n||!l&&!ie.attachments.length)return;const i={localId:`local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,assistantId:n,at:new Date().toISOString(),text:l,...ie.quote?{quote:ie.quote}:{},attachments:ie.attachments,status:"sending"};g0([i.localId]),K(o=>({text:"",quote:null,attachments:[],nonce:o.nonce+1,pending:{...o.pending,[n]:[...o.pending[n]??[],i]}})),await D0(i)}function ab(n,l){const i=ie.pending[n]?.find(o=>o.localId===l);i&&D0(i)}function pS(n,l){Jf(n,l,null)}function $0(n,l){if(!l)return[];const i=n.pending[l]??[],o=n.items[l]??[];return i.length?[...o,...i.map(Ew)]:o}function gS(n,l,i){return l?n.pending[l]?.find(o=>o.localId===i):void 0}async function vS(n){try{await se.stopAssistant(n)}catch(l){K({notice:`停止失败:${me(l)}`})}}async function ib(n,l){const i=ie.approvals[n];if(i){K(o=>({approvals:{...o.approvals,[n]:{...i,status:"answered",...l.key?{chosen:l.key}:{answerText:(l.text??"").trim()}}}}));try{await se.answerApproval(n,l)}catch(o){K({approvals:{...ie.approvals,[n]:i},notice:`提交失败:${me(o)}`})}}}async function xS(n){try{await se.createDraft(n)}catch(l){K({notice:`创建助手失败:${me(l)}`})}}async function bS(n){try{await se.archiveAssistant(n);const l=ie.assistants.find(i=>i.primary);ie.sel===n&&l&&await Pt(l.id)}catch(l){K({notice:`归档失败:${me(l)}`})}}async function yS(n){try{await se.retryDelegation(n)}catch(l){K({notice:`重新转交失败:${me(l)}`})}}async function rb(n,l,i){await L0(n,l,i?"forward":"handback")}async function Eh(n,l,i){await L0(n,l,i?"forward":"delegation")}async function U0(n,l){for(;ie.sel===n&&!(ie.items[n]??[]).some(l)&&ie.itemPages[n]?.hasMore;){const i=ie.items[n]?.[0]?.id;if(await Th(n),ie.itemPages[n]?.error)throw new Error(ie.itemPages[n].error);if(!i||ie.items[n]?.[0]?.id===i)break}return(ie.items[n]??[]).some(l)}async function L0(n,l,i){(ie.sel!==n||!ie.items[n])&&await Pt(n);const o=c=>i==="forward"?c.kind==="user"&&c.from?.delegationId===l:i==="handback"?c.kind==="note"&&c.handbackId===l:c.kind==="delegation"&&c.delegationId===l;try{if(!await U0(n,o)){K({notice:"未找到对应的转交消息"});return}requestAnimationFrame(()=>requestAnimationFrame(()=>document.getElementById(`${i}-${l}`)?.scrollIntoView({block:"center",behavior:"smooth"})))}catch(c){K({notice:`无法定位转交消息:${me(c)}`})}}async function Pf(n,l){try{return await se.replyJob(n,l),!0}catch(i){return K({notice:`发送失败:${me(i)}`}),!1}}async function H0(n){try{await se.stopJob(n)}catch(l){K({notice:`停止失败:${me(l)}`})}}const Fo={};async function ks(n){const l=Fo[n]=(Fo[n]??0)+1;K(i=>({assistantSkills:{...i.assistantSkills,[n]:{skills:i.assistantSkills[n]?.skills??[],loaded:i.assistantSkills[n]?.loaded??!1,loading:!0,error:null}}}));try{const i=await se.assistantSkills(n);Fo[n]===l&&K(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:i,loaded:!0,loading:!1,error:null}}}))}catch(i){Fo[n]===l&&K(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:o.assistantSkills[n]?.skills??[],loaded:o.assistantSkills[n]?.loaded??!1,loading:!1,error:me(i)}}}))}}async function Cf(n,l,i){try{i==="rollback"?await se.rollbackAssistantSkill(n,l):i==="delete"?await se.deleteAssistantSkill(n,l):await se.patchAssistantSkill(n,l,i==="enable"),await ks(n)}catch(o){K({notice:`操作失败:${me(o)}`})}}async function kS(n){try{return await se.sedimentJob(n),!0}catch(l){return K({notice:`沉淀失败:${me(l)}`}),!1}}async function Nl(n,l){const i=ie.routines.find(d=>d.id===n);if(!i)return;const{skill:o,...c}=l;K(d=>({routines:d.routines.map(h=>h.id===n?{...h,...c,...o!==void 0?{skill:o??void 0}:{}}:h)}));try{await se.patchRoutine(n,l)}catch(d){K({routines:ie.routines.map(h=>h.id===n?i:h),notice:`保存失败:${me(d)}`})}}async function jS(n){const l=new Set(ie.routines.map(c=>c.id));let i;try{i=await se.createRoutine(n)}catch(c){K({notice:`创建失败:${me(c)}`});return}const o=i?.id?i:ie.routines.find(c=>!l.has(c.id));o&&K(c=>({panelStack:w0(c.panelStack,{kind:"routine",id:o.id})}))}async function wS(n){try{await se.deleteRoutine(n)}catch(l){K({notice:`删除失败:${me(l)}`})}}async function NS(n){try{const l=await se.runRoutine(n);l?.outcome==="quiet"?K({notice:"检查过了,没有变化"}):l?.outcome==="failed"?K({notice:`检查失败:${l.reason??"原因未知"}`}):l?.outcome==="notify"&&K({notice:"检查有新内容,已发到对话"})}catch(l){K({notice:`运行失败:${me(l)}`})}}async function ar(n,l){const i=ie.assistants.find(c=>c.id===n),o=ie.profiles[n];if(!i)return"助手不存在。";K(c=>({assistants:c.assistants.map(d=>d.id===n?{...d,...l}:d),profiles:c.profiles[n]?{...c.profiles,[n]:{...c.profiles[n],assistant:{...c.profiles[n].assistant,...l}}}:c.profiles}));try{return await se.patchAssistant(n,l),null}catch(c){const d=`保存失败:${me(c)}`;return K(h=>({assistants:h.assistants.map(m=>m.id===n?i:m),profiles:o?{...h.profiles,[n]:o}:h.profiles,notice:d})),d}}async function Ff(n){const l=n.map((o,c)=>({id:o,pinOrder:c})).filter(({id:o,pinOrder:c})=>ie.assistants.find(d=>d.id===o)?.pinOrder!==c);if(!l.length)return null;const i=ie.assistants;K(o=>({assistants:o.assistants.map(c=>{const d=n.indexOf(c.id);return d<0?c:{...c,pinOrder:d}})}));try{return await Promise.all(l.map(({id:o,pinOrder:c})=>se.patchAssistant(o,{pinOrder:c}))),null}catch(o){const c=`保存失败:${me(o)}`;return K({assistants:i,notice:c}),c}}async function SS(n,l,i){try{const o=await se.patchAssistant(n,{rule:{text:l,mode:i}});if(!o?.rule)throw new Error("保存响应缺少规则。");const c=o.rule;return K(d=>{const h=d.profiles[n];return!h||h.rules.some(m=>m.id===c.id)?{}:{profiles:{...d.profiles,[n]:{...h,rules:[...h.rules,c]}}}}),null}catch(o){return`保存失败:${me(o)}`}}async function TS(n,l){try{return await se.patchAssistant(n,{rule:l}),K(i=>{const o=i.profiles[n];return o?{profiles:{...i.profiles,[n]:{...o,rules:o.rules.map(c=>c.id===l.id?{...c,...l,changedAt:new Date().toISOString()}:c)}}}:{}}),null}catch(i){return`保存失败:${me(i)}`}}async function CS(n,l){const i=ie.profiles[n];if(i){K(o=>({profiles:{...o.profiles,[n]:{...i,rules:i.rules.filter(c=>c.id!==l)}}}));try{await se.deleteRule(n,l)}catch(o){K({profiles:{...ie.profiles,[n]:i},notice:`删除失败:${me(o)}`})}}}async function Ah(n){try{const{job:l,steps:i}=await se.transcript(n);K(o=>({jobs:{...o.jobs,[l.id]:l},steps:{...o.steps,[l.id]:o.steps[l.id]?tN(o.steps[l.id],i):i}}))}catch(l){K({notice:`无法加载任务过程:${me(l)}`})}}function Ln(n,l){K(i=>({panelStack:ts(i.panelStack,{kind:"job",id:n,round:l})})),Ah(n)}function B0(n=null){K(l=>({panelStack:ts(l.panelStack,{kind:"jobs"})})),wc({assistantId:n,status:null})}function fr(){const n=ie.panelStack.at(-1);n?.kind==="file"&&n.liveId&&Sh.add(n.liveId),K(l=>({panelStack:j0(l.panelStack)}))}function hr(){for(const n of ie.panelStack)n.kind==="file"&&n.liveId&&Sh.add(n.liveId);K({panelStack:[]})}async function wc(n={}){const l=n.assistantId??null,i=n.status??null;K({worklog:{jobs:[],assistantId:l,status:i,hasMore:!1,loading:!0}});try{const o=await se.jobs({...l?{assistantId:l}:{},...i?{status:i}:{},limit:30});q0(o,l,i)}catch(o){K({worklog:null,notice:`无法加载任务记录:${me(o)}`})}}async function ob(){const n=ie.worklog;if(!n||!n.hasMore||n.loading)return;const l=n.jobs[n.jobs.length-1];K({worklog:{...n,loading:!0}});try{const i=await se.jobs({...n.assistantId?{assistantId:n.assistantId}:{},...n.status?{status:n.status}:{},...l?{before:l.id}:{},limit:30});q0(i,n.assistantId,n.status)}catch(i){K(o=>({worklog:o.worklog?{...o.worklog,loading:!1}:null,notice:`无法加载更多:${me(i)}`}))}}function q0(n,l,i){K(o=>{const c=new Set((o.worklog?.jobs??[]).map(h=>h.id));return{worklog:{jobs:o.worklog&&o.worklog.assistantId===l&&o.worklog.status===i?[...o.worklog.jobs,...n.jobs.filter(h=>!c.has(h.id))]:n.jobs,assistantId:l,status:i,hasMore:n.hasMore,loading:!1},jobs:{...o.jobs,...Tn(n.jobs)}}})}function ir(){K({nonce:ie.nonce+1,mobile:"chat",sheet:!1})}function I0(){const n=ie.assistants.find(l=>l.primary);n&&(Pt(n.id),K({text:"我想创建一个专属助手,负责:",nonce:ie.nonce+1,mobile:"chat",sheet:!1}))}async function ES(n,l){(ie.sel!==n||!ie.items[n])&&await Pt(n),requestAnimationFrame(()=>{document.getElementById(`job-${l}`)?.scrollIntoView({block:"center",behavior:"smooth"})})}function Y0(n){K(l=>({panelStack:ts(l.panelStack,{kind:"routine",id:n})}))}function AS(){K(n=>({panelStack:ts(n.panelStack,{kind:"newRoutine"})}))}function Mh(){K(n=>({panelStack:ts(n.panelStack,{kind:"assistant"})}))}function Wo(n){K(l=>({panelStack:ts(l.panelStack,{kind:n})}))}async function G0(n,l,i){const o={items:[],loaded:!1,loading:!1,loadingMore:!1,hasMore:!1,error:null},c=ie[n][l]??o;if(!(c.loading||i&&(!c.loaded||!c.hasMore))){K(d=>({[n]:{...d[n],[l]:{...c,loading:!0,loadingMore:i,error:null}}}));try{const d=i?c.cursor:void 0,h=n==="sidebarJobs"?await se.jobs({assistantId:l,before:d,limit:20}).then(C=>({items:C.jobs,hasMore:C.hasMore})):await se.knowledge({origin:"output",assistantId:l,before:d,limit:30}).then(C=>({items:C.entries,hasMore:C.hasMore})),m=i?[...c.items,...h.items]:[...h.items,...c.items],p=new Set,g=m.filter(C=>!p.has(C.id)&&!!p.add(C.id)),v=h.items.at(-1),x=i||!c.loaded?v&&("createdAt"in v&&n==="sidebarJobs"?v.id:v.updatedAt):c.cursor,w=i||!c.loaded?h.hasMore:c.hasMore||h.hasMore;K(C=>({[n]:{...C[n],[l]:{items:g,loaded:!0,loading:!1,loadingMore:!1,hasMore:w,error:null,cursor:x}}}))}catch(d){K(h=>({[n]:{...h[n],[l]:{...c,loading:!1,loadingMore:!1,failedMore:i,error:me(d)}}}))}}}function Ef(n,l=!1){return G0("sidebarJobs",n,l)}function Af(n,l=!1){return G0("sidebarFiles",n,l)}let cb=!1;async function MS(){if(cb)return;const n=await se.knowledge({limit:1});cb=!0,K(l=>({knowledge:{...l.knowledge,collections:n.collections,collectionsLoaded:!0}}))}function ub(n,l,i){K({menu:{id:n,x:l,y:i}})}function tr(){ie.menu&&K({menu:null})}let Mf=0;async function _t(n=!1,l=!1){if(n&&(ie.knowledge.loading||!ie.knowledge.hasMore))return;const i=ie.knowledge,o=++Mf;K({knowledge:{...i,loading:n||i.entries.length===0,error:null}});try{const c=await se.knowledge({...i.category==="output"||i.category==="chat"?{origin:i.category}:i.category!=="all"?{collection:i.category}:{},q:i.q,kind:i.kind||void 0,assistantId:i.assistantId,before:n?i.entries.at(-1)?.updatedAt:void 0,limit:l?Math.min(200,Math.max(50,i.entries.length)):50});if(o!==Mf)return;K({knowledge:{...ie.knowledge,entries:n?[...i.entries,...c.entries]:c.entries,collections:c.collections,collectionsLoaded:!0,hasMore:c.hasMore,loading:!1}})}catch(c){o===Mf&&K({knowledge:{...ie.knowledge,loading:!1,error:me(c)}})}}function zl(n){K({knowledge:{...ie.knowledge,...n,hasMore:!1}}),_t()}async function K0(n,l=!0){try{const i=await se.createKnowledgeCollection(n.trim());return l?zl({category:i.id}):await _t(!1,!0),i}catch(i){return K({notice:`新建失败:${me(i)}`}),null}}async function zS(n,l){try{return await se.renameKnowledgeCollection(n,l.trim()),await _t(!1,!0),!0}catch(i){return K({notice:`改名失败:${me(i)}`}),!1}}async function RS(n){try{const{deleted:l}=await se.deleteKnowledgeCollection(n);ie.knowledge.category===n?zl({category:"all"}):await _t(!1,!0),K({notice:l?`已删除知识库,一起删掉 ${l} 个文件`:"已删除知识库"})}catch(l){K({notice:`删除失败:${me(l)}`})}}async function fc(n,l){try{return await se.patchKnowledgeEntry(n,l),await _t(!1,!0),!0}catch(i){return K({notice:`保存失败:${me(i)}`}),!1}}async function OS(n){try{await se.deleteKnowledgeEntry(n),await _t(!1,!0)}catch(l){K({notice:`删除失败:${me(l)}`})}}async function _S(n,l){try{await se.uploadKnowledge(n,l),await _t(!1,!0)}catch(i){K({notice:`上传失败:${me(i)}`})}}function zh(){K({page:"knowledge",panelStack:[],sheet:!1}),_t()}function rr(){K({page:"main",panelStack:[]})}async function DS(n,l){K({page:"main",panelStack:[]}),await Pt(n);try{if(!await U0(n,c=>c.id===l)){K({notice:"未找到对应的对话消息"});return}const i=performance.now()+1500,o=()=>{if(ie.page!=="main"||ie.sel!==n)return;const c=Array.from(document.querySelectorAll("[data-item-id]")).find(d=>d.dataset.itemId===l);if(!c){performance.now()<i?requestAnimationFrame(o):K({notice:"没能定位到这条消息"});return}v0(c)};requestAnimationFrame(o)}catch(i){K({notice:`无法定位对话消息:${me(i)}`})}}function Oc(){K({page:"settings",section:null,sub:null,sheet:!1,search:!1,panelStack:[]})}function Wf(){K({page:"main",panelStack:[]})}function Rl(n){K({section:n,sub:null})}function En(n){K({sub:n})}function Gt(){K({sub:null})}function zf(){K(n=>({nowWide:!n.nowWide}))}function $S(){K({collapsed:!0,sheet:!1})}function US(){K({collapsed:!1,panelStack:[]})}function X0(n){K({query:n})}function eh(n){K({mobile:n,sheet:!1,search:!1})}function LS(){K({sheet:!0})}function Z0(){K({sheet:!1})}function db(n){K({search:n,query:n?ie.query:""})}function HS(){K({notice:null})}function Xa(n){K({notice:n})}function BS(){K({updateReady:!0})}function qS(){K({tick:ie.tick+1})}function Yt(n,l){return se.fileUrl(n,l)}function Rh(n){return se.fileMeta(n)}function V0(n,l){return se.jobFiles(n,l)}function zt(n,l,i){K(o=>({panelStack:ts(o.panelStack,{kind:"file",path:n,full:!1,...l?{title:l}:{},...i})}))}function IS(n){K(l=>({panelStack:ts(l.panelStack,{kind:"file",path:"",full:!1,liveId:n})}))}function YS(){K(n=>{const l=n.panelStack.at(-1);return l?.kind==="file"?{panelStack:w0(n.panelStack,{...l,full:!l.full})}:{}})}const GS=500,fb=10;function Q0(n){const l=y.useRef(null),i=y.useRef(null),o=y.useRef(!1),c=()=>{l.current!==null&&window.clearTimeout(l.current),l.current=null,i.current=null};return y.useEffect(()=>c,[]),{handlers:{onContextMenu(h){h.preventDefault(),c(),ub(n.id,h.clientX,h.clientY)},onPointerDown(h){h.pointerType==="touch"&&(c(),o.current=!1,i.current={x:h.clientX,y:h.clientY},l.current=window.setTimeout(()=>{l.current=null;const m=i.current;m&&(o.current=!0,window.setTimeout(()=>o.current=!1,1e3),ub(n.id,m.x,m.y))},GS))},onPointerMove(h){const m=i.current;m&&(Math.abs(h.clientX-m.x)>fb||Math.abs(h.clientY-m.y)>fb)&&c()},onPointerUp:c,onPointerCancel:c},takeHeld(){return o.current?(o.current=!1,!0):!1}}}function hb(){const n=we(),l=n.menu,i=y.useRef(null);if(y.useEffect(()=>{if(!l)return;const p=v=>{i.current&&!i.current.contains(v.target)&&tr()},g=v=>{v.key==="Escape"&&tr()};return document.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",g),()=>{document.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",g)}},[l]),!l)return null;const o=n.assistants.find(p=>p.id===l.id);if(!o)return null;const c=p=>{tr(),p()},d=o.primary?1:3,h=Math.max(8,Math.min(l.x,window.innerWidth-172)),m=Math.max(8,Math.min(l.y,window.innerHeight-(d*34+16)));return s.jsxs("div",{className:"amenu",ref:i,style:{left:h,top:m,transformOrigin:`${l.x-h}px ${l.y-m}px`},onContextMenu:p=>p.preventDefault(),children:[o.primary?null:s.jsx("button",{onClick:()=>c(()=>void ar(o.id,{pinned:!o.pinned})),children:o.pinned?"取消置顶":"放在顶部"}),o.primary?null:s.jsx("button",{onClick:()=>c(()=>void ar(o.id,{hidden:!o.hidden})),children:o.hidden?"放回列表":"收起这个助手"}),s.jsx("button",{onClick:()=>c(()=>{Pt(o.id,!1),Mh()}),children:"助手设置"})]})}const KS={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp"},XS=/^(?:image|blob|clipboard|pasted|snapshot|untitled|无标题|未命名)(?:[-_ ]?\d+)?(?:\.[a-z0-9]+)?$/i;function Xi(n){return String(n).padStart(2,"0")}function ZS(n){return`${n.getFullYear()}${Xi(n.getMonth()+1)}${Xi(n.getDate())}-${Xi(n.getHours())}${Xi(n.getMinutes())}${Xi(n.getSeconds())}`}function VS(n){const l=n.name.lastIndexOf(".");return l>0?n.name.slice(l).toLowerCase():KS[n.type]??""}function QS(n){if(!n)return[];const l=[];for(const i of Array.from(n.items??[])){if(i.kind!=="file")continue;const o=i.getAsFile();o&&l.push(o)}if(!l.length)for(const i of Array.from(n.files??[]))i&&l.push(i);return l}function JS(n,l=new Date){const i=QS(n);if(!i.length)return[];if((n?.getData?.("text/plain")??"").trim())return[];const o=ZS(l),c=i.length>1;return i.map((d,h)=>{if(d.name&&!XS.test(d.name))return d;const m=`截图-${o}${c?`-${h+1}`:""}${VS(d)}`;return new File([d],m,{type:d.type,lastModified:l.getTime()})})}const J0={};for(const[n,l]of Object.entries({image:"png jpg jpeg gif webp bmp ico avif",table:"csv tsv xls xlsx ods",code:"ts tsx js jsx mjs cjs py go sh bash zsh json jsonl yaml yml toml xml css scss java c cpp h rs rb php sql vue svelte",doc:"md markdown txt pdf doc docx odt rtf",globe:"html htm svg",archive:"zip rar 7z tar gz bz2 xz tgz"}))for(const i of l.split(" "))J0[i]=n;function Ul(n){const l=n.split(/[\\/]/).pop()??"",i=l.lastIndexOf(".");return i>0?J0[l.slice(i+1).toLowerCase()]??"file":"file"}const P0={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"/>',grip:'<circle cx="9" cy="6" r="1"/><circle cx="15" cy="6" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="9" cy="18" r="1"/><circle cx="15" cy="18" r="1"/>',more:'<circle cx="5" cy="12" r="1.2"/><circle cx="12" cy="12" r="1.2"/><circle cx="19" cy="12" r="1.2"/>',doc:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',folder:'<path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',table:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><path d="M3.5 9.5h17M3.5 14.5h17M10 9.5v10"/>',code:'<path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 5l-4 14"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>',archive:'<rect x="4" y="7" width="16" height="13" rx="2"/><rect x="3" y="4" width="18" height="4" rx="1"/><path d="M10 12h4"/>',panel:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M15 4v16"/>',mem:'<path d="M12 3.5 14 9l5.5 2-5.5 2-2 5.5-2-5.5L4.5 11 10 9z"/>',rule:'<path d="M12 3 4 6v6c0 4.5 3.4 8.2 8 9 4.6-.8 8-4.5 8-9V6z"/><path d="m8.5 12 2.5 2.5 4.5-5"/>',chev:'<path d="m9 6 6 6-6 6"/>',down:'<path d="m6 9 6 6 6-6"/>',arrowDown:'<path d="M12 5v14M5.5 12.5 12 19l6.5-6.5"/>',updown:'<path d="m8 9 4-4 4 4M8 15l4 4 4-4"/>',bulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6M10 22h4"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>',send:'<path d="M12 20V5M5.5 11.5 12 5l6.5 6.5"/>',close:'<path d="m6 6 12 12M18 6 6 18"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M15 6.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h1.5"/>',split:'<path d="M4 5h4l8 14h4M4 19h4l8-14h4"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="2"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 7.9h.01"/>',term:'<path d="m5 16 5-4-5-4M12 17h7"/>',dl:'<path d="M12 4v11M7.5 11.5 12 16l4.5-4.5"/><path d="M5 20h14"/>',expand:'<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>',shrink:'<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/>',pointer:'<path d="m5 3 6.5 17 2.3-7.2L21 10.5Z"/>',image:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><circle cx="9" cy="10" r="1.6"/><path d="m20.5 16-4.5-4.5L7 19.5"/>'};function Nc(n,l=16){return`<svg class="i" width="${l}" height="${l}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${P0[n]}</svg>`}function Q({name:n,size:l=16,w:i=1.7,className:o,style:c}){return s.jsx("svg",{className:`i${o?` ${o}`:""}`,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:i,strokeLinecap:"round",strokeLinejoin:"round",style:c,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:P0[n]}})}const _a=["......k.....",".....kok....",".....kook...","..k.koook...",".kokoooook..",".kooooooook.","kooyyyyyyook","koyyeyyeyyok","koyyeyyeyyok","koyyyyyyyyok",".kooyyyyook.","..kkkkkkkk.."],Sn=16,mb="#40261a",Ia={orange:{name:"橙",o:"#ff7a2e",y:"#ffcf4a",bg:"#ffe6d3"},red:{name:"红",o:"#ff5a3c",y:"#ffd2a8",bg:"#ffe3dc"},pink:{name:"粉",o:"#ff6b8a",y:"#ffd6de",bg:"#ffe4ef"},purple:{name:"紫",o:"#8f7bff",y:"#ddd6ff",bg:"#e9e5ff"},blue:{name:"蓝",o:"#4ea3ff",y:"#cfe6ff",bg:"#fff0c4"},slate:{name:"灰蓝",o:"#6f8fb3",y:"#d8e5f2",bg:"#e3eeff"},teal:{name:"青",o:"#20b8b0",y:"#c2f0ea",bg:"#d6f3f1"},green:{name:"绿",o:"#2fbf71",y:"#c9f2da",bg:"#e4f5d9"}},Ve=(n,l)=>[...Array(n).fill(""),...l],_l={hob:{label:"主助手",color:"orange",dx:2,pal:{},art:[]},page:{label:"写作/文档",color:"purple",dx:1,pal:{p:"#ff9db0",g:"#b9c0c8",h:"#ffc21a",b:"#f2c58f"},art:Ve(5,["............kkkk","............kppk","............kppk","............kggk","............khhk","............khhk","............khhk","............khhk","............kbbk",".............kk."])},server:{label:"服务器/运维",color:"slate",dx:2,pal:{h:"#ffc21a",w:"#fff1b8"},art:Ve(2,["......kkkk......",".....khhwwk.....","....khhhhwhk....","....khhhhhhk....","...kkkkkkkkkk..."])},bird:{label:"资讯/动态",color:"blue",dx:0,pal:{l:"#dff3ff",w:"#ffffff"},art:Ve(6,["..........kkkk..",".........kllllk.",".........kwlllk.",".........kllllk.",".........kllllk.","..........kkkk..",".............kk.","..............kk","...............k"])},house:{label:"家/NAS/生活",color:"teal",dx:0,pal:{r:"#ff8b6a",w:"#fff7ea",d:"#9b6b52"},art:Ve(9,["............k...","...........krk..","..........krrrk.",".........krrrrrk","..........kwwwk.","..........kwdwk.","..........kkkkk."])},coin:{label:"钱/记账",color:"green",dx:0,pal:{h:"#ffc21a",w:"#fff1b8",d:"#d18f00"},art:Ve(9,["...........kkk..","..........khhhk.",".........khwdhhk",".........khwdhhk",".........khhdhhk","..........khhhk.","...........kkk.."])},book:{label:"学习/读书",color:"red",dx:2,pal:{d:"#3a3f58",t:"#ffc21a"},art:Ve(1,[".......kk.......",".....kkddkk.....","...kkddddddkk...",".kkddddddddddkk.","...kkddddddkk.t.","....kddddddk..t.","....kkkkkkkk..t.","..............t."])},leaf:{label:"健康/植物",color:"pink",dx:2,pal:{g:"#5ccf6b",s:"#3a9a4f"},art:Ve(0,["....kk.....kk...","...kggk...kggk..","....kggkskggk...",".....kk.s.kk...."])},wifi:{label:"网络/路由器",color:"teal",dx:2,pal:{},art:Ve(0,["......kkkkk.....",".....k.....k....",".......kkk......","......k...k....."])},calendar:{label:"日程/提醒",color:"purple",dx:0,pal:{r:"#ff4d4d",w:"#ffffff"},art:Ve(8,["..........k...k.",".........kkkkkkk",".........krrrrrk",".........kkkkkkk",".........kwwwwwk",".........kwwkwwk",".........kwwwwwk",".........kkkkkkk"])},chef:{label:"做饭/饮食",color:"red",dx:2,pal:{w:"#ffffff",g:"#d9dde2"},art:Ve(1,[".....kk..kk.....","....kwwkkwwk....","...kwwwwwwwwk...","...kwwwwwwwwk...","....kwwwwwwk....","....kggggggk....","....kkkkkkkk...."])},chart:{label:"股票/数据",color:"slate",dx:0,pal:{w:"#ffffff",g:"#f04848"},art:Ve(9,[".........kkkkkkk",".........kwwwwgk",".........kwwgwgk",".........kwwgwgk",".........kgwgwgk",".........kgwgwgk",".........kkkkkkk"])},bag:{label:"旅行/出行",color:"blue",dx:0,pal:{b:"#e8833a",s:"#ffd59a"},art:Ve(9,["...........kkk..","...........k.k..",".........kkkkkkk",".........kbsbsbk",".........kbsbsbk",".........kbsbsbk",".........kkkkkkk"])},paw:{label:"宠物",color:"purple",dx:0,pal:{c:"#ffb36b",p:"#ff8fa6"},art:Ve(9,[".........k.....k",".........kck.kck",".........kccccck",".........kckckck",".........kccpcck","..........kkkkk."])},note:{label:"音乐",color:"pink",dx:1,pal:{},art:Ve(2,["..............k.","..............kk","..............kk","..............k.","..............k.","............kkk.","............kkk."])},code:{label:"代码/开发",color:"green",dx:0,pal:{d:"#2b3240",g:"#6ef0a0"},art:Ve(10,[".........kkkkkkk",".........kgddddk",".........kdgdddk",".........kgdggdk",".........kdddddk",".........kkkkkkk"])},gym:{label:"健身/运动",color:"blue",dx:2,pal:{r:"#ff3b5c"},art:Ve(9,["...krrrrrrrrk...","..krrrrrrrrrrkr.","...............r"])},sticky:{label:"需求/产品负责人",color:"purple",dx:0,pal:{n:"#ffe066",d:"#c9a227"},art:Ve(9,[".........kkkkkkk",".........knnnnnk",".........kdddnnk",".........knnnnnk",".........kddddnk",".........knnnnkk",".........kkkkkk."])},timer:{label:"迭代/敏捷教练",color:"teal",dx:0,pal:{w:"#ffffff",r:"#ff5a3c"},art:Ve(8,["...........kkk..","............k...","..........kkkkk.",".........kwwrwwk",".........kwwrwwk",".........kwwkkwk",".........kwwwwwk","..........kkkkk."])},bug:{label:"测试/质量",color:"green",dx:0,pal:{r:"#ff4d4d"},art:Ve(8,["..........k...k.","...........kkk..","..........krrrk.",".........krkrkrk",".........krrrrrk",".........krkrkrk","..........krrrk.","...........kkk.."])},magnifier:{label:"代码审查/调研",color:"blue",dx:0,pal:{l:"#cfe8ff",w:"#ffffff",h:"#8a5a3c"},art:Ve(8,["..........kkk...",".........kwllk..",".........kllllk.",".........kllllk.","..........kkkk..",".............hh.","..............hh"])},blocks:{label:"架构/系统设计",color:"slate",dx:0,pal:{a:"#ff8b6a",b:"#4ea3ff",c:"#ffc21a"},art:Ve(9,["...........kkkk.","...........kaak.","...........kaak.",".........kkkkkkk",".........kbbkcck",".........kbbkcck",".........kkkkkkk"])},rocket:{label:"发布/部署",color:"purple",dx:0,pal:{w:"#e8edf3",r:"#ff5a3c",b:"#4ea3ff",f:"#ffb020"},art:Ve(6,["............k...","...........krk..","...........krk..","..........kwwwk.","..........kwbwk.","..........kwwwk.","..........kwwwk.",".........krwwwrk",".........kkkkkkk","...........kfk.."])},shield:{label:"安全/权限",color:"blue",dx:0,pal:{s:"#5b8def",w:"#ffffff"},art:Ve(9,[".........kkkkkkk",".........kssswsk",".........kwswssk",".........kswsssk","..........ksssk.","...........ksk..","............k..."])},database:{label:"数据库/数据",color:"teal",dx:0,pal:{d:"#5fa8ff",t:"#cfe6ff"},art:Ve(8,["..........kkkkk.",".........ktttttk",".........kkkkkkk",".........kdddddk",".........kkkkkkk",".........kdddddk","..........kkkkk."])},palette:{label:"界面/视觉设计",color:"pink",dx:0,pal:{p:"#f2c58f",a:"#ff4d4d",b:"#4ea3ff",c:"#5ccf6b"},art:Ve(9,["..........kkkkk.",".........kpppppk",".........kpapbpk",".........kppppk.",".........kpcppk.","..........kkkk.."])},siren:{label:"值班/告警",color:"red",dx:2,pal:{r:"#ff3b3b",w:"#ffd0d0"},art:Ve(1,["..k...kkkk...k..","...k.krwrrk.k...",".....krrrrk.....","....kkkkkkkk...."])},kanban:{label:"项目管理/看板",color:"green",dx:0,pal:{w:"#ffffff",a:"#ff8b6a",b:"#ffc21a",c:"#5ccf6b"},art:Ve(9,[".........kkkkkkk",".........kakbkck",".........kakwkck",".........kwkbkwk",".........kwkwkwk",".........kkkkkkk"])},wrench:{label:"维护/修复",color:"slate",dx:0,pal:{g:"#b9c0c8"},art:Ve(8,["............k.k.","...........kgkgk","...........kgggk","..........kgggk.",".........kggk...","........kggk....","........kgk.....","........kk......"])},bolt:{label:"性能/优化",color:"purple",dx:0,pal:{b:"#ffc21a"},art:Ve(8,["............kkk.","...........kbbk.","..........kbbk..",".........kbbbbk.","..........kkbbk.","...........kbk..","..........kbk...","..........kk...."])}},PS=Object.keys(_l),FS=Object.keys(Ia);function F0(n){if(n==="custom")return{prop:"custom",color:"orange"};if(n.startsWith("custom:")){const d=n.slice(7);return Object.hasOwn(Ia,d)?{prop:"custom",color:d}:void 0}const[l,i,...o]=n.split(":");if(o.length||!Object.hasOwn(_l,l))return;const c=l;return i===void 0?{prop:c,color:_l[c].color}:Object.hasOwn(Ia,i)?{prop:c,color:i}:void 0}function Rf(n){return n==="orange"?"custom":`custom:${n}`}const WS=/^#[0-9a-f]{6}$/;function e2(n){if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"prop_art 要是一个对象:art(字符串数组)、pal(字母 → 颜色)、dx(0|1|2)"};const{art:l,pal:i,dx:o}=n;if(!Array.isArray(l)||l.length===0)return{ok:!1,error:"prop_art.art 要是非空的字符串数组"};if(l.length>Sn)return{ok:!1,error:`prop_art.art 最多 ${Sn} 行,收到 ${l.length} 行`};for(const p of l){if(typeof p!="string")return{ok:!1,error:"prop_art.art 的每行都要是字符串"};if([...p].length!==Sn)return{ok:!1,error:`prop_art.art 每行要正好 ${Sn} 个字符,这一行是 ${[...p].length} 个:「${p}」`}}if(!i||typeof i!="object"||Array.isArray(i))return{ok:!1,error:"prop_art.pal 要是对象:单个小写字母 → #rrggbb"};const c=Object.entries(i);if(c.length>6)return{ok:!1,error:`prop_art.pal 最多 6 种颜色,收到 ${c.length} 种`};for(const[p,g]of c){if(!/^[a-z]$/.test(p))return{ok:!1,error:`pal 的键要是单个小写字母,收到「${p}」`};if(p==="k")return{ok:!1,error:"pal 不能有 k:描边色是固定的,art 里直接用 k 就行"};if("oye".includes(p))return{ok:!1,error:`pal 不能用 ${p}:这是火苗自己的颜色`};if(typeof g!="string"||!WS.test(g))return{ok:!1,error:`pal[${p}] 要是 #rrggbb 格式的颜色,收到「${String(g)}」`}}const d=l.join("");for(const p of new Set([...d].filter(g=>g!==".")))if(p!=="k"&&!Object.hasOwn(i,p))return{ok:!1,error:`art 里的「${p}」没有在 pal 里定义颜色`};const h=[...d].filter(p=>p!==".").length;if(h<6)return{ok:!1,error:`至少要画 6 个像素,现在只有 ${h} 个`};if(o!==0&&o!==1&&o!==2)return{ok:!1,error:`prop_art.dx 要是 0、1 或 2,收到 ${String(o)}`};const m=Sn-_a.length;for(let p=0;p<_a.length;p++)for(let g=0;g<_a[p].length;g++){if(_a[p][g]!=="e")continue;const x=l[m+p]?.[o+g];if(x&&x!==".")return{ok:!1,error:`art 第 ${m+p+1} 行第 ${o+g+1} 列会盖住火苗的眼睛,把图案挪开(或调小 dx)`}}return{ok:!0,prop:{art:l,pal:i,dx:o}}}function Of(n,l){return l===_l[n].color?n:`${n}:${l}`}function t2(n,l){const i=F0(n)??{prop:"hob",color:"slate"},o=i.prop==="custom"&&l?e2(l):void 0,c=i.prop==="custom"?o?.ok?o.prop:_l.hob:_l[i.prop],d=Ia[i.color],h=[...Array(Sn-_a.length).fill(""),..._a].map((x,w)=>{const C=x?`${".".repeat(c.dx)}${x}`.padEnd(Sn,"."):".".repeat(Sn),T=c.art[w]??"";return[...C].map((N,A)=>T[A]&&T[A]!=="."?T[A]:N).join("")});let[m,p,g,v]=[Sn,Sn,0,0];return h.forEach((x,w)=>[...x].forEach((C,T)=>{C!=="."&&([m,p,g,v]=[Math.min(m,T),Math.min(p,w),Math.max(g,T+1),Math.max(v,w+1)])})),{rows:h,pal:{k:mb,e:mb,o:d.o,y:d.y,...c.pal},bg:d.bg,offset:[(m+g-Sn)/2,(p+v-Sn)/2]}}function n2(n){const l=[];return{body:n.rows.map((o,c)=>[...o].map((d,h)=>d!=="e"?d:(l.push([h,c]),"y")).join("")),eyes:l}}function pb({art:n}){const l=[];return n.rows.forEach((i,o)=>{for(let c=0;c<i.length;){const d=i[c];let h=c+1;for(;h<i.length&&i[h]===d;)h++;d!=="."&&n.pal[d]&&l.push({x:c,y:o,w:h-c,fill:n.pal[d]}),c=h}}),s.jsx(s.Fragment,{children:l.map((i,o)=>s.jsx("rect",{x:i.x,y:i.y,width:i.w+.02,height:1.02,fill:i.fill},o))})}const s2={busy:"正在工作",ask:"等你确认",stuck:"受阻",done:"已完成,未读"},l2=4,a2=7;function ot({sprite:n,prop:l,size:i,title:o,onClick:c,motion:d,mark:h,free:m,slot:p}){const g=y.useRef(h);h&&(g.current=h);const v=h??g.current,x=t2(n,l),w=d?n2(x):void 0,C=d==="peek"?`${(p??0)%a2*l2}s`:d?`${-([...n].reduce((T,N)=>(T*31+N.charCodeAt(0))%9973,7)%4e3)/1e3}s`:void 0;return s.jsxs("div",{className:`av${m?" av-free":""}${d?` av-motion av-${d}`:""} av-marked`,title:o,onClick:c,style:{"--av-size":`${i}px`,"--av-bg":x.bg},children:[s.jsx("svg",{viewBox:`${x.offset[0]} ${x.offset[1]} 16 16`,shapeRendering:"crispEdges","aria-hidden":"true",style:C?{"--eye-delay":C}:void 0,children:w?s.jsxs(s.Fragment,{children:[s.jsx(pb,{art:{...x,rows:w.body}}),s.jsx("g",{className:"av-eyes",children:s.jsx("g",{className:"av-blink",children:w.eyes.map(([T,N])=>s.jsx("rect",{x:T,y:N,width:1.02,height:1.02,fill:x.pal.e},`${T}-${N}`))})})]}):s.jsx(pb,{art:x})}),s.jsx("span",{className:`av-mark${h?" present":""}${v?` ${v}`:""}`,"aria-label":h?s2[h]:void 0,"aria-hidden":!h,children:s.jsx("span",{className:"av-mark-icon",children:v==="busy"?s.jsxs("svg",{viewBox:"0 0 13 5",children:[s.jsx("circle",{cx:"2.5",cy:"2.5",r:"1.5"}),s.jsx("circle",{cx:"6.5",cy:"2.5",r:"1.5"}),s.jsx("circle",{cx:"10.5",cy:"2.5",r:"1.5"})]}):v==="done"?s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",children:s.jsx("path",{d:"M3 8.5 6.5 12 13 4.5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}):v==="ask"?"?":v==="stuck"?"!":null},v)})]})}const i2=80;function W0(n){return Math.max(0,n.height-n.view)}function r2(n,l,i){const o=W0(i);return n?o:Math.min(l,o)}function o2(n,l,i){return i.height-i.top-i.view<i2?{stuck:!0,expect:i.top}:i.top<Math.min(l,W0(i))-2?{stuck:!1,expect:i.top}:{stuck:n,expect:i.top}}var Za=f0();async function Oh(n){try{const l=navigator.clipboard;return l?.writeText?(await l.writeText(n),!0):!1}catch{return!1}}const c2="modulepreload",u2=function(n){return"/"+n},gb={},mr=function(l,i,o){let c=Promise.resolve();if(i&&i.length>0){let h=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=h(i.map(g=>{if(g=u2(g),g in gb)return;gb[g]=!0;const v=g.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":c2,v||(w.as="script"),w.crossOrigin="",w.href=g,p&&w.setAttribute("nonce",p),document.head.appendChild(w),v)return new Promise((C,T)=>{w.addEventListener("load",C),w.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return c.then(h=>{for(const m of h||[])m.status==="rejected"&&d(m.reason);return l().catch(d)})};function _h(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ll=_h();function ey(n){Ll=n}var Cl={exec:()=>null};function Sl(n){let l=[];return i=>{let o=Math.max(0,Math.min(3,i-1)),c=l[o];return c||(c=n(o),l[o]=c),c}}function Ee(n,l=""){let i=typeof n=="string"?n:n.source,o={replace:(c,d)=>{let h=typeof d=="string"?d:d.source;return h=h.replace(xt.caret,"$1"),i=i.replace(c,h),o},getRegex:()=>new RegExp(i,l)};return o}var ty=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),xt={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Sl(n=>new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}(?:</?(?:${gr})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:Sl(n=>new RegExp(`^ {0,${n}}>`))},d2=/^(?:[ \t]*(?:\n|$))+/,f2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,pr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,m2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Dh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ny=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,sy=Ee(ny).replace(/bull/g,Dh).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(),p2=Ee(ny).replace(/bull/g,Dh).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(),$h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,g2=/^[^\n]+/,Uh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,v2=Ee(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Uh).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),x2=Ee(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Dh).getRegex(),gr="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",Lh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,b2=Ee("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Lh).replace("tag",gr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ly=n=>Ee($h).replace("hr",pr).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",gr).getRegex(),y2=ly(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),k2=ly(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),j2=Ee(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",k2).getRegex(),Hh={blockquote:j2,code:f2,def:v2,fences:h2,heading:m2,hr:pr,html:b2,lheading:sy,list:x2,newline:d2,paragraph:y2,table:Cl,text:g2},vb=Ee("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pr).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",gr).getRegex(),w2={...Hh,lheading:p2,table:vb,paragraph:Ee($h).replace("hr",pr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vb).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",gr).getRegex()},N2={...Hh,html:Ee(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",Lh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Cl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ee($h).replace("hr",pr).replace("heading",` *#{1,6} *[^
120
+ ]`).replace("lheading",sy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},S2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,T2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ay=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,C2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ns=/[\p{P}\p{S}]/u,Va=/[\s\p{P}\p{S}]/u,vr=/[^\s\p{P}\p{S}]/u,E2=Ee(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Va).getRegex(),A2=/[\p{Pi}\p{Ps}"']/u,iy=/(?!~)[\p{P}\p{S}]/u,M2=/(?!~)[\s\p{P}\p{S}]/u,z2=/(?:[^\s\p{P}\p{S}]|~)/u,R2=Ee(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ty?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ry=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,O2=Ee(ry,"u").replace(/punct/g,ns).getRegex(),_2=Ee(ry,"u").replace(/punct/g,iy).getRegex(),D2=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,$2=Ee(D2,"u").replace(/openQuote/g,A2).replace(/punct/g,ns).getRegex(),oy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",U2=Ee(oy,"gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Va).replace(/punct/g,ns).getRegex(),L2=Ee(oy,"gu").replace(/notPunctSpace/g,z2).replace(/punctSpace/g,M2).replace(/punct/g,iy).getRegex(),H2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",B2=Ee(H2,"gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Va).replace(/punct/g,ns).getRegex(),q2=Ee("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Va).replace(/punct/g,ns).getRegex(),I2="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Y2=Ee(I2,"gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Va).replace(/punct/g,ns).getRegex(),G2=Ee(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ns).getRegex(),K2="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",X2=Ee(K2,"gu").replace(/notPunctSpace/g,vr).replace(/punctSpace/g,Va).replace(/punct/g,ns).getRegex(),Z2=Ee(/\\(punct)/,"gu").replace(/punct/g,ns).getRegex(),V2=Ee(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ns).getRegex(),Q2=Ee(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),J2=Ee(Lh).replace("(?:-->|$)","-->").getRegex(),P2=Ee("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",J2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),cy=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Sc=Ee(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",cy).getRegex(),F2=Ee(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Sc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),W2=Ee(/^!?\[(label)\]\[(ref)\]/).replace("label",Sc).replace("ref",Uh).getRegex(),eT=Ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",Uh).getRegex(),xb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,tT=Ee(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",cy).getRegex(),nT=Ee("reflink|nolink(?!\\()","g").replace("reflink",Ee(/^!?\[(label)\]\[(ref)\]/).replace("label",tT).replace("ref",xb).getRegex()).replace("nolink",Ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",xb).getRegex()).getRegex(),bb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sT=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,lT=Ee(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,sT).getRegex(),Bh={_backpedal:Cl,anyPunctuation:Z2,anyPunctuationOutsideCode:V2,autolink:Q2,blockSkip:R2,br:ay,code:T2,del:Cl,delLDelim:Cl,delRDelim:Cl,emStrongLDelim:O2,emStrongRDelimAst:U2,emStrongRDelimUnd:q2,escape:S2,link:F2,nolink:eT,punctuation:E2,reflink:W2,reflinkSearch:nT,tag:P2,text:C2,url:Cl},aT={...Bh,emStrongLDelim:$2,emStrongRDelimAst:B2,emStrongRDelimUnd:Y2,link:Ee(/^!?\[(label)\]\((.*?)\)/).replace("label",Sc).getRegex(),reflink:Ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sc).getRegex()},th={...Bh,emStrongRDelimAst:L2,emStrongLDelim:_2,delLDelim:G2,delRDelim:X2,url:Ee(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",lT).replace("protocol",bb).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ee(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",bb).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",ty?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},iT={...th,br:Ee(ay).replace("{2,}","*").getRegex(),text:Ee(th.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ec={normal:Hh,gfm:w2,pedantic:N2},Zi={normal:Bh,gfm:th,breaks:iT,pedantic:aT},rT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},yb=n=>rT[n];function dn(n,l){if(l){if(xt.escapeTest.test(n))return n.replace(xt.escapeReplace,yb)}else if(xt.escapeTestNoEncode.test(n))return n.replace(xt.escapeReplaceNoEncode,yb);return n}function oT(n){return xt.numericCharacterReference.test(n)?n.replace(xt.numericCharacterReferenceOrAmpersand,(l,i,o)=>{if(i===void 0&&o===void 0)return"&amp;";let c=i===void 0?Number.parseInt(o,16):Number.parseInt(i,10);return c===0||c>1114111||c>=55296&&c<=57343?"�":c===38?"&amp;":String.fromCodePoint(c)}):n}function kb(n){try{n=encodeURI(n).replace(xt.percentDecode,"%")}catch{return null}return n}function jb(n,l){let i=n.replace(xt.findPipe,(d,h,m)=>{let p=!1,g=h;for(;--g>=0&&m[g]==="\\";)p=!p;return p?"|":" |"}),o=i.split(xt.splitPipe),c=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),l)if(o.length>l)o.splice(l);else for(;o.length<l;)o.push("");for(;c<o.length;c++)o[c]=o[c].trim().replace(xt.slashPipe,"|");return o}function xs(n,l,i){let o=n.length;if(o===0)return"";let c=0;for(;c<o&&n.charAt(o-c-1)===l;)c++;return n.slice(0,o-c)}function wb(n){let l=n.split(`
121
+ `),i=l.length-1;for(;i>=0&&xt.blankLine.test(l[i]);)i--;return l.length-i<=2?n:l.slice(0,i+1).join(`
122
+ `)}function Tc(n){return n.trim().replace(xt.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function Nb(n,l){if(n.indexOf(l[0])===-1&&n.indexOf(l[1])===-1)return-1;let i=0;for(let o=0;o<n.length;o++)if(n[o]==="\\")o++;else if(n[o]===l[0])i++;else if(n[o]===l[1]&&(i--,i<0))return o;return i>0?-2:-1}var Ya=new WeakMap;function qh(n){let l={"*":-1,_:-1},i=-1,o=n.length;for(let c=0;c<o;c++){let d=n[c];if(d!=="*"&&d!=="_"&&d!=="~")continue;let h=c===0?`
123
+ `:n[c-1],m=c+1;for(;m<o&&n[m]===d;)m++;h!==" "&&h!==" "&&h!==`
124
+ `&&h!=="\r"&&h!=="\f"&&(d==="~"?i=c:l[d]=c),c=m-1}return{maskedSrc:n,lastPossibleEmStrongCloserIndex:l,lastPossibleDelCloserIndex:i}}function cT(n,l){let i=qh(l),o=Ya.get(n);o?o.push(i):Ya.set(n,[i])}function uT(n){let l=Ya.get(n);l&&(l.pop(),l.length===0&&Ya.delete(n))}function dT(n,l,i){let o=Ya.get(n)?.at(-1);return o&&o.maskedSrc===l?o.lastPossibleEmStrongCloserIndex[i]:qh(l).lastPossibleEmStrongCloserIndex[i]}function fT(n,l){let i=Ya.get(n)?.at(-1);return i&&i.maskedSrc===l?i.lastPossibleDelCloserIndex:qh(l).lastPossibleDelCloserIndex}function tc(n,l=0){let i=l,o="";for(let c of n)if(c===" "){let d=4-i%4;o+=" ".repeat(d),i+=d}else o+=c,i++;return o}function Sb(n,l,i,o,c){let d=l.href,h=l.title||null,m=n[1].replace(c.other.outputLinkReplace,"$1"),p=n[0].charAt(0)==="!",g=o.state.inLink,v=o.state.linkEmitted,x=o.state.inRawBlock;o.state.inLink=!0,o.state.linkEmitted=!1;let w=o.inlineTokens(m),C=o.state.linkEmitted;if(o.state.linkEmitted=v,o.state.inLink=g,!p){if(C){o.state.inRawBlock=x;return}o.state.linkEmitted=!0}return{type:p?"image":"link",raw:i,href:d,title:h,text:m,tokens:w}}function hT(n,l,i){let o=n.match(i.other.indentCodeCompensation);if(o===null)return l;let c=o[1];return l.split(`
125
+ `).map(d=>{let h=d.match(i.other.beginningSpace);if(h===null)return d;let[m]=h;return d.slice(Math.min(m.length,c.length))}).join(`
126
+ `)}function Tb(n,l,i,o){if(!l.includes("<"))return!1;for(let c=0;c<l.length;c++){if(l[c]==="\\"){c++;continue}if(l[c]==="`"){let m=o.inline.code.exec(l.slice(c));if(m){c+=m[0].length-1;continue}}if(l[c]!=="<")continue;let d=n.slice(i+c),h=o.inline.tag.exec(d)||o.inline.autolink.exec(d);if(h){if(h[0].length>l.length-c)return!0;c+=h[0].length-1}}return!1}var Ua=class{options;rules;lexer;constructor(l){this.options=l||Ll}space(l){let i=this.rules.block.newline.exec(l);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(l){let i=this.rules.block.code.exec(l);if(i){let o=this.options.pedantic?i[0]:wb(i[0]),c=o.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:o,codeBlockStyle:"indented",text:c}}}fences(l){let i=this.rules.block.fences.exec(l);if(i){let o=i[0],c=hT(o,i[3]||"",this.rules);return{type:"code",raw:o,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:c}}}heading(l){let i=this.rules.block.heading.exec(l);if(i){let o=i[2].trim();if(this.rules.other.endingHash.test(o)){let c=xs(o,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceTabChar.test(c))&&(o=c.trim())}return{type:"heading",raw:xs(i[0],`
127
+ `),depth:i[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(l){let i=this.rules.block.hr.exec(l);if(i)return{type:"hr",raw:xs(i[0],`
128
+ `)}}blockquote(l){let i=this.rules.block.blockquote.exec(l);if(i){let o=xs(i[0],`
129
+ `).split(`
130
+ `),c="",d="",h=[];for(;o.length>0;){let m=!1,p=[],g;for(g=0;g<o.length;g++)if(this.rules.other.blockquoteStart.test(o[g]))p.push(o[g]),m=!0;else if(!m)p.push(o[g]);else break;o=o.slice(g);let v=p.join(`
131
+ `),x=v.replace(this.rules.other.blockquoteMarkerWhitespace,(T,N,A)=>N+tc(A,N.length)).replace(this.rules.other.blockquoteSetextReplace,`
132
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
133
+ ${v}`:v,d=d?`${d}
134
+ ${x}`:x;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,h,!0),this.lexer.state.top=w,o.length===0)break;let C=h.at(-1);if(C?.type==="code"||C?.type==="heading"||C?.type==="hr"||C?.type==="html"||C?.type==="table")break;if(C?.type==="blockquote"){let T=C,N=o.join(`
135
+ `),A=T.raw+`
136
+ `+N.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(A);h[h.length-1]=M;let R=A.substring(M.raw.length).replace(/^\n/,""),O=R?R.split(`
137
+ `).length:0,J=O?o.slice(0,-O):o;if(J.length>0&&(c=`${c}
138
+ ${J.join(`
139
+ `)}`),d=d.substring(0,d.length-T.text.length)+M.text,o=o.slice(J.length),o.length>0&&this.rules.other.blockquoteStart.test(o[0]))continue;break}else if(C?.type==="list"){let T=C,N=T.raw+`
140
+ `+o.join(`
141
+ `),A=this.list(N);h[h.length-1]=A;let M=A.raw.length>T.raw.length?N.slice(T.raw.length+1,A.raw.length).split(`
142
+ `).length:0;if(M>0){let R=o.slice(0,M).join(`
143
+ `);c=`${c}
144
+ ${R}`,d=`${d}
145
+ ${R}`}o=o.slice(M);continue}}return{type:"blockquote",raw:c,tokens:h,text:d}}}list(l){let i=this.rules.block.list.exec(l);if(i){let o=l,c=()=>o.length-l.length,d=i[1].trim(),h=d.length>1,m={type:"list",raw:"",ordered:h,start:h?+d.slice(0,-1):"",loose:!1,items:[]};d=h?`\\d{1,9}\\${d.slice(-1)}`:`\\${d}`,this.options.pedantic&&(d=h?d:"[*+-]");let p=this.rules.other.listItemRegex(d),g=!1;for(;l;){let x=!1,w="";if(!(i=p.exec(l))||this.rules.block.hr.test(l))break;let C=c();l=l.substring(i[0].length);let T=i[2].split(`
146
+ `,1)[0],N=i[1].length,A=this.options.pedantic?tc(T,N):T.replace(this.rules.other.leadingSpaceTab,ee=>tc(ee,N)),M=l.split(`
147
+ `,1)[0],R=!A.trim(),O=0;if(this.options.pedantic?(O=2,w=A.trimStart()):R?O=N+1:(O=A.search(this.rules.other.nonSpaceChar),O=O>4?1:O,w=A.slice(O),O+=N),R&&this.rules.other.blankLine.test(M)&&(l=l.substring(M.length+1),x=!0),!x){let ee=this.rules.other.nextBulletRegex(O),B=this.rules.other.hrRegex(O),k=this.rules.other.fencesBeginRegex(O),j=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(O):this.rules.other.headingBeginRegex(O),E=this.rules.other.htmlBeginRegex(O),U=this.rules.other.blockquoteBeginRegex(O);for(;l;){let X=l.split(`
148
+ `,1)[0],oe;if(M=X,this.options.pedantic?(M=M.replace(this.rules.other.listReplaceNesting," "),oe=M):oe=M.replace(this.rules.other.leadingSpaceTab,ce=>tc(ce)),k.test(M)||j.test(M)||E.test(M)||U.test(M)||ee.test(M)||B.test(M))break;if(oe.search(this.rules.other.nonSpaceChar)>=O||!M.trim())w+=`
149
+ `+oe.slice(O);else{if(R||A.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(A)||j.test(A)||E.test(A)||B.test(A))break;let ce=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(M)&&this.rules.block.lheading.test(`${A}
150
+ ${M}`)?` ${oe.replace(/^ {0,3}/,"")}`:M;w+=`
151
+ `+ce}R=!M.trim(),l=l.substring(X.length+1),A=oe.slice(O)}}let J=o.slice(C,c());m.loose||(g?m.loose=!0:this.rules.other.doubleBlankLine.test(J)&&(g=!0)),m.items.push({type:"list_item",raw:J,task:!!this.options.gfm&&this.rules.other.listIsTask.test(w),loose:!1,text:w,tokens:[]})}let v=m.items.at(-1);if(v)v.raw=v.raw.trimEnd(),v.text=v.text.trimEnd();else return;m.raw=o.slice(0,c()).trimEnd();for(let x of m.items)if(this.lexer.state.top=!1,x.tokens=this.lexer.blockTokens(x.text,[]),!m.loose){let w=x.tokens.filter(T=>T.type==="space"),C=w.length>0&&w.some(T=>this.rules.other.anyLine.test(T.raw));m.loose=C}for(let x of m.items){let w=x.tokens[0];if(x.task&&(w?.type==="text"||w?.type==="paragraph")){x.text=x.text.replace(this.rules.other.listReplaceTask,""),w.raw=w.raw.replace(this.rules.other.listReplaceTask,""),w.text=w.text.replace(this.rules.other.listReplaceTask,"");for(let T=this.lexer.inlineQueue.length-1;T>=0;T--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[T].src)){this.lexer.inlineQueue[T].src=this.lexer.inlineQueue[T].src.replace(this.rules.other.listReplaceTask,"");break}let C=this.rules.other.listTaskCheckbox.exec(x.raw);if(C){let T={type:"checkbox",raw:C[0]+" ",checked:C[0]!=="[ ]"};x.checked=T.checked,m.loose?x.tokens[0]&&["paragraph","text"].includes(x.tokens[0].type)&&"tokens"in x.tokens[0]&&x.tokens[0].tokens?(x.tokens[0].raw=T.raw+x.tokens[0].raw,x.tokens[0].text=T.raw+x.tokens[0].text,x.tokens[0].tokens.unshift(T)):x.tokens.unshift({type:"paragraph",raw:T.raw,text:T.raw,tokens:[T]}):x.tokens.unshift(T)}}else x.task&&(x.task=!1)}if(m.loose)for(let x of m.items){x.loose=!0;for(let w of x.tokens)w.type==="text"&&(w.type="paragraph")}return m}}html(l){let i=this.rules.block.html.exec(l);if(i){let o=wb(i[0]);return{type:"html",block:!0,raw:o,pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:o}}}def(l){let i=this.rules.block.def.exec(l);if(i){if(!this.rules.other.startAngleBracket.test(i[2])&&Nb(i[2],"()")!==-1)return;let o=Tc(i[1]),c=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:o,raw:xs(i[0],`
152
+ `),href:c,title:d}}}table(l){let i=this.rules.block.table.exec(l);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;let o=jb(i[1]),c=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),d=i[3]?.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
153
+ `):[],h={type:"table",raw:xs(i[0],`
154
+ `),header:[],align:[],rows:[]};if(o.length===c.length){for(let m of c)this.rules.other.tableAlignRight.test(m)?h.align.push("right"):this.rules.other.tableAlignCenter.test(m)?h.align.push("center"):this.rules.other.tableAlignLeft.test(m)?h.align.push("left"):h.align.push(null);for(let m=0;m<o.length;m++)h.header.push({text:o[m],tokens:this.lexer.inline(o[m]),header:!0,align:h.align[m]});for(let m of d)h.rows.push(jb(m,h.header.length).map((p,g)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:h.align[g]})));return h}}lheading(l){let i=this.rules.block.lheading.exec(l);if(i){let o=i[1].trim();return{type:"heading",raw:xs(i[0],`
155
+ `),depth:i[2].charAt(0)==="="?1:2,text:o,tokens:this.lexer.inline(o)}}}paragraph(l){let i=this.rules.block.paragraph.exec(l);if(i){let o=i[1].charAt(i[1].length-1)===`
156
+ `?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:o,tokens:this.lexer.inline(o)}}}text(l){let i=this.rules.block.text.exec(l);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(l){let i=this.rules.inline.escape.exec(l);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(l){let i=this.rules.inline.tag.exec(l);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(l){if(this.lexer.state.linkParenPossible===!1)return;let i=this.rules.inline.link.exec(l);if(i){let o=i[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Tb(l,i[1],o,this.rules))return;let c=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(c)){if(!this.rules.other.endAngleBracket.test(c))return;let p=xs(c.slice(0,-1),"\\");if((c.length-p.length)%2===0)return}else{let p=Nb(i[2],"()");if(p===-2)return;if(p>-1){let g=(i[0].indexOf("!")===0?5:4)+i[1].length+p;i[2]=i[2].substring(0,p),i[0]=i[0].substring(0,g).trim(),i[3]=""}}let d=xs(i[0].slice(0,-1),"\\");if((i[0].length-d.length)%2===0)return;let h=i[2],m="";if(this.options.pedantic){let p=this.rules.other.pedanticHrefTitle.exec(h);p&&(h=p[1],m=p[3])}else m=i[3]?i[3].slice(1,-1):"";return h=h.trim(),this.rules.other.startAngleBracket.test(h)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(c)?h=h.slice(1):h=h.slice(1,-1)),Sb(i,{href:h&&h.replace(this.rules.inline.anyPunctuation,"$1"),title:m&&m.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(l,i){let o;if((o=this.rules.inline.reflink.exec(l))||(o=this.rules.inline.nolink.exec(l))){let c=o[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Tb(l,o[1],c,this.rules))return;let d=i[Tc(o[2]||o[1])];if(!d){let h=o[0].charAt(0);return{type:"text",raw:h,text:h}}return Sb(o,d,o[0],this.lexer,this.rules)}}emStrong(l,i,o=""){let c=this.rules.inline.emStrongLDelim.exec(l);if(!c||!c[1]&&!c[2]&&!c[3]&&!c[4])return;let d=c[0][0],h=o===d,m=i.length-l.length,p=m;for(;!this.options.pedantic&&p>0&&i[p-1]===d;)p--;let g=[...i.slice(Math.max(0,p-2),p)].at(-1)??"",v=g==="*"||g==="_"||!!this.rules.inline.punctuation.exec(g);p<m&&(o=g);let x=p<m?v:!!this.rules.inline.punctuation.exec(o);if(c[4]&&o.match(this.rules.other.unicodeAlphaNumeric))return;let w=c[1]||c[3]||"";if(!w||!o||x){let C=[...c[0]].length-1,T,N,A=C,M=0,R=m-p+C,O=!this.options.pedantic&&!!g.trim()&&(!!w||d==="*"&&!v);if(d!=="*"&&d!=="_")return;let J=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,ee=dT(this,i,d),B=i.length-l.length+C;if(ee<B)return;i=i.slice(-1*l.length+C);let k=ee-B;for(J.lastIndex=0;(c=J.exec(i))!==null&&!(c.index>k);){if(T=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!T)continue;if(N=[...T].length,c[3]||c[4]){A+=N;continue}else if(c[5]||c[6]||O){if(h&&(c[5]||c[6]))break;if(R%3&&!((R+N)%3)){M+=N;continue}}if(A-=N,A>0)continue;N=Math.min(N,N+A+M);let j=[...c[0]][0].length,E=l.slice(0,C+c.index+j+N);if(Math.min(C,N)%2){let X=E.slice(1,-1);return{type:"em",raw:E,text:X,tokens:this.lexer.inlineTokens(X)}}let U=E.slice(2,-2);return{type:"strong",raw:E,text:U,tokens:this.lexer.inlineTokens(U)}}}}codespan(l){let i=this.rules.inline.code.exec(l);if(i){let o=i[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(o),d=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return c&&d&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:i[0],text:o}}}br(l){let i=this.rules.inline.br.exec(l);if(i)return{type:"br",raw:i[0]}}del(l,i,o=""){let c=this.rules.inline.delLDelim.exec(l);if(c&&(!c[1]||!o||this.rules.inline.punctuation.exec(o))){let d=[...c[0]].length-1,h,m,p=d,g=this.rules.inline.delRDelim,v=fT(this,i),x=i.length-l.length+d;if(v<x)return;i=i.slice(-1*l.length+d);let w=v-x;for(g.lastIndex=0;(c=g.exec(i))!==null&&!(c.index>w);){if(h=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!h||(m=[...h].length,m!==d))continue;if(c[3]||c[4]){p+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p);let C=[...c[0]][0].length,T=l.slice(0,d+c.index+C+m),N=T.slice(d,-d);return{type:"del",raw:T,text:N,tokens:this.lexer.inlineTokens(N)}}}}autolink(l){let i=this.rules.inline.autolink.exec(l);if(i){let o,c;return i[2]==="@"?(o=i[1],c="mailto:"+o):(o=i[1],c=o),{type:"link",raw:i[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}url(l){let i;if(i=this.rules.inline.url.exec(l)){let o,c;if(i[2]==="@")o=i[0],c="mailto:"+o;else{let d;do d=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])?.[0]??"";while(d!==i[0]);o=i[0],i[1]==="www."?c="http://"+i[0]:c=i[0]}return{type:"link",raw:i[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(l){let i=this.rules.inline.text.exec(l);if(i){let o=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:o?i[0]:oT(i[0]),escaped:o}}}},$n=class nh{tokens;options;state;inlineQueue;tokenizer;constructor(l){this.tokens=[],this.tokens.links=Object.create(null),this.options=l||Ll,this.options.tokenizer=this.options.tokenizer||new Ua,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let i={other:xt,block:ec.normal,inline:Zi.normal};this.options.pedantic?(i.block=ec.pedantic,i.inline=Zi.pedantic):this.options.gfm&&(i.block=ec.gfm,this.options.breaks?i.inline=Zi.breaks:i.inline=Zi.gfm),this.tokenizer.rules=i}static get rules(){return{block:ec,inline:Zi}}static lex(l,i){return new nh(i).lex(l)}static lexInline(l,i){return new nh(i).inlineTokens(l)}lex(l){l=l.replace(xt.carriageReturn,`
157
+ `),this.blockTokens(l,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let o=this.inlineQueue[i];this.state.inRawBlock=!1,this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(l,i=[],o=!1){this.tokenizer.lexer=this,this.options.pedantic&&(l=l.replace(xt.tabCharGlobal," ").replace(xt.spaceLine,""));let c=1/0;for(;l;){if(l.length<c)c=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}let d;if(this.options.extensions?.block?.some(m=>(d=m.call({lexer:this},l,i))?(l=l.substring(d.raw.length),i.push(d),!0):!1))continue;if(d=this.tokenizer.space(l)){l=l.substring(d.raw.length);let m=i.at(-1);d.raw.length===1&&m!==void 0?m.raw+=`
158
+ `:i.push(d);continue}if(d=this.tokenizer.code(l)){l=l.substring(d.raw.length);let m=i.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
159
+ `)?"":`
160
+ `)+d.raw,m.text+=`
161
+ `+d.text,this.inlineQueue.at(-1).src=m.text):i.push(d);continue}if(d=this.tokenizer.fences(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.heading(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.hr(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.blockquote(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.list(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.html(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.def(l)){l=l.substring(d.raw.length);let m=i.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
162
+ `)?"":`
163
+ `)+d.raw,m.text+=`
164
+ `+d.raw,this.inlineQueue.at(-1).src=m.text):(this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title}),i.push(d));continue}if(d=this.tokenizer.table(l)){l=l.substring(d.raw.length),i.push(d);continue}if(d=this.tokenizer.lheading(l)){l=l.substring(d.raw.length),i.push(d);continue}let h=l;if(this.options.extensions?.startBlock){let m=1/0,p=l.slice(1),g;this.options.extensions.startBlock.forEach(v=>{g=v.call({lexer:this},p),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(h=l.substring(0,m+1))}if(this.state.top&&(d=this.tokenizer.paragraph(h))){let m=i.at(-1);o&&m?.type==="paragraph"?(m.raw+=(m.raw.endsWith(`
165
+ `)?"":`
166
+ `)+d.raw,m.text+=`
167
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):i.push(d),o=h.length!==l.length,l=l.substring(d.raw.length);continue}if(d=this.tokenizer.text(l)){l=l.substring(d.raw.length);let m=i.at(-1);m?.type==="text"?(m.raw+=(m.raw.endsWith(`
168
+ `)?"":`
169
+ `)+d.raw,m.text+=`
170
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):i.push(d);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return this.state.top=!0,i}inline(l,i=[]){return this.inlineQueue.push({src:l,tokens:i}),i}linkInText(l){if(!l.includes("["))return!1;let i=this.tokenizer.rules.inline.link;for(let o of l.matchAll(this.tokenizer.rules.inline.blockSkip))if(i.test(o[0])&&l.charAt(o.index-1)!=="!")return!0;for(let o of l.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let c=o[0],d=c.lastIndexOf("[");if(!(c.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Tc(c.slice(d+1,-1))))&&!(d>1&&this.linkInText(c.slice(1,d-1))))return!0}return!1}inlineTokens(l,i=[]){this.tokenizer.lexer=this;let o=this.state.linkParenPossible;this.state.linkParenPossible=o&&l.includes(")");try{return this.#e(l,i)}finally{this.state.linkParenPossible=o}}#e(l,i){let o=l.includes("*")||l.includes("_")||l.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Ua.prototype.emStrong||this.tokenizer.del!==Ua.prototype.del?this.#n(l):l;cT(this.tokenizer,o);try{return this.#t(l,o,i)}finally{uT(this.tokenizer)}}#t(l,i,o){let c=!1,d="",h=1/0;for(;l;){if(l.length<h)h=l.length;else{this.infiniteLoopError(l.charCodeAt(0));break}c||(d=""),c=!1;let m;if(this.options.extensions?.inline?.some(g=>(m=g.call({lexer:this},l,o))?(l=l.substring(m.raw.length),o.push(m),!0):!1))continue;if(m=this.tokenizer.escape(l)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.tag(l)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.link(l)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.reflink(l,this.tokens.links)){l=l.substring(m.raw.length);let g=o.at(-1);m.type==="text"&&g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(m=this.tokenizer.emStrong(l,i,d)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.codespan(l)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.br(l)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.del(l,i,d)){l=l.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.autolink(l)){l=l.substring(m.raw.length),o.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(l))){l=l.substring(m.raw.length),o.push(m);continue}let p=l;if(this.options.extensions?.startInline){let g=1/0,v=l.slice(1),x;this.options.extensions.startInline.forEach(w=>{x=w.call({lexer:this},v),typeof x=="number"&&x>=0&&(g=Math.min(g,x))}),g<1/0&&g>=0&&(p=l.substring(0,g+1))}if(m=this.tokenizer.inlineText(p)){l=l.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(d=m.raw.slice(-1)),c=!0;let g=o.at(-1);g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(l){this.infiniteLoopError(l.charCodeAt(0));break}}return o}#n(l){let i=l;if(this.tokens.links&&l.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let h=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Tc(d.slice(h+1,-1))))return d;if(h>1&&d.charAt(0)!=="!"){let m=d.slice(1,h-1);if(this.linkInText(m))return"["+m.replace(o,c)+"]["+"a".repeat(d.length-h-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};i=i.replace(o,c)}return i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(o,c,d)=>d?"+".repeat(o.length):c?c+o.slice(c.length,-c.length).replace(/`/g,"+")+c:o),i=i.replace(this.tokenizer.rules.inline.blockSkip,(o,c,d)=>{let h=d?d.length:0;return o.slice(0,h)+"["+"a".repeat(o.length-h-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i,i}infiniteLoopError(l){let i="Infinite loop on byte: "+l;if(this.options.silent)console.error(i);else throw new Error(i)}},Cc=class{options;parser;constructor(n){this.options=n||Ll}space(n){return""}code({text:n,lang:l,escaped:i}){let o=(l||"").match(xt.notSpaceStart)?.[0],c=n?n.replace(xt.endingNewline,"")+`
171
+ `:"";return o?'<pre><code class="language-'+dn(o)+'">'+(i?c:dn(c,!0))+`</code></pre>
172
+ `:"<pre><code>"+(i?c:dn(c,!0))+`</code></pre>
173
+ `}blockquote({tokens:n}){return`<blockquote>
174
+ ${this.parser.parse(n)}</blockquote>
175
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:l}){return`<h${l}>${this.parser.parseInline(n)}</h${l}>
176
+ `}hr(n){return`<hr>
177
+ `}list(n){let l=n.ordered,i=n.start,o="";for(let h=0;h<n.items.length;h++){let m=n.items[h];o+=this.listitem(m)}let c=l?"ol":"ul",d=l&&i!==1?' start="'+i+'"':"";return"<"+c+d+`>
178
+ `+o+"</"+c+`>
179
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
180
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
181
+ `}table(n){let l="",i="";for(let c=0;c<n.header.length;c++)i+=this.tablecell(n.header[c]);l+=this.tablerow({text:i});let o="";for(let c=0;c<n.rows.length;c++){let d=n.rows[c];i="";for(let h=0;h<d.length;h++)i+=this.tablecell(d[h]);o+=this.tablerow({text:i})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
182
+ <thead>
183
+ `+l+`</thead>
184
+ `+o+`</table>
185
+ `}tablerow({text:n}){return`<tr>
186
+ ${n}</tr>
187
+ `}tablecell(n){let l=this.parser.parseInline(n.tokens),i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+l+`</${i}>
188
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${dn(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:l,text:i,tokens:o,autolink:c}){let d=c?dn(i,!0):this.parser.parseInline(o),h=kb(n);if(h===null)return d;n=dn(h,c);let m='<a href="'+n+'"';return l&&(m+=' title="'+dn(l)+'"'),m+=">"+d+"</a>",m}image({href:n,title:l,text:i,tokens:o}){o&&(i=this.parser.parseInline(o,this.parser.textRenderer));let c=kb(n);if(c===null)return dn(i);n=c;let d=`<img src="${dn(n)}" alt="${dn(i)}"`;return l&&(d+=` title="${dn(l)}"`),d+=">",d}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:dn(n.text)}},Ih=class{parser;strong({text:n,tokens:l}){return l?this.parser.parseInline(l,this):n}em({text:n,tokens:l}){return l?this.parser.parseInline(l,this):n}codespan({text:n}){return n}del({text:n,tokens:l}){return l?this.parser.parseInline(l,this):n}html({text:n}){return n}text({text:n}){return n}link({text:n,tokens:l}){return l?this.parser.parseInline(l,this):n}image({text:n,tokens:l}){return l?this.parser.parseInline(l,this):n}br(){return""}checkbox({raw:n}){return n}},Un=class sh{options;renderer;textRenderer;constructor(l){this.options=l||Ll,this.options.renderer=this.options.renderer||new Cc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ih,this.textRenderer.parser=this}static parse(l,i){return new sh(i).parse(l)}static parseInline(l,i){return new sh(i).parseInline(l)}parse(l){this.renderer.parser=this;let i="";for(let o=0;o<l.length;o++){let c=l[o];if(this.options.extensions?.renderers?.[c.type]){let h=c,m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(h.type)){i+=m||"";continue}}let d=c;switch(d.type){case"space":{i+=this.renderer.space(d);break}case"hr":{i+=this.renderer.hr(d);break}case"heading":{i+=this.renderer.heading(d);break}case"code":{i+=this.renderer.code(d);break}case"table":{i+=this.renderer.table(d);break}case"blockquote":{i+=this.renderer.blockquote(d);break}case"list":{i+=this.renderer.list(d);break}case"checkbox":{i+=this.renderer.checkbox(d);break}case"html":{i+=this.renderer.html(d);break}case"def":{i+=this.renderer.def(d);break}case"paragraph":{i+=this.renderer.paragraph(d);break}case"text":{i+=this.renderer.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(l,i=this.renderer){this.renderer.parser=this;let o="";for(let c=0;c<l.length;c++){let d=l[c];if(this.options.extensions?.renderers?.[d.type]){let m=this.options.extensions.renderers[d.type].call({parser:this},d);if(m!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){o+=m||"";continue}}let h=d;switch(h.type){case"escape":{o+=i.text(h);break}case"html":{o+=i.html(h);break}case"link":{o+=i.link(h);break}case"image":{o+=i.image(h);break}case"checkbox":{o+=i.checkbox(h);break}case"strong":{o+=i.strong(h);break}case"em":{o+=i.em(h);break}case"codespan":{o+=i.codespan(h);break}case"br":{o+=i.br(h);break}case"del":{o+=i.del(h);break}case"text":{o+=i.text(h);break}default:{let m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},Ji=class{options;block;constructor(n){this.options=n||Ll}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?$n.lex:$n.lexInline}provideParser(n=this.block){return n?Un.parse:Un.parseInline}};function Ps(n,l){if(Array.isArray(l))for(let i=0;i<l.length;i++)n.push(l[i]);else n.push(l)}var uy=class{defaults=_h();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Un;Renderer=Cc;TextRenderer=Ih;Lexer=$n;Tokenizer=Ua;Hooks=Ji;constructor(...n){this.use(...n)}walkTokens(n,l){let i=[];for(let o of n)switch(Ps(i,l.call(this,o)),o.type){case"table":{let c=o;for(let d of c.header)Ps(i,this.walkTokens(d.tokens,l));for(let d of c.rows)for(let h of d)Ps(i,this.walkTokens(h.tokens,l));break}case"list":{let c=o;Ps(i,this.walkTokens(c.items,l));break}default:{let c=o;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(d=>{let h=c[d].flat(1/0);Ps(i,this.walkTokens(h,l))}):c.tokens&&Ps(i,this.walkTokens(c.tokens,l))}}return i}use(...n){let l=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return n.forEach(i=>{let o={...i};if(o.async=this.defaults.async||o.async||!1,i.extensions&&(i.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let d=l.renderers[c.name];d?l.renderers[c.name]=function(...h){let m=c.renderer.apply(this,h);return m===!1&&(m=d.apply(this,h)),m}:l.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=l[c.level];d?d.unshift(c.tokenizer):l[c.level]=[c.tokenizer],c.start&&(c.level==="block"?l.startBlock?l.startBlock.push(c.start):l.startBlock=[c.start]:c.level==="inline"&&(l.startInline?l.startInline.push(c.start):l.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(l.childTokens[c.name]=c.childTokens)}),o.extensions=l),i.renderer){let c=this.defaults.renderer||new Cc(this.defaults);for(let d in i.renderer){if(!(d in c))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let h=d,m=i.renderer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v===!1?"":v??""}}o.renderer=c}if(i.tokenizer){let c=this.defaults.tokenizer||new Ua(this.defaults);for(let d in i.tokenizer){if(!(d in c))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let h=d,m=i.tokenizer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.tokenizer=c}if(i.hooks){let c=this.defaults.hooks||new Ji;for(let d in i.hooks){if(!(d in c))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let h=d,m=i.hooks[h],p=c[h];Ji.passThroughHooks.has(d)?c[h]=g=>{if(c.options.async&&Ji.passThroughHooksRespectAsync.has(d))return(async()=>{let x=await m.call(c,g);return p.call(c,x)})();let v=m.call(c,g);return p.call(c,v)}:c[h]=(...g)=>{if(c.options.async)return(async()=>{let x=await m.apply(c,g);return x===!1&&(x=await p.apply(c,g)),x})();let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.hooks=c}if(i.walkTokens){let c=this.defaults.walkTokens,d=i.walkTokens;o.walkTokens=function(h){let m=[];return Ps(m,d.call(this,h)),c&&Ps(m,c.call(this,h)),m}}this.defaults={...this.defaults,...o}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,l){return $n.lex(n,l??this.defaults)}parser(n,l){return Un.parse(n,l??this.defaults)}parseMarkdown(n){return(l,i)=>{let o={...i},c={...this.defaults,...o},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&o.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof l>"u"||l===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof l!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(l)+", 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(l):l,m=await(c.hooks?await c.hooks.provideLexer(n):n?$n.lex:$n.lexInline)(h,c),p=c.hooks?await c.hooks.processAllTokens(m):m;c.walkTokens&&await Promise.all(this.walkTokens(p,c.walkTokens));let g=await(c.hooks?await c.hooks.provideParser(n):n?Un.parse:Un.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(g):g})().catch(d);try{c.hooks&&(l=c.hooks.preprocess(l));let h=(c.hooks?c.hooks.provideLexer(n):n?$n.lex:$n.lexInline)(l,c);c.hooks&&(h=c.hooks.processAllTokens(h)),c.walkTokens&&this.walkTokens(h,c.walkTokens);let m=(c.hooks?c.hooks.provideParser(n):n?Un.parse:Un.parseInline)(h,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(h){return d(h)}}}onError(n,l){return i=>{if(i.message+=`
189
+ Please report this to https://github.com/markedjs/marked.`,n){let o="<p>An error occurred:</p><pre>"+dn(i.message+"",!0)+"</pre>";return l?Promise.resolve(o):o}if(l)return Promise.reject(i);throw i}}},Dl=new uy;function Fe(n,l){return Dl.parse(n,l)}Fe.options=Fe.setOptions=function(n){return Dl.setOptions(n),Fe.defaults=Dl.defaults,ey(Fe.defaults),Fe};Fe.getDefaults=_h;Fe.defaults=Ll;function mT(...n){return Dl.use(...n),Fe.defaults=Dl.defaults,ey(Fe.defaults),Fe}Fe.use=mT;Fe.walkTokens=function(n,l){return Dl.walkTokens(n,l)};Fe.parseInline=Dl.parseInline;Fe.Parser=Un;Fe.parser=Un.parse;Fe.Renderer=Cc;Fe.TextRenderer=Ih;Fe.Lexer=$n;Fe.lexer=$n.lex;Fe.Tokenizer=Ua;Fe.Hooks=Ji;Fe.parse=Fe;Fe.options;Fe.setOptions;Fe.walkTokens;Fe.parseInline;Un.parse;$n.lex;const In="\\u1100-\\u11ff\\u20a9\\u2329-\\u232a\\u2630-\\u2637\\u268a-\\u268f\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303e\\u3041-\\u3096\\u3099-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u31e5\\u31ef-\\u321e\\u3220-\\u3247\\u3250-\\ua48c\\ua490-\\ua4c6\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufaff\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe66\\ufe68-\\ufe6b\\uff01-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\\uffe0-\\uffe6\\uffe8-\\uffee\\u{16fe0}-\\u{16fe4}\\u{16ff0}-\\u{16ff6}\\u{17000}-\\u{18cda}\\u{18cff}-\\u{18d20}\\u{18d80}-\\u{18df2}\\u{18e00}-\\u{19191}\\u{191a0}-\\u{191d2}\\u{1aff0}-\\u{1aff3}\\u{1aff5}-\\u{1affb}\\u{1affd}-\\u{1affe}\\u{1b000}-\\u{1b128}\\u{1b132}\\u{1b150}-\\u{1b152}\\u{1b155}\\u{1b164}-\\u{1b168}\\u{1b170}-\\u{1b2fb}\\u{1d300}-\\u{1d356}\\u{1d360}-\\u{1d376}\\u{1f1ae}\\u{1f200}\\u{1f202}\\u{1f210}-\\u{1f219}\\u{1f21b}-\\u{1f22e}\\u{1f230}-\\u{1f231}\\u{1f237}\\u{1f23b}\\u{1f240}-\\u{1f248}\\u{1f260}-\\u{1f265}\\u{1f7da}\\u{20000}-\\u{3fffd}",Ga=new RegExp(`[${In}]`,"u"),pT=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${In}])`,"u");function dy(n,l,i){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${n}(\\*+)(?=[\\s]|$)|${i}(\\*+)(?!\\*)(?=${l}|$)|(?!\\*)${l}(\\*+)(?=${i})|[\\s](\\*+)(?!\\*)(?=${n})|(?!\\*)${n}(\\*+)(?!\\*)(?=${n})|${i}(\\*+)(?=${i})`,"gu")}function gT(n,l,i){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${n}(_+)(?=[\\s]|$)|${i}(_+)(?!_)(?=${l}|$)|(?!_)${l}(_+)(?=${i})|[\\s](_+)(?!_)(?=${n})|(?!_)${n}(_+)(?!_)(?=${n})`,"gu")}function vT(n,l,i){return new RegExp(`^[^~]+(?=[^~])|(?!~)${n}(~~?)(?=[\\s]|$)|${i}(~~?)(?!~)(?=${l}|$)|(?!~)${l}(~~?)(?=${i})|[\\s](~~?)(?!~)(?=${n})|(?!~)${n}(~~?)(?!~)(?=${n})|${i}(~~?)(?=${i})`,"gu")}const fy=`[\\p{P}\\p{S}${In}]`,hy=`[\\s\\p{P}\\p{S}${In}]`,my=`[^\\s\\p{P}\\p{S}${In}]`,xT=`(?![*_])[\\p{P}\\p{S}${In}]`,bT=`(?![*_])[\\s\\p{P}\\p{S}${In}]`,yT=`(?:[^\\s\\p{P}\\p{S}${In}]|[*_])`,kT=`(?!~)[\\p{P}\\p{S}${In}]`,jT=`(?!~)[\\s\\p{P}\\p{S}${In}]`,wT=`(?:[^\\s\\p{P}\\p{S}${In}]|~)`,NT=dy(fy,hy,my),ST=dy(kT,jT,wT),TT=gT(fy,hy,my),Cb=vT(xT,bT,yT);function Eb(n,l,i){let o=pT.test(n);if(!o&&n){const c=l.length-i.length;if(c>=1){let d=c-1,h=l.charCodeAt(d);if(h>=65024&&h<=65038&&d>=1&&(d--,h=l.charCodeAt(d)),(h&64512)===56320&&d>=1){const m=l.codePointAt(d-1);m!==void 0&&m>65535&&(m>=917760&&m<=917999?o=!0:o=Ga.test(String.fromCodePoint(m)))}else o=Ga.test(String.fromCharCode(h))}}return o}function Ab(n,l){if(!(n[1]||n[2]||n[3]||n[4]))return!1;const i=String.fromCodePoint(n[0].codePointAt(0)),o=n.index+n[0].length,c=o<l.length?String.fromCodePoint(l.codePointAt(o)):"";return Ga.test(i)||Ga.test(c)}function Yh(n){return n.length>=5}function CT(n){return!!(n[1]||n[2]||n[3]||n[4])}function ET(n){return Yh(n)?!!n[4]:!!n[3]}function AT(n){return Yh(n)?n[1]||n[3]||"":n[1]||n[2]||""}function nc(n){let l=n.length;const i=l-1;for(let o=0;o<i;){const c=n.charCodeAt(o++);if(c<55296||56320<=c)continue;const d=n.charCodeAt(o);d<56320||57344<=d||(o++,l--)}return l}function MT(){return{tokenizer:{emStrong(n,l,i=""){const{rules:o}=this,c=o.inline.emStrongLDelim.exec(n);if(!c)return!1;const d=Yh(c);if(d&&!CT(c))return;if(ET(c)&&i.match(o.other.unicodeAlphaNumeric))return!1;const h=AT(c),m=Eb(i,l,n);if(!h||!i||o.inline.punctuation.exec(i)||m||Ga.test(h)){const p=nc(c[0])-1;let g,v,x=p,w=0;const C=d&&i===c[0][0],T=o.inline.emStrongRDelimAst.source.includes("(?!~)");let N;c[0][0]==="*"?N=T?ST:NT:N=TT,N.lastIndex=0;const A=l.slice(-1*n.length+p);let M;for(;(M=N.exec(A))!=null;){if(g=M[1]||M[2]||M[3]||M[4]||M[5]||M[6],!g)continue;v=nc(g);const R=Ab(M,A),O=!!(M[3]||M[4]),J=!!(M[5]||M[6]);if(O&&!R){x+=v;continue}if(J||R){if(p%3&&!((p+v)%3)){w+=v;continue}if(C&&J)break}if(x-=v,x>0)continue;v=Math.min(v,v+x+w);const ee=M[0].codePointAt(0)>65535?2:1,B=n.slice(0,p+M.index+ee+v);if(Math.min(p,v)%2){const j=B.slice(1,-1);return{type:"em",raw:B,text:j,tokens:this.lexer.inlineTokens(j)}}const k=B.slice(2,-2);return{type:"strong",raw:B,text:k,tokens:this.lexer.inlineTokens(k)}}}},del(n,l,i=""){const{rules:o}=this,c=o.inline.delLDelim.exec(n);if(!c)return!1;const d=c[1]||"",h=Eb(i,l,n);if(!d||!i||o.inline.punctuation.exec(i)||h||Ga.test(d)){const m=nc(c[0])-1;let p,g,v=m;Cb.lastIndex=0;const x=l.slice(-1*n.length+m);let w;for(;(w=Cb.exec(x))!=null;){if(p=w[1]||w[2]||w[3]||w[4]||w[5]||w[6],!p||(g=nc(p),g!==m))continue;const C=Ab(w,x);if((w[3]||w[4])&&!C){v+=g;continue}if(v-=g,v>0)continue;g=Math.min(g,g+v);const T=w[0].codePointAt(0)>65535?2:1,N=n.slice(0,m+w.index+T+g),A=N.slice(m,-m);return{type:"del",raw:N,text:A,tokens:this.lexer.inlineTokens(A)}}}}}}}function nr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let lh,zT;function RT(){return zT??=mr(()=>import("./math-weKGDUmL.js"),__vite__mapDeps([0,1])).then(n=>{lh=n.default})}function OT(n){let l=!1;return or.walkTokens(or.lexer(n),i=>{(i.type==="inlineMath"||i.type==="displayMath")&&(l=!0)}),l}function Mb(n,l,i){if(!lh)return nr(i);try{return lh.renderToString(n,{displayMode:l,throwOnError:!0,trust:!1})}catch{return nr(i)}}const or=new uy({extensions:[{name:"displayMath",level:"block",start(n){return n.search(/\$\$|\\\[/)},tokenizer(n){const l=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])(?:\n|$)/.exec(n);if(l)return{type:"displayMath",raw:l[0],text:l[1]??l[2]}},renderer(n){return`<div class="math-display">${Mb(String(n.text),!0,n.raw.trimEnd())}</div>`}},{name:"inlineMath",level:"inline",start(n){return n.search(/\$|\\\(/)},tokenizer(n){const l=/^(?:\$(?!\$|\s)([^$`\n]*?[^$`\s])\$(?!\d)|\\\((.+?)\\\))/.exec(n);if(l)return{type:"inlineMath",raw:l[0],text:l[1]??l[2]}},renderer(n){return Mb(String(n.text),!1,n.raw)}}],renderer:{html(n){return nr(n.text??"")},code(n){const l=n.lang?.trim().split(/\s+/)[0]??"";return`<div class="code-block">${l?`<div class="code-head">${nr(l)}</div>`:""}<button type="button" class="code-copy" aria-label="复制代码" title="复制代码">${Nc("copy",15)}</button><pre><code>${nr(n.text)}
190
+ </code></pre></div>`}}});or.use(MT());const _T=/^(https?:|mailto:|\/|#|\.)/i;function DT(n){return or.parse(n,{async:!1,gfm:!0,breaks:!0}).replace(/<a href="([^"]*)"/g,(i,o)=>x0(o)?`<a class="knowledge-citation" href="${o}"`:_T.test(o.trim())?`<a target="_blank" rel="noreferrer" href="${o}"`:"<a").replace(/(<a class="knowledge-citation"[^>]*>)/g,`$1${Nc("doc",13)}`).replace(/[((]\s*(<a class="knowledge-citation"[^>]*>[\s\S]*?<\/a>)\s*[))]/g,"$1")}function $T(n){const l=[];for(const o of or.lexer(n,{gfm:!0})){const c=o.type==="table",d=l.at(-1);d&&!d.table&&!c?d.md+=o.raw:l.push({table:c,md:o.raw})}const i=l.filter(o=>o.table||o.md.trim());return i.length?i:[{table:!1,md:n}]}const ah=/[\p{L}\p{N}]/u;function UT(n){const l=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s*[#>\-*]+\s*/gm,"");return Array.from(l).filter(i=>ah.test(i)).join("")}function LT(n,l){const i=[];let o="";for(const g of n)for(let v=0;v<g.data.length;){const x=String.fromCodePoint(g.data.codePointAt(v));if(ah.test(x)){o+=x;for(let w=0;w<x.length;w++)i.push({node:g,offset:v,end:v+x.length})}v+=x.length}const c=Array.from(l).filter(g=>ah.test(g)).join("");if(!c)return null;let d=o.indexOf(c),h=d+c.length;if(d<0){const g=Array.from(c),v=g.slice(0,40).join(""),x=g.slice(-40).join("");if(d=o.indexOf(v),d<0)return null;const w=o.lastIndexOf(x,d+c.length*2-x.length);h=w>=d+v.length?w+x.length:d+v.length}const m=i[d],p=i[h-1];return{start:{node:m.node,offset:m.offset},end:{node:p.node,offset:p.end}}}async function HT(n,l){try{const i=await WN(n,l);zt(i.entry.path,i.entry.name,{find:i.chunk?UT(i.chunk.text):void 0,page:i.chunk?.page})}catch(i){Xa(i instanceof Ue&&i.status===404?"这份资料已经删除":`无法打开资料:${i instanceof Error?i.message:String(i)}`)}}function Ka({text:n,className:l,streaming:i,onMathRendered:o}){const[c,d]=y.useState(0);return y.useEffect(()=>{let h=!0;return OT(n)&&RT().then(()=>{h&&d(m=>m+1)}).catch(()=>{}),()=>{h=!1}},[n]),y.useEffect(()=>{c&&o?.()},[c,o]),s.jsx("div",{className:l,onClick:h=>{const m=h.target.closest("a.knowledge-citation"),p=m&&x0(m.getAttribute("href")??"");if(p){h.preventDefault(),h.stopPropagation(),HT(p.entryId,p.chunk);return}const g=h.target.closest(".code-copy");if(!g)return;h.stopPropagation();const v=g.closest(".code-block")?.querySelector("code")?.textContent??"";Oh(v.endsWith(`
191
+ `)?v.slice(0,-1):v).then(x=>{if(!x){Xa("复制失败:浏览器不允许写入剪贴板");return}g.innerHTML=Nc("check",15),g.setAttribute("aria-label","已复制"),window.setTimeout(()=>{g.innerHTML=Nc("copy",15),g.setAttribute("aria-label","复制代码")},1500)})},dangerouslySetInnerHTML:{__html:DT(n)+(i?'<span class="cur"></span>':"")}})}const BT={".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 qT(n){const l=n.lastIndexOf(".");return l>0?n.slice(l).toLowerCase():""}function IT(n){return BT[qT(n)]}function YT(n,l){return Array.from({length:l},(i,o)=>{const c=Math.floor(o*n.length/l),d=Math.floor((o+1)*n.length/l);let h=0;for(let m=c;m<d;m++)h=Math.max(h,Math.abs(n[m]));return h})}let Ma=null;function GT({path:n,name:l,fallback:i,itemId:o}){const c=y.useRef(null),[d,h]=y.useState(null),[m,p]=y.useState(0),[g,v]=y.useState(0),[x,w]=y.useState(!0),[C,T]=y.useState(1);y.useEffect(()=>{const M=new AbortController;let R;return(async()=>{try{const O=await fetch(Yt(n),{signal:M.signal});if(!O.ok||Number(O.headers.get("content-length"))>20*1024*1024)return;const J=O.body?.getReader();if(!J)return;const ee=[];let B=0;for(;;){const{done:U,value:X}=await J.read();if(U)break;if(B+=X.byteLength,B>20*1024*1024){await J.cancel();return}ee.push(X)}const k=new Uint8Array(B);let j=0;for(const U of ee)k.set(U,j),j+=U.byteLength;R=new AudioContext;const E=await R.decodeAudioData(k.buffer);M.signal.aborted||h(YT(E.getChannelData(0),50))}catch{}finally{R&&R.close()}})(),()=>{M.abort(),Ma===c.current&&(Ma=null)}},[n]);const N=g?Math.min(1,m/g):0,A=M=>`${Math.floor(M/60)}:${String(Math.floor(M%60)).padStart(2,"0")}`;return s.jsxs("div",{className:"media-audio","data-item-id":o,children:[s.jsx("audio",{ref:c,src:Yt(n),preload:"metadata",onError:i,onPlay:M=>{Ma&&Ma!==M.currentTarget&&Ma.pause(),Ma=M.currentTarget,w(!1)},onPause:()=>w(!0),onTimeUpdate:M=>p(M.currentTarget.currentTime),onLoadedMetadata:M=>v(M.currentTarget.duration)}),s.jsx("button",{className:"audio-play","aria-label":x?"播放":"暂停",onClick:()=>{const M=c.current;M&&(M.paused?M.play().catch(i):M.pause())},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",children:x?s.jsx("path",{d:"M8.5 5.8v12.4a1 1 0 0 0 1.5.86l10-6.2a1 1 0 0 0 0-1.72l-10-6.2a1 1 0 0 0-1.5.86Z"}):s.jsx("path",{d:"M7 5h3.5v14H7zM13.5 5H17v14h-3.5z"})})}),s.jsxs("div",{className:"audio-main",children:[s.jsx("button",{className:"audio-name",onClick:()=>zt(n,l),children:l}),s.jsxs("div",{className:"audio-track",children:[d?s.jsx("div",{className:"audio-bars","aria-hidden":"true",children:d.map((M,R)=>s.jsx("i",{className:R/d.length<N?"played":"",style:{height:`${Math.max(12,M*100)}%`}},R))}):s.jsx("div",{className:"audio-line",children:s.jsx("i",{style:{width:`${N*100}%`}})}),s.jsx("input",{type:"range","aria-label":"播放进度",min:0,max:g||0,step:"0.01",value:Math.min(m,g||0),onChange:M=>{c.current&&(c.current.currentTime=Number(M.target.value))}})]})]}),s.jsx("span",{className:"audio-time",children:A(g||0)}),s.jsxs("button",{className:"audio-rate",onClick:()=>{const M=C===1?1.5:C===1.5?2:1;T(M),c.current&&(c.current.playbackRate=M)},children:[C,"×"]})]})}function zb({path:n,name:l,fallback:i,itemId:o}){const[c,d]=y.useState(!1);if(c)return i;const h=IT(n);return h==="audio"?s.jsx(GT,{path:n,name:l,fallback:()=>d(!0),itemId:o}):h==="video"?s.jsxs("div",{className:"media-video","data-item-id":o,children:[s.jsx("video",{controls:!0,playsInline:!0,preload:"metadata",src:Yt(n),onError:()=>d(!0)}),s.jsx("button",{onClick:()=>zt(n,l),children:l})]}):i}const za=13,KT=2.7,Rb=700;function XT(n){const l=/^(\d{2,5})x(\d{2,5})$/.exec(n??""),i=l?Number(l[1])/Number(l[2]):1;return Math.min(16/9,Math.max(9/16,i))}function ZT(n){return Math.min(.96,1-Math.exp(-n/30))}function VT(n){return n<.2?"正在构思":n<.55?"正在勾勒草图":n<.85?"正在上色":"正在润色细节"}function QT(){return[[.22,.6,.3],[.18,.5,.7]].map(([n,l,i])=>{const o=.3+Math.random()*.4;return{x:i,y:o,tx:i,ty:o,next:0,r:n,gain:l}})}function JT(n,l){for(let i=0;i<6;i++)if(n.tx=.2+Math.random()*.6,n.ty=.2+Math.random()*.6,Math.hypot(n.tx-l.tx,n.ty-l.ty)>.35)return}const _f=[3500,7500];function PT(n,l,i,o){const c=(l-n.at)/n.dur;if(c<0||c>=1)return 0;const d=Math.hypot(i,o);if(n.kind==="ring"){const h=d-c*.85;return .75*(1-c)*Math.exp(-(h*h)/.008)}return .7*Math.sin(Math.PI*c)*Math.exp(-(d*d)/.03)}function FT({status:n,prompt:l,size:i,path:o,error:c,startedAt:d,fresh:h,itemId:m}){const p=y.useRef(null),[g,v]=y.useState(n==="done"?"shown":"live"),[x,w]=y.useState(()=>Date.now()),C=Date.parse(d)||Date.now(),T=y.useRef(g);T.current=g,y.useEffect(()=>{if(n!=="pending")return;const M=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(M)},[n]),y.useEffect(()=>{if(g!=="reveal")return;const M=setTimeout(()=>v("shown"),Rb+200);return()=>clearTimeout(M)},[g]),y.useEffect(()=>{const M=p.current;if(!M||g==="shown")return;const R=M.getContext("2d");if(!R)return;const O=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let J=0,ee=!0,B=0,k=[];const j=QT();let E=[],U=0,X=0;const oe=new IntersectionObserver(([ye])=>{ee=ye.isIntersecting,ee&&!J&&(J=requestAnimationFrame(ce))});oe.observe(M);function ce(ye){J=0;const Ce=Math.min(2,window.devicePixelRatio||1),{width:ue,height:xe}=M.getBoundingClientRect();(M.width!==Math.round(ue*Ce)||M.height!==Math.round(xe*Ce))&&(M.width=Math.round(ue*Ce),M.height=Math.round(xe*Ce)),R.setTransform(Ce,0,0,Ce,0,0),R.clearRect(0,0,ue,xe);const ge=Math.max(1,Math.floor(ue/za)),Re=Math.max(1,Math.floor(xe/za)),Te=(ue-(ge-1)*za)/2,pt=(xe-(Re-1)*za)/2;k.length!==ge*Re&&(k=Array.from({length:ge*Re},()=>Math.random()));const wt=document.documentElement.classList.contains("dark");T.current==="reveal"&&!B&&(B=ye);const gt=B?Math.min(1,(ye-B)/Rb):0,$=n==="pending"&&!O,le=X?Math.min(.1,(ye-X)/1e3):0;if(X=ye,$){if(U||(U=ye+1200+Math.random()*1500),ye>U){const te=Math.random()<.5;E.push({kind:te?"ring":"swell",x:.2+Math.random()*.6,y:.2+Math.random()*.6,at:ye,dur:te?2600:1800}),U=ye+_f[0]+Math.random()*(_f[1]-_f[0])}E=E.filter(te=>ye-te.at<te.dur);for(const[te,ae]of j.entries()){ye>ae.next&&(JT(ae,j[1-te]),ae.next=ye+3e3+Math.random()*2500);const fe=1-Math.exp(-le*.7);ae.x+=(ae.tx-ae.x)*fe,ae.y+=(ae.ty-ae.y)*fe}}R.fillStyle=wt?"rgb(232,232,230)":"rgb(38,38,36)";const L=ue/xe,Y=ye/1e3;for(let te=0;te<Re;te++)for(let ae=0;ae<ge;ae++){const fe=k[te*ge+ae],ve=ge>1?ae/(ge-1):.5,tt=Re>1?te/(Re-1):.5,at=Math.min(1,Math.min(ve,1-ve,tt,1-tt)/.3);let ct=.12;if(n!=="failed"){for(const Lt of j){const An=(ve-Lt.x)*L,el=tt-Lt.y;ct+=Lt.gain*Math.exp(-(An*An+el*el)/(Lt.r*Lt.r))}for(const Lt of E)ct+=PT(Lt,ye,(ve-Lt.x)*L,tt-Lt.y)}const $t=$?Math.sin(Y*1.3+fe*6.28)*.03:0,nt=Math.min(1,Math.max(0,.08+.92*(.35+.65*at)*Math.min(1,ct)+$t)),qe=Math.min(1,Math.max(0,(gt-fe*.6)/.4)),Ut=(.45+(KT-.45)*nt)*(1-qe);Ut<.3||(R.globalAlpha=(.16+.84*nt)*(1-qe),R.beginPath(),R.arc(Te+ae*za,pt+te*za,Ut,0,Math.PI*2),R.fill())}R.globalAlpha=1,(T.current==="reveal"?gt<1:$)&&ee&&(J=requestAnimationFrame(ce))}return J=requestAnimationFrame(ce),()=>{cancelAnimationFrame(J),oe.disconnect()}},[g,n,C]);const N=Math.max(0,Math.floor((x-C)/1e3)),A=ZT(N);return s.jsxs("div",{className:`igen ${g}${n==="failed"?" failed":""}${h?" enter":""}`,"data-item-id":m,children:[g==="live"&&n!=="failed"?s.jsx("div",{className:"igen-stage",role:"status",title:l,children:VT(A)}):null,s.jsxs("div",{className:"igen-frame",style:{aspectRatio:String(XT(i))},children:[o?s.jsx("button",{className:"igen-img",onClick:()=>zt(o),title:l,tabIndex:g==="live"?-1:0,children:s.jsx("img",{src:$l(o),alt:l,onLoad:()=>{T.current==="live"&&v("reveal")}})}):null,g==="shown"?null:s.jsx("canvas",{ref:p,"aria-hidden":"true"}),g==="live"&&n==="pending"?s.jsxs("span",{className:"igen-pct",children:[Math.floor(A*100),"%"]}):null]}),n==="failed"&&g==="live"?s.jsxs("div",{className:"igen-cap",role:"status",title:l,children:[s.jsx("span",{children:"没有生成出来"}),s.jsx("span",{className:"igen-note",children:c||"图片生成失败。"})]}):null]})}const WT=50,eC=110;function tC({photos:n,onOpen:l}){const[i,o]=y.useState(0),[c,d]=y.useState(0),h=y.useRef(null),m=n.length,p=Math.min(1,Math.abs(c)/eC),g=v=>{const x=h.current;h.current=null,x&&(x.moved?Math.abs(c)>WT&&o((i+1)%m):v&&l(n[i]),d(0))};return s.jsx("div",{className:`album-stack${c?" dragging":""}`,role:"group","aria-label":`${m} 张图片,左右滑动切换,点一下查看`,onPointerDown:v=>{h.current={id:v.pointerId,x:v.clientX,moved:!1},v.currentTarget.setPointerCapture(v.pointerId)},onPointerMove:v=>{const x=h.current;if(!x||x.id!==v.pointerId)return;const w=v.clientX-x.x;!x.moved&&Math.abs(w)<6||(x.moved=!0,d(w))},onPointerUp:()=>g(!0),onPointerCancel:()=>g(!1),children:n.map((v,x)=>{const w=(x-i+m)%m;if(w>2)return null;const T={"--d":w===0?0:w-p,"--dx":w===0?`${c}px`:"0px","--rot":w===0?`${c*.06}deg`:"0deg",zIndex:m-w};return s.jsx("img",{src:$l(v),alt:"",draggable:!1,style:T},v)})})}const py=["日","一","二","三","四","五","六"];function Pi(n){return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function Gh(n,l){const i=new Date(n),o=new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),c=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime();return Math.round((o-c)/864e5)}function Dt(n,l=new Date){const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=Gh(n,l);return o===0?`今天 ${Pi(i)}`:o===1?`昨天 ${Pi(i)}`:o===-1?`明天 ${Pi(i)}`:`${i.getMonth()+1}月${i.getDate()}日 ${Pi(i)}`}function hc(n,l=new Date){if(!n)return"";const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=Gh(n,l);return o===0?Pi(i):o===1?"昨天":`${i.getMonth()+1}月${i.getDate()}日`}function xr(n,l=Date.now()){const i=Math.max(0,Math.round((l-new Date(n).getTime())/6e4));if(i<1)return"刚刚";if(i<60)return`${i} 分钟`;const o=Math.floor(i/60),c=i%60;return c?`${o} 小时 ${c} 分钟`:`${o} 小时`}function Hl(n){const l=Math.max(0,Math.round(n/1e3));if(l<60)return`${l} 秒`;const i=Math.floor(l/60);if(i<60){const o=l%60;return o?`${i} 分 ${o} 秒`:`${i} 分钟`}return`${Math.floor(i/60)} 小时 ${i%60} 分钟`}function ih(n){if(n<1e3)return String(n);const l=n/1e3;return`${l<10?l.toFixed(1):Math.round(l)}k`}function nC(n){return[n.durationMs!==void 0?Hl(n.durationMs):void 0,n.tools!==void 0?`${n.tools} 次操作`:void 0,n.tokens!==void 0?`${ih(n.tokens)} token`:void 0].filter(Boolean).join(" · ")}function Qa(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 sC(n,l=new Date){return Gh(n,l)===0}function lC(n,l){return n?new Date(l).getTime()-new Date(n).getTime()>300*1e3:!1}function Kh(n){const l={kind:"raw",hour:9,minute:0,weekday:5,day:1,raw:n},i=n.trim().split(/\s+/);if(i.length!==5)return l;const[o,c,d,h,m]=i;if(!/^\d+$/.test(o)||!/^\d+$/.test(c)||h!=="*")return l;const p=Number(o),g=Number(c);return p>59||g>23?l:d==="*"&&m==="*"?{...l,kind:"daily",hour:g,minute:p}:d==="*"&&/^\d$/.test(m)?{...l,kind:"weekly",hour:g,minute:p,weekday:Number(m)}:/^\d{1,2}$/.test(d)&&m==="*"?{...l,kind:"monthly",hour:g,minute:p,day:Number(d)}:l}function aC(n){const l=String(n.minute).padStart(2,"0"),i=String(n.hour).padStart(2,"0");return n.kind==="daily"?`${n.minute} ${n.hour} * * *`:n.kind==="weekly"?`${n.minute} ${n.hour} * * ${n.weekday}`:n.kind==="monthly"?`${n.minute} ${n.hour} ${n.day} * *`:n.raw.trim()||`${l} ${i} * * *`}function gy(n,l=new Date){const i=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::\d{2})?$/.exec(n.trim());if(!i)return;const[,o,c,d,h,m]=i;return`${Number(o)===l.getFullYear()?"":`${Number(o)}年`}${Number(c)}月${Number(d)}日 ${h}:${m}`}function Ec(n){const l=gy(n);if(l)return`${l}(一次)`;const i=/^\*\/(\d+) \* \* \* \*$/.exec(n.trim());if(i)return`每 ${i[1]} 分钟`;const o=Kh(n),c=`${String(o.hour).padStart(2,"0")}:${String(o.minute).padStart(2,"0")}`;return o.kind==="daily"?`每天 ${c}`:o.kind==="weekly"?`每周${py[o.weekday]??"?"} ${c}`:o.kind==="monthly"?`每月${o.day}日 ${c}`:n}function iC(n,l,i){const o=l-n.x,c=i-n.y;let d=n.direction;return d==="pending"&&Math.hypot(o,c)>8&&(o<-8&&Math.abs(o)>Math.abs(c)*1.5?d="horizontal":(Math.abs(c)>Math.abs(o)||o>8)&&(d="vertical")),{...n,direction:d,distance:d==="horizontal"?Math.max(0,-o):0}}function Ob(n){return n.direction==="horizontal"&&n.distance>48}function rC(n,l){return{top:n.bottom+8+92<=l.bottom?n.bottom+8:Math.max(l.top+8,n.top-92-8),left:Math.max(l.left+8,Math.min(n.right-160,l.right-168))}}function oC(n,l){return l.type==="open"?l.id:l.type==="outside"&&l.inside?n:null}function vy(n){return n.status==="running"?"沉淀技能中…":n.status==="empty"?"没有要沉淀的":n.status==="failed"?"沉淀失败":n.updated?`已更新技能「${n.title}」· 第 ${n.version} 版`:`已沉淀技能「${n.title}」`}const es={queued:{text:"排队中",icon:"clock",color:"",spin:!1},running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等助手回复",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},failed:{text:"失败",icon:"close",color:"bad",spin:!1},stopped:{text:"已停止",icon:"stop",color:"",spin:!1}},xy={running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等你确认",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},interrupted:{text:"已中断",icon:"close",color:"bad",spin:!1},returned:{text:"已退回",icon:"close",color:"bad",spin:!1},takenOver:{text:"已被你接手",icon:"user",color:"",spin:!1}};function Xh(n,l,i){const o=es[n];return s.jsx(Q,{name:o.icon,size:l,w:i,className:o.spin?"spin":""})}function js({meta:n,card:l=!1,animated:i=!1,swapped:o=!1,children:c}){const d=l?`st${n.color==="ok"?" done":n.color==="bad"?" bad":""}`:`jt-st${n.color?` ${n.color}`:""}`;return s.jsxs("span",{className:d,children:[i?s.jsxs("span",{className:"stico",children:[s.jsx(Q,{name:"spin",size:14,w:2,className:`spin stspin${n.spin?"":" off"}`}),n.spin?null:s.jsx(Q,{name:n.icon,size:14,w:2,className:`stic${n.color==="ok"?" pop":""}${o?" anim":""}`})]}):s.jsx(Q,{name:n.icon,size:l?14:13,className:n.spin?"spin":""}),n.text,c]})}const cC={memory:"mem",skill:"bulb",rule:"rule",routine:"clock",split:"split",info:"info"};function uC(){const[n,l]=y.useState(()=>window.matchMedia("(hover: none)").matches);return y.useEffect(()=>{const i=window.matchMedia("(hover: none)"),o=()=>l(i.matches);return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]),n}function rh({text:n,itemId:l,menu:i=!1,close:o}){const[c,d]=y.useState(!1),h=y.useRef(0);y.useEffect(()=>()=>window.clearTimeout(h.current),[]);const m=async()=>{if(!await Oh(n)){Xa("复制失败:浏览器不允许写入剪贴板");return}if(i){o?.();return}d(!0),window.clearTimeout(h.current),h.current=window.setTimeout(()=>d(!1),1500)};return s.jsxs("div",{className:`tools${i?" menu":""}`,children:[s.jsxs("button",{title:"回复","aria-label":"回复",onClick:()=>{kc({itemId:l,text:Ba(n).slice(0,60)}),ir(),o?.()},children:[s.jsx(Q,{name:"reply",size:16}),i?"回复":null]}),s.jsxs("button",{className:c?"copied":"",title:c?"已复制":"复制","aria-label":c?"已复制":"复制",onClick:()=>void m(),children:[s.jsx(Q,{name:c?"check":"copy",size:16}),i?"复制":null]})]})}function _b({anchor:n,text:l,itemId:i,close:o}){const[c,d]=y.useState(null),h=y.useRef(null);if(y.useLayoutEffect(()=>{const v=n.current,x=v?.closest(".mmsgs, .msgs");v&&x&&d({bubble:v.getBoundingClientRect(),area:x.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,g=rC(m,p);return Za.createPortal(s.jsxs("div",{className:"message-popup",onPointerDown:v=>v.stopPropagation(),children:[s.jsx("div",{className:"message-shade",style:{left:p.left,top:p.top,width:p.width,height:p.height},onPointerDown:o}),s.jsx("div",{ref:h,className:"message-popup-bubble",style:{left:m.left,top:m.top,width:m.width}}),s.jsx("div",{className:"message-popup-menu",style:g,children:s.jsx(rh,{text:l,itemId:i,menu:!0,close:o})})]}),document.body)}function dC(n,l){const o=[...n.currentTarget.closest(".col")?.querySelectorAll(".message-row[data-item-id]")??[]].find(c=>c.dataset.itemId===l);o&&v0(o)}function Db(n){const l=n.durationMs??(n.startedAt&&n.endedAt?Date.parse(n.endedAt)-Date.parse(n.startedAt):void 0);return l===void 0?void 0:Hl(l)}function fC({job:n,round:l,fresh:i,itemId:o}){const c=we(),d=rN(n,l),h=d!==n,[m,p]=y.useState(!1),[g,v]=y.useState(""),[x,w]=y.useState(!1),C=fn(m,200),T=d.status==="running",N=!h&&(T||d.status==="waiting"),A=d.status==="stuck"||d.status==="failed",M=yh(d),R=c.assistants.find(E=>E.id===d.assistantId),O=h?void 0:d.sediment,J=O&&O.status!=="empty"?O:void 0,ee=y.useRef(void 0);J&&(ee.current=J);const B=fn(!!J,200),k=B.mounted?J??ee.current:void 0,j=y.useRef(d.status);return y.useEffect(()=>{if(j.current===d.status)return;j.current=d.status,w(!0);const E=window.setTimeout(()=>w(!1),400);return()=>window.clearTimeout(E)},[d.status]),s.jsx("div",{className:`hov${i?" enter":""}`,id:h?void 0:`job-${d.id}`,"data-item-id":o,children:s.jsxs("div",{className:"b jobcard",role:"button",tabIndex:0,onClick:()=>Ln(d.id,l??0),onKeyDown:E=>{E.key==="Enter"&&Ln(d.id,l??0)},children:[s.jsxs("div",{className:"tt",children:[R?s.jsx("span",{className:"jav",children:s.jsx(ot,{sprite:R.sprite,prop:R.prop,size:40})}):null,s.jsxs("span",{className:"jt",children:[d.routineId?s.jsx(Q,{name:"clock",size:14}):null,d.title]}),s.jsx("span",{className:"stline",children:s.jsx(js,{meta:es[d.status],card:!0,animated:!0,swapped:x,children:T?` · ${xr(d.startedAt??d.createdAt)}`:Db(d)?` · 用时 ${Db(d)}`:null})})]}),M||k?s.jsxs("div",{className:`jnote${!M&&B.leaving?" leaving":""}`,children:[M?s.jsx("div",{className:`jnote-row${A?" bad":""}`,children:s.jsx("span",{className:"clamp",children:M})}):null,k?s.jsxs("div",{className:`jnote-row${k.status==="failed"?" bad":""}`,children:[s.jsx(Q,{name:k.status==="running"?"spin":"mem",size:13,className:k.status==="running"?"spin":void 0}),s.jsx("span",{children:vy(k)})]}):null]}):null,N||T?s.jsxs("div",{className:"acts",children:[N?s.jsxs("button",{className:`hob-btn job-reply${m?" selected":""}`,"aria-pressed":m,onClick:E=>{E.stopPropagation(),p(U=>!U)},children:[s.jsx(Q,{name:"edit",size:14}),"补充要求"]}):null,T?s.jsxs("button",{className:"hob-btn hob-btn-danger job-stop",onClick:E=>{E.stopPropagation(),H0(d.id)},children:[s.jsx(Q,{name:"stop",size:14}),"停止"]}):null]}):null,C.mounted?s.jsx("div",{className:`replywrap${C.leaving?" leaving":""}`,onClick:E=>E.stopPropagation(),children:s.jsx("div",{className:"replyclip",children:s.jsxs("div",{className:"replybox",children:[s.jsx("input",{autoFocus:!0,value:g,placeholder:"补充说明或更正方向",onChange:E=>v(E.target.value),onKeyDown:E=>{E.key==="Enter"&&g.trim()&&(Pf(d.id,g.trim()),v(""),p(!1)),E.key==="Escape"&&p(!1)}}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{g.trim()&&Pf(d.id,g.trim()),v(""),p(!1)},children:"发送"})]})})}):null]})})}function $b({draft:n}){const l=we(),i=n.status==="created"&&n.createdAssistantId,o=i?l.assistants.find(h=>h.id===n.createdAssistantId):void 0,c=o?.prop??n.prop,d=!!i&&!o;return s.jsxs("div",{className:"draft",children:[s.jsxs("div",{className:"top",children:[s.jsx(ot,{sprite:o?.sprite??n.sprite,prop:c,size:46}),s.jsxs("div",{children:[s.jsx("div",{className:"dn",children:n.name}),s.jsx("div",{className:"ds",children:n.status==="created"?"新助手 · 已创建":"新助手 · 草稿"})]})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"职责"}),s.jsx("span",{children:n.dutyLong})]}),s.jsx("div",{className:`expand${i?"":" open"}`,inert:!!i,children:s.jsxs("div",{children:[s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"定时任务"}),s.jsx("span",{className:n.routinesText?void 0:"none",children:n.routinesText||"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"执行前确认"}),s.jsx("span",{className:n.askFirst.length?void 0:"none",children:n.askFirst.join(" · ")||"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"补充说明"}),n.instructions.length?s.jsx("span",{children:n.instructions.map((h,m)=>s.jsx("span",{className:"line",children:h},m))}):s.jsx("span",{className:"none",children:"没有"})]}),s.jsxs("div",{className:"kv",children:[s.jsx("span",{className:"k",children:"迁移"}),s.jsxs("span",{children:[n.carry.conversations," 段对话"]})]})]})}),s.jsxs("div",{className:"acts swap",style:{marginTop:12},children:[s.jsxs("div",{className:i?"off":void 0,children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void xS(n.id),children:"创建"}),s.jsx("button",{className:"hob-btn",onClick:()=>{Ch("请修改草稿:"),ir()},children:"修改草稿"})]}),s.jsx("div",{className:i?void 0:"off",children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:d,onClick:()=>void Pt(n.createdAssistantId),children:d?"已归档":"已创建 · 查看"})})]})]})}function hC({delegation:n,fresh:l}){const i=we(),[o,c]=y.useState(!1),d=y.useRef(n.status),h=d.current!==n.status;y.useEffect(()=>{d.current=n.status},[n.status]);const m=i.assistants.find(v=>v.id===n.to),p=m?.name??n.to,g=Object.values(i.approvals).filter(v=>v.status==="pending"&&((n.approvalIds??[]).includes(v.id)||!!(v.jobId&&n.jobIds.includes(v.jobId))));return s.jsx("div",{className:`hov${l?" enter":""}`,id:`delegation-${n.id}`,children:s.jsxs("div",{className:"b jobcard delegation-card",children:[s.jsxs("div",{className:"tt",children:[m?s.jsx("span",{className:"jav",children:s.jsx(ot,{sprite:m.sprite,prop:m.prop,size:40})}):null,s.jsxs("span",{className:"jt",children:["交给「",p,"」"]}),s.jsx("span",{className:h?"status-fade":void 0,children:s.jsx(js,{meta:xy[n.status],card:!0})},n.status)]}),s.jsx("button",{className:`delegation-text${o?" expanded":""}`,onClick:()=>c(!o),title:o?"收起":"查看全文",children:n.text}),n.status==="returned"&&n.reply?s.jsx("div",{className:"note",children:n.reply}):null,n.jobIds.map(v=>{const x=i.jobs[v];return x?s.jsxs("button",{className:`delegation-job ${x.status}`,onClick:()=>Ln(v),title:es[x.status].text,children:[Xh(x.status,14,2),s.jsx("span",{children:x.title}),s.jsx(Q,{name:"chev",size:14,className:"go"})]},v):null}),g.map(v=>s.jsx(by,{approval:v,fresh:!1},v.id)),s.jsxs("div",{className:"delegation-actions",children:[s.jsxs("button",{onClick:()=>void Eh(n.to,n.id,!0),children:["去「",p,"」看看 →"]}),n.status==="interrupted"?s.jsx("button",{onClick:()=>void yS(n.id),children:"重新转交"}):null]})]})})}function by({approval:n,fresh:l}){const i=y.useRef(n.status),o=i.current!==n.status;y.useEffect(()=>{i.current=n.status},[n.status]);const c=n.options.find(N=>N.key===n.chosen),d=n.status==="answered"&&c?n.chosen:void 0,[h,m]=y.useState(null),[p,g]=y.useState(""),v=h??d,x=h!==null,w=n.status==="answered"?n.answerText:void 0,C=p.trim(),T=()=>{C&&ib(n.id,{text:C})};return s.jsxs("div",{className:`b q${l?" enter":""}`,children:[s.jsx("div",{className:"qt",children:n.title}),n.detail?s.jsx("div",{className:"qs",children:n.detail}):null,s.jsxs("div",{className:"opts",children:[n.status==="expired"?s.jsx("div",{className:`opt${o?" status-fade":""}`,children:"已结束"}):w?s.jsxs("div",{className:"opt chosen",children:[s.jsx("span",{className:"key",children:s.jsx(Q,{name:"user",size:12})}),w,s.jsx("span",{className:`ck${o?" check-enter":""}`,children:s.jsx(Q,{name:"check",size:16})})]}):v&&!x?s.jsxs("div",{className:"opt chosen",children:[s.jsx("span",{className:"key",children:v}),n.options.find(N=>N.key===v)?.label,s.jsx("span",{className:"ck",children:s.jsx(Q,{name:"check",size:16})})]}):n.options.map(N=>{const A=N.key===v;return s.jsx("div",{className:`optrow${x&&!A?" away":""}`,children:s.jsx("div",{className:"optclip",children:s.jsxs("button",{className:`opt${A?" chosen":""}`,disabled:x,onClick:()=>{m(N.key),ib(n.id,{key:N.key})},children:[s.jsx("span",{className:"key",children:N.key}),N.label,A&&x?s.jsx("span",{className:"ck",children:s.jsx(Q,{name:"check",size:16})}):null]})})},N.key)}),n.status==="expired"||w||x||v?null:s.jsxs("div",{className:"other",children:[s.jsx("input",{value:p,placeholder:"其他想法…",onChange:N=>g(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.nativeEvent.isComposing&&T()}}),C?s.jsx("button",{className:"hob-icon-btn other-send",title:"发送",onClick:T,children:s.jsx(Q,{name:"send",size:16})}):null]})]})]})}function mC({name:n,path:l,meta:i,fresh:o,itemId:c}){return s.jsxs("button",{className:`att filecard${o?" enter":""}`,"data-item-id":c,onClick:()=>zt(l,n),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:Ul(l),size:18})}),s.jsxs("span",{children:[s.jsx("span",{className:"n",style:{display:"block"},children:n}),i?s.jsx("span",{className:"m",children:i}):null]})]})}function pC({name:n,path:l,fresh:i,itemId:o}){return s.jsx("button",{className:`imgcard${i?" enter":""}`,"data-item-id":o,onClick:()=>zt(l),title:n,children:s.jsx("img",{src:$l(l),alt:n,loading:"lazy"})})}function gC(n){const l=y.useRef(null);return y.useLayoutEffect(()=>{const i=l.current;if(!i||(i.style.maxWidth="",n===void 0))return;let o=!0;const c=()=>{if(!o)return;i.style.maxWidth="";const d=i.getBoundingClientRect();if(!d.width)return;let h=0;const m=document.createRange(),p=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let v=p.nextNode();v;v=p.nextNode()){let x;if(v instanceof Element){if(getComputedStyle(v).display!=="inline")continue;x=v.getClientRects()}else m.selectNodeContents(v),x=m.getClientRects();for(const w of x)h=Math.max(h,w.right)}if(!h)return;const g=Math.ceil(h-d.left+parseFloat(getComputedStyle(i).paddingRight));g>=d.width-1||(i.style.maxWidth=`${g}px`,i.getBoundingClientRect().height>d.height+.5&&(i.style.maxWidth=""))};return c(),document.fonts.ready.then(c),()=>{o=!1}},[n]),l}function vC({item:n,inlineDraft:l,fresh:i,tools:o}){const c=we(),d=i?" enter":"",[h,m]=y.useState(!1),p=gC(n.kind==="user"&&!n.files?.length?n.text:void 0),g=o.touch?C=>C.preventDefault():void 0,v=o.distance?{transform:`translateX(-${Math.min(64,o.distance*.8)}px)`,transition:"none"}:void 0,x=Math.min(1,o.distance/48),w=o.distance>0?s.jsx("span",{className:`swipe-reply${o.ready?" ready":""}`,style:{opacity:x,transform:`scale(${x})`},children:s.jsx("span",{className:"swipe-reply-inner",children:s.jsx(Q,{name:"reply",size:18})})}):null;if(n.kind==="user"){const C=n.files?.filter(er)??[],T=n.files?.filter(B=>!er(B))??[],N=C.length===1,A=C.length>1,M=!!(n.from||n.quote||n.text||T.length),R=gS(c,c.sel,n.id),O=B=>{B.startsWith("pending/")||zt(B,Ki(B))},J=(B,k)=>s.jsx("button",{className:k,onClick:()=>O(B),title:Ki(B),children:s.jsx("img",{src:$l(B),alt:Ki(B),loading:"lazy"})},B),ee=B=>s.jsxs("button",{className:"ufile",onClick:()=>O(B),children:[s.jsx("span",{className:"fi",children:s.jsx(Q,{name:Ul(B),size:16})}),s.jsx("span",{className:"fn",children:Ki(B)})]});return s.jsxs("div",{className:"message-row right",id:n.from?`forward-${n.from.delegationId}`:void 0,"data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[w,R?.status==="failed"?s.jsx("button",{className:"send-failed",title:"重试","aria-label":"未送达,重试",onClick:()=>ab(R.assistantId,R.localId),children:"!"}):R&&n.files?.length?s.jsx("span",{className:"send-progress","aria-label":"正在发送",children:s.jsx(Q,{name:"spin",size:16,w:2.2,className:"spin"})}):null,s.jsxs("div",{className:`hov right msg${i?" enter-right":""}${R?" pending":""}`,children:[A?s.jsxs("div",{className:`u-album${h?" open":""}`,ref:M?void 0:p,style:M?void 0:v,children:[s.jsx("button",{className:"album-pill",onClick:()=>m(!h),children:h?"收起":`展开 ${C.length}`}),h?s.jsx("div",{className:"album-list",children:C.map(B=>J(B,"u-photo album-item"))}):s.jsx(tC,{photos:C,onOpen:O})]}):null,N?s.jsx("div",{className:"u-solo",ref:M?void 0:p,style:M?void 0:v,children:J(C[0],"u-photo album-item")}):null,M?s.jsxs("div",{className:"u",ref:p,style:v,children:[n.from?s.jsxs("button",{className:"forward-label",onClick:()=>void(n.from.assistantId==="hob"?Eh(n.from.assistantId,n.from.delegationId,!1):rb(n.from.assistantId,n.from.delegationId,!1)),children:[(()=>{const B=c.assistants.find(k=>k.id===n.from.assistantId);return B?s.jsx(ot,{sprite:B.sprite,prop:B.prop,size:16}):null})(),"转自 ",n.from.assistantId==="hob"?n.from.name:`「${n.from.name}」`]}):null,n.quote?s.jsx("button",{className:"quote",onClick:B=>dC(B,n.quote.itemId),children:n.quote.text}):null,n.text?s.jsx("span",{className:"u-text",children:n.text}):null,T.map(B=>B.startsWith("pending/")?s.jsx(y.Fragment,{children:ee(B)},B):s.jsx(zb,{path:B,name:Ki(B),fallback:ee(B)},B))]}):null,R?.status==="failed"?s.jsxs("div",{className:"send-status",children:["未送达",s.jsx("button",{onClick:()=>ab(R.assistantId,R.localId),children:"重试"}),s.jsx("button",{onClick:()=>pS(R.assistantId,R.localId),children:"删除"})]}):null,R?null:s.jsx(rh,{text:n.text,itemId:n.id})]}),o.open?s.jsx(_b,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})}if(n.kind==="assistant")return s.jsxs(s.Fragment,{children:[n.routine?s.jsx("div",{className:`tag${i?" enter-fade":""}`,children:n.routine.jobId?s.jsxs("button",{onClick:()=>Ln(n.routine.jobId),children:[s.jsx(Q,{name:"clock",size:13}),n.routine.name]}):s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"clock",size:13}),n.routine.name]})}):null,s.jsxs("div",{className:"message-row","data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[w,s.jsxs("div",{className:`hov msg${d}`,children:[$T(n.text).map((C,T,N)=>C.table?s.jsx("div",{className:"tablecard",ref:T===0?p:void 0,style:T===0?v:void 0,children:s.jsx(Ka,{text:C.md})},T):s.jsxs("div",{className:`b${l&&T===N.length-1?" wide":""}`,ref:T===0?p:void 0,style:T===0?v:void 0,children:[s.jsx(Ka,{text:C.md,streaming:n.streaming&&T===N.length-1}),l&&T===N.length-1?s.jsx($b,{draft:l}):null]},T)),s.jsx(rh,{text:n.text,itemId:n.id})]}),o.open?s.jsx(_b,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})]});if(n.kind==="note")return s.jsxs("div",{className:`sys${i?" enter-fade":""}`,id:n.handbackId?`handback-${n.handbackId}`:void 0,children:[n.icon!=="split"?s.jsx(Q,{name:cC[n.icon],size:14}):null,n.handbackId?s.jsx("button",{onClick:()=>void rb("hob",n.handbackId,!0),children:n.text}):n.icon==="skill"&&n.path?s.jsx("button",{onClick:()=>zt(n.path),children:n.text}):n.icon==="memory"?s.jsx("span",{className:"sys-memory",title:n.text,children:n.text.replace(/[::,,;;、]+\s*$/u,"")}):n.text]});if(n.kind==="question"){const C=c.approvals[n.approvalId];return C?s.jsx(by,{approval:C,fresh:i}):null}if(n.kind==="job"){const C=c.jobs[n.jobId];return C?s.jsx(fC,{job:C,round:n.round,fresh:i,itemId:n.id}):null}if(n.kind==="draft"){const C=c.drafts[n.draftId];return C?s.jsx("div",{className:`b wide${d}`,children:s.jsx($b,{draft:C})}):null}if(n.kind==="delegation"){const C=c.delegations[n.delegationId];return C?s.jsx(hC,{delegation:C,fresh:i}):null}return n.kind==="image"?s.jsx(FT,{...n,fresh:i,itemId:n.id}):er(n.path)?s.jsx(pC,{path:n.path,name:n.name,fresh:i,itemId:n.id}):s.jsx(zb,{path:n.path,name:n.name,itemId:n.id,fallback:s.jsx(mC,{path:n.path,name:n.name,meta:n.meta,fresh:i,itemId:n.id})})}function xC(n,l){return n?n.kind==="user"!=(l.kind==="user")||!!l.lead:!1}function yy({items:n}){const l=we(),i=uC(),[o,c]=y.useReducer(oC,null),d=y.useRef(null),[h,m]=y.useState(null);y.useEffect(()=>{const g=()=>{d.current&&window.clearTimeout(d.current.timer),d.current=null,m(null)},v=T=>{c({type:"outside",inside:T.target instanceof Element&&!!T.target.closest(".tools.menu")})},x=T=>{const N=d.current;if(!N||N.pointerId!==T.pointerId)return;if(N.swipe=iC(N.swipe,T.clientX,T.clientY),Math.hypot(T.clientX-N.swipe.x,T.clientY-N.swipe.y)>10&&window.clearTimeout(N.timer),N.swipe.direction==="vertical"){g();return}if(N.swipe.direction!=="horizontal")return;window.clearTimeout(N.timer);const A=Ob(N.swipe);if(A&&!N.ready&&navigator.vibrate?.(10),N.ready=A,window.matchMedia("(prefers-reduced-motion: reduce)").matches){A&&(kc({itemId:N.id,text:Ba(N.text).slice(0,60)}),ir(),g());return}m({id:N.id,distance:N.swipe.distance,ready:A})},w=T=>{const N=d.current;!N||N.pointerId!==T.pointerId||(Ob(N.swipe)&&(kc({itemId:N.id,text:Ba(N.text).slice(0,60)}),ir()),g())},C=()=>{g(),c({type:"close"})};return document.addEventListener("pointerdown",v,!0),document.addEventListener("pointermove",x,!0),document.addEventListener("pointerup",w,!0),document.addEventListener("pointercancel",g,!0),document.addEventListener("scroll",C,!0),()=>{g(),document.removeEventListener("pointerdown",v,!0),document.removeEventListener("pointermove",x,!0),document.removeEventListener("pointerup",w,!0),document.removeEventListener("pointercancel",g,!0),document.removeEventListener("scroll",C,!0)}},[]);const p=[];n.length&&!sC(n[0].at)&&n[0].kind!=="note"&&p.push(s.jsx("div",{className:"div",children:Dt(n[0].at)},"first-div"));for(let g=0;g<n.length;g++){const v=n[g],x=n[g-1],w=n[g+1],C=Sw(v.id),T=v.kind==="assistant"&&w?.kind==="draft"?l.drafts[w.draftId]:void 0,N={open:i&&o===v.id,touch:i,distance:h?.id===v.id?h.distance:0,ready:h?.id===v.id&&h.ready,close:()=>c({type:"close"}),start:i?A=>{if(A.pointerType!=="touch"||v.kind!=="user"&&v.kind!=="assistant"||A.target.closest("a,button,input,textarea,select,[contenteditable],.draft,.album-stack"))return;d.current&&window.clearTimeout(d.current.timer);const{clientX:M,clientY:R,pointerId:O}=A,J=window.setTimeout(()=>{d.current=null,c({type:"open",id:v.id})},500);d.current={timer:J,pointerId:O,id:v.id,text:v.text,swipe:{x:M,y:R,direction:"pending",distance:0},ready:!1}}:void 0};T&&g++,p.push(s.jsxs(y.Fragment,{children:[lC(x?.at,v.at)?s.jsx("div",{className:`div${C?" enter-fade":""}`,children:Dt(v.at)}):xC(x,v)?s.jsx("div",{className:"g"}):null,s.jsx(vC,{item:v,inlineDraft:T,fresh:C,tools:N})]},v.id))}for(const g of ww(Object.values(l.livePages),l.sel))p.push(s.jsxs("button",{className:`att filecard${g.state==="failed"?" bad":""}`,onClick:()=>IS(g.callId),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:g.state==="writing"?"spin":"close",className:g.state==="writing"?"spin":"",size:18})}),s.jsxs("span",{children:[s.jsx("span",{className:"n",style:{display:"block"},children:g.title||"正在写页面…"}),s.jsx("span",{className:"m",children:g.state==="failed"?`生成失败:${g.error}`:"生成中"})]})]},g.callId));return s.jsx(s.Fragment,{children:p})}function ze({children:n,action:l,large:i=!1}){return s.jsxs("div",{className:`empty${i?" empty-large":""}`,children:[n,l?s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{onClick:l.onClick,children:l.label})]}):null]})}function Hn({text:n}){const[l,i]=y.useState(!1);return y.useEffect(()=>{const o=setTimeout(()=>i(!0),300);return()=>clearTimeout(o)},[]),l?n:null}function ky({leaving:n,gap:l,a:i}){return s.jsxs(s.Fragment,{children:[l?s.jsx("div",{className:"g"}):null,s.jsx("div",{className:`hov think${n?" leaving":""}`,children:s.jsxs("div",{className:"activity-line",role:"status",children:[s.jsx(ot,{sprite:i.sprite,prop:i.prop,size:46,free:!0,motion:i.activity?.state==="tool"?"work":"think"}),s.jsx("span",{className:"activity-shimmer",children:i.activity?.label??"正在想…"})]})})]})}function jy(n,l,i,o,c,d){const[h,m]=y.useState(!0),p=y.useRef(!0),g=y.useRef({key:"",len:0});return y.useEffect(()=>{const x=n.current;if(!x)return;const w=()=>({top:x.scrollTop,height:x.scrollHeight,view:x.clientHeight}),C=()=>{const N=o2(p.current,l.current,w());l.current=N.expect,N.stuck!==p.current&&(p.current=N.stuck,m(N.stuck))},T=new ResizeObserver(()=>{l.current=r2(p.current,l.current,w()),p.current&&(x.scrollTop=l.current)});x.addEventListener("scroll",C,{passive:!0}),T.observe(x);for(const N of Array.from(x.children))T.observe(N);return()=>{x.removeEventListener("scroll",C),T.disconnect()}},[n,l]),y.useLayoutEffect(()=>{const x=n.current;if(!x)return;const w=g.current;g.current={key:i,len:o,firstId:c},w.key!==i||o<w.len?(p.current=!0,m(!0),x.scrollTop=x.scrollHeight,l.current=x.scrollTop):o>w.len&&w.firstId===c&&(p.current||d)&&(p.current=!0,m(!0),x.scrollTo({top:x.scrollHeight,behavior:"smooth"}))},[n,l,i,o,c,d]),{atBottom:h,toBottom:()=>{const x=n.current;x&&(p.current=!0,m(!0),x.scrollTo({top:x.scrollHeight,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}))}}}function wy(n,l,i,o,c){const d=y.useRef(null),h=y.useRef({key:""}),m=()=>{const p=n.current;if(!p)return;const g=p.getBoundingClientRect().top,v=Array.from(p.querySelectorAll("[data-item-id]")).find(x=>x.getBoundingClientRect().bottom>g);d.current=v?{id:v.dataset.itemId,top:v.getBoundingClientRect().top,key:i}:null};return y.useLayoutEffect(()=>{const p=n.current,g=h.current;if(p&&g.key===i&&g.id&&g.id!==o&&d.current?.key===i){const v=Array.from(p.querySelectorAll("[data-item-id]")).find(x=>x.dataset.itemId===d.current?.id);v&&(p.scrollTop+=v.getBoundingClientRect().top-d.current.top,c.current=p.scrollTop)}h.current={key:i,id:o}},[n,i,o,c]),()=>{const p=n.current;!p||!l||(m(),p.scrollTop<120&&Th(l))}}function Ny({id:n}){const l=we().itemPages[n??""];return!l?.hasMore&&!l?.loading&&!l?.error?null:s.jsx("div",{className:"older-messages",role:"status",children:l.error?s.jsxs("button",{onClick:()=>n&&void Th(n,!0),children:["读取失败:",l.error," · 重试"]}):l.loading?s.jsx(Hn,{text:"正在读取更早的消息…"}):null})}function Sy(n){return n?.kind==="user"&&!n.from}function Ty({show:n,busy:l,onClick:i}){return s.jsx("button",{className:`jump${n?" show":""}`,onClick:i,title:"回到最新消息","aria-label":"回到最新消息","aria-hidden":!n,tabIndex:n?0:-1,children:l?s.jsxs("span",{className:"jump-dots","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}):s.jsx(Q,{name:"arrowDown",size:20})})}const bC=["查看这台电脑的磁盘和内存占用","每天早上 9 点给我一份科技新闻简报","把附件里的会议记录整理成要点"];function Cy({a:n}){const i=we().settings.settings.models,o=i.roster.length>0&&i.conversation.ref!=="";return s.jsxs("div",{className:"hello",children:[s.jsx(ot,{sprite:n.sprite,prop:n.prop,size:88,free:!0,motion:"home"}),s.jsx("div",{className:"t",children:`我是${Ey(n.name,!1)}${n.primary?",你的主助手":""}`}),s.jsx("div",{className:"d",children:n.primary?"交给我的事,我会分派给后台任务执行,完成、受阻或需要你确认时再告诉你;也可以让我定时执行。同类工作多了,我会建议创建专属助手。":`负责${n.duty}。`}),o?n.primary?s.jsx("div",{className:"ex",children:bC.map(c=>s.jsx("button",{className:"hob-btn",onClick:()=>{Ch(c),ir()},children:c},c))}):null:s.jsxs("div",{className:"setup",children:[s.jsx("div",{children:"开始使用前,请先添加模型服务商并选择模型。"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{Oc(),Rl("providers")},children:"前往设置"})]})]})}function Ey(n,l=!0){const i=o=>!!(o&&/[A-Za-z0-9]/.test(o));return`${i(n[0])?" ":""}${n}${l&&i(n.at(-1))?" ":""}`}function Ay(n,l){return`${n??""}|${l??0}`}function yC(){const n=we(),l=n.assistants.find(x=>x.id===n.sel),i=$0(n,n.sel),o=!!(l&&n.sel&&i.length===0&&n.items[n.sel]!==void 0&&!l.busy),c=y.useRef(null),d=Ay(n.sel,n.sel?n.itemGen[n.sel]:0),h=!!l?.busy&&!p0(i),m=fn(h,180),p=y.useRef(0),g=wy(c,n.sel,d,i[0]?.id,p),v=jy(c,p,d,i.length,i[0]?.id,Sy(i.at(-1)));return s.jsxs("main",{className:"chat",children:[s.jsxs("div",{className:"head",children:[l?s.jsx(ot,{sprite:l.sprite,prop:l.prop,size:24}):null,s.jsx("span",{className:"nm",children:l?.name??""}),s.jsx("span",{className:"sp"}),n.collapsed?s.jsx("button",{className:"hob-icon-btn",title:"展开右栏",onClick:US,children:s.jsx(Q,{name:"panel",size:18})}):null]}),s.jsx("div",{className:"msgs",ref:c,onScroll:g,children:s.jsxs("div",{className:`col${o?" mid":""}`,children:[s.jsx(Ny,{id:n.sel}),o&&l?s.jsx(Cy,{a:l}):s.jsx(yy,{items:i}),m.mounted&&l?s.jsx(ky,{a:l,leaving:m.leaving,gap:i.at(-1)?.kind==="user"}):null]})}),s.jsx(Ty,{show:!v.atBottom,busy:!!l?.busy,onClick:v.toBottom}),s.jsx(My,{})]})}function My({variant:n="desktop"}){const l=we(),i=l.assistants.find(g=>g.id===l.sel),o=y.useRef(null),c=l.text.trim().length>0||l.attachments.length>0,d=fn(l.quote!==null,180);y.useLayoutEffect(()=>{const g=o.current;if(!g)return;g.style.height="auto";const v=n==="mobile"?120:180;g.style.height=`${Math.min(g.scrollHeight,v)}px`},[l.text,l.nonce,n]),y.useEffect(()=>{l.nonce&&o.current?.focus()},[l.nonce]);const h=g=>{const v=JS(g.clipboardData);v.length&&(g.preventDefault(),l.sel&&Qf(v,l.sel))},m=y.useRef(null);y.useLayoutEffect(()=>{const g=m.current,v=g?.closest(".chat");if(!g||!v)return;const x=new ResizeObserver(()=>v.style.setProperty("--comp-h",`${g.offsetHeight}px`));return x.observe(g),()=>x.disconnect()},[n]);const p=s.jsxs("div",{className:n==="mobile"?"mcomp":"comp",onPaste:h,children:[d.mounted?s.jsxs("div",{className:`comp-quote${d.leaving?" leaving":""}`,children:[s.jsx("div",{className:"quote",children:l.quote?.text}),s.jsx("button",{className:"hob-icon-btn",style:{width:20,height:20},onClick:()=>kc(null),title:"取消引用",children:s.jsx(Q,{name:"close",size:13})})]}):null,l.attachments.length?s.jsx("div",{className:"comp-files",children:l.attachments.map(g=>{const v=g.path??zc(g),x=g.status==="uploading"?" uploading":g.status==="failed"?" failed":"";return er(g.name)?s.jsxs("span",{className:`comp-thumb${x}`,children:[s.jsx("img",{src:$l(v),alt:g.name}),g.status==="uploading"?s.jsx("span",{className:"att-spin",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,g.status==="failed"?s.jsx("span",{className:"att-bad",children:"!"}):null,s.jsx("button",{onClick:()=>sb(g.id),title:"移除","aria-label":"移除",children:s.jsx(Q,{name:"close",size:11,w:2.2})})]},g.id):s.jsxs("span",{className:`filechip${x}`,children:[s.jsx("span",{className:"fi",children:g.status==="uploading"?s.jsx(Q,{name:"spin",size:16,w:2.2,className:"spin"}):s.jsx(Q,{name:Ul(g.name),size:16})}),s.jsx("span",{className:"fn",children:g.name}),s.jsx("button",{onClick:()=>sb(g.id),title:"移除","aria-label":"移除",children:s.jsx(Q,{name:"close",size:12})})]},g.id)})}):null,s.jsxs("div",{className:"comp-main",children:[s.jsxs("label",{className:"pl",title:"加文件(也可粘贴截图)",children:[s.jsx(Q,{name:"plus",size:19}),s.jsx("input",{type:"file",multiple:!0,hidden:!0,onChange:g=>{const v=Array.from(g.target.files??[]);g.target.value="",v.length&&l.sel&&Qf(v,l.sel)}})]}),s.jsx("textarea",{ref:o,className:"ta",rows:1,value:l.text,placeholder:`给${Ey(i?.name??"")}发消息`,onChange:g=>Ch(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),lb())}}),i?.busy&&!c?s.jsx("button",{className:"sendbtn stop",title:"停止",onClick:()=>void vS(i.id),children:s.jsx(Q,{name:"stop",size:18})}):s.jsx("button",{className:"sendbtn",title:"发送",disabled:!c,onClick:()=>void lb(),children:s.jsx(Q,{name:"send",size:17})})]})]});return n==="mobile"?s.jsx("div",{className:"mcomp-wrap",ref:m,children:p}):s.jsx("div",{className:"compwrap",ref:m,children:s.jsx("div",{className:"col",children:p})})}function kC(){const n=we(),l=n.assistants.find(x=>x.id===n.sel),i=$0(n,n.sel),o=!!(l&&n.sel&&i.length===0&&n.items[n.sel]!==void 0&&!l.busy),c=y.useRef(null),d=!!l?.busy&&!p0(i),h=fn(d,180),m=Ay(n.sel,n.sel?n.itemGen[n.sel]:0),p=y.useRef(0),g=wy(c,n.sel,m,i[0]?.id,p),v=jy(c,p,m,i.length,i[0]?.id,Sy(i.at(-1)));return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mchat-head",children:[s.jsx("button",{className:"hob-icon-btn",style:{marginLeft:-8},title:"返回",onClick:()=>eh("list"),children:s.jsx(Q,{name:"left",size:22})}),l?s.jsx(ot,{sprite:l.sprite,prop:l.prop,size:30}):null,s.jsx("span",{className:"nm",children:l?.name??""}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-icon-btn",title:"助手信息",onClick:LS,children:s.jsx(Q,{name:"more",size:20})})]}),s.jsx("div",{className:"mmsgs",ref:c,onScroll:g,children:s.jsxs("div",{className:`col${o?" mid":""}`,children:[s.jsx(Ny,{id:n.sel}),o&&l?s.jsx(Cy,{a:l}):s.jsx(yy,{items:i}),h.mounted&&l?s.jsx(ky,{a:l,leaving:h.leaving,gap:i.at(-1)?.kind==="user"}):null]})}),s.jsx(Ty,{show:!v.atBottom,busy:!!l?.busy,onClick:v.toBottom}),s.jsx(My,{variant:"mobile"})]})}function sc(n){if(!n)return!1;for(const l of Array.from(n.types??[]))if(l.toLowerCase()==="files")return!0;return(n.files?.length??0)>0}function jC(n){const l=Array.from(n?.items??[]).filter(i=>i.kind==="file");return l.length?l.flatMap(i=>{if(i.webkitGetAsEntry?.()?.isDirectory)return[];const o=i.getAsFile?.();return o?[o]:[]}):Array.from(n?.files??[]).filter(i=>!!i)}const wC=1500;function NC(){const n=we(),l=n.assistants.find(h=>h.id===n.sel),[i,o]=y.useState(!1),c=y.useRef(0),d=y.useRef(0);return y.useEffect(()=>{const h=()=>{o(!0),clearTimeout(d.current),d.current=window.setTimeout(()=>{c.current=0,o(!1)},wC)},m=w=>{sc(w.dataTransfer)&&(c.current+=1,h())},p=w=>{sc(w.dataTransfer)&&(c.current=Math.max(0,c.current-1),!c.current&&(clearTimeout(d.current),o(!1)))},g=w=>{sc(w.dataTransfer)&&(w.preventDefault(),w.dataTransfer&&(w.dataTransfer.dropEffect="copy"),h())},v=w=>{if(!sc(w.dataTransfer))return;w.preventDefault(),c.current=0,clearTimeout(d.current),o(!1);const C=jC(w.dataTransfer);C.length&&n.sel&&Qf(C,n.sel)},x={capture:!0};return window.addEventListener("dragenter",m,x),window.addEventListener("dragleave",p,x),window.addEventListener("dragover",g,x),window.addEventListener("drop",v,x),()=>{clearTimeout(d.current),window.removeEventListener("dragenter",m,x),window.removeEventListener("dragleave",p,x),window.removeEventListener("dragover",g,x),window.removeEventListener("drop",v,x)}},[]),i?s.jsx("div",{className:"dropmask",role:"status",children:s.jsxs("div",{className:"dropcard",children:[s.jsx("div",{className:"t",children:"松开即可上传"}),s.jsx("div",{className:"d",children:l?`文件会加进和 ${l.name} 的输入框,发送时一起发出去`:"文件会加进输入框,发送时一起发出去"})]})}):null}const SC="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')});",TC="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'})});",CC="(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)})();",EC="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: https:; media-src data: https:; font-src data:",AC=`: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}
192
+ :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}
193
+ *{box-sizing:border-box}
194
+ 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}
195
+ body{margin:0;padding:52px 24px 80px}
196
+ .page{max-width:760px;margin:0 auto}
197
+ .hd{margin-bottom:40px;padding-bottom:28px;border-bottom:1px solid var(--line)}
198
+ .hd h1{font-size:32px;line-height:1.25;letter-spacing:-.015em;margin:0 0 10px;font-weight:700}
199
+ .hd p{margin:0;color:var(--muted);font-size:17px;line-height:1.6}
200
+ h2{font-size:22px;line-height:1.35;letter-spacing:-.01em;margin:48px 0 14px;font-weight:700}
201
+ h3{font-size:16.5px;line-height:1.45;margin:28px 0 8px;font-weight:650}
202
+ main>h2:first-child,main>section:first-child>h2:first-child{margin-top:0}
203
+ p,ul,ol,table,pre,figure,blockquote,.note,.cards,.cols,.kpis,.steps{margin:0 0 18px}
204
+ ul,ol{padding-left:1.4em}li{margin:5px 0}li::marker{color:var(--faint)}
205
+ a{color:var(--accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--accent) 35%,transparent)}
206
+ strong,b{font-weight:650}
207
+ .muted{color:var(--muted)}.accent{color:var(--accent)}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}
208
+ code{font:.88em/1.5 ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;background:var(--soft);padding:.12em .4em;border-radius:5px}
209
+ 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}
210
+ blockquote{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted)}
211
+ hr{border:0;border-top:1px solid var(--line);margin:36px 0}
212
+ table{width:100%;border-collapse:collapse;font-size:14.5px;line-height:1.6}
213
+ .tw{overflow-x:auto;margin:0 0 18px}.tw>table{margin:0}
214
+ th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
215
+ th{font-size:13px;font-weight:600;color:var(--muted);border-bottom-width:1.5px;white-space:nowrap}
216
+ td{min-width:5.5em}
217
+ th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}
218
+ .cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
219
+ .card{background:var(--soft);border-radius:14px;padding:16px 18px}.card h3{margin:0 0 6px;font-size:15.5px}
220
+ .cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px 28px}
221
+ .cols>div>h3:first-child{margin-top:0}
222
+ .kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
223
+ .kpi{border:1px solid var(--line);border-radius:14px;padding:14px 16px 12px}
224
+ .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}
225
+ .steps{list-style:none;padding:0;counter-reset:s}
226
+ .steps>li{position:relative;margin:0;padding:1px 0 20px 44px;counter-increment:s}
227
+ .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}
228
+ .steps>li::after{content:"";position:absolute;left:13.5px;top:34px;bottom:6px;width:1px;background:var(--line)}
229
+ .steps>li:last-child{padding-bottom:0}.steps>li:last-child::after{display:none}.steps>li>b:first-child{display:block}
230
+ .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)}
231
+ .card>:last-child,.note>:last-child,.cols>div>:last-child,section>:last-child{margin-bottom:0}
232
+ .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}
233
+ .card .tag{background:var(--bg)}
234
+ .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)}
235
+ figure{margin:28px 0;overflow-x:auto}img,svg{max-width:100%;height:auto}figure>svg,figure>img{display:block;margin:0 auto}
236
+ figcaption{color:var(--muted);font-size:13.5px;margin-top:10px;text-align:center}
237
+ svg{color:var(--ink)}svg text{fill:var(--ink);font-family:inherit;font-size:13px}
238
+ 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}
239
+ svg .line{fill:none;stroke:var(--faint);stroke-width:1.5}svg text.muted{fill:var(--muted)}svg text.accent{fill:var(--accent)}
240
+ @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}}`,Df=n=>n.replace(/[&<>"]/g,l=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[l]);function MC(){return zC("","","").replace("</body>",`<script>
241
+ (function(){
242
+ let latest, scheduled = false, follow = true;
243
+ addEventListener('scroll', function(){ follow = document.documentElement.scrollHeight - innerHeight - scrollY < 48; }, {passive:true});
244
+ addEventListener('message', function(e){
245
+ if(e.source !== parent || e.data?.type !== 'hob-page-live') return;
246
+ latest = e.data;
247
+ if(scheduled) return;
248
+ scheduled = true;
249
+ requestAnimationFrame(function(){
250
+ scheduled = false;
251
+ document.documentElement.classList.toggle('dark', !!latest.dark);
252
+ document.title = latest.title || '';
253
+ document.querySelector('.hd h1').textContent = latest.title || '';
254
+ document.querySelector('.hd p').textContent = latest.summary || '';
255
+ const main = document.querySelector('main');
256
+ const template = document.createElement('template');
257
+ template.innerHTML = (latest.html || '').replace(/<[^>]*$/, '');
258
+ template.content.querySelectorAll('script,iframe,object,embed').forEach(function(el){el.remove()});
259
+ template.content.querySelectorAll('*').forEach(function(el){
260
+ 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)});
261
+ });
262
+ main.innerHTML = template.innerHTML;
263
+ main.querySelectorAll('table').forEach(function(t){const w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});
264
+ 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'});
265
+ if(follow) scrollTo(0, document.documentElement.scrollHeight);
266
+ });
267
+ });
268
+ })();<\/script></body>`)}function zC(n,l,i){return`<!doctype html>
269
+ <html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
270
+ <meta http-equiv="Content-Security-Policy" content="${EC}">
271
+ <title>${Df(n)}</title><script>${CC}${TC}<\/script><style>${AC}</style></head>
272
+ <body><div class="page"><header class="hd"><h1>${Df(n)}</h1><p>${Df(l)}</p></header>
273
+ <main>
274
+ ${i}
275
+ </main></div><script>${SC}<\/script></body></html>
276
+ `}function RC(n){const[l,...i]=n;return l?l.map((o,c)=>i.length>0&&i.every(d=>{const h=d[c]?.trim();return!!h&&/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(h)&&Number.isFinite(Number(h))})):[]}function cr({title:n,children:l,root:i=!1,close:o=!1,className:c=""}){const d=we(),h=i||d.page!=="main"&&d.panelStack.length<=1;return s.jsxs("div",{className:`panel-head ${c}`,children:[s.jsx("button",{className:`hob-icon-btn${h?" panel-mobile-back":""}`,title:"返回",onClick:i?Z0:fr,children:s.jsx(Q,{name:"left",size:18})}),n,l,o?s.jsx("button",{className:"hob-icon-btn panel-close",title:"关闭",onClick:hr,children:s.jsx(Q,{name:"close",size:17})}):null]})}const OC=1024*1024;function mc({embedded:n=!1,page:l}){const i=we(),o=l??i.panelStack.at(-1),c=o?.kind==="file"?o:null,d=fn(!!c,180),h=y.useRef(c);c&&(h.current=c);const m=c??h.current;return!d.mounted||!m?null:s.jsx("div",{className:`${n?"fp-embedded":"fpwrap"}${d.leaving?" leaving":""}`,onClick:n?void 0:hr,children:s.jsx("div",{className:`fp${m.full?" full":""}`,onClick:p=>p.stopPropagation(),children:m.liveId&&i.livePages[m.liveId]?s.jsx(_C,{page:i.livePages[m.liveId]}):s.jsx(DC,{path:m.path,title:m.title,find:m.find,page:m.page})})})}function _C({page:n}){const l=y.useRef(null),i=y.useRef(n);i.current=n;const[o,c]=y.useState(null),d=y.useMemo(()=>MC(),[]),h=()=>l.current?.contentWindow?.postMessage({type:"hob-page-live",title:i.current.title,summary:i.current.summary,html:i.current.html,dark:document.documentElement.classList.contains("dark")},"*");y.useEffect(()=>{h()},[n]),y.useEffect(()=>{const p=new MutationObserver(h);p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const g=v=>{if(!(v.source!==l.current?.contentWindow||v.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const x=new URL(v.data.url);["http:","https:"].includes(x.protocol)&&window.open(x.href,"_blank","noopener")}catch{}};return window.addEventListener("message",g),()=>{p.disconnect(),window.removeEventListener("message",g)}},[]),y.useEffect(()=>{let p=!0;return n.path&&Rh(n.path).then(g=>{p&&c(g)}).catch(g=>Xa(`无法加载文件信息:${g instanceof Error?g.message:String(g)}`)),()=>{p=!1}},[n.path]);const m=n.state!=="done";return s.jsxs(s.Fragment,{children:[s.jsx(zy,{name:n.title||"正在写页面…",meta:o,path:n.path||"page.html",liveStatus:n.state==="writing"?"正在生成…":n.state==="failed"?`生成失败:${n.error}`:void 0,disabled:m}),s.jsx("div",{className:"fp-body",children:n.state==="done"&&/<\s*script\b/i.test(n.html)&&o?s.jsx(Ry,{meta:o}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),s.jsx("iframe",{ref:l,className:"fp-frame",sandbox:"allow-scripts",srcDoc:d,onLoad:h,title:n.title||"正在写页面"})]})})]})}function DC({path:n,title:l,find:i,page:o}){const[c,d]=y.useState({state:"loading"});y.useEffect(()=>{let p=!0;return d({state:"loading"}),Rh(n).then(g=>{p&&d({state:"ok",meta:g})}).catch(g=>{if(!p)return;const v=g instanceof Error?g.message:String(g),x=v.includes("只允许读 Hob 自己的文件");d({state:"error",outside:x,message:v})}),()=>{p=!1}},[n]);const h=c.state==="ok"?c.meta:null,m=l??h?.name??n.split("/").pop()??n;return s.jsxs(s.Fragment,{children:[s.jsx(zy,{name:m,meta:h,path:n}),s.jsx("div",{className:"fp-body",children:c.state==="loading"?s.jsx("div",{className:"fp-center dim",children:s.jsx(Hn,{text:"正在读取文件信息…"})}):c.state==="error"?s.jsx("div",{className:"fp-center",children:s.jsxs("div",{className:"fp-nofile",children:[s.jsx(Q,{name:"doc",size:22}),s.jsx("div",{children:c.outside?"这个文件不在 Hob 的数据目录或任务的工作目录里,无法预览":c.message}),s.jsx("button",{className:"hob-btn",onClick:()=>void Oh(n).then(p=>Xa(p?"路径已复制":"复制失败:浏览器不允许写入剪贴板")),children:"复制路径"})]})}):s.jsx($C,{meta:c.meta,find:i,page:o})})]})}function zy({name:n,meta:l,path:i,liveStatus:o,disabled:c}){const d=we().panelStack.at(-1),h=d?.kind==="file"&&d.full;return s.jsxs(cr,{className:"fphead",close:!0,children:[s.jsx(Q,{name:Ul(i),size:18,className:"fp-file-icon"}),s.jsxs("div",{className:"fpt",children:[s.jsx("div",{className:"n",title:n,children:n}),o?s.jsx("div",{className:"m",children:o}):l?s.jsxs("div",{className:"m",children:[Qa(l.size)," · ",Dt(l.modifiedAt)]}):null]}),c?s.jsx("button",{className:"hob-icon-btn fp-act",title:"下载",disabled:!0,children:s.jsx(Q,{name:"dl",size:17})}):s.jsx("a",{className:"hob-icon-btn fp-act",title:"下载",href:Yt(i),download:n,children:s.jsx(Q,{name:"dl",size:17})}),s.jsx("button",{className:"hob-icon-btn fp-act",title:"在新窗口打开",disabled:c,onClick:()=>window.open(Yt(i,{inline:!0}),"_blank","noopener"),children:s.jsx(Q,{name:"out",size:17})}),s.jsx("button",{className:"hob-icon-btn fp-act fp-wide-btn",title:"切换全宽",onClick:YS,children:s.jsx(Q,{name:h?"shrink":"expand",size:17})})]})}function Ry({meta:n}){const l=y.useRef(null);return y.useEffect(()=>{const i=o=>{if(!(!n.page||o.source!==l.current?.contentWindow||o.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const c=new URL(o.data.url);(c.protocol==="https:"||c.protocol==="http:")&&window.open(c.href,"_blank","noopener")}catch{}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[n.page]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),s.jsx("iframe",{ref:l,className:"fp-frame",sandbox:"allow-scripts",src:Yt(n.path,{inline:!0})+(n.page?document.documentElement.classList.contains("dark")?"#dark":"#light":""),title:n.name})]})}function $C({meta:n,find:l,page:i}){switch(n.kind){case"image":return s.jsx(Ub,{path:n.path,name:n.name,svg:!1},n.path);case"svg":return s.jsx(Ub,{path:n.path,name:n.name,svg:!0},n.path);case"pdf":return s.jsx("iframe",{className:"fp-frame",src:Yt(n.path)+(i?`#page=${i}`:""),title:n.name});case"audio":return s.jsx("div",{className:"fp-center",children:s.jsx("audio",{controls:!0,src:Yt(n.path)})});case"video":return s.jsx("div",{className:"fp-center",children:s.jsx("video",{controls:!0,src:Yt(n.path)})});case"html":return s.jsx(Ry,{meta:n});case"other":return s.jsx("div",{className:"fp-center",children:s.jsxs("div",{className:"fp-nofile",children:[s.jsx(Q,{name:"doc",size:22}),s.jsx("div",{children:"这种文件不在浏览器里预览,可以下载后打开。"}),s.jsx("a",{className:"hob-btn hob-btn-primary",href:Yt(n.path),download:n.name,children:"下载"})]})});default:return s.jsx(UC,{meta:n,find:l})}}function Ub({path:n,name:l,svg:i}){const[o,c]=y.useState(!1),d=Yt(n,i?{inline:!0}:void 0),[h,m]=y.useState(i?"loaded":"loading"),p=h==="loading",g=$l(n);return y.useEffect(()=>{if(!o)return;const v=x=>{x.key==="Escape"&&(x.stopImmediatePropagation(),c(!1))};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[o]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-img",children:s.jsxs("button",{onClick:()=>c(!0),title:"放大",className:p?"fp-img-loading":void 0,children:[p?s.jsx("img",{className:"fp-img-thumb",src:g,alt:"","aria-hidden":"true"}):null,s.jsx("img",{src:d,alt:l,onLoad:()=>m("loaded"),onError:()=>m("error"),style:p?{position:"absolute",opacity:0}:void 0}),p?s.jsx("span",{className:"fp-img-spin","aria-label":"图片加载中",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,h==="error"?s.jsx("span",{children:"图片加载失败"}):null]})}),o?s.jsx("div",{className:"lightbox fp-lightbox",role:"dialog","aria-label":l,onClick:()=>c(!1),children:s.jsxs("div",{className:p?"fp-lightbox-image fp-img-loading":"fp-lightbox-image",children:[s.jsx("img",{src:p?g:d,alt:l}),p?s.jsx("span",{className:"fp-img-spin","aria-label":"图片加载中",children:s.jsx(Q,{name:"spin",size:18,w:2.2,className:"spin"})}):null,h==="error"?s.jsx("span",{children:"图片加载失败"}):null]})}):null]})}function UC({meta:n,find:l}){const[i,o]=y.useState(null),[c,d]=y.useState(null),[h,m]=y.useState(0),p=y.useCallback(()=>m(v=>v+1),[]);if(y.useEffect(()=>{let v=!0;return o(null),d(null),(async()=>{try{const x=await fetch(Yt(n.path,{truncate:!0}));if(!x.ok)throw new Error(`读取失败(${x.status})`);v&&o(await x.text())}catch(x){v&&d(x instanceof Error?x.message:String(x))}})(),()=>{v=!1}},[n.path]),c)return s.jsx("div",{className:"fp-center fp-nofile",children:c});if(i===null)return s.jsx("div",{className:"fp-center dim",children:s.jsx(Hn,{text:"正在读取内容…"})});const g=n.size>OC?s.jsxs("div",{className:"fp-note",children:["文件有 ",Qa(n.size),",只显示前 1 MB,完整内容请下载。"]}):null;if(n.kind==="markdown")return s.jsxs(s.Fragment,{children:[g,s.jsx(lc,{find:l,text:i,mathVersion:h,children:s.jsx(Ka,{className:"fp-md markdown-body",text:i,onMathRendered:p})})]});if(n.kind==="json"){let v=i;try{v=JSON.stringify(JSON.parse(i),null,2)}catch{}return s.jsxs(s.Fragment,{children:[g,s.jsx(lc,{find:l,text:i,children:s.jsx(Lb,{text:v})})]})}return n.kind==="csv"?s.jsxs(s.Fragment,{children:[g,s.jsx(lc,{find:l,text:i,children:s.jsx(LC,{text:i,tsv:n.mime.includes("tab-separated")})})]}):s.jsxs(s.Fragment,{children:[g,s.jsx(lc,{find:l,text:i,children:s.jsx(Lb,{text:i})})]})}function lc({find:n,text:l,mathVersion:i,children:o}){const c=y.useRef(null);return y.useEffect(()=>{const d=CSS.highlights;if(!c.current||!n||!d||typeof Highlight>"u")return;const h=document.createTreeWalker(c.current,NodeFilter.SHOW_TEXT,{acceptNode(w){return w.parentElement?.closest(".ln, .code-copy, .fp-codebar, .katex-mathml")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),m=[];for(;h.nextNode();)m.push(h.currentNode);const p=LT(m,n);if(!p)return;const{start:g,end:v}=p,x=document.createRange();return x.setStart(g.node,g.offset),x.setEnd(v.node,v.offset),d.set("knowledge-source",new Highlight(x)),g.node.parentElement?.scrollIntoView({block:"center"}),()=>{d.delete("knowledge-source")}},[n,l,i]),s.jsx("div",{ref:c,children:o})}function Lb({text:n}){const[l,i]=y.useState(!0),o=y.useMemo(()=>n.split(`
277
+ `),[n]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fp-codebar",children:[s.jsxs("span",{className:"dim",children:[o.length," 行"]}),s.jsx("button",{className:"hob-btn",onClick:()=>i(!l),children:l?"不自动换行":"自动换行"})]}),s.jsx("div",{className:`fp-code mono${l?" wrap":""}`,children:o.map((c,d)=>s.jsxs("div",{className:"cl",children:[s.jsx("span",{className:"ln",children:d+1}),s.jsx("span",{className:"ct",children:c||" "})]},d))})]})}function LC({text:n,tsv:l}){const i=y.useMemo(()=>HC(n,l?" ":","),[n,l]),o=y.useMemo(()=>RC(i),[i]),c=i.slice(0,1e3),[d,...h]=c;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fp-codebar",children:s.jsxs("span",{className:"dim",children:[i.length," 行",i.length>1e3?"(只显示前 1000 行)":""]})}),s.jsx("div",{className:"fp-table-wrap",children:s.jsxs("table",{className:"fp-table",children:[d?s.jsx("thead",{children:s.jsx("tr",{children:d.map((m,p)=>s.jsx("th",{className:o[p]?"numeric":void 0,children:m},p))})}):null,s.jsx("tbody",{children:h.map((m,p)=>s.jsx("tr",{children:m.map((g,v)=>s.jsx("td",{className:o[v]?"numeric":void 0,children:g},v))},p))})]})})]})}function HC(n,l){const i=[];let o=[],c="",d=!1;for(let h=0;h<n.length;h+=1){const m=n[h];d?m==='"'?n[h+1]==='"'?(c+='"',h+=1):d=!1:c+=m:m==='"'?d=!0:m===l?(o.push(c),c=""):m===`
278
+ `?(o.push(c),i.push(o),o=[],c=""):m!=="\r"&&(c+=m)}return(c||o.length)&&(o.push(c),i.push(o)),i}const BC=y.lazy(()=>mr(()=>import("./DesktopView-3QDYo0UU.js"),[]).then(n=>({default:n.DesktopView}))),qC={off:"关",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},IC=["running","waiting","queued","done","stuck","failed","stopped"],YC={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 ur(n){return n.status==="running"||n.status==="queued"||n.status==="waiting"}function $f({embedded:n=!1,page:l}){const i=we(),o=l??i.panelStack.at(-1),c=o?.kind==="job"||o?.kind==="jobs"?o:null,d=fn(!!c,180),h=y.useRef(c);c&&(h.current=c);const m=c??h.current;return!d.mounted||!m?null:s.jsx("div",{className:`${n?"jd-embedded":"jd-overlay"}${d.leaving?" leaving":""}`,onClick:n?void 0:hr,children:s.jsx("div",{className:"jd",onClick:p=>p.stopPropagation(),children:m.kind==="jobs"?s.jsxs(s.Fragment,{children:[s.jsx(cr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务记录"}),close:!0}),s.jsx(tE,{})]}):s.jsx(GC,{id:m.id,round:m.round},`${m.id}-${m.round??"default"}`)})})}function GC({id:n,round:l}){const i=we(),o=i.jobs[n],c=i.steps[n],d=y.useRef(null),h=y.useRef(l===void 0&&(o?ur(o):!0)),[m,p]=y.useState(null),[g,v]=y.useState(!1),[x,w]=y.useState(l);if(y.useEffect(()=>{wh().then(O=>p(O?.models??null))},[]),y.useEffect(()=>{const O=d.current;if(!O)return;const J=()=>{h.current=O.scrollHeight-O.scrollTop-O.clientHeight<80};return O.addEventListener("scroll",J),()=>O.removeEventListener("scroll",J)},[]),y.useEffect(()=>{const O=d.current,J=c?.[c.length-1]?.queued;O&&(h.current||J)&&(O.scrollTop=O.scrollHeight,h.current=!0)},[c?.length,c?.[c.length-1]?.id]),!o)return s.jsxs("div",{className:"jdbody",children:[s.jsx(cr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务"}),close:!0}),s.jsx(ze,{children:"无法读取这个任务。"})]});const C=i.assistants.find(O=>O.id===o.assistantId),T=o.model?m?.find(O=>O.ref===o.model)?.name??o.model:"",N=o.startedAt??o.createdAt,A=o.durationMs??(ur(o)?Date.now()-new Date(N).getTime():void 0),M=o.usage,R=yh(o);return s.jsxs(s.Fragment,{children:[s.jsxs(cr,{className:"jdhead",title:s.jsx("span",{className:"t",children:"任务"}),close:!0,children:[o.status==="done"?s.jsxs("button",{className:"hob-btn hob-btn-compact",disabled:o.sediment?.status==="running",onClick:()=>{kS(o.id)},children:[s.jsx(Q,{name:"mem",size:14}),o.sediment?.status==="running"?"正在沉淀…":"沉淀成技能"]}):null,c?.some(O=>O.name?.startsWith("browser_")||O.name?.startsWith("desktop_"))?s.jsxs("button",{className:"hob-btn hob-btn-compact",onClick:()=>v(!0),children:[s.jsx(Q,{name:"pointer",size:14}),"看桌面"]}):null]}),s.jsxs("div",{className:"jdbody",ref:d,children:[s.jsx("div",{className:"jd-title",children:o.title}),s.jsxs("div",{className:"jd-meta",children:[s.jsx(js,{meta:es[o.status]}),C||o.assistantName?s.jsxs("span",{className:"jd-owner",children:[C?s.jsx(ot,{sprite:C.sprite,prop:C.prop,size:16}):null,C?.name??o.assistantName]}):null,s.jsx("span",{children:Dt(N)}),A!==void 0?s.jsxs("span",{children:["用时 ",Hl(A)]}):null]}),o.model||M?s.jsxs("div",{className:"jd-meta dim",children:[o.model?s.jsx("span",{className:T===o.model?"mono":void 0,title:o.model,children:T}):null,o.thinking?s.jsxs("span",{children:["思考 ",qC[o.thinking]??o.thinking]}):null,o.modelReason?s.jsx("span",{children:o.modelReason}):null,M?s.jsxs("span",{children:["输入 ",ih(M.input)," · 输出 ",ih(M.output),M.cost>0?` · $${M.cost.toFixed(4)}`:""]}):null]}):null,R?s.jsx("div",{className:"jd-reason",children:R}):null,o.rounds?.length?(()=>{const O=aN(o,c),J=Math.min(x??O.length-1,O.length-1);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"seg jd-rounds",role:"tablist",style:{"--seg-count":O.length,"--seg-index":J},children:O.map((ee,B)=>s.jsxs("button",{role:"tab","aria-selected":B===J,className:B===J?"on":void 0,onClick:()=>w(B),children:["第 ",B+1," 轮"]},B))}),s.jsx("div",{className:x!==l?"jd-round-content":void 0,children:s.jsx(Hb,{part:O[J],last:J===O.length-1,index:J})},J)]})})():s.jsx(s.Fragment,{children:s.jsx(Hb,{part:{job:o,instruction:o.instruction,steps:c},last:!0,index:0})})]}),s.jsx(KC,{job:o}),g?s.jsx(y.Suspense,{fallback:s.jsx("div",{children:"正在打开云桌面…"}),children:s.jsx(BC,{onClose:()=>v(!1)})}):null]})}function Hb({part:n,last:l,index:i}){const[o,c]=y.useState(!1),d=n.steps?.findIndex(x=>x.from==="user"&&x.text==="沉淀技能")??-1,h=n.steps===void 0?void 0:Lx(d<0?n.steps:n.steps.slice(0,d)),m=d<0?void 0:Lx(n.steps.slice(d+1)),p=yh(n.job),g=!ur(n.job),v=new Set(h?Po(h.rows,g,!1).rows.map(x=>x.id):[]);return s.jsxs(s.Fragment,{children:[l?null:s.jsxs("div",{className:"jd-meta",children:[s.jsx(js,{meta:es[n.job.status]}),n.job.durationMs!==void 0?s.jsxs("span",{children:["用时 ",Hl(n.job.durationMs)]}):null]}),p&&!l?s.jsx("div",{className:"jd-reason",children:p}):null,g?s.jsxs(s.Fragment,{children:[s.jsx(JC,{job:n.job}),s.jsx(PC,{job:n.job})]}):null,n.instruction?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:i===0?"任务内容":"这一轮的要求"}),s.jsx("div",{className:"jd-instruction",children:n.instruction})]}):null,s.jsx("div",{className:"lbl",children:"执行过程"}),s.jsx("div",{className:"jd-timeline",children:h===void 0?s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取执行过程…"})}):h.rows.length||h.thinking?s.jsxs(s.Fragment,{children:[Po(h.rows,g,o).rows.map(x=>o&&!v.has(x.id)?s.jsx("div",{className:"jd-unfold",children:s.jsx("div",{children:s.jsx(Uf,{step:x,cwd:n.job.cwd})})},x.id):s.jsx(Uf,{step:x,cwd:n.job.cwd},x.id)),Po(h.rows,g,o).remaining?s.jsx("div",{className:"jd-tool",children:s.jsxs("button",{className:"jd-tool-head",onClick:()=>c(!0),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"more",size:14})}),s.jsxs("span",{className:"tt",children:["还有 ",Po(h.rows,g,o).remaining," 步"]})]})}):null,h.thinking?s.jsx(Bb,{text:h.thinking}):null]}):s.jsx(ze,{children:"还没有执行步骤。"})}),m||l&&n.job.sediment?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"lbl",children:["沉淀技能",l&&n.job.sediment?` · ${vy(n.job.sediment)}`:""]}),s.jsxs("div",{className:"jd-timeline",children:[m?.rows.map(x=>s.jsx(Uf,{step:x,cwd:n.job.cwd},x.id)),m?.thinking?s.jsx(Bb,{text:m.thinking}):null]})]}):null,l?s.jsx(WC,{jobId:n.job.id}):null]})}function KC({job:n}){const[l,i]=y.useState(""),o=l.trim().length>0,c=()=>{if(!o)return;const d=l.trim();i(""),Pf(n.id,d).then(h=>{h||i(m=>m||d)})};return s.jsxs("div",{className:"jd-foot",children:[s.jsx("input",{value:l,placeholder:ur(n)?"补充说明或更正方向":"接着说…",onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.nativeEvent.isComposing&&c()}}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!o,onClick:c,children:"发送"}),n.status==="running"?s.jsx("button",{className:"hob-btn",onClick:()=>void H0(n.id),children:"停止"}):null]})}function Uf({step:n,cwd:l}){const[i,o]=y.useState(!1),c=fn(i,180);if(n.kind==="text")return n.from==="user"?s.jsxs("div",{className:`jd-mine${n.queued?" queued":""}`,children:[n.text,n.queued?s.jsx("div",{className:"jd-mine-note",children:"已送达,当前这一步做完后读取"}):null]}):s.jsxs("div",{className:"jd-textrow",children:[n.thinking?s.jsx(Oy,{text:n.thinking,open:!1}):null,s.jsx(Ka,{className:"jd-text",text:n.text??""})]});const d=n.title??n.name??"",h=oN(d);return s.jsxs("div",{className:`jd-tool${n.isError?" bad":""}${i?" open":""}`,children:[s.jsxs("button",{className:"jd-tool-head",onClick:()=>o(m=>!m),children:[s.jsx("span",{className:"ico",children:n.running?s.jsx(Q,{name:"spin",size:14,className:"spin"}):s.jsx(Q,{name:YC[n.name??""]??(/^(lore|memory)_/.test(n.name??"")?"mem":"more"),size:14})}),s.jsx("span",{className:"tt",children:h.map((m,p)=>s.jsx("span",{className:m.mono?"mono":void 0,children:m.text},p))}),n.thinking?s.jsx("span",{className:"blb",title:"有思考过程",children:s.jsx(Q,{name:"bulb",size:13})}):null,s.jsx("span",{className:"tm",children:n.isError?"出错":n.durationMs&&n.durationMs>=1e3?Hl(n.durationMs):""}),s.jsx(Q,{name:i?"down":"chev",size:13})]}),s.jsx("div",{className:`expand${i?" open":""}`,inert:!i,children:s.jsx("div",{children:c.mounted?s.jsx(ZC,{step:n,cwd:l}):null})})]})}function Oy({text:n,open:l}){const[i,o]=y.useState(l);return s.jsxs("div",{className:"jd-think-in",children:[s.jsxs("button",{className:"jd-think-head",title:i?"收起思考过程":"展开思考过程",onClick:()=>o(c=>!c),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"bulb",size:13})}),s.jsx("span",{className:"tt",children:"思考过程"}),s.jsx(Q,{name:i?"down":"chev",size:12})]}),i?s.jsx("div",{className:"jd-think-body",children:n}):null]})}function Bb({text:n}){const[l,i]=y.useState(!1);return s.jsxs("div",{className:"jd-think",children:[s.jsxs("button",{onClick:()=>i(o=>!o),children:[s.jsx("span",{className:"ico",children:s.jsx(Q,{name:"bulb",size:14})}),s.jsx("span",{className:"tt",children:"思考中"}),s.jsx(Q,{name:l?"down":"chev",size:13})]}),l?s.jsx("div",{className:"jd-think-body",children:n}):null]})}function XC(n){const l=n.args?.edits;return Array.isArray(l)?l.map(i=>({oldText:String(i?.oldText??""),newText:String(i?.newText??"")})):[]}function oh({path:n,cwd:l}){if(!n)return null;const i=n.startsWith("/")?n:l?`${l.replace(/\/+$/,"")}/${n}`:null;return i?s.jsx("button",{className:"jd-kv mono jd-path",title:i,onClick:()=>zt(i),children:n}):s.jsx("div",{className:"jd-kv mono",children:n})}function ZC({step:n,cwd:l}){const i=n.args??{},o=XC(n);return s.jsxs("div",{className:"jd-tool-body",children:[n.thinking?s.jsx(Oy,{text:n.thinking,open:!0}):null,o.length?s.jsxs(s.Fragment,{children:[s.jsx(oh,{path:String(i.path??""),cwd:l}),o.map((c,d)=>s.jsx(QC,{before:c.oldText,after:c.newText},d))]}):s.jsx(VC,{step:n,args:i,cwd:l}),n.output?s.jsx(ch,{text:n.output,className:"jd-out mono"}):null,n.outputPath?s.jsxs("button",{className:"jd-file",onClick:()=>zt(n.outputPath),children:[s.jsx(Q,{name:"doc",size:12}),"完整输出"]}):null]})}function VC({step:n,args:l,cwd:i}){if(n.name==="bash")return s.jsx(ch,{text:String(l.command??""),className:"jd-arg mono",lines:8});if(n.name==="write")return s.jsxs("div",{className:"jd-kv-wrap",children:[s.jsx(oh,{path:String(l.path??""),cwd:i}),s.jsxs("span",{className:"jd-kv-len",children:[String(l.contentLength??0)," 字"]})]});if(n.name==="read"||n.name==="ls"||n.name==="edit")return s.jsx(oh,{path:String(l.path??""),cwd:i});const o=JSON.stringify(l,null,2);return o==="{}"?null:s.jsx(ch,{text:o,className:"jd-arg mono",lines:6})}function QC({before:n,after:l}){const[i,o]=y.useState(!1),c=sN(n,l),d=i?c:c.slice(0,24);return s.jsxs("div",{className:"jd-diff",children:[d.map((h,m)=>s.jsxs("div",{className:`dl ${h.sign==="-"?"del":h.sign==="+"?"add":""}`,children:[s.jsx("span",{className:"sg",children:h.sign}),s.jsx("span",{className:"mono",children:h.text||" "})]},m)),c.length>d.length?s.jsxs("button",{className:"jd-more",onClick:()=>o(!0),children:["展开全部 ",c.length," 行"]}):null]})}function ch({text:n,className:l,lines:i=12}){const[o,c]=y.useState(!1),d=n.split(`
279
+ `).length;return s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:`${l}${o?" all":""}`,style:o?void 0:{maxHeight:`${i*1.6}em`},children:n}),d>i?s.jsx("button",{className:"jd-more",onClick:()=>c(!o),children:o?"收起":`展开全部 ${d} 行`}):null]})}function JC({job:n}){return n.summary?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"报告"}),s.jsx(Ka,{className:"jd-report",text:n.summary})]}):null}function PC({job:n}){const l=[...new Set(n.files??[])];return l.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"产出文件"}),s.jsx("div",{className:"jd-files",children:l.map(i=>s.jsx(FC,{path:i},i))})]}):null}function FC({path:n}){const[l,i]=y.useState(),[o,c]=y.useState("");return y.useEffect(()=>{let d=!0;return Rh(n).then(h=>{d&&i(h.size)}).catch(h=>{d&&c(h instanceof Error?h.message:String(h))}),()=>{d=!1}},[n]),s.jsxs("button",{className:"jd-file-row",onClick:()=>zt(n),children:[s.jsx(Q,{name:Ul(n),size:18}),s.jsx("span",{children:n.split("/").pop()}),o?s.jsx("small",{title:o,children:"大小读取失败"}):l!==void 0?s.jsx("small",{children:Qa(l)}):null]})}function WC({jobId:n}){const[l,i]=y.useState(!1),[o,c]=y.useState(),[d,h]=y.useState(""),[m,p]=y.useState(0);return y.useEffect(()=>{let g=!0;return h(""),V0(n).then(v=>{g&&c(v)}).catch(v=>{g&&h(v instanceof Error?v.message:String(v))}),()=>{g=!1}},[n,m]),o&&!o.total&&!d?null:s.jsxs("div",{className:"jd-directory",children:[s.jsxs("button",{className:"jd-directory-head",onClick:()=>i(!l),children:[s.jsx(Q,{name:l?"down":"chev",size:15}),"工作目录",o?` · ${o.fileCount} 个文件、${o.directoryCount} 个文件夹`:""]}),d?s.jsxs("div",{className:"jd-dir-error",children:[d," ",s.jsx("button",{className:"jd-more",onClick:()=>p(m+1),children:"重试"})]}):null,l&&o?s.jsx(_y,{jobId:n,view:o}):null]})}function _y({jobId:n,view:l}){return s.jsxs("div",{className:"jd-files",children:[l.files.map(i=>i.type==="file"?s.jsxs("button",{className:"jd-file-row",onClick:()=>zt(i.path),children:[s.jsx(Q,{name:Ul(i.name),size:18}),s.jsx("span",{children:i.name}),s.jsx("small",{children:Qa(i.size)})]},i.rel):s.jsx(eE,{jobId:n,entry:i},i.rel)),l.total>l.files.length?s.jsxs("div",{className:"jd-dir-more",children:["还有 ",l.total-l.files.length," 项"]}):null]})}function eE({jobId:n,entry:l}){const[i,o]=y.useState(!1),[c,d]=y.useState(),[h,m]=y.useState(""),[p,g]=y.useState(0);return y.useEffect(()=>{if(!i||c)return;let v=!0;return m(""),V0(n,l.rel).then(x=>{v&&d(x)}).catch(x=>{v&&m(x instanceof Error?x.message:String(x))}),()=>{v=!1}},[i,c,n,l.rel,p]),s.jsxs("div",{children:[s.jsxs("button",{className:"jd-file-row",onClick:()=>o(!i),children:[s.jsx(Q,{name:i?"down":"chev",size:14}),s.jsx(Q,{name:"folder",size:18}),s.jsx("span",{children:l.name}),s.jsxs("small",{children:[l.count," 项"]})]}),i?s.jsx("div",{className:"jd-dir-child",children:h?s.jsxs("div",{className:"jd-dir-error",children:[h," ",s.jsx("button",{className:"jd-more",onClick:()=>g(p+1),children:"重试"})]}):c?s.jsx(_y,{jobId:n,view:c}):s.jsx("div",{className:"jd-dir-more",children:"正在读取…"})}):null]})}function tE(){const n=we(),l=n.worklog,i=l?.assistantId??null,o=l?.status??null;return s.jsxs("div",{className:"jdbody",onScroll:c=>{const d=c.currentTarget;l?.hasMore&&!l.loading&&d.scrollHeight-d.scrollTop-d.clientHeight<100&&ob()},children:[s.jsxs("div",{className:"jd-filters",children:[s.jsxs("select",{className:"pick",value:i??"",onChange:c=>void wc({assistantId:c.target.value||null,status:o}),children:[s.jsx("option",{value:"",children:"全部助手"}),n.assistants.map(c=>s.jsx("option",{value:c.id,children:c.name},c.id))]}),s.jsxs("select",{className:"pick",value:o??"",onChange:c=>void wc({assistantId:i,status:c.target.value||null}),children:[s.jsx("option",{value:"",children:"全部状态"}),IC.map(c=>s.jsx("option",{value:c,children:es[c].text},c))]}),s.jsx("span",{className:"sp"}),l?s.jsxs("span",{className:"dim",children:[l.jobs.length," 个"]}):null]}),l===null?s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取任务记录…"})}):l.jobs.length?s.jsx("div",{className:"jd-rows",children:l.jobs.map(c=>{const d=n.jobs[c.id]??c,h=n.assistants.find(m=>m.id===d.assistantId);return s.jsxs("button",{className:"list-row history-row",onClick:()=>{h&&Pt(d.assistantId,!0,!0),Ln(d.id)},children:[h?s.jsx(ot,{sprite:h.sprite,prop:h.prop,size:26}):s.jsx("span",{style:{width:26}}),s.jsxs("span",{className:"history-content",children:[s.jsx("span",{className:"n",children:d.title}),s.jsxs("span",{className:"tm",children:[Dt(d.startedAt??d.createdAt),d.durationMs!==void 0?` · ${Hl(d.durationMs)}`:ur(d)?` · ${xr(d.startedAt??d.createdAt)}`:""]})]}),s.jsx(js,{meta:es[d.status]})]},d.id)})}):s.jsx(ze,{children:"没有符合条件的任务。"}),l?.hasMore?s.jsx("button",{className:"hob-btn jd-morebtn",onClick:()=>void ob(),children:l.loading?"正在读取…":"加载更多"}):null]})}function nE(){const n=we(),[l,i]=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 d=()=>{l&&uS(l)};return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"card",children:[s.jsx(ot,{sprite:"hob",size:88,free:!0,motion:"home"}),s.jsx("div",{className:"nm",children:"Hob"}),s.jsx("div",{className:"ds",children:"请输入密码"}),s.jsx("label",{className:`field${o?" shake":""}`,children:s.jsx("input",{type:"password",autoFocus:!0,value:l,placeholder:"密码",onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&d()}})}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:d,disabled:n.loggingIn,children:n.loggingIn?"正在登录…":"登录"}),n.error?s.jsx("div",{className:"err",style:{width:"100%"},children:n.error}):null]})})}const sE=[["","全部类型"],["image","图片"],["document","文档"],["table","表格"],["page","网页"],["other","其他"]],lE=n=>`删除知识库「${n}」?直接上传到这里、又不在别的知识库里的文件会一起删除,其余文件只是移出。`;function _c(n="right"){const[l,i]=y.useState(null),o=y.useRef(null);return y.useLayoutEffect(()=>{if(!l||!o.current)return;const c=l.anchor.getBoundingClientRect(),d=o.current.getBoundingClientRect(),h=n==="left"?c.left:c.right-d.width;o.current.style.left=`${Math.max(8,Math.min(h,window.innerWidth-d.width-8))}px`,o.current.style.top=`${Math.max(8,Math.min(c.bottom+4,window.innerHeight-d.height-8))}px`}),y.useEffect(()=>{if(!l)return;const c=m=>{!o.current?.contains(m.target)&&!l.anchor.contains(m.target)&&i(null)},d=m=>{m.key==="Escape"&&(m.stopPropagation(),i(null))},h=m=>{o.current?.contains(m.target)||i(null)};return document.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",d,!0),document.addEventListener("scroll",h,!0),()=>{document.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",d,!0),document.removeEventListener("scroll",h,!0)}},[l]),{menu:l,box:o,close:()=>i(null),toggle:(c,d)=>i(h=>h?.id===c?null:{id:c,anchor:d})}}function Ac({initial:n="",label:l,save:i,cancel:o}){const[c,d]=y.useState(n),[h,m]=y.useState(!1);return s.jsx("form",{className:"knowledge-name",onSubmit:p=>{p.preventDefault(),!(!c.trim()||h)&&(m(!0),i(c.trim()).then(g=>{g?o():m(!1)}))},children:s.jsx("input",{autoFocus:!0,"aria-label":l,value:c,disabled:h,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),o())}})})}function aE({collections:n,selected:l,narrow:i}){const[o,c]=y.useState(!1),[d,h]=y.useState(null),m=_c(),p=n.find(g=>g.id===m.menu?.id);return s.jsxs("nav",{className:i?"knowledge-categories":"setnav","aria-label":"知识库分类",children:[!i&&s.jsx("div",{className:"setnavtitle",children:"知识库"}),[["all","全部"],["output","助手产出"],["chat","对话上传"]].map(([g,v])=>s.jsx("div",{children:s.jsx("button",{className:`navrow${l===g?" sel":""}`,onClick:()=>zl({category:g}),children:v})},g)),!i&&s.jsx("div",{className:"knowledge-label",children:"我的知识库"}),n.map(g=>s.jsxs("div",{className:`knowledge-category${m.menu?.id===g.id?" menu-open":""}${l===g.id?" selected":""}`,onContextMenu:v=>{v.preventDefault();const x=v.currentTarget.querySelector(".category-dots");x&&m.toggle(g.id,x)},children:[d===g.id?s.jsx(Ac,{initial:g.name,label:"知识库名称",save:v=>zS(g.id,v),cancel:()=>h(null)}):s.jsxs("button",{className:`navrow${l===g.id?" sel":""}`,onClick:()=>zl({category:g.id}),children:[s.jsx("span",{children:g.name}),s.jsx("span",{className:"knowledge-count",children:g.count})]}),s.jsx("button",{className:"knowledge-dots category-dots","aria-label":`${g.name}的操作`,onClick:v=>m.toggle(g.id,v.currentTarget),children:s.jsx(Q,{name:"more",size:18})})]},g.id)),s.jsx("div",{children:o?s.jsx(Ac,{label:"新知识库名称",save:async g=>!!await K0(g),cancel:()=>c(!1)}):s.jsx("button",{className:"navrow knowledge-new",onClick:()=>c(!0),children:"+ 新建"})}),!i&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sp"}),s.jsx("button",{className:"navrow",onClick:rr,children:"返回 Hob"})]}),p&&Za.createPortal(s.jsxs("div",{className:"amenu knowledge-popup",ref:m.box,children:[s.jsx("button",{onClick:()=>{m.close(),h(p.id)},children:"改名"}),s.jsx("button",{onClick:()=>{m.close(),window.confirm(lE(p.name))&&RS(p.id)},children:"删除"})]}),document.body)]})}function iE({knowledge:n,assistants:l,uploading:i,upload:o}){const[c,d]=y.useState(n.q),[h,m]=y.useState(!1),p=y.useRef(null),g=n.collections.some(v=>v.id===n.category);return y.useEffect(()=>{if(h||c===n.q)return;const v=window.setTimeout(()=>zl({q:c}),250);return()=>window.clearTimeout(v)},[c,h,n.q]),s.jsxs("div",{className:"knowledge-filters",children:[s.jsxs("label",{className:"knowledge-search",children:[s.jsx(Q,{name:"search",size:16}),s.jsx("input",{placeholder:"搜索知识库",value:c,onChange:v=>d(v.target.value),onCompositionStart:()=>m(!0),onCompositionEnd:v=>{d(v.currentTarget.value),m(!1)}})]}),s.jsx("select",{"aria-label":"类型",value:n.kind,onChange:v=>zl({kind:v.target.value}),children:sE.map(([v,x])=>s.jsx("option",{value:v,children:x},v))}),s.jsxs("select",{"aria-label":"助手",value:n.assistantId,onChange:v=>zl({assistantId:v.target.value}),children:[s.jsx("option",{value:"",children:"全部助手"}),l.map(v=>s.jsx("option",{value:v.id,children:v.name},v.id))]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:p,type:"file",multiple:!0,hidden:!0,onChange:v=>{o(Array.from(v.target.files??[])),v.target.value=""}}),s.jsx("button",{className:"hob-btn hob-btn-upload",disabled:i,onClick:()=>p.current?.click(),children:i?"正在上传…":"上传"})]})]})}function rE({entry:n,collections:l}){return s.jsx(s.Fragment,{children:l.map(i=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:n.collections.includes(i.id),onChange:o=>{const c=o.target.checked?[...n.collections,i.id]:n.collections.filter(d=>d!==i.id);fc(n.id,{collections:c})}}),i.name]},i.id))})}function oE({entry:n,collections:l,category:i,join:o,rename:c,remove:d,confirm:h}){return s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:o,children:"加入知识库"}),s.jsx("button",{onClick:c,children:"改名"}),s.jsx("a",{href:Yt(n.path),download:n.name,children:"下载"}),l.some(m=>m.id===i)&&s.jsx("button",{onClick:d,children:"移出这个知识库"}),s.jsx("button",{onClick:h,children:"删除"})]})}function cE({entry:n,collections:l,assistants:i,selected:o,category:c}){const d=_c(),[h,m]=y.useState(!1),[p,g]=y.useState(!1),[v,x]=y.useState(!1),w=b0(n.kind),C=i.find(M=>M.id===n.source?.assistantId),T=n.source,N=n.index?.state==="queued"||n.index?.state==="indexing"?"正在建索引…":n.index?.state==="failed"?`未能建索引:${n.index.error||"未知原因"}`:n.index?.state==="unsupported"?"这类文件还不能建索引":"",A=[n.origin==="upload"?"上传":C?.name,Dt(n.updatedAt),Qa(n.size),n.versions?.length?`第 ${n.versions.length+1} 版`:"",N].filter(Boolean).join(" · ");return s.jsxs("div",{className:`knowledge-row${o?" selected":""}`,children:[s.jsxs("div",{className:"knowledge-open",role:"button",tabIndex:0,onClick:()=>{v||zt(n.path,n.name)},onKeyDown:M=>{!v&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),zt(n.path,n.name))},children:[s.jsx("span",{className:"knowledge-thumb",children:w==="image"?s.jsx("img",{src:$l(n.path),alt:""}):s.jsx(Q,{name:w==="table"?"table":w==="page"?"globe":"doc",size:24})}),s.jsxs("div",{className:"knowledge-info",children:[v?s.jsx(Ac,{initial:n.name,label:"文件名称",save:M=>fc(n.id,{name:M}),cancel:()=>x(!1)}):s.jsx("strong",{children:n.name}),n.snippet||n.description?s.jsx("span",{className:"knowledge-description",children:n.snippet||n.description}):null,s.jsxs("span",{className:"knowledge-meta",children:[s.jsx("span",{className:"knowledge-meta-text",children:A}),s.jsx("span",{className:"knowledge-tags",children:n.collections.map(M=>{const R=l.find(O=>O.id===M);return R?s.jsx("span",{children:R.name},M):null})})]})]})]}),T&&(T.itemId||T.jobId)?s.jsx("button",{className:"knowledge-source",onClick:()=>{T.itemId?DS(T.assistantId,T.itemId):T.jobId&&(rr(),Ln(T.jobId))},children:"出处"}):null,s.jsx("div",{className:"knowledge-actions",children:s.jsx("button",{className:"knowledge-dots","aria-label":`${n.name}的操作`,onClick:M=>{d.toggle(n.id,M.currentTarget),m(!1)},children:s.jsx(Q,{name:"more",size:18})})}),d.menu&&Za.createPortal(s.jsx("div",{className:"amenu knowledge-popup",ref:d.box,children:h?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"knowledge-menu-title",children:"加入知识库"}),s.jsx(rE,{entry:n,collections:l}),p?s.jsx(Ac,{label:"新知识库名称",save:async M=>{const R=await K0(M,!1);return!!R&&await fc(n.id,{collections:[...n.collections,R.id]})},cancel:()=>g(!1)}):s.jsx("button",{onClick:()=>g(!0),children:"+ 新建知识库"})]}):s.jsx(oE,{entry:n,collections:l,category:c,join:()=>m(!0),rename:()=>{d.close(),x(!0)},remove:()=>{d.close(),fc(n.id,{collections:n.collections.filter(M=>M!==c)})},confirm:()=>{d.close(),window.confirm(`删除「${n.name}」?会从所有知识库里移除,不能恢复。`)&&OS(n.id)}})}),document.body)]})}function uE({knowledge:n,assistants:l,previewPath:i,upload:o}){const c=n.collections.some(h=>h.id===n.category),d=n.category==="output"&&!n.q?"还没有助手产出。助手交给你的文件、图片和页面会自动收在这里。":n.category==="chat"&&!n.q?"还没有对话上传的文件。":n.q?"没有找到匹配的资料。":"这里还没有资料。";return s.jsxs("div",{className:"knowledge-list",onDragOver:h=>{c&&h.preventDefault()},onDrop:h=>{c&&(h.preventDefault(),o(Array.from(h.dataTransfer.files)))},onScroll:h=>{const m=h.currentTarget;m.scrollHeight-m.scrollTop-m.clientHeight<120&&_t(!0)},children:[n.error?s.jsxs(ze,{large:!0,action:{label:"重试",onClick:()=>void _t()},children:["加载失败:",n.error]}):!n.entries.length&&!n.loading?s.jsx(ze,{large:!0,children:d}):null,n.entries.map(h=>s.jsx(cE,{entry:h,collections:n.collections,assistants:l,selected:h.path===i,category:n.category},h.id)),n.loading?s.jsx(ze,{large:!0,children:"正在加载…"}):null,n.hasMore&&!n.loading?s.jsx("button",{className:"knowledge-more",onClick:()=>void _t(!0),children:"加载更多"}):null]})}function dE({collectionId:n,collections:l,assistants:i,busy:o,setBusy:c}){return s.jsx(s.Fragment,{children:i.map(d=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:d.knowledge?.includes(n)??!1,disabled:o,onChange:()=>{const h=(d.knowledge??[]).filter(m=>l.some(p=>p.id===m));c(!0),ar(d.id,{knowledge:h.includes(n)?h.filter(m=>m!==n):[...h,n]}).finally(()=>c(!1))}}),d.name]},d.id))})}function fE({id:n,busy:l,setBusy:i}){return s.jsx("button",{disabled:l,onClick:()=>{i(!0),eS(n).then(()=>_t(!1,!0)).catch(o=>Xa(`重试失败:${o instanceof Error?o.message:String(o)}`)).finally(()=>i(!1))},children:"重试"})}function hE({collection:n,collections:l,assistants:i,embedding:o}){const c=_c("left"),d=i.filter(p=>p.knowledge?.includes(n.id)),[h,m]=y.useState(!1);return s.jsxs("div",{className:"knowledge-status",children:[s.jsxs("div",{children:[d.length?`给 ${d.map(p=>p.name).join("、")} 用`:s.jsx("strong",{children:"还没有助手用这个库"})," · ",s.jsx("button",{onClick:p=>c.toggle(n.id,p.currentTarget),children:d.length?"修改":"选择助手"})]}),c.menu&&Za.createPortal(s.jsx("div",{className:"amenu knowledge-popup",ref:c.box,children:s.jsx(dE,{collectionId:n.id,collections:l,assistants:i,busy:h,setBusy:m})}),document.body),s.jsxs("div",{children:["已建索引 ",n.indexed??0,"/",n.count-(n.unsupported??0),(n.failed??0)>0?s.jsxs(s.Fragment,{children:[" · ",n.failed," 个失败 · ",s.jsx(fE,{id:n.id,busy:h,setBusy:m})]}):null,o?null:s.jsxs(s.Fragment,{children:[" · 只按关键词查 · ",s.jsx("button",{onClick:()=>{Oc(),Rl("knowledge")},children:"去设置向量模型"})]})]})]})}function mE({narrow:n,leaving:l}){const i=we(),o=i.knowledge,c=i.panelStack.at(-1),d=c?.kind==="file"?c:null,[h,m]=y.useState(!1),p=g=>{!g.length||h||(m(!0),_S(o.category,g).finally(()=>m(!1)))};return y.useEffect(()=>{if(i.page!=="knowledge"||d)return;const g=v=>{v.key==="Escape"&&rr()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i.page,d]),s.jsxs("main",{className:`setpage knowledge${n?" narrow":""}${d&&!n?" has-preview":""}${d?.full&&!n?" preview-full":""}${l?" leaving":""}`,children:[n?s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:rr,children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:"知识库"})]}):null,s.jsx(aE,{collections:o.collections,selected:o.category,narrow:n}),s.jsxs("section",{className:"knowledge-main",children:[s.jsx(iE,{knowledge:o,assistants:i.assistants,uploading:h,upload:p}),o.collections.find(g=>g.id===o.category)?s.jsx(hE,{collection:o.collections.find(g=>g.id===o.category),collections:o.collections,assistants:i.assistants,embedding:i.settings.settings.knowledge?.embedding.source==="openai"}):null,s.jsx(uE,{knowledge:o,assistants:i.assistants,previewPath:d?.path,upload:p})]}),!n&&d?s.jsx("aside",{className:"knowledge-preview",children:s.jsx(mc,{embedded:!0})}):null]})}const pE=5,gE=24*3600*1e3;function uh(n,l){const i=l.trim();return i?n.name.includes(i)||n.duty.includes(i)||(n.last?.text??"").includes(i):!0}function Dy(n,l){return(l.last?.at??"").localeCompare(n.last?.at??"")}function vE(n,l){const i=o=>o.pinOrder??Number.MAX_SAFE_INTEGER;return i(n)-i(l)||n.createdAt.localeCompare(l.createdAt)}function xE(n,l){const i=o=>o.pinOrder??Number.MAX_SAFE_INTEGER;return i(n)-i(l)||Dy(n,l)}function Zh(n,l){return n.filter(i=>i.pinned&&!i.hidden&&uh(i,l)).sort(vE)}const qb=n=>n.status==="running"||n.status==="queued"||n.status==="waiting";function bE(n,l){return(l.startedAt??l.createdAt).localeCompare(n.startedAt??n.createdAt)}function yE(n,l){return(l.endedAt??l.createdAt).localeCompare(n.endedAt??n.createdAt)}function Ib(n){const l=Kh(n.schedules[0]??"");return l.kind==="raw"?1440:l.hour*60+l.minute}function kE(n,l=Date.now()){const i=n.query.trim().length>0,o=new Date(l-gE).toISOString(),c=Object.values(n.jobs),d=Zh(n.assistants,n.query),h=n.assistants.filter(C=>!C.pinned&&!C.hidden&&uh(C,n.query)).sort(xE),m=n.assistants.filter(C=>C.hidden&&uh(C,n.query)).sort(Dy),p=i?[]:Object.values(n.approvals).filter(C=>C.status==="pending").sort((C,T)=>T.createdAt.localeCompare(C.createdAt)),g=i?[]:c.filter(qb).sort(bE),v=i?[]:c.filter(C=>!qb(C)&&(C.endedAt??C.createdAt)>o).sort(yE).slice(0,pE),x=i?[]:n.routines.filter(C=>C.active).sort((C,T)=>Ib(C)-Ib(T)),w=!i&&!p.length&&!g.length&&!h.length&&!m.length&&!v.length&&!x.length;return{searching:i,pins:d,rows:h,hidden:m,asks:p,live:g,recent:v,routines:x,empty:w}}function Ot(n,l,i,o,c,d,h,m){return Ot.fromTZ(Ot.tp(n,l,i,o,c,d,h),m)}Ot.fromTZISO=(n,l,i)=>Ot.fromTZ(jE(n,l),i);Ot.fromTZ=function(n,l){let i=new Date(Date.UTC(n.y,n.m-1,n.d,n.h,n.i,n.s)),o=Lf(n.tz,i),c=new Date(i.getTime()-o),d=Lf(n.tz,c);if(d-o===0)return c;{let h=new Date(i.getTime()-d),m=Lf(n.tz,h);if(m-d===0||!l&&m-d>0)return h;if(l)throw new Error("Invalid date passed to fromTZ()");return c}};Ot.toTZ=function(n,l){let i=n.toLocaleString("en-US",{timeZone:l}).replace(/[\u202f]/," "),o=new Date(i);return{y:o.getFullYear(),m:o.getMonth()+1,d:o.getDate(),h:o.getHours(),i:o.getMinutes(),s:o.getSeconds(),tz:l}};Ot.tp=(n,l,i,o,c,d,h)=>({y:n,m:l,d:i,h:o,i:c,s:d,tz:h});function Lf(n,l=new Date){let i=l.toLocaleString("en-US",{timeZone:n,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],o=l.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${o} GMT`)-Date.parse(`${o} ${i}`)}function jE(n,l){let i=new Date(Date.parse(n));if(isNaN(i))throw new Error("minitz: Invalid ISO8601 passed to parser.");let o=n.substring(9);return n.includes("Z")||o.includes("-")||o.includes("+")?Ot.tp(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),"Etc/UTC"):Ot.tp(i.getFullYear(),i.getMonth()+1,i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),l)}Ot.minitz=Ot;var Vh=32,sr=31|Vh,$y=[1,2,4,8,16],Yb=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(n,l){this.pattern=n,this.timezone=l,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 l=new Nn(new Date,this.timezone).getDate(!0);n[0]=n[0].replace("?",l.getSeconds().toString()),n[1]=n[1].replace("?",l.getMinutes().toString()),n[2]=n[2].replace("?",l.getHours().toString()),this.starDOM||(n[3]=n[3].replace("?",l.getDate().toString())),n[4]=n[4].replace("?",(l.getMonth()+1).toString()),this.starDOW||(n[5]=n[5].replace("?",l.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,sr),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(n,l,i,o){let c=this[n],d=n==="day"&&this.lastDayOfMonth;if(l===""&&!d)throw new TypeError("CronPattern: configuration entry "+n+" ("+l+") is empty, check for trailing spaces.");if(l==="*")return c.fill(o);let h=l.split(",");if(h.length>1)for(let m=0;m<h.length;m++)this.partToArray(n,h[m],i,o);else l.indexOf("-")!==-1&&l.indexOf("/")!==-1?this.handleRangeWithStepping(l,n,i,o):l.indexOf("-")!==-1?this.handleRange(l,n,i,o):l.indexOf("/")!==-1?this.handleStepping(l,n,i,o):l!==""&&this.handleNumber(l,n,i,o)}throwAtIllegalCharacters(n){for(let l=0;l<n.length;l++)if((l===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(n[l]))throw new TypeError("CronPattern: configuration entry "+l+" ("+n[l]+") contains illegal characters.")}handleNumber(n,l,i,o){let c=this.extractNth(n,l),d=parseInt(c[0],10)+i;if(isNaN(d))throw new TypeError("CronPattern: "+l+" is not a number: '"+n+"'");this.setPart(l,d,c[1]||o)}setPart(n,l,i){if(!Object.prototype.hasOwnProperty.call(this,n))throw new TypeError("CronPattern: Invalid part specified: "+n);if(n==="dayOfWeek"){if(l===7&&(l=0),l<0||l>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+l);this.setNthWeekdayOfMonth(l,i);return}if(n==="second"||n==="minute"){if(l<0||l>=60)throw new RangeError("CronPattern: Invalid value for "+n+": "+l)}else if(n==="hour"){if(l<0||l>=24)throw new RangeError("CronPattern: Invalid value for "+n+": "+l)}else if(n==="day"){if(l<0||l>=31)throw new RangeError("CronPattern: Invalid value for "+n+": "+l)}else if(n==="month"&&(l<0||l>=12))throw new RangeError("CronPattern: Invalid value for "+n+": "+l);this[n][l]=i}handleRangeWithStepping(n,l,i,o){let c=this.extractNth(n,l),d=c[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(d===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+n+"'");let[,h,m,p]=d,g=parseInt(h,10)+i,v=parseInt(m,10)+i,x=parseInt(p,10);if(isNaN(g))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(v))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(x))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(x===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(x>this[l].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[l].length+")");if(g>v)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let w=g;w<=v;w+=x)this.setPart(l,w,c[1]||o)}extractNth(n,l){let i=n,o;if(i.includes("#")){if(l!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=i.split("#")[1],i=i.split("#")[0]}return[i,o]}handleRange(n,l,i,o){let c=this.extractNth(n,l),d=c[0].split("-");if(d.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+n+"'");let h=parseInt(d[0],10)+i,m=parseInt(d[1],10)+i;if(isNaN(h))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(h>m)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let p=h;p<=m;p++)this.setPart(l,p,c[1]||o)}handleStepping(n,l,i,o){let c=this.extractNth(n,l),d=c[0].split("/");if(d.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+n+"'");d[0]===""&&(d[0]="*");let h=0;d[0]!=="*"&&(h=parseInt(d[0],10)+i);let m=parseInt(d[1],10);if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(m===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(m>this[l].length)throw new TypeError("CronPattern: Syntax error, max steps for part is ("+this[l].length+")");for(let p=h;p<this[l].length;p+=m)this.setPart(l,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 l=n.trim().toLowerCase();return l==="@yearly"||l==="@annually"?"0 0 1 1 *":l==="@monthly"?"0 0 1 * *":l==="@weekly"?"0 0 * * 0":l==="@daily"?"0 0 * * *":l==="@hourly"?"0 * * * *":n}setNthWeekdayOfMonth(n,l){if(typeof l!="number"&&l==="L")this.dayOfWeek[n]=this.dayOfWeek[n]|Vh;else if(l===sr)this.dayOfWeek[n]=sr;else if(l<6&&l>0)this.dayOfWeek[n]=this.dayOfWeek[n]|$y[l-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${l}, Type: ${typeof l}`)}},Gb=[31,28,31,30,31,30,31,31,30,31,30,31],bs=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Nn=class Uy{tz;ms;second;minute;hour;day;month;year;constructor(l,i){if(this.tz=i,l&&l instanceof Date)if(!isNaN(l))this.fromDate(l);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(l===void 0)this.fromDate(new Date);else if(l&&typeof l=="string")this.fromString(l);else if(l instanceof Uy)this.fromCronDate(l);else throw new TypeError("CronDate: Invalid type ("+typeof l+") passed to CronDate constructor")}isNthWeekdayOfMonth(l,i,o,c){let d=new Date(Date.UTC(l,i,o)).getUTCDay(),h=0;for(let m=1;m<=o;m++)new Date(Date.UTC(l,i,m)).getUTCDay()===d&&h++;if(c&sr&&$y[h-1]&c)return!0;if(c&Vh){let m=new Date(Date.UTC(l,i+1,0)).getUTCDate();for(let p=o+1;p<=m;p++)if(new Date(Date.UTC(l,i,p)).getUTCDay()===d)return!1;return!0}return!1}fromDate(l){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=l.getUTCMilliseconds(),this.second=l.getUTCSeconds(),this.minute=l.getUTCMinutes()+this.tz,this.hour=l.getUTCHours(),this.day=l.getUTCDate(),this.month=l.getUTCMonth(),this.year=l.getUTCFullYear(),this.apply();else{let i=Ot.toTZ(l,this.tz);this.ms=l.getMilliseconds(),this.second=i.s,this.minute=i.i,this.hour=i.h,this.day=i.d,this.month=i.m-1,this.year=i.y}else this.ms=l.getMilliseconds(),this.second=l.getSeconds(),this.minute=l.getMinutes(),this.hour=l.getHours(),this.day=l.getDate(),this.month=l.getMonth(),this.year=l.getFullYear()}fromCronDate(l){this.tz=l.tz,this.year=l.year,this.month=l.month,this.day=l.day,this.hour=l.hour,this.minute=l.minute,this.second=l.second,this.ms=l.ms}apply(){if(this.month>11||this.day>Gb[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let l=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=l.getUTCMilliseconds(),this.second=l.getUTCSeconds(),this.minute=l.getUTCMinutes(),this.hour=l.getUTCHours(),this.day=l.getUTCDate(),this.month=l.getUTCMonth(),this.year=l.getUTCFullYear(),!0}else return!1}fromString(l){if(typeof this.tz=="number"){let i=Ot.fromTZISO(l);this.ms=i.getUTCMilliseconds(),this.second=i.getUTCSeconds(),this.minute=i.getUTCMinutes(),this.hour=i.getUTCHours(),this.day=i.getUTCDate(),this.month=i.getUTCMonth(),this.year=i.getUTCFullYear(),this.apply()}else return this.fromDate(Ot.fromTZISO(l,this.tz))}findNext(l,i,o,c){let d=this[i],h;o.lastDayOfMonth&&(this.month!==1?h=Gb[this.month]:h=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let m=!o.starDOW&&i=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let p=this[i]+c;p<o[i].length;p++){let g=o[i][p];if(i==="day"&&o.lastDayOfMonth&&p-c==h&&(g=1),i==="day"&&!o.starDOW){let v=o.dayOfWeek[(m+(p-c-1))%7];if(v&&v&sr)v=this.isNthWeekdayOfMonth(this.year,this.month,p-c,v)?1:0;else if(v)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${v}`);l.legacyMode&&!o.starDOM?g=g||v:g=g&&v}if(g)return this[i]=p-c,d!==this[i]?2:1}return 3}recurse(l,i,o){let c=this.findNext(i,bs[o][0],l,bs[o][2]);if(c>1){let d=o+1;for(;d<bs.length;)this[bs[d][0]]=-bs[d][2],d++;if(c===3)return this[bs[o][1]]++,this[bs[o][0]]=-bs[o][2],this.apply(),this.recurse(l,i,0);if(this.apply())return this.recurse(l,i,o-1)}return o+=1,o>=bs.length?this:this.year>=3e3?null:this.recurse(l,i,o)}increment(l,i,o){return this.second+=i.interval!==void 0&&i.interval>1&&o?i.interval:1,this.ms=0,this.apply(),this.recurse(l,i,0)}getDate(l){return l||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):Ot.fromTZ(Ot.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function wE(n){if(n===void 0&&(n={}),delete n.name,n.legacyMode=n.legacyMode===void 0?!0:n.legacyMode,n.paused=n.paused===void 0?!1:n.paused,n.maxRuns=n.maxRuns===void 0?1/0:n.maxRuns,n.catch=n.catch===void 0?!1:n.catch,n.interval=n.interval===void 0?0:parseInt(n.interval.toString(),10),n.utcOffset=n.utcOffset===void 0?void 0:parseInt(n.utcOffset.toString(),10),n.unref=n.unref===void 0?!1:n.unref,n.startAt&&(n.startAt=new Nn(n.startAt,n.timezone)),n.stopAt&&(n.stopAt=new Nn(n.stopAt,n.timezone)),n.interval!==null){if(isNaN(n.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(n.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(n.utcOffset!==void 0){if(isNaN(n.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(n.utcOffset<-870||n.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(n.utcOffset!==void 0&&n.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(n.unref!==!0&&n.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");return n}function Fi(n){return Object.prototype.toString.call(n)==="[object Function]"||typeof n=="function"||n instanceof Function}function NE(n){return Fi(n)}function SE(n){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(n):n&&typeof n.unref<"u"&&n.unref()}var Kb=30*1e3,ac=[],TE=class{name;options;_states;fn;constructor(n,l,i){let o,c;if(Fi(l))c=l;else if(typeof l=="object")o=l;else if(l!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(Fi(i))c=i;else if(typeof i=="object")o=i;else if(i!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=wE(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 Yb("* * * * *")},n&&(n instanceof Date||typeof n=="string"&&n.indexOf(":")>0)?this._states.once=new Nn(n,this.options.timezone||this.options.utcOffset):this._states.pattern=new Yb(n,this.options.timezone),this.name){if(ac.find(d=>d.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");ac.push(this)}return c!==void 0&&NE(c)&&(this.fn=c,this.schedule()),this}nextRun(n){let l=this._next(n);return l?l.getDate(!1):null}nextRuns(n,l){this._states.maxRuns!==void 0&&n>this._states.maxRuns&&(n=this._states.maxRuns);let i=[],o=l||this._states.currentRun||void 0;for(;n--&&(o=this.nextRun(o));)i.push(o);return i}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let n=this.nextRun(this._states.currentRun),l=!this._states.paused,i=this.fn!==void 0,o=!this._states.kill;return l&&i&&o&&n!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(n){let l=this._next(n);return l?n instanceof Nn||n instanceof Date?l.getTime()-n.getTime():l.getTime()-new Nn(n).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let n=ac.indexOf(this);n>=0&&ac.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 l=this.msToNext(),i=this.nextRun(this._states.currentRun);return l==null||isNaN(l)||i===null?this:(l>Kb&&(l=Kb),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(i),l),this._states.currentTimeout&&this.options.unref&&SE(this._states.currentTimeout),this)}async _trigger(n){if(this._states.blocking=!0,this._states.currentRun=new Nn(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(l){Fi(this.options.catch)&&this.options.catch(l,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new Nn(n,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(n){let l=new Date,i=!this._states.paused&&l.getTime()>=n.getTime(),o=this._states.blocking&&this.options.protect;i&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):i&&o&&Fi(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(n){let l=!!(n||this._states.currentRun),i=!1;!n&&this.options.startAt&&this.options.interval&&([n,l]=this._calculatePreviousRun(n,l),i=!n),n=new Nn(n,this.options.timezone||this.options.utcOffset),this.options.startAt&&n&&n.getTime()<this.options.startAt.getTime()&&(n=this.options.startAt);let o=this._states.once||new Nn(n,this.options.timezone||this.options.utcOffset);return!i&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,l)),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,l){let i=new Nn(void 0,this.options.timezone||this.options.utcOffset),o=n;if(this.options.startAt.getTime()<=i.getTime()){o=this.options.startAt;let c=o.getTime()+this.options.interval*1e3;for(;c<=i.getTime();)o=new Nn(o,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),c=o.getTime()+this.options.interval*1e3;l=!0}return o===null&&(o=void 0),[o,l]}};function Ly(n,l,i=new Date){let o;for(const c of n)if(c.active)for(const d of c.schedules)try{const h=new TE(d,{timezone:l}).nextRun(i);h&&(!o||h<o.at)&&(o={routine:c,at:h})}catch{}return o}function Qh(n,l,i,o){const c=l.filter(d=>d.assistantId===n.id);return i.some(d=>d.status==="pending"&&(d.assistantId===n.id||c.some(h=>h.id===d.jobId)))||c.some(d=>d.status==="waiting")?"等你确认":n.busy||c.some(d=>d.status==="running")||o.some(d=>d.status==="running"&&(d.from===n.id||d.to===n.id))?"执行中":c.some(d=>d.status==="queued")?"排队中":"空闲"}function CE(n,l){const i=n.filter(h=>h.assistantId===l),o=i.filter(h=>["running","queued","waiting"].includes(h.status)).sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0],c=i.filter(h=>!["running","queued","waiting"].includes(h.status)&&h.endedAt).sort((h,m)=>m.endedAt.localeCompare(h.endedAt))[0],d=i.filter(h=>h.status==="running").sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0];return{active:o,running:d,last:c,recent:i.sort((h,m)=>m.createdAt.localeCompare(h.createdAt)).slice(0,20)}}function Hy(n,l,i=new Date){const o=x=>new Intl.DateTimeFormat("en-CA",{timeZone:l,year:"numeric",month:"2-digit",day:"2-digit"}).format(x),c=o(n),[d,h,m]=o(i).split("-").map(Number),p=new Date(Date.UTC(d,h-1,m+1)).toISOString().slice(0,10),g=new Intl.DateTimeFormat("zh-CN",{timeZone:l,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(n);return c===o(i)?`今天 ${g}`:c===p?`明天 ${g}`:`${new Intl.DateTimeFormat("zh-CN",{timeZone:l,month:"numeric",day:"numeric"}).format(n)} ${g}`}function EE(n,l,i=new Date){if(!n.length)return"没有";const o=Ly(n,l,i);return o?`${n.length} 个 · ${Hy(o.at,l,i)}`:`${n.length} 个 · ${n.some(c=>c.active)?"无下次执行时间":"已暂停"}`}function AE(n,l,i){return{skills:n?`${n} 个`:"没有",knowledge:l.length?l.join("、"):"未开启",rules:i?`${i} 条`:"没有"}}function ME(n,l=new Date){const i=new Date(l.getFullYear(),l.getMonth(),l.getDate());return i.setDate(i.getDate()-(i.getDay()+6)%7),{week:n.filter(o=>new Date(o.updatedAt)>=i),older:n.filter(o=>new Date(o.updatedAt)<i)}}function zE(n,l,i){if(l<0||l>=n.length)return n;const o=Math.min(Math.max(i,0),n.length-1);if(o===l)return n;const c=n.slice(),[d]=c.splice(l,1);return c.splice(o,0,d),c}function By(n,l,i){let o=-1,c=1/0;return n.forEach((d,h)=>{const m=l-(d.left+d.width/2),p=i-(d.top+d.height/2),g=m*m+p*p;g<c&&(c=g,o=h)}),o}function RE(n,l,i,o,c){const d=n.indexOf(i);if(d<0)return n;const h=By(l,o,c);return h<0?n:zE(n,d,h)}const Mc=6;function dh(n,l=!1){const i=n.style.transform;l&&(n.style.transform="none");const o=n.getBoundingClientRect();return l&&(n.style.transform=i),{left:o.left,top:o.top,width:o.width,height:o.height}}function qy(n,l=!1){const i=we().menu!==null,o=y.useRef(null),[c,d]=y.useState(null),[h,m]=y.useState(null),[p,g]=y.useState(null),v=y.useRef(!1),x=y.useMemo(()=>{if(!c)return n;const T=new Map(n.map(A=>[A.id,A])),N=c.map(A=>T.get(A)).filter(A=>!!A);for(const A of n)c.includes(A.id)||N.push(A);return N},[c,n]),w=T=>{const N=o.current;return N?[...N.querySelectorAll("[data-pin]")].filter(A=>T.includes(A.dataset.pin??"")).map(A=>dh(A,h?.id===A.dataset.pin)):[]};y.useEffect(()=>{if(!h)return;const T=A=>{if(A.pointerId!==h.pointerId)return;if(!h.active){if(Math.abs(A.clientX-h.from.x)<=Mc&&Math.abs(A.clientY-h.from.y)<=Mc)return;tr(),v.current=!0,m({...h,active:!0})}g({x:A.clientX,y:A.clientY});const M=c??n.map(O=>O.id),R=RE(M,w(M),h.id,A.clientX,A.clientY);R!==M&&d(R)},N=A=>{if(A.pointerId!==h.pointerId)return;const M=c??n.map(O=>O.id),R=h.active;m(null),g(null),d(null),R&&Ff(M)};return window.addEventListener("pointermove",T),window.addEventListener("pointerup",N),window.addEventListener("pointercancel",N),()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",N),window.removeEventListener("pointercancel",N)}},[h,c,n]),y.useLayoutEffect(()=>{if(!h)return;const N=[...o.current?.querySelectorAll("[data-pin]")??[]].find(M=>M.dataset.pin===h.id);if(!N)return;if(!h.active||!p){N.style.transform="";return}const A=dh(N,!0);return N.style.transform=`translate(${p.x-h.grab.x-A.left}px, ${p.y-h.grab.y-A.top}px)`,()=>{N.style.transform=""}},[h,p,x]);const C=T=>({handlers:{onPointerDown(N){if(N.pointerType==="mouse"&&N.button!==0||i||l)return;const A=[...o.current?.querySelectorAll("[data-pin]")??[]].find(R=>R.dataset.pin===T);if(!A)return;const M=A.getBoundingClientRect();v.current=!1,m({id:T,pointerId:N.pointerId,from:{x:N.clientX,y:N.clientY},grab:{x:N.clientX-M.left,y:N.clientY-M.top},active:!1}),g({x:N.clientX,y:N.clientY})}},takeMoved(){const N=v.current;return v.current=!1,N}});return{grid:o,locked:l,order:x,lifted:h?.active?h.id:null,target:C,className:T=>h?.active&&h.id===T?"lift":void 0}}function OE(n){const l=we(),i=l.menu!==null,o=l.query.trim().length>0,[c,d]=y.useState(null),[h,m]=y.useState(null),p=y.useRef(!1);return y.useEffect(()=>{if(!c)return;const g=()=>document.querySelector(".pins:not(.locked)"),v=(A,M)=>{const R=g()?.getBoundingClientRect();return!!R&&A>=R.left&&A<=R.right&&M>=R.top-12&&M<=R.bottom+12},x=()=>[...document.querySelectorAll(".home-row[data-row]")],w=(A,M)=>{const R=x();if(o||!R.length)return null;const O=R[0].getBoundingClientRect(),J=R[R.length-1].getBoundingClientRect();if(A<O.left||A>O.right||M<O.top-20||M>J.bottom+20)return null;const ee=R.findIndex(B=>{const k=B.getBoundingClientRect();return M<k.top+k.height/2});return ee<0?{index:R.length,el:R[R.length-1],after:!0}:{index:ee,el:R[ee],after:!1}},C=()=>{g()?.classList.remove("drop");for(const A of x())A.classList.remove("drop-before","drop-after")},T=A=>{if(A.pointerId!==c.pointerId)return;if(!c.active){if(Math.abs(A.clientX-c.from.x)<=Mc&&Math.abs(A.clientY-c.from.y)<=Mc)return;tr(),p.current=!0,d({...c,active:!0})}const M=v(A.clientX,A.clientY);if(C(),M)g()?.classList.add("drop");else{const R=w(A.clientX,A.clientY);R?.el.classList.add(R.after?"drop-after":"drop-before")}m({x:A.clientX,y:A.clientY,over:M})},N=A=>{if(A.pointerId!==c.pointerId)return;const M=g();if(C(),d(null),m(null),!c.active)return;if(!M||!v(A.clientX,A.clientY)){const k=w(A.clientX,A.clientY);if(!k||n.hidden)return;const j=x().map(X=>X.dataset.row??""),E=j.indexOf(n.id);if(E<0)return;const U=j.filter(X=>X!==n.id);U.splice(k.index>E?k.index-1:k.index,0,n.id),Ff(U);return}const R=[...M.querySelectorAll("[data-pin]")],O=R.map(k=>k.dataset.pin??""),J=By(R.map(k=>dh(k)),A.clientX,A.clientY),ee=J<0?null:R[J].getBoundingClientRect(),B=J<0?O.length:A.clientX>ee.left+ee.width/2?J+1:J;(async()=>await ar(n.id,n.hidden?{pinned:!0,hidden:!1}:{pinned:!0})||await Ff([...O.slice(0,B),n.id,...O.slice(B)]))()};return window.addEventListener("pointermove",T),window.addEventListener("pointerup",N),window.addEventListener("pointercancel",N),()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",N),window.removeEventListener("pointercancel",N)}},[c,n.id,n.hidden,o]),{onPointerDown(g){g.pointerType!=="mouse"||g.button!==0||i||(p.current=!1,d({pointerId:g.pointerId,from:{x:g.clientX,y:g.clientY},active:!1}))},ghost:c?.active&&h?h:null,takeMoved(){const g=p.current;return p.current=!1,g}}}function Xb(n,l=new Date){return`${n.uses?`用过 ${n.uses} 次${n.lastUsedAt?` · 上次${Dt(n.lastUsedAt,l)}`:""}`:"还没用过"} · 第 ${n.version} 版`}function Iy(n){let l=n.trim();for(;;){const o=l.replace(/^cd\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;)\s*/,"").replace(/^timeout\s+(?:-[ks]\s+\S+\s+|-\S+\s+)*\d+(?:\.\d+)?[smhd]?\s+/,"");if(o===l)break;l=o}const i=_E.exec(l);if(i){let o=i[2];const c=Zb(o);if(c){let[d,h]=c;const m=/^(?:ba)?sh\s+-l?c\s+/.exec(d),p=m?Zb(d.slice(m[0].length)):void 0;p&&(d=p[0]+p[1]),o=d+h}l=`${i[1]}: ${Iy(o)}`}return l||n.trim()}const _E=/^ssh\s+(?:-[BbcDEeFIiJLlmOoPpQRSWw]\s*\S+\s+|-[46AaCfGgKkMNnqsTtVvXxYy]+\s+)*([^\s'"-]\S*)\s+(.+)$/s;function Zb(n){const l=/^'([^']*)'?/.exec(n)??/^"((?:[^"\\]|\\.)*)"?/s.exec(n);return l?[n[0]==='"'?l[1].replace(/\\(["\\$`])/g,"$1"):l[1],n.slice(l[0].length)]:void 0}function DE(){return s.jsx("div",{className:"sidebar-loading",role:"status",children:s.jsx(Hn,{text:"正在读取…"})})}function $E(){const n=we(),l=n.sel??"hob",i=n.profiles[l],o=i?.assistant??n.assistants.find(j=>j.id===l),c=n.routines.filter(j=>j.assistantId===l),d=n.assistantSkills[l],[h,m]=y.useState("任务"),[p,g]=y.useState(""),[v,x]=y.useState(!n.knowledge.collectionsLoaded),w=n.sidebarJobs?.[l],C=n.sidebarFiles?.[l],T=C?.items??[],N=Object.values({...Object.fromEntries((w?.items??[]).map(j=>[j.id,j])),...n.jobs}).filter(j=>j.assistantId===l).sort((j,E)=>E.createdAt.localeCompare(j.createdAt)),A=y.useRef(null),M=y.useRef(!1);(!A.current||A.current.aid!==l)&&(A.current={aid:l,ids:new Set},M.current=!1);const R=w?.loaded?new Set(N.filter(j=>!A.current.ids.has(j.id)).map(j=>j.id)):new Set;y.useEffect(()=>{if(!w?.loaded){M.current=!1;return}N.forEach(j=>A.current?.ids.add(j.id)),M.current=!0}),y.useEffect(()=>{m("任务"),ks(l),Ef(l)},[l]),y.useEffect(()=>{MS().catch(j=>g(j instanceof Error?j.message:String(j))).finally(()=>x(!1))},[]),y.useEffect(()=>{h==="文件"&&Af(l)},[l,h]);const O=h==="任务"?w:C,J=y.useRef(null);y.useEffect(()=>{const j=J.current;if(!j||!O?.hasMore||O.loading||O.error)return;const E=new IntersectionObserver(U=>{U.some(X=>X.isIntersecting)&&(h==="任务"?Ef(l,!0):Af(l,!0))},{root:j.closest(".panel")});return E.observe(j),()=>E.disconnect()},[l,h,O?.hasMore,O?.loading,O?.error,O?.cursor]);const ee=(o?.knowledge??[]).map(j=>n.knowledge.collections.find(E=>E.id===j)?.name).filter(j=>!!j),B=AE(d?.skills.length??0,ee,i?.rules.length??0),k=ME(T);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"group-card sidebar-info",children:[s.jsxs("button",{className:"sidebar-instructions",onClick:Mh,children:[s.jsx("small",{children:"补充说明"}),s.jsx("span",{className:o?.instructions?"":"muted",children:o?.instructions||"记下这个助手要知道的事实"}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Wo("routines"),children:[s.jsx(Q,{name:"clock",size:15}),s.jsx("span",{children:"定时任务"}),s.jsx("small",{children:EE(c,n.settings.settings.general.timezone)}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Wo("skills"),children:[s.jsx(Q,{name:"mem",size:15}),s.jsx("span",{children:"技能"}),s.jsx("small",{children:d?.error?"加载失败":d?.loaded?B.skills:s.jsx(Hn,{text:"正在加载…"},l)}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Wo("knowledge"),children:[s.jsx(Q,{name:"archive",size:15}),s.jsx("span",{children:"知识库"}),s.jsx("small",{children:p?"加载失败":v?s.jsx(Hn,{text:"正在加载…"}):B.knowledge}),s.jsx("b",{children:"›"})]}),s.jsxs("button",{onClick:()=>Wo("rules"),children:[s.jsx(Q,{name:"rule",size:15}),s.jsx("span",{children:"执行前确认"}),s.jsx("small",{children:B.rules}),s.jsx("b",{children:"›"})]})]}),s.jsx("div",{className:"sidebar-tabs",children:s.jsx("div",{className:"seg",style:{"--seg-count":2,"--seg-index":["任务","文件"].indexOf(h)},children:["任务","文件"].map(j=>s.jsx("button",{className:h===j?"on":"",onClick:()=>m(j),children:j},j))})}),s.jsx("div",{className:"sidebar-tab-content",children:s.jsxs("div",{className:"group-card sidebar-list",children:[h==="任务"?N.map(j=>s.jsx("div",{className:`srow${M.current&&R.has(j.id)?" enter":""}`,children:s.jsx("div",{className:"srowclip",children:s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Ln(j.id),children:[Xh(j.status,16),s.jsxs("span",{children:[s.jsxs("strong",{children:[j.routineId?"⏱ ":"",j.title]}),s.jsxs("small",{children:[Dt(j.startedAt??j.createdAt),j.status==="running"||j.status==="waiting"?` · 已进行 ${xr(j.startedAt??j.createdAt)}`:j.durationMs!==void 0?` · 用时 ${Hl(j.durationMs)}`:""]})]}),s.jsx("b",{children:"›"})]})})},j.id)):[["本周",k.week],["更早",k.older]].map(([j,E])=>E.length?s.jsxs("div",{children:[s.jsx("div",{className:"sidebar-group-label",children:j}),E.map(U=>s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>zt(U.path,U.name),children:[s.jsx(Q,{name:Ul(U.name),size:18}),s.jsxs("span",{children:[s.jsx("strong",{children:U.name}),s.jsxs("small",{children:[Qa(U.size)," · ",Dt(U.updatedAt)]})]}),s.jsx("b",{children:"›"})]},U.id))]},j):null),O?.loaded&&!(h==="任务"?N.length:T.length)&&!O.error?s.jsx(ze,{children:h==="任务"?"分派的任务会显示在这里":"还没有产出文件"}):null,O?.error?s.jsxs("div",{className:"badline",children:["加载失败:",O.error," ",s.jsx("button",{onClick:()=>void(h==="任务"?Ef(l,O.failedMore):Af(l,O.failedMore)),children:"重试"})]}):null,!O?.loaded&&!O?.error||O?.loadingMore?s.jsx(DE,{}):null,O?.hasMore&&!O.error?s.jsx("div",{ref:J}):null]})},h)]})}const Da=["off","minimal","low","medium","high","xhigh","max"];function Yy(n){return n?.thinkingLevels??["off"]}function dr(n,l){const i=Yy(n);if(!n||i.includes(l))return l;const o=Da.indexOf(l);return[...i].reverse().find(c=>Da.indexOf(c)<=o)??"off"}function UE(n,l){const i=l.trim().toLowerCase();return i?n.filter(o=>o.name.toLowerCase().includes(i)||o.ref.toLowerCase().includes(i)):n}function LE(n){const l=[];for(const i of n){let o=l.find(c=>c.provider===i.provider);o||(o={provider:i.provider,models:[]},l.push(o)),o.models.push(i)}return l}function HE(){const[n,l]=y.useState({screens:[],profiles:{}});return y.useEffect(()=>{if(Ol){(bc()==="ready"||bc()==="deployed")&&l({screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}],profiles:{hob:"hob"}});return}let i=!0,o=0;const c=async()=>{const h=o;try{const m=await fetch("/api/desktop/screens");if(!m.ok)throw new Error("无法读取屏幕状态。");const p=await m.json();i&&l(g=>({profiles:p.profiles,screens:o===h?p.screens:g.screens}))}catch{i&&l({screens:[],profiles:{}})}},d=new EventSource("/api/events");return d.onopen=()=>{c()},d.onerror=()=>{i&&l(h=>({...h,screens:[]}))},d.onmessage=h=>{try{const m=JSON.parse(h.data);m.type==="desktop-screens"&&Array.isArray(m.screens)?(o++,l(p=>({...p,screens:m.screens}))):(m.type==="assistant"||m.type==="assistant_removed")&&c()}catch{}},()=>{i=!1,d.close()}},[]),n}async function yA(n){const l=await fetch(`/api/desktop/screens/${encodeURIComponent(n)}/start`,{method:"POST"});if(!l.ok){const i=await l.json().catch(()=>({}));throw new Error(i.error??"无法启动屏幕。")}}const BE=y.lazy(()=>mr(()=>import("./DesktopView-3QDYo0UU.js"),[]).then(n=>({default:n.DesktopMini}))),qE=y.lazy(()=>mr(()=>import("./DesktopView-3QDYo0UU.js"),[]).then(n=>({default:n.DesktopView}))),IE={读:"读取",跑:"运行",改:"修改",写:"写入",搜:"搜索"};function fh(n){return[IE[n.verb]??n.verb,n.verb==="跑"?Iy(n.text):n.text]}function hh({mobile:n=!1,page:l}){const i=we(),o=l===void 0?i.panelStack.at(-1):l,c=o&&o.kind!=="job"&&o.kind!=="jobs"&&o.kind!=="file"?o:{kind:"now"},d=c.kind,[h,m]=y.useState(!1),p=i.profiles[i.sel??"hob"]?.assistant??i.assistants.find(v=>v.id===(i.sel??"hob"));y.useEffect(()=>m(!1),[i.sel]);const g=c.kind==="routine"?i.routines.find(v=>v.id===c.id)?.name??"定时任务":d==="newRoutine"?"新建定时任务":d==="routines"?"定时任务":d==="skills"?"技能":d==="knowledge"?"知识库":d==="rules"?"执行前确认":d==="now"?"":"编辑助手";return s.jsxs("aside",{className:"panel",onScroll:v=>{if(d==="now"){const x=v.currentTarget.querySelector(".sidebar-card"),w=v.currentTarget.querySelector(".phead");m(!!x&&!!w&&x.getBoundingClientRect().bottom<=w.getBoundingClientRect().bottom)}},children:[s.jsxs(cr,{className:"phead",root:d==="now",title:s.jsx("span",{className:"t",children:d==="now"&&h&&p?s.jsxs("span",{className:"sidebar-head-identity",children:[s.jsx(ot,{sprite:p.sprite,prop:p.prop,size:24}),p.name]}):g}),children:[d==="now"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-icon-btn",title:"编辑助手",onClick:Mh,children:s.jsx(Q,{name:"edit",size:17})}),s.jsx("button",{className:"hob-icon-btn panel-close",title:"收起右栏",onClick:$S,children:s.jsx(Q,{name:"dbl",size:17})})]}):null,d==="routines"?s.jsx("button",{className:"hob-icon-btn",title:"新建定时任务",onClick:AS,children:s.jsx(Q,{name:"plus",size:17})}):null,c.kind==="routine"?s.jsx("button",{className:"hob-btn hob-btn-primary hob-btn-compact",onClick:()=>void NS(c.id),children:"立即运行"}):null]}),s.jsx("div",{className:`pbody sidebar-page-${d}`,children:d==="routine"?s.jsx(ZE,{id:c.kind==="routine"?c.id:""},c.kind==="routine"?c.id:""):d==="newRoutine"?s.jsx(XE,{}):d==="assistant"?s.jsx(t3,{},i.sel??"hob"):d==="routines"?s.jsx(GE,{}):d==="skills"?s.jsx(PE,{aid:i.sel??"hob"}):d==="knowledge"?s.jsx(JE,{aid:i.sel??"hob"}):d==="rules"?s.jsx(KE,{aid:i.sel??"hob"}):s.jsxs(s.Fragment,{children:[s.jsx(YE,{}),s.jsx($E,{})]})})]})}function YE(){const n=we(),l=n.sel??"hob",i=n.profiles[l]?.assistant??n.assistants.find(ee=>ee.id===l),o=Object.values(n.jobs),{running:c,last:d}=CE(o,l),h=i?Qh(i,o,Object.values(n.approvals),Object.values(n.delegations)):"空闲",m=Ly(n.routines.filter(ee=>ee.assistantId===l),n.settings.settings.general.timezone),p=HE(),g=p.profiles[n.sel??"hob"],v=!!g&&p.screens.some(ee=>ee.id===g&&ee.running),[x,w]=y.useState(null),C=v&&n.nowWide,T=y.useRef([]);c&&(T.current=c.activity);const N=(c?.activity??T.current).slice(v&&!C?-2:-8),A=fn(!!c&&!v),M=N.map(ee=>`${ee.at}|${ee.verb}|${ee.text}`),R=y.useRef(null);R.current===null&&(R.current=new Set(M));const O=new Set(M.filter(ee=>!R.current.has(ee)));y.useEffect(()=>{for(const ee of M)R.current.add(ee)});const J=(ee,B,k)=>s.jsxs("button",{className:`screen ${ee}`,title:B,onClick:k,children:[N.map((j,E)=>j.verb==="$"?s.jsxs("div",{className:O.has(M[E])?"new":void 0,children:[s.jsx("span",{className:"p",children:"$"})," ",j.text]},M[E]):s.jsxs("div",{className:O.has(M[E])?"new":void 0,children:[s.jsx("span",{className:"v",children:fh(j)[0]}),fh(j)[1]]},M[E])),s.jsx("div",{children:s.jsx("span",{className:"cur"})})]});return s.jsxs("div",{className:"group-card sidebar-card",children:[i?s.jsxs("div",{className:"sidebar-identity",children:[s.jsx(ot,{sprite:i.sprite,prop:i.prop,size:44}),s.jsxs("span",{children:[s.jsx("strong",{children:i.name}),s.jsx("small",{children:i.duty})]}),s.jsx("em",{className:h!=="空闲"?"active":"",children:s.jsx("span",{children:h},h)})]}):null,v?s.jsxs("div",{className:"now-desk",children:[s.jsxs("div",{className:"now-screen",children:[s.jsx("button",{className:"now-hit",title:C?"收起":"在侧栏展开","aria-label":C?"收起":"在侧栏展开",onClick:zf}),s.jsx(y.Suspense,{fallback:null,children:s.jsx(BE,{screen:g},g)}),s.jsx("span",{className:"now-live",children:"实时"}),s.jsxs("div",{className:"now-acts",children:[C?s.jsx("button",{className:"now-btn",title:"收起","aria-label":"收起",onClick:zf,children:s.jsx(Q,{name:"shrink",size:15})}):null,s.jsx("button",{className:"now-btn",title:"全屏","aria-label":"全屏查看云桌面",onClick:()=>w("view"),children:s.jsx(Q,{name:"expand",size:15})}),s.jsxs("button",{className:"now-btn txt",title:"接管云桌面",onClick:()=>w("take"),children:[s.jsx(Q,{name:"pointer",size:14}),"接管"]})]})]}),c?J("strip",C?"收起":"在侧栏展开",zf):null]}):null,x&&g?s.jsx(y.Suspense,{fallback:null,children:s.jsx(qE,{initialScreen:g,takeOver:x==="take",onClose:()=>w(null)})}):null,v?null:s.jsx("div",{className:`now-log${c?" open":""}`,inert:!c,children:s.jsx("div",{children:A.mounted&&c?J("jd-open","打开任务详情",()=>Ln(c.id)):A.mounted?J("jd-open","打开任务详情",()=>{}):null})}),c?s.jsx(s.Fragment,{children:s.jsxs("div",{className:"caprow",children:[s.jsxs("span",{className:"cap",children:[c.title,c.routineId?" · 定时执行":""," · 已进行 ",xr(c.startedAt??c.createdAt)]}),s.jsx("button",{className:"more",onClick:()=>Ln(c.id),children:"任务详情 ›"})]})}):s.jsxs("div",{className:"sidebar-facts",children:[d?s.jsxs("button",{onClick:()=>Ln(d.id),children:["上次 ",s.jsxs("span",{children:[Xh(d.status,14),s.jsx("span",{children:d.title})]}),s.jsx("small",{children:Dt(d.endedAt)})]}):null,m?s.jsxs("div",{children:["下一次 ",s.jsxs("span",{children:[s.jsx("span",{"aria-hidden":"true",children:"⏱"}),s.jsx("span",{children:m.routine.name})]}),s.jsx("small",{children:Hy(m.at,n.settings.settings.general.timezone)})]}):null]}),n.sel==="hob"?Object.values(n.delegations).filter(ee=>ee.status==="running"||ee.status==="waiting").map(ee=>{const B=n.assistants.find(k=>k.id===ee.to);return s.jsxs("button",{className:"sidebar-delegation",onClick:()=>void Eh("hob",ee.id,!1),children:[B?s.jsx(ot,{sprite:B.sprite,prop:B.prop,size:22}):null,s.jsxs("span",{children:["交给「",B?.name??ee.to,"」"]}),s.jsx("small",{children:s.jsx(js,{meta:xy[ee.status]})})," ›"]},ee.id)}):null]})}function pc(n){if(n.stopReason==="hit")return"已触发,已停";if(n.stopReason==="finished")return"已跑完"}function GE(){const n=we(),l=n.routines.filter(i=>i.assistantId===(n.sel??"hob"));return l.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:l.map(i=>s.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Y0(i.id),children:[s.jsx(Q,{name:i.active?"clock":"pause",size:18}),s.jsxs("span",{children:[s.jsx("strong",{children:i.name}),s.jsx("small",{children:i.active?s.jsxs(s.Fragment,{children:[Ec(i.schedules[0]??""),i.check?i.checks?.failing?s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"rt-bad",children:"检查失败"})]}):` · 检查 ${i.checks?.total??0} 次 · 触发 ${i.checks?.hits??0} 次`:i.runs[0]?s.jsxs(s.Fragment,{children:[" · 上次 ",s.jsx(js,{meta:es[i.runs[0].status]})," ",Dt(i.runs[0].at)]}):null]}):pc(i)??"已暂停"})]}),s.jsx("b",{children:"›"})]},i.id))}):s.jsx(ze,{children:"这个助手还没有定时任务"})}function KE({aid:n}){const l=we().profiles[n]?.rules??[];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"note",children:"标为「需确认」的事项,助手执行前会先征求你的同意。"}),l.length?null:s.jsx(ze,{children:"还没有执行前确认事项"}),s.jsxs("div",{className:"group-card sidebar-card-group card-rows",children:[l.map(i=>s.jsx(WE,{aid:n,rule:i},i.id)),s.jsx(e3,{aid:n})]})]})}function Gy({value:n,onSave:l,onRemove:i}){const[o,c]=y.useState(!1),d=Kh(n);if(gy(n))return s.jsxs("div",{className:"w",children:[s.jsx(Q,{name:"clock",size:15}),Ec(n),i?s.jsx("button",{className:"hob-btn hob-btn-danger",style:{marginLeft:"auto"},onClick:i,children:"删除"}):null]});if(!o)return s.jsxs("button",{className:"w",onClick:()=>c(!0),children:[s.jsx(Q,{name:"clock",size:15}),Ec(n)]});const h=p=>{const g=d.kind==="raw"?{...d,kind:"daily"}:d;l(aC({...g,...p}))},m=`${String(d.hour).padStart(2,"0")}:${String(d.minute).padStart(2,"0")}`;return s.jsxs("div",{className:"w sched-edit",children:[s.jsxs("select",{value:d.kind,onChange:p=>h({kind:p.target.value}),children:[s.jsx("option",{value:"daily",children:"每天"}),s.jsx("option",{value:"weekly",children:"每周"}),s.jsx("option",{value:"monthly",children:"每月"}),s.jsx("option",{value:"raw",children:"自定义"})]}),d.kind==="weekly"?s.jsx("select",{value:d.weekday,onChange:p=>h({weekday:Number(p.target.value)}),children:py.map((p,g)=>s.jsxs("option",{value:g,children:["周",p]},g))}):null,d.kind==="monthly"?s.jsx("input",{type:"number",min:1,max:28,value:d.day,onChange:p=>h({day:Number(p.target.value)||1})}):null,d.kind==="raw"?s.jsx("input",{className:"rawcron",value:d.raw,onChange:p=>l(p.target.value)}):s.jsx("input",{type:"time",value:m,onChange:p=>{const[g,v]=p.target.value.split(":").map(Number);h({hour:g||0,minute:v||0})}}),i?s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:i,children:"删除"}):null,s.jsx("button",{className:"hob-btn",onClick:()=>c(!1),children:"完成"})]})}function XE(){const n=we(),[l,i]=y.useState(""),[o,c]=y.useState(""),[d,h]=y.useState("0 9 * * *"),[m,p]=y.useState(!0),[g,v]=y.useState(""),[x,w]=y.useState(!1),C=n.sel??"hob";y.useEffect(()=>{ks(C)},[C]);const T=l.trim()!==""&&o.trim()!==""&&!x,N=async()=>{w(!0),await jS({assistantId:n.sel??"hob",name:l.trim(),instruction:o.trim(),schedules:[d],active:m,...g?{skill:g}:{}}),w(!1)};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("div",{className:"ctl",children:[s.jsx("span",{children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${m?"":" off"}`,title:m?"暂停":"启用",onClick:()=>p(!m)})]})}),s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("label",{className:"field",children:s.jsx("input",{autoFocus:!0,value:l,placeholder:"如「每日简报」",onChange:A=>i(A.target.value)})}),s.jsx("div",{className:"lbl",children:"任务内容"}),s.jsx("label",{className:"field",children:s.jsx("textarea",{rows:4,value:o,placeholder:"到点后交给后台任务执行的内容,写清楚需要什么结果",onChange:A=>c(A.target.value)})}),s.jsx("div",{className:"lbl",children:"执行时间"}),s.jsx("div",{className:"when",children:s.jsx(Gy,{value:d,onSave:h})}),s.jsx("div",{className:"lbl",children:"技能"}),n.assistantSkills[C]?.error?s.jsxs("div",{className:"badline",children:["加载失败:",n.assistantSkills[C].error," ",s.jsx("button",{onClick:()=>void ks(C),children:"重试"})]}):null,s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("select",{className:"pick","aria-label":"技能",value:g,disabled:!n.assistantSkills[C]||n.assistantSkills[C].loading||!!n.assistantSkills[C].error,onChange:A=>v(A.target.value),children:[s.jsx("option",{value:"",children:"不用技能"}),(n.assistantSkills[C]?.skills??[]).filter(A=>A.enabled).map(A=>s.jsx("option",{value:A.name,children:A.title},A.name))]})}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn",onClick:fr,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!T,onClick:()=>void N(),children:"创建"})]})]})}function ZE({id:n}){const l=we(),i=l.routines.find(c=>c.id===n),o=i?.assistantId;return y.useEffect(()=>{o&&ks(o)},[o]),i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${i.active?"":" off"}`,title:i.active?"暂停":"启用",onClick:()=>void Nl(i.id,{active:!i.active})})]})}),s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("label",{className:"field",children:s.jsx("input",{defaultValue:i.name,onBlur:c=>{const d=c.target.value.trim();d&&d!==i.name&&Nl(i.id,{name:d})}})}),s.jsx("div",{className:"lbl",children:"任务内容"}),s.jsx("label",{className:"field",children:s.jsx("textarea",{rows:4,defaultValue:i.instruction,onBlur:c=>{c.target.value!==i.instruction&&Nl(i.id,{instruction:c.target.value})}})}),s.jsx("div",{className:"lbl",children:"执行时间"}),s.jsxs("div",{className:"when",children:[i.schedules.map((c,d)=>s.jsx(Gy,{value:c,onSave:h=>{const m=i.schedules.slice();m[d]=h,Nl(i.id,{schedules:m})},onRemove:i.schedules.length>1?()=>void Nl(i.id,{schedules:i.schedules.filter((h,m)=>m!==d)}):void 0},d)),s.jsxs("button",{className:"w",onClick:()=>void Nl(i.id,{schedules:[...i.schedules,"0 9 * * *"]}),children:[s.jsx(Q,{name:"plus",size:14}),"添加执行时间"]})]}),i.once||pc(i)?s.jsx("div",{className:"rt-when-note",children:[i.once?"触发一次就停":"",pc(i)?`${pc(i)}${i.stoppedAt?` · ${Dt(i.stoppedAt)}`:""}`:""].filter(Boolean).join(" · ")}):null,s.jsx("div",{className:"lbl",children:"技能"}),l.assistantSkills[i.assistantId]?.error?s.jsxs("div",{className:"badline",children:["加载失败:",l.assistantSkills[i.assistantId].error," ",s.jsx("button",{onClick:()=>void ks(i.assistantId),children:"重试"})]}):null,s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsxs("select",{className:"pick","aria-label":"技能",value:i.skill??"",disabled:!l.assistantSkills[i.assistantId]||l.assistantSkills[i.assistantId].loading||!!l.assistantSkills[i.assistantId].error,onChange:c=>void Nl(i.id,{skill:c.target.value||null}),children:[s.jsx("option",{value:"",children:"不用技能"}),i.skill&&!l.assistantSkills[i.assistantId]?.skills.some(c=>c.name===i.skill&&c.enabled)?s.jsx("option",{value:i.skill,disabled:!0,children:i.skill}):null,(l.assistantSkills[i.assistantId]?.skills??[]).filter(c=>c.enabled).map(c=>s.jsx("option",{value:c.name,children:c.title},c.name))]})}),i.check?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"检查"}),s.jsxs("div",{className:"group-card sidebar-card-group",children:[s.jsxs("div",{className:"rt-check-line",children:["检查 ",i.checks?.total??0," 次 · 触发 ",i.checks?.hits??0," 次",i.checks?.lastAt?` · 上次 ${Dt(i.checks.lastAt)}`:""]}),i.checks?.failing?s.jsxs("div",{className:"rt-check-line badline",children:["失败原因:",i.checks.failing]}):null]}),s.jsxs("details",{className:"rt-script",children:[s.jsx("summary",{children:"检查脚本"}),s.jsx("pre",{className:"mono",children:i.check.script})]})]}):null,s.jsx("div",{className:"lbl",children:"运行记录"}),s.jsx("div",{className:"group-card sidebar-card-group sidebar-runs",children:i.runs.length?i.runs.map(c=>{const h=l.jobs[c.jobId]?.status??c.status,m=h==="running"||h==="queued",p=h==="failed"||h==="stuck",g=nC(c);return s.jsxs("button",{className:`run${p?" bad":""}`,onClick:()=>void ES(i.assistantId,c.jobId),children:[s.jsxs("span",{className:"rt",children:[Dt(c.at),g?s.jsx("small",{children:g}):null]}),s.jsx(Q,{name:m?"spin":p?"close":"check",size:16,className:m?"spin":""})]},c.jobId)}):s.jsx(ze,{children:"还没有运行记录"})}),s.jsx("div",{className:"group-card sidebar-card-group sidebar-danger",style:{marginTop:18},children:s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:async()=>{window.confirm(`删除定时任务「${i.name}」?已有的运行记录会保留在对话里。`)&&(await wS(i.id),fr())},children:"删除定时任务"})})]}):s.jsx(ze,{children:"这个定时任务已不存在。"})}function br(n){const[l,i]=y.useState(null),[o,c]=y.useState(!1);return y.useEffect(()=>{if(l!=="已保存")return;const h=setTimeout(()=>i(null),3e3);return()=>clearTimeout(h)},[l]),{save:async h=>{c(!0);const m=await ar(n,h);return c(!1),i(m??"已保存"),!m},busy:o,message:l,fail:h=>i(h)}}function yr({message:n}){return n?s.jsx("div",{role:"status",className:n==="已保存"?"okline":"badline",children:n}):null}function ic({value:n,multiline:l,placeholder:i,save:o}){const[c,d]=y.useState(n);y.useEffect(()=>d(n),[n]);const h={value:c,placeholder:i,onChange:m=>d(m.target.value),onBlur:()=>{c!==n&&o(c).then(m=>{m||d(n)})},onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),m.currentTarget.blur())}};return s.jsx("label",{className:"field",children:l?s.jsx("textarea",{rows:2,...h}):s.jsx("input",{...h})})}function VE({aid:n}){const l=we(),i=br(n),o=l.profiles[n],[c,d]=y.useState(null);y.useEffect(()=>{wh().then(d)},[]);const h=l.settings.settings.models.roster;if(!o)return null;const m=o.assistant.models??{},p=l.settings.settings.models,g=A=>c?.models.find(M=>M.ref===A)?.name??A,v=A=>h.find(M=>M.ref===A),x=A=>void i.save({models:A}),w=A=>M=>{const R={...m};if(M){const O=A==="conversation"?p.conversation.thinking:p.work.thinking;R[A]={ref:M,thinking:dr(c?.models.find(J=>J.ref===M),v(M)?.thinking??O)}}else delete R[A];x(R)},C=m.allowed??[],T=A=>{const M={...m};A.length?M.allowed=A:delete M.allowed,x(M)},N=(A,M)=>s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:A}),s.jsx("div",{className:"ctl",children:s.jsxs("select",{className:"pick grow",value:m[M]?.ref??"",onChange:R=>w(M)(R.target.value),children:[s.jsxs("option",{value:"",children:["跟随全局(",g(M==="conversation"?p.conversation.ref:p.work.ref),")"]}),h.map(R=>s.jsx("option",{value:R.ref,children:g(R.ref)},R.ref))]})})]});return s.jsxs(s.Fragment,{children:[s.jsx(yr,{message:i.message}),N("对话模型","conversation"),N("默认任务模型","work"),s.jsx("div",{className:"lbl",children:"可分派的模型"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`hob-btn${C.length?"":" hob-btn-primary"}`,onClick:()=>T([]),children:"全部"}),s.jsx("button",{className:`hob-btn${C.length?" hob-btn-primary":""}`,onClick:()=>T(h.map(A=>A.ref)),children:"指定"}),s.jsx("span",{className:"note",style:{margin:0},children:C.length?`已选 ${C.length} 个`:`可用模型共 ${h.length} 个`})]}),C.length?s.jsx("div",{className:"chips",style:{marginTop:8},children:h.map(A=>{const M=C.includes(A.ref);return s.jsx("button",{className:`chip${M?" on":""}`,onClick:()=>T(M?C.filter(R=>R!==A.ref):[...C,A.ref]),children:g(A.ref)},A.ref)})}):null]})}function QE({aid:n}){const l=we(),i=br(n),o=l.profiles[n];if(!o)return null;const c=o.assistant.abilities??{exec:!0,write:!0,image:!0},d=l.settings.settings.image.source!=="off",h=p=>void i.save({abilities:{...c,...p}}),m=(p,g,v,x)=>s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:p}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${g?"":" off"}`,title:g?"关闭":"开启",onClick:v})]}),x?s.jsx("div",{className:"note",children:x}):null]});return s.jsxs(s.Fragment,{children:[s.jsx(yr,{message:i.message}),m("执行命令",c.exec,()=>h({exec:!c.exec}),"开启后,任务可以运行命令,并可通过命令访问网络。"),m("修改文件",c.write,()=>h({write:!c.write}),"开启后,任务可以创建和修改文件。"),d?m("图像生成",c.image,()=>h({image:!c.image}),"开启后,任务可以生成图片,图片以缩略图显示在对话中。"):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ctl",style:{marginTop:8},children:[s.jsx("span",{style:{fontSize:14,color:"var(--text3)"},children:"图像生成"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"tog off",disabled:!0,title:"需要先在 设置 → 图像生成 中完成配置"})]}),s.jsx("div",{className:"note",children:"需要先在 设置 → 图像生成 中完成配置。"})]}),s.jsx("div",{className:"note",children:"读取文件始终可用。"})]})}function Ky(){const[n,l]=y.useState(!1);return y.useEffect(()=>{const i=setTimeout(()=>l(!0),300);return()=>clearTimeout(i)},[]),s.jsx("div",{className:"sidebar-loading",role:"status",children:n?"正在加载…":null})}function JE({aid:n}){const l=we(),i=br(n);y.useEffect(()=>{_t()},[]);const o=(l.profiles[n]?.assistant.knowledge??[]).filter(c=>l.knowledge.collections.some(d=>d.id===c));return s.jsxs(s.Fragment,{children:[s.jsx(yr,{message:i.message}),l.knowledge.error?s.jsxs("div",{className:"badline",children:["加载失败:",l.knowledge.error," ",s.jsx("button",{onClick:()=>void _t(),children:"重试"})]}):null,l.knowledge.collectionsLoaded?l.knowledge.collections.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:l.knowledge.collections.map(c=>s.jsxs("div",{className:"ctl",children:[s.jsx("span",{children:c.name}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${o.includes(c.id)?"":" off"}`,"aria-label":c.name,"aria-pressed":o.includes(c.id),disabled:i.busy,onClick:()=>void i.save({knowledge:o.includes(c.id)?o.filter(d=>d!==c.id):[...o,c.id]})})]},c.id))}):s.jsx(ze,{action:{label:"去知识库",onClick:zh},children:"还没有知识库"}):l.knowledge.error?null:s.jsx(Ky,{})]})}function PE({aid:n}){const l=we().assistantSkills[n],i=_c();y.useEffect(()=>{l?.loading||ks(n)},[n]);const o=l?.skills.find(c=>c.name===i.menu?.id);return s.jsxs(s.Fragment,{children:[l?.error?s.jsxs("div",{className:"badline",children:["加载失败:",l.error," ",s.jsx("button",{onClick:()=>void ks(n),children:"重试"})]}):null,l?.loaded?l.skills.length?s.jsx("div",{className:"group-card sidebar-card-group card-rows",children:l.skills.map(c=>s.jsxs("div",{className:"list-row assistant-skill",children:[s.jsxs("button",{className:"assistant-skill-info",onClick:()=>zt(c.path),title:`${c.description} · ${Xb(c)}`,children:[s.jsx("strong",{children:c.title}),s.jsxs("span",{children:[c.description," · ",Xb(c)]})]}),s.jsx("button",{className:`tog${c.enabled?"":" off"}`,"aria-label":c.title,"aria-pressed":c.enabled,onClick:()=>void Cf(n,c.name,c.enabled?"disable":"enable")}),s.jsx("button",{className:"knowledge-dots","aria-label":`${c.title}的操作`,onClick:d=>i.toggle(c.name,d.currentTarget),children:s.jsx(Q,{name:"more",size:18})})]},c.name))}):s.jsx(ze,{children:"还没有技能。助手会把做成的事沉淀成技能,你也可以在任务详情里点「沉淀成技能」。"}):l?.error?null:s.jsx(Ky,{}),o&&i.menu&&Za.createPortal(s.jsxs("div",{className:"amenu knowledge-popup",ref:i.box,children:[s.jsx("button",{onClick:()=>{i.close(),zt(o.path)},children:"查看"}),o.version>1?s.jsx("button",{onClick:()=>{i.close(),Cf(n,o.name,"rollback")},children:"回退到上一版"}):null,s.jsx("button",{onClick:()=>{i.close(),window.confirm(`删除「${o.title}」?`)&&Cf(n,o.name,"delete")},children:"删除"})]}),document.body)]})}function FE({aid:n,sprite:l,prop:i,onDone:o}){const c=br(n),d=F0(l)??{prop:"hob",color:"slate"},h=m=>{m!==l&&c.save({sprite:m})};return s.jsxs(s.Fragment,{children:[s.jsx(yr,{message:c.message}),s.jsxs("div",{className:"sprite-pick",children:[i?s.jsx("button",{className:d.prop==="custom"?"on":void 0,title:"自画道具",onClick:()=>h(Rf(d.color)),children:s.jsx(ot,{sprite:Rf(d.color),prop:i,size:34})}):null,PS.map(m=>s.jsx("button",{className:m===d.prop?"on":void 0,title:_l[m].label,onClick:()=>h(Of(m,d.color)),children:s.jsx(ot,{sprite:Of(m,d.color),size:34})},m))]}),s.jsxs("div",{className:"sprite-colors",children:[FS.map(m=>s.jsx("button",{className:m===d.color?"on":void 0,title:Ia[m].name,style:{background:Ia[m].o},onClick:()=>h(d.prop==="custom"?Rf(m):Of(d.prop,m))},m)),s.jsx("button",{className:"hob-btn",onClick:o,children:"完成"})]})]})}function WE({aid:n,rule:l}){const[i,o]=y.useState(!1),[c,d]=y.useState(l.text),[h,m]=y.useState(!1),[p,g]=y.useState(!1),[v,x]=y.useState(null),w=y.useRef(!1);y.useEffect(()=>{if(v!=="已保存")return;const N=setTimeout(()=>x(null),3e3);return()=>clearTimeout(N)},[v]);const C=async N=>{g(!0);const A=await TS(n,{id:l.id,...N});g(!1),x(A??"已保存"),A||o(!1)},T=()=>{if(w.current){w.current=!1;return}const N=c.trim();if(N===l.text){o(!1);return}if(!N){x("规则内容不能为空。");return}C({text:N})};return s.jsxs("div",{className:"rule-wrap",children:[s.jsxs("div",{className:"rule",children:[i?s.jsx("input",{className:"rule-input",autoFocus:!0,value:c,maxLength:1e3,disabled:p,onChange:N=>d(N.target.value),onBlur:T,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(w.current=!0,d(l.text),o(!1))}}):s.jsx("button",{className:"rule-text",onClick:()=>{w.current=!1,d(l.text),o(!0)},disabled:p,title:"编辑规则",children:l.text}),s.jsxs("span",{className:"v",children:[s.jsx("button",{className:`rule-mode ${l.mode}`,disabled:p,onClick:()=>void C({mode:l.mode==="ask"?"allow":"ask"}),title:"切换确认方式",children:l.mode==="ask"?"需确认":"直接执行"}),s.jsx("button",{className:"del",title:"删除这条规则",disabled:p,onClick:()=>m(!0),children:s.jsx(Q,{name:"close",size:13})})]})]}),h?s.jsxs("div",{className:"rule-confirm",children:[s.jsx("span",{children:"确定删除这条规则?"}),s.jsx("button",{className:"hob-btn",onClick:()=>m(!1),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void CS(n,l.id),children:"确认删除"})]}):null,v?s.jsx("div",{className:v==="已保存"?"okline":"badline",role:"status",children:v}):null]})}function e3({aid:n}){const[l,i]=y.useState(!1),[o,c]=y.useState(""),[d,h]=y.useState("ask"),[m,p]=y.useState(!1),[g,v]=y.useState(null);y.useEffect(()=>{if(g!=="已保存")return;const C=setTimeout(()=>v(null),3e3);return()=>clearTimeout(C)},[g]);const x=()=>{i(!1),c(""),h("ask"),v(null)},w=async()=>{if(m||!o.trim())return;p(!0),v(null);const C=await SS(n,o.trim(),d);if(p(!1),C){v(C);return}c(""),h("ask"),i(!1),v("已保存")};return s.jsxs("div",{className:"rule-wrap",children:[l?s.jsxs("form",{className:"rule-new",onSubmit:C=>{C.preventDefault(),w()},onKeyDown:C=>{C.key==="Escape"&&!m&&(C.preventDefault(),x())},children:[s.jsx("input",{className:"rule-input",autoFocus:!0,"aria-label":"规则文字",placeholder:"输入规则内容",maxLength:1e3,value:o,disabled:m,onChange:C=>c(C.target.value)}),s.jsxs("div",{className:"ctl",children:[s.jsxs("select",{className:"pick","aria-label":"规则确认方式",value:d,disabled:m,onChange:C=>h(C.target.value),children:[s.jsx("option",{value:"ask",children:"需确认"}),s.jsx("option",{value:"allow",children:"直接执行"})]}),s.jsx("span",{className:"sp"}),s.jsx("button",{type:"button",className:"hob-btn",disabled:m,onClick:x,children:"取消"}),s.jsx("button",{type:"submit",className:"hob-btn hob-btn-primary",disabled:m||!o.trim(),children:m?"正在保存…":"保存"})]})]}):s.jsx("button",{className:"rule-add",onClick:()=>{v(null),i(!0)},children:"+ 新增规则"}),g?s.jsx("div",{className:g==="已保存"?"okline":"badline",role:"status",children:g}):null]})}function t3(){const n=we(),l=n.sel??"hob",i=n.profiles[l],[o,c]=y.useState(!1),[d,h]=y.useState(!1),m=br(l);if(!i)return s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取档案…"})});const p=i.assistant;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"bigav",children:s.jsx(ot,{sprite:p.sprite,prop:p.prop,size:96,motion:"home",onClick:()=>c(g=>!g),title:"换头像"})}),s.jsx("div",{className:"avatar-hint",children:"点头像更换"}),o?s.jsx(FE,{aid:l,sprite:p.sprite,prop:p.prop,onDone:()=>c(!1)}):null,s.jsx(yr,{message:m.message}),s.jsx("div",{className:"sech",children:s.jsx("span",{children:"基本信息"})}),s.jsxs("div",{className:"group-card sidebar-card-group",children:[s.jsx("div",{className:"lbl",children:"名字"}),s.jsx(ic,{value:p.name,save:g=>g.trim()?m.save({name:g.trim()}):(m.fail("名字不能为空。"),Promise.resolve(!1))}),s.jsx("div",{className:"lbl",children:"职责简介"}),s.jsx(ic,{value:p.duty,save:g=>m.save({duty:g})}),s.jsx("div",{className:"lbl",children:"详细职责"}),s.jsx(ic,{multiline:!0,value:p.dutyLong??"",save:g=>m.save({dutyLong:g})}),s.jsx("div",{className:"lbl",children:"补充说明"}),s.jsx(ic,{multiline:!0,value:p.instructions,placeholder:"记下这个助手要知道的事实,如“周报发到团队群”",save:g=>m.save({instructions:g})})]})]}),s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"模型"})}),s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsx(VE,{aid:l})}),s.jsx("div",{className:"sech",children:s.jsx("span",{children:"能力"})}),s.jsx("div",{className:"group-card sidebar-card-group",children:s.jsx(QE,{aid:l})})]}),s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"通知与位置"})}),s.jsxs("div",{className:"group-card sidebar-card-group",children:[s.jsx("div",{className:"lbl",children:"通知"}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"需要确认时通知我"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${p.notify?"":" off"}`,title:p.notify?"关闭通知":"开启通知",disabled:m.busy,onClick:()=>void m.save({notify:!p.notify})})]}),s.jsx("div",{className:"note",children:"要在手机上接收推送,请先在 设置 → 通知 中开启本机推送。"}),p.primary?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"位置"}),s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"放在顶部"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${p.pinned?"":" off"}`,title:p.pinned?"取消置顶":"放在顶部",disabled:m.busy,onClick:()=>void m.save({pinned:!p.pinned})})]})]}),p.primary?null:s.jsx("div",{className:"mergebar",children:s.jsx("button",{className:"hob-btn",onClick:()=>void m.save({hidden:!p.hidden}),children:p.hidden?"放回列表":"收起这个助手"})})]})]}),p.primary?null:s.jsxs("div",{className:"pgroup",children:[s.jsx("div",{className:"sech",children:s.jsx("span",{children:"危险操作"})}),s.jsx("div",{className:"mergebar sidebar-group",children:d?s.jsxs("div",{className:"mergeconfirm",children:["归档「",p.name,"」?它会从列表中移除,定时任务一并停掉。对话、规则和历史任务都留着,不会转给 Hob。",s.jsxs("div",{className:"acts",children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void bS(l),children:"确认归档"}),s.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"取消"})]})]}):s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>h(!0),children:"归档这个助手"})})]})]})}function Vb(n,l){return Qh(l,Object.values(n.jobs),Object.values(n.approvals),Object.values(n.delegations))!=="空闲"}function Jh(n){const l=we();return!n||!Vb(l,n)?{busy:!1,slot:0}:{busy:!0,slot:l.assistants.filter(i=>Vb(l,i)).findIndex(i=>i.id===n.id)}}function Xy(n,l){const i=we();if(Qh(n,Object.values(i.jobs),Object.values(i.approvals),Object.values(i.delegations))==="等你确认")return"ask";const o=Object.values(i.jobs).filter(c=>c.assistantId===n.id&&c.endedAt&&(!n.readAt||c.endedAt>n.readAt)).sort((c,d)=>(d.endedAt??"").localeCompare(c.endedAt??""))[0];if(n.unread>0&&o&&(o.status==="stuck"||o.status==="failed"))return"stuck";if(l)return"busy";if(n.unread>0&&o?.status==="done")return"done"}function Zy({a:n,sel:l,size:i=52,drag:o}){const c=Q0(n),{busy:d,slot:h}=Jh(n),m=Xy(n,d);return s.jsxs("button",{className:`pin${l?" sel":""}`,onPointerDown:p=>{c.handlers.onPointerDown(p),o?.handlers.onPointerDown(p)},onContextMenu:c.handlers.onContextMenu,onPointerMove:c.handlers.onPointerMove,onPointerUp:c.handlers.onPointerUp,onPointerCancel:c.handlers.onPointerCancel,onClick:()=>{o?.takeMoved()||c.takeHeld()||Pt(n.id)},children:[o?s.jsx(Q,{name:"grip",size:14,className:"grip"}):null,s.jsx(ot,{sprite:n.sprite,prop:n.prop,size:i,motion:d&&!l?"peek":void 0,slot:h,mark:m}),s.jsx("div",{className:"nm",children:n.name}),s.jsx("div",{className:"sub",children:n.duty})]})}function Vy(n){return n===1?{cls:" n1",size:72}:n===2?{cls:" n2",size:62}:{cls:"",size:52}}function Qb({a:n,sel:l,size:i=42,onClick:o}){const c=Q0(n),{busy:d,slot:h}=Jh(n),m=Xy(n,d),p=OE(n);return s.jsxs("button",{className:`list-row home-row${l?" sel":""}${n.pinned?"":" can-pin"}`,"data-row":n.pinned||n.hidden?void 0:n.id,...c.handlers,onPointerDown:g=>{c.handlers.onPointerDown(g),n.pinned||p.onPointerDown(g)},onClick:()=>{p.takeMoved()||c.takeHeld()||(o?o():Pt(n.id))},children:[s.jsx(ot,{sprite:n.sprite,prop:n.prop,size:i,motion:d&&!l?"peek":void 0,slot:h,mark:m}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:n.name}),s.jsx("span",{className:"tm",children:hc(n.last?.at)})]}),s.jsx("div",{className:"pv",children:n.last?Ba(n.last.text):n.duty})]}),n.pinned?null:s.jsx(Q,{name:"grip",size:14,className:"grip"}),p.ghost?Za.createPortal(s.jsxs("div",{className:`pin-ghost${p.ghost.over?" over":""}`,style:{left:p.ghost.x,top:p.ghost.y},children:[s.jsx(ot,{sprite:n.sprite,prop:n.prop,size:40}),s.jsx("span",{children:p.ghost.over?"松手置顶":n.name})]}),document.body):null]})}function n3(n,l){const i=n.activity.at(-1);return[l?.name,i?fh(i).join(" "):""].filter(Boolean).join(" · ")}function Jb(n,l){hr(),l&&Pt(n.assistantId),Ln(n.id)}function Pb({job:n,owner:l,time:i,text:o,size:c,onClick:d,moving:h}){return s.jsxs("button",{className:"list-row home-row job",onClick:d,children:[s.jsx(mh,{owner:l,size:c,moving:h}),s.jsxs("span",{className:"nm",children:[n.routineId?s.jsx(Q,{name:"clock",size:14}):null,n.title]}),s.jsx("span",{className:"tm",children:i}),s.jsx("span",{className:"pv",children:Ba(o)}),s.jsx(js,{meta:es[n.status]})]})}function Oa({title:n,more:l,children:i}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gt",children:[s.jsx("span",{children:n}),l]}),i]})}function mh({owner:n,size:l,moving:i}){const{slot:o}=Jh(n);return n?s.jsx(ot,{sprite:n.sprite,prop:n.prop,size:l,motion:i?"peek":void 0,slot:o}):s.jsx("span",{style:{width:l,flex:"none"}})}function Fb({title:n,text:l}){return s.jsx(Oa,{title:n,children:s.jsx(ze,{children:l})})}function Qy({size:n=42,markSel:l=!1}){const i=we(),[o,c]=y.useState(!0),d=kE(i),h=v=>i.assistants.find(x=>x.id===v),m=!o||d.searching,p=new Set,g=v=>{const x=h(v.assistantId);return!x?.hidden||m||l&&x.id===i.sel||p.has(x.id)?!1:(p.add(x.id),!0)};return s.jsxs(s.Fragment,{children:[d.asks.length?s.jsx(Oa,{title:"等你确认",children:d.asks.map(v=>s.jsxs("button",{className:"list-row home-row",onClick:()=>void Pt(v.assistantId),children:[s.jsx(mh,{owner:h(v.assistantId),size:n}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:v.title}),s.jsx("span",{className:"tm",children:hc(v.createdAt)})]}),s.jsxs("div",{className:"pv",children:[h(v.assistantId)?.name??""," · 等待你的选择"]})]})]},v.id))}):null,d.live.length?s.jsx(Oa,{title:"进行中",children:d.live.map(v=>s.jsx(Pb,{job:v,owner:h(v.assistantId),moving:g(v),time:xr(v.startedAt??v.createdAt),text:n3(v,h(v.assistantId)),size:n,onClick:()=>Jb(v,h(v.assistantId))},v.id))}):null,d.rows.length||d.hidden.length?s.jsxs(Oa,{title:"日常",children:[d.rows.map(v=>s.jsx(Qb,{a:v,size:n,sel:l&&v.id===i.sel},v.id)),d.hidden.length&&!d.searching?s.jsxs("button",{className:"fold",onClick:()=>c(v=>!v),children:[s.jsx("span",{children:"收起的助手"}),s.jsxs("span",{children:[d.hidden.length,s.jsx(Q,{name:o?"chev":"down",size:13})]})]}):null,s.jsx("div",{className:`expand${m?" open":""}`,inert:!m,children:s.jsx("div",{children:d.hidden.map(v=>s.jsx(Qb,{a:v,size:n,sel:l&&v.id===i.sel},v.id))})})]}):null,d.recent.length?s.jsx(Oa,{title:"最近任务",more:s.jsx("button",{className:"more",onClick:()=>B0(),children:"全部"}),children:d.recent.map(v=>s.jsx(Pb,{job:v,owner:h(v.assistantId),time:hc(v.endedAt??v.createdAt),text:v.summary||v.statusReason||"",size:n,onClick:()=>Jb(v,h(v.assistantId))},v.id))}):null,d.routines.length?s.jsx(Oa,{title:"定时任务",children:d.routines.map(v=>{const x=v.runs[0];return s.jsxs("button",{className:"list-row home-row",onClick:()=>{hr(),Pt(v.assistantId),Y0(v.id)},children:[s.jsx(mh,{owner:h(v.assistantId),size:n}),s.jsxs("div",{className:"main",children:[s.jsxs("div",{className:"l1",children:[s.jsx("span",{className:"nm",children:v.name}),s.jsx("span",{className:"tm",children:Ec(v.schedules[0]??"")})]}),s.jsx("div",{className:"pv",children:x?s.jsxs(s.Fragment,{children:["上次运行 ",hc(x.at)," · ",s.jsx(js,{meta:es[x.status]})]}):"尚未运行"})]})]},v.id)})}):null,d.empty?s.jsxs(s.Fragment,{children:[s.jsx(Fb,{title:"最近任务",text:"分派的任务会显示在这里"}),s.jsx(Fb,{title:"定时任务",text:"定时任务会显示在这里"})]}):null]})}function s3(){const n=we(),l=Zh(n.assistants,n.query),i=qy(l,n.query.trim().length>0),o=Vy(l.length);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mhead",children:[s.jsx("button",{className:"me",title:"设置",onClick:Oc,children:s.jsx(Q,{name:"user",size:17})}),s.jsx("span",{className:"sp"}),n.search?s.jsxs("div",{className:"msearch",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{autoFocus:!0,value:n.query,placeholder:"搜索助手",onChange:c=>X0(c.target.value)}),s.jsx("button",{onClick:()=>db(!1),title:"关闭搜索",children:s.jsx(Q,{name:"close",size:14})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-icon-btn",title:"知识库",onClick:zh,children:s.jsx(Q,{name:"archive",size:19})}),s.jsx("button",{className:"hob-icon-btn",title:"搜索助手",onClick:()=>db(!0),children:s.jsx(Q,{name:"search",size:19})}),s.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:I0,children:s.jsx(Q,{name:"plus",size:21})})]})]}),s.jsx("div",{className:`mpins${o.cls}${i.locked?" locked":""}`,ref:i.grid,children:i.order.map(c=>s.jsx("div",{className:["pinslot",i.className(c.id)].filter(Boolean).join(" "),"data-pin":c.id,children:s.jsx(Zy,{a:c,size:o.size,drag:i.target(c.id)})},c.id))}),s.jsx("div",{className:"mlist",children:s.jsx(Qy,{size:36})})]})}function Wb({leaving:n,page:l}){return s.jsx("div",{className:`mfull${n?" leaving":""}`,children:s.jsx(hh,{mobile:!0,page:l})})}const Jy={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 Ph(n){const l=`${n.id} ${n.name}`;return/(?:^|[^a-z])mini|haiku|lite/i.test(l)?{smart:40,cost:10,speed:95}:/flash/i.test(l)?{smart:60,cost:20,speed:85}:/gpt[-\s]?[56](?:\D|$)|opus|pro|sol/i.test(l)?{smart:90,cost:80,speed:40}:n.reasoning?{smart:70,cost:50,speed:50}:{smart:50,cost:50,speed:60}}function e0(n,l){return Jy[n].reduce((i,o)=>Math.abs(o.value-l)<Math.abs(i.value-l)?o:i).label}function Py(n){return`聪明 ${n.smart}% · 成本 ${n.cost}% · 速度 ${n.speed}%`}function Fh(n){if(n>=1e6){const l=n/1e6;return`${Number.isInteger(l)?l:l.toFixed(1)}M`}return`${Math.round(n/1e3)}K`}function Qe({title:n,desc:l}){return s.jsxs("div",{className:"setintro",children:[s.jsx("div",{className:"h",children:n}),s.jsx("div",{className:"d",children:l})]})}function Bn({items:n,value:l,onChange:i,disabled:o}){return s.jsx("div",{className:"seg",role:"radiogroup",style:{"--seg-count":n.length,"--seg-index":Math.max(0,n.findIndex(c=>c.key===l))},children:n.map(c=>s.jsx("button",{role:"radio","aria-checked":l===c.key,className:l===c.key?"on":void 0,onClick:()=>i(c.key),disabled:o,children:c.label},c.key))})}function ke({children:n}){return s.jsx("div",{className:"group",children:n})}const Hf=[{key:"today",label:"今天",days:1},{key:"week",label:"近 7 天",days:7},{key:"month",label:"近 30 天",days:30},{key:"all",label:"全部",days:0}],l3=[{key:"requests",label:"请求"},{key:"tokens",label:"Token"},{key:"cost",label:"花费"}],a3={requests:"按请求次数着色",tokens:"按 Token 数着色",cost:"按花费着色"},t0=[{key:"input",label:"输入"},{key:"output",label:"输出"},{key:"cacheRead",label:"缓存读"},{key:"cacheWrite",label:"缓存写"}];function i3(n){return new Intl.DateTimeFormat("sv-SE",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}function rc(n,l){const i=Date.parse(`${n}T00:00:00Z`);return Array.from({length:l},(o,c)=>new Date(i-(l-1-c)*864e5).toISOString().slice(0,10))}function r3(n){return(new Date(`${n}T00:00:00Z`).getUTCDay()+6)%7}function n0(n){const l=new Date(`${n}T00:00:00Z`),i=new Intl.DateTimeFormat("zh-CN",{timeZone:"UTC",month:"long",day:"numeric"}).format(l),o=new Intl.DateTimeFormat("zh-CN",{timeZone:"UTC",weekday:"short"}).format(l);return`${i} ${o}`}function Fs(n){return n>=1e9?`${(n/1e9).toFixed(1)}B`:n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e4?`${Math.round(n/1e3)}K`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(Math.round(n))}function Ra(n){return`$${n.toFixed(2)}`}function oc(n){return`${Math.round(n*100)}%`}function gc(n,l){return(n.input*l.input+n.output*l.output+n.cacheRead*l.cacheRead+n.cacheWrite*l.cacheWrite)/1e6}function vc(n){return n.input+n.cacheRead+n.cacheWrite}function s0(n,l){const i={requests:0,input:0,output:0,cacheRead:0,cost:0,unpriced:0},o=new Set;for(const c of n){i.requests+=c.requests,i.input+=vc(c),i.output+=c.output,i.cacheRead+=c.cacheRead;const d=l.models[c.model]?.price;d?i.cost+=gc(c,d):o.add(c.model)}return i.unpriced=o.size,i}function o3(n){return n.error?n.updatedAt?`价格表更新失败:${n.error},用的是 ${Dt(n.updatedAt)} 的。`:`价格表还没有拉到过:${n.error},所有模型都先按未定价算。`:n.updatedAt?null:"还没有拉到价格表,所有模型都先按未定价算。"}function c3(){const[n,l]=y.useState(null),[i,o]=y.useState(null);return y.useEffect(()=>{let c=!0;return NN().then(d=>{c&&(d.ok?l(d.view):o(d.error))}),()=>{c=!1}},[]),i?s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"消耗",desc:"对话和任务用掉的 token 和花费,按服务商返回的用量统计;花费按模型价格估算,以服务商账单为准。"}),s.jsx("div",{className:"badline",role:"status",children:i})]}):n?s.jsx(u3,{view:n}):s.jsx(ze,{children:s.jsx(Hn,{text:"正在统计会话用量…"})})}function u3({view:n}){const l=we(),[i,o]=y.useState(n.prices),[c,d]=y.useState("month"),[h,m]=y.useState("requests"),[p,g]=y.useState(null),v=y.useRef(null),[x,w]=y.useState(null),[C,T]=y.useState({input:"",output:"",cacheRead:"",cacheWrite:""}),[N,A]=y.useState(!1),[M,R]=y.useState(null),O=i3(n.timezone),J=y.useMemo(()=>rc(O,365),[O]),ee=Hf.find(L=>L.key===c)??Hf[2],B=ee.days,k=ee.label,j=y.useMemo(()=>{const L=new Map;for(const Y of n.rows){const _=L.get(Y.day)??{requests:0,tokens:0,cost:0};_.requests+=Y.requests,_.tokens+=vc(Y)+Y.output;const te=i.models[Y.model]?.price;te&&(_.cost+=gc(Y,te)),L.set(Y.day,_)}return L},[n.rows,i]),E=y.useMemo(()=>{const L=B?rc(O,B)[0]:"";return n.rows.filter(Y=>!L||Y.day>=L)},[n.rows,B,O]),U=y.useMemo(()=>s0(E,i),[E,i]),X=y.useMemo(()=>{if(!B)return null;const L=rc(O,B)[0],Y=rc(O,B*2)[0];return s0(n.rows.filter(_=>_.day>=Y&&_.day<L),i)},[n.rows,i,B,O]),oe=y.useMemo(()=>{if(B)return B;const L=n.rows.reduce((Y,_)=>!Y||_.day<Y?_.day:Y,null);return L?Math.max(1,Math.round((Date.parse(`${O}T00:00:00Z`)-Date.parse(`${L}T00:00:00Z`))/864e5)+1):1},[n.rows,B,O]),ce=y.useMemo(()=>{const L=new Map;for(const Y of E){const _=L.get(Y.model)??{requests:0,input:0,output:0,cacheRead:0,providers:new Map,priced:!1,cost:0};_.requests+=Y.requests,_.input+=vc(Y),_.output+=Y.output,_.cacheRead+=Y.cacheRead;const te=vc(Y)+Y.output;_.providers.set(Y.provider,(_.providers.get(Y.provider)??0)+te);const ae=i.models[Y.model]?.price;ae&&(_.priced=!0,_.cost+=gc(Y,ae)),L.set(Y.model,_)}return[...L].map(([Y,_])=>({model:Y,provider:[..._.providers].sort((te,ae)=>ae[1]-te[1])[0]?.[0]??"",requests:_.requests,input:_.input,output:_.output,cacheRead:_.cacheRead,cost:_.priced?_.cost:null,price:i.models[Y]})).sort((Y,_)=>(_.cost??-1)-(Y.cost??-1)||_.requests-Y.requests)},[E,i]),ye=y.useMemo(()=>{const L=new Map;for(const Y of E){const _=L.get(Y.assistantId)??{chat:0,job:0,requests:0},te=i.models[Y.model]?.price;te&&(_[Y.source==="chat"?"chat":"job"]+=gc(Y,te)),_.requests+=Y.requests,L.set(Y.assistantId,_)}return n.assistants.map(Y=>{const _=L.get(Y.id)??{chat:0,job:0,requests:0};return{...Y,..._,cost:_.chat+_.job}}).filter(Y=>Y.requests>0).sort((Y,_)=>_.cost-Y.cost)},[E,i,n.assistants]),Ce=y.useMemo(()=>{const L=[...Array.from({length:r3(J[0])},()=>null),...J];for(;L.length%7;)L.push(null);const Y=[];for(let at=0;at<L.length;at+=7)Y.push(L.slice(at,at+7));const _=at=>{const ct=j.get(at);return ct?ct[h]:0},te=Math.max(0,...J.map(_)),ae=at=>{const ct=_(at);return ct<=0?0:ct<te*.2?1:ct<te*.45?2:ct<te*.7?3:4},fe=[];let ve=0,tt=-9;return Y.forEach((at,ct)=>{const $t=[...at].reverse().find(Ut=>!!Ut),nt=$t?Number($t.slice(5,7)):ve,qe=nt!==ve&&ct-tt>2;fe.push(qe?`${nt}月`:""),qe&&(tt=ct),ve=nt}),{weeks:Y,level:ae,months:fe}},[J,j,h]);y.useLayoutEffect(()=>{const L=v.current;if(!L)return;const Y=()=>{L.scrollLeft=L.scrollWidth-L.clientWidth};Y();const _=new ResizeObserver(Y);return _.observe(L),()=>_.disconnect()},[Ce.weeks.length]);const ue=L=>i.models[L],xe=L=>{const Y=l.settings.settings.providers.find(_=>_.id===L);return Y?.kind==="custom"?Y.name:L},ge=o3(i),Re=Math.max(0,...ce.map(L=>L.cost??0)),Te=Math.max(0,...ye.map(L=>L.cost)),pt=J.reduce((L,Y)=>{const _=j.get(Y);return{requests:L.requests+(_?.requests??0)}},{requests:0}),wt=L=>{const Y=ue(L)?.price;w(x===L?null:L),R(null),T({input:Y?String(Y.input):"",output:Y?String(Y.output):"",cacheRead:Y?String(Y.cacheRead):"",cacheWrite:Y?String(Y.cacheWrite):""})},gt=(L,Y)=>{o(_=>{const te={..._.models};return Y?te[L]=Y:delete te[L],{..._,models:te}}),w(null),R(null)},$=async L=>{if(N)return;const Y={input:Number(C.input),output:Number(C.output),cacheRead:Number(C.cacheRead),cacheWrite:Number(C.cacheWrite)};if(t0.some(te=>!Number.isFinite(Y[te.key])||Y[te.key]<0)){R("四项单价都要填大于等于 0 的数字(美元 / 百万 token)。");return}A(!0);const _=await Kx(L,Y);if(A(!1),!_.ok){R(_.error);return}gt(L,_.price)},le=async L=>{if(N)return;A(!0);const Y=await Kx(L,null);if(A(!1),!Y.ok){R(Y.error);return}gt(L,Y.price)};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"消耗",desc:"对话和任务用掉的 token 和花费,按服务商返回的用量统计;花费按模型价格估算,以服务商账单为准。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"u-seg",children:s.jsx(Bn,{items:Hf.map(({key:L,label:Y})=>({key:L,label:Y})),value:c,onChange:d})}),s.jsxs("div",{className:"group-card settings-card u-stats",children:[s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"请求"}),s.jsx("span",{className:"v",children:U.requests.toLocaleString("en-US")}),X?X.requests?s.jsxs("span",{className:"s",children:[c==="today"?"比昨天":`比上个 ${B} 天`," ",s.jsx("b",{children:d3(U.requests,X.requests)})]}):s.jsxs("span",{className:"s",children:[c==="today"?"昨天":"上个时段","没有请求"]}):null]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"输入 token"}),s.jsx("span",{className:"v",children:Fs(U.input)}),U.input?s.jsxs("span",{className:"s",children:["其中缓存命中 ",oc(U.cacheRead/U.input)]}):null]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"输出 token"}),s.jsx("span",{className:"v",children:Fs(U.output)}),s.jsxs("span",{className:"s",children:["日均 ",Fs(U.output/oe)]})]}),s.jsxs("div",{className:"u-stat",children:[s.jsx("span",{className:"k",children:"花费"}),s.jsx("span",{className:"v",children:Ra(U.cost)}),s.jsxs("span",{className:"s",children:["日均 ",Ra(U.cost/oe)]})]})]}),ge?s.jsx("div",{className:"note",children:ge}):null,U.unpriced?s.jsxs("div",{className:"note",children:["有 ",U.unpriced," 个模型没有价格,这些模型的花费没有计入。"]}):null]}),s.jsxs(ke,{children:[s.jsxs("div",{className:"lbl",children:["最近一年 · 共 ",Fs(pt.requests)," 次请求"]}),s.jsx("div",{className:"u-seg",children:s.jsx(Bn,{items:l3,value:h,onChange:m})}),s.jsxs("div",{className:"u-heatwrap",children:[s.jsxs("div",{className:"group-card settings-card u-heat",onMouseLeave:()=>g(null),style:{"--weeks":Ce.weeks.length},children:[s.jsxs("div",{className:"u-scroll",ref:v,children:[s.jsx("div",{className:"u-months",children:Ce.months.map((L,Y)=>s.jsx("span",{children:L},Y))}),s.jsxs("div",{className:"u-grid",children:[s.jsxs("div",{className:"u-wd",children:[s.jsx("span",{children:"一"}),s.jsx("span",{}),s.jsx("span",{children:"三"}),s.jsx("span",{}),s.jsx("span",{children:"五"}),s.jsx("span",{}),s.jsx("span",{})]}),s.jsx("div",{className:"u-cells",children:Ce.weeks.map((L,Y)=>s.jsx("div",{className:"hw",children:L.map((_,te)=>_?s.jsx("i",{className:`l${Ce.level(_)}${_===O?" today":""}`,onMouseEnter:()=>g(_),title:`${n0(_)}:${j.get(_)?.requests??0} 次请求 · ${Fs(j.get(_)?.tokens??0)} token · ${Ra(j.get(_)?.cost??0)}`},_):s.jsx("i",{},`empty-${te}`))},Y))})]})]}),s.jsxs("div",{className:"u-foot",children:[s.jsxs("span",{children:["每格一天,",a3[h]]}),s.jsxs("span",{className:"u-legend",children:["少 ",s.jsx("i",{className:"l0"}),s.jsx("i",{className:"l1"}),s.jsx("i",{className:"l2"}),s.jsx("i",{className:"l3"}),s.jsx("i",{className:"l4"})," 多"]})]})]}),p?s.jsxs("div",{className:"u-tip",children:[s.jsx("b",{children:n0(p)}),s.jsx("br",{}),j.get(p)?.requests??0," 次请求 · ",Fs(j.get(p)?.tokens??0)," token · ",Ra(j.get(p)?.cost??0)]}):null]})]}),s.jsxs(ke,{children:[s.jsxs("div",{className:"lbl",children:["按模型 · ",k]}),ce.length?s.jsxs("div",{className:"u-mhead",children:[s.jsx("span",{children:"模型"}),s.jsx("span",{children:"花费占比"}),s.jsx("span",{children:"请求"}),s.jsx("span",{children:"输入"}),s.jsx("span",{children:"输出"}),s.jsx("span",{children:"缓存"}),s.jsx("span",{children:"花费"}),s.jsx("span",{children:"单价"})]}):null,s.jsx("div",{className:"group-card settings-card u-cards",children:ce.length?ce.map(L=>{const Y=L.price,_=Re>0&&L.cost?L.cost/Re*100:0;return s.jsxs("div",{children:[s.jsxs("div",{className:"u-mrow",children:[s.jsxs("div",{className:"u-mname",children:[s.jsx("b",{title:L.model,children:L.model}),s.jsxs("span",{children:[xe(L.provider),Y?.custom?s.jsx("em",{children:"自定"}):null]})]}),s.jsx("div",{className:"u-bar",children:s.jsx("i",{style:{width:`${_}%`}})}),s.jsxs("div",{className:"u-num u-req",children:[s.jsx("span",{className:"u-k",children:"请求"}),L.requests.toLocaleString("en-US")]}),s.jsxs("div",{className:"u-num u-in",children:[s.jsx("span",{className:"u-k",children:"输入"}),Fs(L.input)]}),s.jsxs("div",{className:"u-num u-out",children:[s.jsx("span",{className:"u-k",children:"输出"}),Fs(L.output)]}),s.jsxs("div",{className:"u-num u-cache",children:[s.jsx("span",{className:"u-k",children:"缓存命中"}),L.input?oc(L.cacheRead/L.input):"—"]}),s.jsx("div",{className:"u-num strong u-cost",children:L.cost===null?"—":Ra(L.cost)}),s.jsx("button",{className:`u-price${Y?"":" missing"}`,onClick:()=>wt(L.model),title:"点这里改单价",children:Y?f3(Y.price):"未定价"})]}),x===L.model?s.jsxs("div",{className:"u-edit",children:[s.jsx("div",{className:"u-edit-fields",children:t0.map(te=>s.jsxs("label",{children:[s.jsx("span",{children:te.label}),s.jsx("input",{value:C[te.key],inputMode:"decimal",disabled:N,onChange:ae=>T(fe=>({...fe,[te.key]:ae.target.value}))})]},te.key))}),s.jsxs("div",{className:"u-edit-actions",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void $(L.model),disabled:N,children:"保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>w(null),disabled:N,children:"取消"}),Y?.custom?s.jsx("button",{className:"hob-btn",onClick:()=>void le(L.model),disabled:N,children:"恢复默认"}):null,M?s.jsx("span",{className:"badline",children:M}):null]}),s.jsx("div",{className:"note",children:"美元 / 百万 token。缓存读是命中缓存的输入,缓存写是写进缓存的输入;花费按这里算,以服务商账单为准。"})]}):null]},L.model)}):s.jsx(ze,{children:"这段时间没有用量"})}),s.jsx("div",{className:"note",children:"点单价可以改成自己的价格;改过的标「自定」,可以恢复默认。"})]}),s.jsxs(ke,{children:[s.jsxs("div",{className:"lbl",children:["按助手 · ",k]}),s.jsx("div",{className:"group-card settings-card u-cards",children:ye.length?ye.map(L=>{const Y=L.chat+L.job,_=Te>0?L.cost/Te*100:0;return s.jsxs("div",{className:"u-wrow",children:[s.jsxs("b",{title:L.name,children:[L.name,L.archived?"(已归档)":""]}),s.jsx("span",{children:Y?`对话 ${oc(L.chat/Y)} · 任务 ${oc(L.job/Y)}`:"对话 — · 任务 —"}),s.jsx("div",{className:"u-bar",children:s.jsx("i",{style:{width:`${_}%`}})}),s.jsx("div",{className:"u-num strong",children:Ra(L.cost)})]},L.id)}):s.jsx(ze,{children:"这段时间没有用量"})})]})]})}function d3(n,l){const i=(n-l)/l;return Math.round(i*100)===0?"持平":`${i>0?"+":"−"}${Math.abs(Math.round(i*100))}%`}function f3(n){return`${l0(n.input)} / ${l0(n.output)}`}function l0(n){return`$${Number(n.toFixed(2))}`}const h3=y.lazy(()=>mr(()=>import("./DesktopView-3QDYo0UU.js"),[]).then(n=>({default:n.DesktopView})));function qn({saved:n,error:l,children:i,lead:o}){return s.jsxs("div",{className:"sfoot",children:[o,n&&!l?s.jsx("span",{className:"okline",children:"已保存"}):null,l?s.jsx("span",{className:"badline",children:l}):null,s.jsx("span",{className:"sp"}),i]})}function La(){const[n,l]=y.useState(null),[i,o]=y.useState(!1);return y.useEffect(()=>{if(n!=="已保存")return;const d=setTimeout(()=>l(null),3e3);return()=>clearTimeout(d)},[n]),{save:async d=>{o(!0);const h=await jh(d);return o(!1),l(h?"已保存":ys().notice??"保存失败,请重试。"),h},busy:i,message:n}}function Cn({message:n,toast:l=!1}){return n?s.jsx("span",{className:`${n==="已保存"?"okline":"badline"}${l?" savetoast":""}`,role:"status",children:n}):null}function Ha({value:n,placeholder:l,multiline:i,onSave:o}){const[c,d]=y.useState(n),[h,m]=y.useState(!1);y.useEffect(()=>d(n),[n]);const p=async()=>{if(h||c===n)return;m(!0);const v=await o(c);m(!1),v||d(n)},g={value:c,placeholder:l,disabled:h,onChange:v=>d(v.target.value),onBlur:()=>void p(),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),v.currentTarget.blur())}};return s.jsx("div",{className:"field",children:i?s.jsx("textarea",{...g,rows:3}):s.jsx("input",{...g})})}const Bf=[{id:"general",label:"通用"},{id:"rules",label:"规则"},{id:"providers",label:"服务商"},{id:"models",label:"模型"},{id:"memory",label:"记忆"},{id:"image",label:"图像生成"},{id:"knowledge",label:"知识库"},{id:"search",label:"联网搜索"},{id:"skills",label:"技能"},{id:"mcp",label:"MCP"},{id:"desktop",label:"云桌面"},{id:"work",label:"任务"},{id:"usage",label:"消耗"},{id:"push",label:"通知"},{id:"about",label:"关于"}],m3=[{key:"system",label:"跟随系统"},{key:"light",label:"浅色"},{key:"dark",label:"深色"}];function p3(){return Intl.supportedValuesOf?.("timeZone")??[]}function g3({narrow:n,leaving:l}){const i=we(),o=i.section??(n?null:"general"),c=y.useRef(null);return y.useEffect(()=>{c.current?.scrollTo(0,0)},[o,i.sub]),n&&o===null?s.jsxs("div",{className:`setpage narrow${l?" leaving":""}`,children:[s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:Wf,children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:"设置"})]}),s.jsx("div",{className:"setbody",children:Bf.map(d=>s.jsxs("button",{className:"setitem",onClick:()=>Rl(d.id),children:[s.jsx("span",{children:d.label}),s.jsx(Q,{name:"chev",size:15})]},d.id))})]}):s.jsxs("div",{className:`setpage${n?" narrow":""}${l?" leaving":""}`,children:[n?s.jsxs("div",{className:"sethead",children:[s.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:i.sub?Gt:()=>Rl(null),children:s.jsx(Q,{name:"left",size:17})}),s.jsx("span",{className:"t",children:i.sub?.title??Bf.find(d=>d.id===o)?.label??"设置"})]}):s.jsxs("div",{className:"setnav",children:[s.jsx("div",{className:"setnavtitle",children:"设置"}),Bf.map(d=>s.jsx("button",{className:`navrow${o===d.id?" sel":""}`,onClick:()=>Rl(d.id),children:d.label},d.id)),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"navrow",onClick:Wf,children:"返回 Hob"})]}),s.jsx("div",{className:"setmain",ref:c,children:o==="rules"?s.jsx(v3,{}):o==="providers"?s.jsx(T3,{}):o==="models"?s.jsx(_3,{}):o==="memory"?s.jsx(Y3,{}):o==="image"?s.jsx(Z3,{}):o==="knowledge"?s.jsx(X3,{}):o==="search"?s.jsx(rA,{}):o==="skills"?s.jsx(J3,{}):o==="mcp"?s.jsx(tA,{}):o==="desktop"?s.jsx(y3,{}):o==="work"?s.jsx(L3,{}):o==="usage"?s.jsx(c3,{}):o==="push"?s.jsx(H3,{}):o==="about"?s.jsx(cA,{}):s.jsx(k3,{})})]})}function v3(){const{rules:n,error:l,busy:i}=we().globalRules;y.useEffect(()=>{Xf()},[]);const o=c=>SN(c);return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"全局规则",desc:"所有助手和任务都遵守的规则。「执行前确认」的事项,助手执行前会征求你的确认;「一律照做」是做事的规则。每个助手自己的规则在它的档案里修改。"}),l?s.jsx("div",{className:"badline",role:"status",children:l}):null,n===null?l?s.jsx("button",{className:"hob-btn",onClick:()=>void Xf(),children:"重试"}):s.jsx(ze,{children:s.jsx(Hn,{text:"正在读取全局规则…"})}):[{mode:"ask",label:"执行前确认"},{mode:"allow",label:"一律照做"}].map(({mode:c,label:d})=>s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:d}),s.jsxs("div",{className:"group-card settings-card rules-card",children:[n.filter(h=>h.mode===c).map(h=>s.jsx(x3,{rule:h,busy:i,onSave:m=>o(n.map(p=>p.id===h.id?{...p,text:m}:p)),onDelete:()=>void o(n.filter(m=>m.id!==h.id))},h.id)),s.jsx(b3,{label:d,busy:i,onAdd:h=>o([...n,{text:h,mode:c}])})]})]},c))]})}function x3({rule:n,busy:l,onSave:i,onDelete:o}){const[c,d]=y.useState(!1),[h,m]=y.useState(n.text),p=y.useRef(!1),g=()=>{if(p.current){p.current=!1;return}const x=h.trim();if(!x||x===n.text){d(!1);return}i(x).then(w=>{w&&d(!1)})},v=Date.now()-Date.parse(n.changedAt);return s.jsxs("div",{className:"rule",children:[c?s.jsx("input",{className:"rule-input","aria-label":"编辑规则",autoFocus:!0,maxLength:1e3,value:h,disabled:l,onChange:x=>m(x.target.value),onBlur:g,onKeyDown:x=>{x.key==="Enter"&&x.currentTarget.blur(),x.key==="Escape"&&(p.current=!0,m(n.text),d(!1))}}):s.jsx("button",{className:"rule-text",title:"编辑规则",disabled:l,onClick:()=>{p.current=!1,m(n.text),d(!0)},children:n.text}),s.jsxs("span",{className:"v",children:[v>=0&&v<864e5?s.jsx("span",{className:"rule-recent",children:"最近修改"}):null,s.jsx("button",{className:"del","aria-label":`删除规则:${n.text}`,title:"删除这条规则",disabled:l,onClick:o,children:s.jsx(Q,{name:"close",size:13})})]})]})}function b3({label:n,busy:l,onAdd:i}){const[o,c]=y.useState("");return s.jsxs("form",{className:"rule-add-form",onSubmit:d=>{d.preventDefault();const h=o.trim();h&&!l&&i(h).then(m=>{m&&c("")})},children:[s.jsx("input",{className:"rule-input","aria-label":`${n}添加规则`,placeholder:"+ 添加规则",maxLength:1e3,value:o,disabled:l,onChange:d=>c(d.target.value)}),s.jsx("button",{className:"hob-btn",type:"submit",disabled:l||!o.trim(),children:"添加"})]})}function y3(){const[n,l]=y.useState(null),[i,o]=y.useState(""),[c,d]=y.useState(""),[h,m]=y.useState(!1),[p,g]=y.useState(null),[v,x]=y.useState(null),[w,C]=y.useState(!1),[T,N]=y.useState(null),[A,M]=y.useState([]),R=we().assistants;y.useEffect(()=>{LN().then(E=>{l(E),o(E.url),m(E.enabled),M(E.publicAssistants)}).catch(E=>x({ok:!1,text:`无法读取云桌面配置:${E.message}`}))},[]);const O=n?.deployed??!1,J=n!==null&&h!==n.enabled;async function ee(){if(n){C(!0),x(null);try{const E=await HN({revision:n.revision,url:i,enabled:h,...c?{token:c}:{}});l(E),d(""),x({ok:!0,text:"已保存"})}catch(E){x({ok:!1,text:E instanceof Error?E.message:String(E)})}finally{C(!1)}}}async function B(){if(n){C(!0),x(null);try{const E=await BN(n.revision,A);l(E),M(E.publicAssistants),x({ok:!0,text:"已保存",public:!0})}catch(E){x({ok:!1,text:E instanceof Error?E.message:String(E),public:!0})}finally{C(!1)}}}async function k(){C(!0),g(null);try{const E=await qN();if(!E.ok){g({ok:!1,text:E.error});return}const U=E.health.screens.filter(X=>X.browserRunning).map(X=>X.id).join("、");g({ok:!0,text:`已连接 · ${E.health.display.width}×${E.health.display.height} · 浏览器:${U||"无"}`})}catch(E){g({ok:!1,text:E instanceof Error?E.message:String(E)})}finally{C(!1)}}const j=p?s.jsx("span",{className:p.ok?"okline":"badline",style:p.ok?void 0:{color:"var(--danger)"},role:"status",children:p.text}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"云桌面",desc:"云桌面需要单独部署。登录 Hob 的人可以观看和接管桌面。"}),O?s.jsxs(ke,{children:[s.jsx("div",{className:"note",children:"由部署配置(compose 的 desktop 服务)"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"地址"}),s.jsx("div",{className:"sline mono",children:n?.url||"未配置"}),s.jsx("div",{className:"lbl sub",children:"令牌"}),s.jsx("div",{className:"sline",children:n?.tokenConfigured?"已设置":"未设置"}),s.jsx("div",{className:"lbl sub",children:"启用"}),s.jsx("div",{className:"sline",children:n?.enabled?"已启用":"未启用"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",disabled:w||!n,onClick:()=>void k(),children:"测试连接"}),s.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>N("hob"),children:"打开桌面"}),j]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"启用"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`tog${h?"":" off"}`,"aria-label":"启用云桌面","aria-pressed":h,disabled:!n,onClick:()=>m(!h)}),s.jsx("span",{className:"note",children:(h?"已启用。登录 Hob 的人可以观看桌面,接管后可以操作。":"未启用。界面不打开桌面,任务也不能使用桌面。")+(J?"(保存后生效)":"")})]})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:i,disabled:!n||w,onChange:E=>o(E.target.value),placeholder:"http://127.0.0.1:6080"})}),s.jsx("div",{className:"lbl",children:"令牌"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:c,disabled:!n||w,onChange:E=>d(E.target.value),placeholder:n?.tokenConfigured?"已保存,留空不变":"云桌面的访问令牌"})}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:w||!n,onClick:()=>void k(),children:"测试连接"}),s.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>N("hob"),children:"打开桌面"}),j,v&&!v.public?s.jsx("span",{className:v.ok?"okline":"badline",role:"status",children:v.text}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w||!n,onClick:()=>void ee(),children:"保存"})]})]}),s.jsxs("div",{className:"note",children:["部署说明见 ",s.jsx("a",{href:"https://github.com/FFatTiger/hob#云桌面",target:"_blank",rel:"noreferrer",children:"云桌面文档"}),"。测试连接会检查地址、令牌和云桌面是否可用。"]})]})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"公共屏幕"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"plist",children:R.map(E=>s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:A.includes(E.id),disabled:w||!n,onChange:U=>M(X=>U.target.checked?[...X,E.id]:X.filter(oe=>oe!==E.id))}),s.jsx("span",{children:E.name})]},E.id))}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:!n?.enabled||w,onClick:()=>N("public"),children:"打开公共屏幕"}),v?.public?s.jsx("span",{className:v.ok?"okline":"badline",role:"status",children:v.text}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!n||w,onClick:()=>void B(),children:"保存"})]})]}),s.jsx("div",{className:"note",children:"用于登录你自己的账号,勾选的助手可以使用。受 Google 限制,目前无法登录 Google 账号。"})]}),T?s.jsx(y.Suspense,{fallback:null,children:s.jsx(h3,{initialScreen:T,takeOver:T==="public",onClose:()=>N(null)})}):null]})}function k3(){const n=we(),l=n.settings.settings.general.aboutYou,i=La(),o=La(),c=La(),[d,h]=y.useState(null);return y.useEffect(()=>{if(!d)return;const m=setTimeout(()=>h(null),4e3);return()=>clearTimeout(m)},[d]),s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"通用",desc:"主题、时区、个人信息、登录密码。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"主题"}),s.jsx(Bn,{items:m3,value:n.theme,disabled:i.busy,onChange:m=>void i.save({general:{theme:m}})}),s.jsx(Cn,{message:i.message})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"时区"}),s.jsx(j3,{value:n.settings.settings.general.timezone,onSave:m=>o.save({general:{timezone:m}})}),s.jsx(Cn,{message:o.message}),s.jsx("div",{className:"note",children:"助手的「现在时间」和定时任务都按这个时区算。"})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"展示页面"}),s.jsx("button",{className:`tog${n.settings.settings.general.showPage===!1?" off":""}`,"aria-label":"展示页面","aria-pressed":n.settings.settings.general.showPage!==!1,disabled:i.busy,onClick:()=>void i.save({general:{showPage:n.settings.settings.general.showPage===!1}})}),s.jsx(Cn,{message:i.message}),s.jsx("div",{className:"note",children:"允许助手把适合可视化的内容展示为页面。"})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"个人信息"}),s.jsx("div",{className:"lbl sub",children:"称呼"}),s.jsx(Ha,{placeholder:"如「王先生」",value:l.name,onSave:m=>c.save({general:{aboutYou:{name:m.trim()}}})}),s.jsx("div",{className:"lbl sub",children:"语言"}),s.jsx(Ha,{placeholder:"如「中文」",value:l.language,onSave:m=>c.save({general:{aboutYou:{language:m.trim()}}})}),s.jsx("div",{className:"lbl sub",children:"其他"}),s.jsx(Ha,{multiline:!0,placeholder:"如「不要看融资新闻」",value:l.notes,onSave:m=>c.save({general:{aboutYou:{notes:m}}})}),s.jsx(Cn,{message:c.message}),s.jsx("div",{className:"note",children:"所有助手都会参考这些信息;未填写的项不使用。"})]}),s.jsx(ke,{children:s.jsxs("div",{className:"formcard",children:[s.jsx(w3,{onDone:h}),d?s.jsx("div",{className:"note",children:d}):null]})})]})}function j3({value:n,onSave:l}){const i=p3(),[o,c]=y.useState(n),[d,h]=y.useState(!1),[m,p]=y.useState(null),g=y.useRef(null);y.useEffect(()=>c(n),[n]),y.useEffect(()=>{if(!d)return;const w=C=>{g.current?.contains(C.target)||h(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]);const v=i.filter(w=>w.toLowerCase().includes(o.trim().toLowerCase())).slice(0,40),x=w=>{h(!1),p(null),c(w),w!==n&&l(w).then(C=>{C||c(n)})};return s.jsxs("div",{className:"tz",ref:g,children:[s.jsx("label",{className:"field",children:s.jsx("input",{value:o,placeholder:"搜索时区,如 Berlin",onFocus:()=>h(!0),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),w.currentTarget.blur())},onChange:w=>{c(w.target.value),h(!0)},onBlur:()=>{o.trim()!==n&&(i.includes(o.trim())?x(o.trim()):(c(n),p("时区无效,请从列表中选择。")))}})}),m?s.jsx("div",{className:"badline",role:"status",children:m}):null,d&&v.length?s.jsx("div",{className:"tzlist",children:v.map(w=>s.jsx("button",{className:w===n?"sel":"",onMouseDown:()=>x(w),children:w},w))}):null]})}function w3({onDone:n}){const[l,i]=y.useState(""),[o,c]=y.useState(""),[d,h]=y.useState(""),[m,p]=y.useState(!1),g=async()=>{if(m)return;if(!l||!o){n("请填写旧密码和新密码。");return}if(o!==d){n("两次输入的新密码不一致。");return}p(!0);const v=await jN(l,o);if(p(!1),v){n(`修改失败:${v}`);return}i(""),c(""),h(""),n("密码已修改。")};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"登录密码"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"旧密码",value:l,onChange:v=>i(v.target.value)})}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"新密码",value:o,onChange:v=>c(v.target.value)})}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",placeholder:"再次输入新密码",value:d,onChange:v=>h(v.target.value)})}),s.jsxs(qn,{saved:!1,error:null,children:[l||o||d?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",disabled:m||!(l||o||d),onClick:()=>{i(""),c(""),h(""),n("")},children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void g(),disabled:m||!l||!o||!d,children:m?"正在验证…":"保存"})]})]})}function Fy({value:n,options:l,label:i,icon:o,onChange:c}){return s.jsxs("span",{className:"ctl",children:[o?s.jsx(Q,{name:o,size:14}):null,s.jsx("select",{className:"pick","aria-label":i,value:n,onChange:d=>c(d.target.value),children:l.map(d=>s.jsx("option",{value:d.value,children:d.text},d.value))})]})}function Wy({value:n,model:l,onChange:i}){const o=Yy(l);return o.length===1?null:s.jsx(Fy,{value:n,label:"思考强度",icon:"bulb",options:o.map(c=>({value:c,text:uc[c]})),onChange:i})}function a0({modelRef:n,info:l,disabled:i,onSaved:o}){const[c,d]=y.useState(!1),[h,m]=y.useState(null),[p,g]=y.useState(""),[v,x]=y.useState(!1),[w,C]=y.useState(null),[T,N]=y.useState(!1);y.useEffect(()=>{if(!T)return;const B=setTimeout(()=>N(!1),3e3);return()=>clearTimeout(B)},[T]);const A=h??l.levels,M=Da.filter(B=>!A.some(k=>k.level===B)),R=h!==null,O=B=>{m(B.slice().sort((k,j)=>Da.indexOf(k.level)-Da.indexOf(j.level))),C(null),N(!1)},J=async B=>{x(!0),C(null);const k=await AN(n,B);if(x(!1),!k.ok){m(null),C(k.error);return}m(null),N(!0),o(k.thinking,k.settings)},ee=(B=A)=>{const k={};for(const j of Da){const E=B.find(U=>U.level===j);k[j]=E?E.text.trim():null}J(k)};return s.jsxs("div",{className:"think-levels",children:[s.jsxs("button",{className:"thinkhead",onClick:()=>d(B=>!B),disabled:v,children:[s.jsx("span",{className:"lbl sub",children:"思考档"}),s.jsxs("span",{className:"note",children:[A.length," 档",l.custom?" · 有自定义":" · 默认"]}),s.jsx(Q,{name:c?"down":"chev",size:14})]}),s.jsx("div",{className:`expand${c?" open":""}`,inert:!c,children:s.jsxs("div",{children:[s.jsx("div",{className:"thinkrows",children:A.map(B=>s.jsxs("div",{className:"thinkrow",children:[s.jsx("span",{className:"tname",children:uc[B.level]}),s.jsx("input",{className:"ttext",value:B.text,placeholder:"默认",title:"留空就按服务商协议的默认值发",onChange:k=>O(A.map(j=>j.level===B.level?{...j,text:k.target.value}:j)),onBlur:()=>{R&&ee()},onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur()},disabled:v||i}),B.level==="off"?s.jsx("span",{className:"rremove still",title:"关闭这一档不能删","aria-hidden":!0}):s.jsx("button",{className:"rremove",title:`删掉「${uc[B.level]}」`,onClick:()=>ee(A.filter(k=>k.level!==B.level)),disabled:v||i,children:s.jsx(Q,{name:"close",size:13})})]},B.level))}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[s.jsxs("select",{className:"pick",value:p,onChange:B=>g(B.target.value),disabled:v||i||!M.length,"aria-label":"添加思考档",children:[s.jsx("option",{value:"",children:M.length?"选择档位":"七个档都用上了"}),M.map(B=>s.jsx("option",{value:B,children:uc[B]},B))]}),s.jsx("button",{className:"hob-btn",onClick:()=>{p&&(ee([...A,{level:p,text:""}]),g(""))},disabled:v||i||!p,children:"添加思考档"}),s.jsx("span",{className:"sp"}),l.custom?s.jsx("button",{className:"hob-btn",onClick:()=>void J(null),disabled:v||i,children:"恢复默认"}):null]}),s.jsx("div",{className:"note",children:"留空就按服务商协议的默认值发;填了才按你写的发(例如 DeepSeek 的「中」填 high)。 关闭这一档不能删,其余档删掉后不再出现在思考强度里。"}),w?s.jsx("div",{className:"badline",children:w}):null,T?s.jsx("div",{className:"okline",children:"已保存思考档"}):null]})})]})}function ek({info:n}){const l=Fh(n.contextWindow);return s.jsxs("span",{className:"caps",children:[n.input.includes("image")?s.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:s.jsx(Q,{name:"image",size:14})}):null,n.reasoning?s.jsx("span",{title:"支持推理","aria-label":"支持推理",children:s.jsx(Q,{name:"bulb",size:14})}):null,s.jsx("span",{className:"ctx",title:`上下文 ${l}`,children:l})]})}const tk=[{key:"openai-completions",label:"OpenAI 兼容"},{key:"openai-responses",label:"OpenAI Responses 兼容"},{key:"anthropic-messages",label:"Anthropic 兼容"},{key:"google-generative-ai",label:"Google 兼容"}],N3=Object.fromEntries(tk.map(n=>[n.key,n.label])),cc=128e3,qf=n=>n.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),S3={literal:"包含 Key",env:"包含 Key",command:"需手动填写",none:"无 Key"};function T3(){const l=we().sub,[i,o]=y.useState(null),[c,d]=y.useState(null),[h,m]=y.useState(null),[p,g]=y.useState({}),v=(C,T)=>g(N=>({...N,[C]:T}));if(y.useEffect(()=>{EN().then(C=>C.ok?o(C.view):d(C.error))},[]),y.useEffect(()=>{l&&m(null)},[l]),y.useEffect(()=>{i&&g(C=>Object.fromEntries(Object.entries(C).filter(([T])=>i.providers.some(N=>N.id===T))))},[i]),c)return s.jsx("div",{className:"note",children:c});if(!i)return s.jsx(ze,{children:"正在读取服务商…"});const x=(C,T)=>{T.startsWith("已导入")&&g({}),o(C),m(T),Gt()},w=(C,T,N)=>{o(A=>A&&{...A,settings:N,models:{...A.models,[C]:(A.models[C]??[]).map(M=>M.ref===T.ref?T:M)}})};return l?.kind==="provider"?s.jsx(A3,{id:l.id,view:i,onView:o,onSaved:x,onThinking:w,onConnection:v}):l?.kind==="addProvider"?s.jsx(M3,{view:i,onSaved:x,onConnection:v}):l?.kind==="importProviders"?s.jsx(z3,{onSaved:x}):s.jsx(C3,{view:i,notice:h,connectionStatus:p})}function C3({view:n,notice:l,connectionStatus:i}){const o=d=>n.builtin.find(h=>h.id===d)?.name??d,c=d=>d.kind==="builtin"?o(d.id):d.name;return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"服务商",desc:"模型服务商与 API Key。内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。API Key 只保存在本机,保存后不再显示。"}),s.jsx(E3,{}),s.jsxs(ke,{children:[s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>En({kind:"addProvider",title:"添加服务商"}),children:"添加服务商"})}),s.jsx("div",{className:"lbl",children:"已配置的服务商"}),s.jsxs("div",{className:"group-card settings-card",children:[n.providers.map(d=>s.jsxs("button",{className:"list-row setting-row",onClick:()=>En({kind:"provider",id:d.id,title:c(d)}),children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname",children:c(d)}),s.jsx("div",{className:"rprov",children:d.kind==="builtin"?"内置服务商":"兼容接口"})]}),s.jsx("span",{className:d.keyConfigured&&i[d.id]!=="failed"?"note":"badline",children:d.keyConfigured?`${i[d.id]==="connected"?"已连接":i[d.id]==="failed"?"连接失败":"未验证"} · ${n.models[d.id]?.length??0} 个模型`:"未填 Key"}),s.jsx(Q,{name:"chev",size:15,className:"rgo"})]},d.id)),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"importProviders",title:"从本机导入"}),children:[s.jsx(Q,{name:"doc",size:16}),"从本机导入"]})]}),n.providers.length?null:s.jsx(ze,{children:"尚未添加其他服务商。"}),s.jsx("div",{className:"note",children:"从本机导入会只读本机配置并一次性复制到 Hob,不会修改来源。"}),l?s.jsx("div",{className:"okline",children:l}):null]})]})}function E3(){const[n,l]=y.useState(null),[i,o]=y.useState({enabled:!1,plan:"pro",executable:""}),[c,d]=y.useState(!1),[h,m]=y.useState("");async function p(x=!1){d(!0),m("");try{const w=await TN();l(w),x&&o(w.settings.settings.claude??{enabled:!1,plan:"pro",executable:""})}catch(w){m(w instanceof Error?w.message:String(w))}finally{d(!1)}}y.useEffect(()=>{p(!0)},[]);async function g(){d(!0),m("");try{l(await CN(i)),m("已保存")}catch(x){m(x instanceof Error?x.message:String(x))}finally{d(!1)}}const v=n?.status;return s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"Claude 订阅(经本机 Claude Code)"}),s.jsxs("div",{className:"formcard",children:[s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:`tog${i.enabled?"":" off"}`,"aria-label":"启用 Claude 订阅","aria-pressed":i.enabled,disabled:!n||c,onClick:()=>o({...i,enabled:!i.enabled})}),s.jsxs("span",{className:"note",children:[i.enabled?"已启用":"未启用",n&&i.enabled!==(n.settings.settings.claude?.enabled??!1)?"(保存后生效)":""]})]}),s.jsx("div",{className:"lbl sub",children:"状态"}),s.jsx("div",{className:v?.loggedIn?"okline":"badline",role:"status",children:v?v.found?v.error?v.error:v.loggedIn?`已登录${v.version?` · ${v.version}`:""}${v.plan?` · ${v.plan}`:""}${v.email?` · ${v.email}`:""}`:`未登录${v.version?` · ${v.version}`:""},当前不可用。`:"未找到 Claude Code,当前不可用。":"正在检测…"}),v?.found&&!v.loggedIn?s.jsxs("div",{className:"note",children:["请在终端执行 ",s.jsx("code",{children:"claude auth login"}),",然后重新检测。"]}):null,s.jsx("div",{className:"lbl sub",children:"套餐"}),s.jsxs("select",{className:"pick",value:i.plan,disabled:c||!n,onChange:x=>o({...i,plan:x.target.value}),children:[s.jsx("option",{value:"pro",children:"Pro"}),s.jsx("option",{value:"max",children:"Max"})]}),s.jsx("div",{className:"lbl sub",children:"Claude Code 程序路径"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:i.executable,disabled:c||!n,onChange:x=>o({...i,executable:x.target.value}),placeholder:v?.executable||"留空时自动查找"})}),s.jsx("div",{className:"note",children:"用量计入你的 Claude 订阅额度,与 Claude Code 共用。Docker 镜像不支持此功能。"}),s.jsxs("div",{className:"sfoot",children:[s.jsx("button",{className:"hob-btn",disabled:c,onClick:()=>void p(),children:"重新检测"}),h?s.jsx("span",{className:"note",role:"status",children:h}):null,s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:c||!n,onClick:()=>void g(),children:"保存"})]})]})]})}function A3({id:n,view:l,onView:i,onSaved:o,onThinking:c,onConnection:d}){const h=l.providers.find(p=>p.id===n);if(y.useEffect(()=>{h||Gt()},[h]),!h)return null;const m=h.kind==="builtin"?{kind:"builtin",isNew:!1,id:h.id,key:""}:{kind:"custom",isNew:!1,id:h.id,name:h.name,api:h.api,baseUrl:h.baseUrl,key:"",models:h.models};return s.jsx(nk,{view:l,initial:m,onSaved:o,onView:i,onConnection:d,onThinking:(p,g)=>c(n,p,g),extra:s.jsx(R3,{view:l,provider:h,onDeleted:p=>{i(p),Gt()}})})}function M3({view:n,onSaved:l,onConnection:i}){const[o,c]=y.useState(null),[d,h]=y.useState(null),m=n.builtin.filter(g=>!n.providers.some(v=>v.id===g.id));if(o===null)return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:"添加服务商",desc:"内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。"}),s.jsx(ke,{children:s.jsxs("div",{className:"group-card settings-card",children:[s.jsxs("button",{className:"list-row model-row",onClick:()=>c("builtin"),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:"内置服务商"}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"提供完整的模型目录,填写 API Key 即可。"})]}),s.jsxs("button",{className:"list-row model-row",onClick:()=>c("custom"),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:"兼容接口"}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"填写服务地址、协议与模型;模型列表可从接口获取。"})]})]})})]});if(o==="builtin"&&d===null)return s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"subback",onClick:()=>c(null),children:[s.jsx(Q,{name:"left",size:15}),"添加服务商"]}),s.jsx(Qe,{title:"选择内置服务商",desc:"选择服务商后填写 API Key。"}),s.jsx(ke,{children:s.jsx("div",{className:"group-card settings-card",children:m.length?m.map(g=>s.jsxs("button",{className:"list-row model-row",onClick:()=>h(g.id),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:g.name}),s.jsx("span",{className:"sp"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsx("span",{className:"mprev",children:"内置服务商"})]},g.id)):s.jsx(ze,{children:"所有内置服务商均已添加。"})})})]});const p=o==="builtin"?{kind:"builtin",isNew:!0,id:d??"",key:""}:{kind:"custom",isNew:!0,id:"",name:"",api:"openai-completions",baseUrl:"",key:"",models:[]};return s.jsx(nk,{view:n,initial:p,onSaved:l,onConnection:i,onThinking:()=>{}})}function z3({onSaved:n}){const[l,i]=y.useState(null),[o,c]=y.useState(new Set),[d,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{RN().then(x=>{if(!x.ok){p(x.error);return}i(x.view),c(new Set(x.view.items.filter(w=>w.selectable&&!w.exists).map(w=>w.id)))})},[]);const g=x=>c(w=>{const C=new Set(w);return C.has(x)?C.delete(x):C.add(x),C}),v=async()=>{if(d||!o.size)return;h(!0),p(null);const x=[...o],w=await ON(x);if(h(!1),!w.ok){p(w.error);return}n(w.view,`已导入 ${x.length} 个服务商`)};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:"从本机导入",desc:"读取本机其他客户端保存的服务商配置。来源文件只读,导入后 Key 存入 Hob,不再显示。"}),l===null?m?null:s.jsx(ze,{children:"正在读取…"}):s.jsxs(ke,{children:[s.jsxs("div",{className:"sline",children:["来源:",l.source]}),l.items.length?s.jsx("div",{className:"group-card settings-card",style:{marginTop:8},children:l.items.map(x=>s.jsxs("label",{className:`list-row setting-row${x.selectable?"":" gone"}`,children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:o.has(x.id),disabled:!x.selectable||d,onChange:()=>g(x.id)}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[x.id,s.jsxs("span",{className:"rtags",children:[s.jsx("span",{className:"rtag",children:x.kind==="builtin"?"内置服务商":`兼容接口${x.api?` · ${N3[x.api]}`:""}`}),x.models?s.jsxs("span",{className:"rtag",children:[x.models," 个模型"]}):null,x.exists?s.jsx("span",{className:"rtag",children:"将覆盖"}):null]})]}),x.baseUrl?s.jsx("div",{className:"rprov",children:x.baseUrl}):null,s.jsx("div",{className:"rfoot",children:s.jsx("span",{className:x.key==="none"&&!x.note?"rtag bad":"rtag",children:S3[x.key]})}),x.note?s.jsx("div",{className:"note",children:x.note}):null]})]},x.id))}):s.jsx(ze,{children:"未找到可导入的配置。"}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void v(),disabled:d||!o.size,children:d?"正在导入…":"导入所选"}),s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:d,children:"取消"})]})]}),m?s.jsx("div",{className:"badline",children:m}):null]})}function R3({view:n,provider:l,onDeleted:i}){const[o,c]=y.useState(!1),[d,h]=y.useState(null),[m,p]=y.useState(!1),g=["conversation","work"].filter(w=>n.settings.settings.models[w].ref.startsWith(`${l.id}/`)),v=l.kind==="builtin"?n.builtin.find(w=>w.id===l.id)?.name??l.id:l.name,x=async()=>{if(o)return;c(!0),h(null);const w=await MN(l.id);if(c(!1),!w.ok){h(w.error);return}i(w.view)};return s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"危险操作"}),s.jsx("div",{className:"group-card settings-card",children:m?s.jsxs("div",{className:"ctl",style:{padding:12,gap:8,flexWrap:"wrap"},children:[s.jsxs("span",{children:["删除「",v,"」后,该服务商的模型将不可用。",g.length?`受影响的默认模型:${g.map(w=>w==="conversation"?"对话":"任务执行").join("、")}。`:"当前默认模型不受影响。"]}),s.jsx("button",{className:"hob-btn",onClick:()=>p(!1),disabled:o,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void x(),disabled:o,children:"确认删除"})]}):s.jsx("button",{className:"mline danger",onClick:()=>p(!0),disabled:o,children:"删除服务商"})}),d?s.jsx("div",{className:"badline",children:d}):null]})}function nk({view:n,initial:l,onSaved:i,onView:o,onConnection:c,onThinking:d,extra:h}){const m=we(),[p,g]=y.useState(l),[v,x]=y.useState(!1),[w,C]=y.useState(null);y.useEffect(()=>{if(!w||w!=="已保存")return;const _=setTimeout(()=>C(null),3e3);return()=>clearTimeout(_)},[w]);const[T,N]=y.useState([]),[A,M]=y.useState(l.isNew||!n.providers.find(_=>_.id===l.id)?.keyConfigured),[R,O]=y.useState(null),[J,ee]=y.useState(null),[B,k]=y.useState(null),[j,E]=y.useState(!1),U=new Set(n.providers.map(_=>_.id)),X=_=>n.builtin.find(te=>te.id===_)?.name??_,oe=_=>n.models[p.id]?.find(te=>te.id===_),ce=_=>g(te=>({...te,..._})),ye=p.isNew||JSON.stringify(p)!==JSON.stringify(l),Ce=p.kind==="builtin"?{kind:"builtin",id:p.id,...p.key.trim()?{apiKey:p.key.trim()}:{}}:{kind:"custom",...p.id?{id:p.id}:{},api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{}},ue=JSON.stringify(Ce),xe=async()=>{if(j)return;E(!0),k(null),ee(null);const _=await Zx(Ce);if(E(!1),!ye&&p.id&&c(p.id,_?"failed":"connected"),_){O(null),k(_);return}O(ue),ee("连接成功")},ge=_=>{const te=`${p.id}/${_.id}`,ae=m.settings.settings.models,fe=ae.roster.some(tt=>tt.ref===te),ve=ae.conversation.ref===te||ae.work.ref===te;return s.jsxs("label",{className:"ctl",children:[s.jsx("input",{type:"checkbox",checked:fe,disabled:p.isNew||!oe(_.id)||v||j||ve,onChange:()=>{const tt=fe?ae.roster.filter(at=>at.ref!==te):[...ae.roster,{ref:te,note:"",scores:Ph({id:_.id,name:_.name??_.id,reasoning:!!_.reasoning}),scoresConfirmed:!1}];x(!0),C(null),jh({models:{roster:tt}}).then(at=>{x(!1),C(at?"已保存":"保存失败,请重试。")})}}),s.jsx("span",{children:ve?"默认模型已加入":"加入可用模型"})]})},Re=async()=>{if(p.kind!=="custom"||j)return;E(!0),k(null);const _=await zN({api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{},...p.id?{id:p.id}:{}});if(E(!1),!_.ok){k(_.error),N([]);return}N(_.models)},Te=async _=>{if(p.kind!=="custom")return;if(p.isNew){ce({models:_});return}const te=n.providers.find(at=>at.id===p.id);if(!te||te.kind!=="custom")return;E(!0),k(null);const{id:ae,keyConfigured:fe,...ve}=te,tt=await Xx(ae,{...ve,models:_});if(E(!1),!tt.ok){k(tt.error);return}ce({models:_}),o?.(tt.view),C("已保存")},pt=_=>{if(p.kind!=="custom")return;const te=p.models.some(ae=>ae.id===_.id);Te(te?p.models.filter(ae=>ae.id!==_.id):[...p.models,{id:_.id,..._.name?{name:_.name}:{}}])},wt=_=>{if(p.kind!=="custom")return;const te=_.trim();!te||p.models.some(ae=>ae.id===te)||Te([...p.models,{id:te}])},gt=(_,te)=>{p.kind==="custom"&&Te(p.models.map(ae=>ae.id===_?{...ae,...te}:ae))},$=_=>{const te=n.models[_]??[];return te.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"模型"}),s.jsx("div",{className:"group-card settings-card",children:te.map(ae=>s.jsx("div",{className:"list-row setting-row",children:s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[ae.name,s.jsx("span",{className:"rtags",children:s.jsx("span",{className:"rtag mono",children:ae.id})})]}),s.jsxs("div",{className:"caps",children:[ae.input?.includes("image")?s.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:s.jsx(Q,{name:"image",size:14})}):null,ae.reasoning?s.jsx("span",{title:"支持推理","aria-label":"支持推理",children:s.jsx(Q,{name:"bulb",size:14})}):null,ae.contextWindow?s.jsx("span",{className:"ctx",children:Fh(ae.contextWindow)}):null]}),ge(ae),ae.reasoning?s.jsx(a0,{modelRef:ae.ref,info:ae,disabled:j,onSaved:d}):s.jsx("div",{className:"note",children:"不推理,没有思考档。"})]})},ae.id))}),s.jsx("div",{className:"note",children:"模型由服务商提供。会推理的模型可以改每个思考档发给服务商的字符。"})]}):null},le=async()=>{if(j)return;E(!0),k(null);const _=n.providers.find(ve=>ve.id===p.id),te=p.kind==="builtin"?{kind:"builtin",...p.key.trim()?{key:p.key.trim()}:{}}:{kind:"custom",name:p.name.trim(),api:p.api,baseUrl:p.baseUrl.trim(),models:p.models,..._?.kind==="custom"&&_.extra?{extra:_.extra}:{},...p.key.trim()?{key:p.key.trim()}:{}},ae=p.kind==="custom"&&p.isNew?p.id.trim()||qf(p.name):p.id;if(!ae){E(!1),k("保存失败:请填写标识。模型引用使用该标识,只能包含小写字母、数字、点和短横线,例如 my-proxy。");return}if(p.isNew&&U.has(ae)){E(!1),k("该服务商标识已存在,请使用其他标识。");return}if(R!==ue){ee("正在验证连接…");const ve=await Zx(Ce);if(ee(null),ve){E(!1),k(`测试连接失败:${ve}`);return}}const fe=await Xx(ae,te);if(E(!1),!fe.ok){k(fe.error);return}c(ae,"connected"),i(fe.view,"已保存")},L=p.kind==="builtin"?p.isNew?"添加内置服务商":X(p.id):p.isNew?"添加兼容接口":p.name||"兼容接口",Y=p.kind==="builtin"?p.id:p.id||qf(p.name);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"服务商"}),s.jsx(Qe,{title:L,desc:Y?s.jsx("span",{className:"mono",children:Y}):null}),p.kind==="builtin"?s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"服务商"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick grow",value:p.id,onChange:_=>ce({id:_.target.value}),disabled:!0,children:n.builtin.filter(_=>!p.isNew||!U.has(_.id)).map(_=>s.jsxs("option",{value:_.id,children:[_.name,U.has(_.id)?"(已配置)":""]},_.id))})}),s.jsx("div",{className:"lbl sub",children:"API Key"}),A?s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(_=>_.id===p.id)?.keyConfigured?"已保存,留空不变":"sk-…",onChange:_=>ce({key:_.target.value}),disabled:j})}):s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:"已保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>M(!0),children:"更换"})]}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",disabled:j,onClick:()=>void xe(),children:"测试连接"}),s.jsx("span",{className:"note",children:"测试会请求模型,可能产生费用。"}),J&&R===ue?s.jsx("span",{className:"okline",children:J}):null]}),s.jsx(i0,{busy:j,error:B,dirty:ye,onCancel:Gt,onSave:()=>void le()})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"连接"}),s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl sub",children:"名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.name,placeholder:"如「我的代理」",onChange:_=>ce({name:_.target.value}),disabled:j})}),p.isNew?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl sub",children:"标识"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.id,placeholder:qf(p.name)||"my-proxy",onChange:_=>ce({id:_.target.value}),disabled:j})}),s.jsx("div",{className:"note",children:"模型引用使用该标识,例如 my-proxy/gpt-x。留空则按名称自动生成。"})]}):s.jsxs("div",{className:"note mono",children:["标识:",p.id]}),s.jsx("div",{className:"lbl sub",children:"协议"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick grow",value:p.api,onChange:_=>ce({api:_.target.value}),disabled:j,children:tk.map(_=>s.jsx("option",{value:_.key,children:_.label},_.key))})}),s.jsx("div",{className:"lbl sub",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:p.baseUrl,placeholder:"http://127.0.0.1:8080/v1",onChange:_=>ce({baseUrl:_.target.value}),disabled:j})}),s.jsx("div",{className:"lbl sub",children:"API Key"}),A?s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(_=>_.id===p.id)?.keyConfigured?"已保存,留空不变":"sk-…",onChange:_=>ce({key:_.target.value}),disabled:j})}):s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:"已保存"}),s.jsx("button",{className:"hob-btn",onClick:()=>M(!0),children:"更换"})]}),s.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap"},children:[s.jsx("button",{className:"hob-btn",disabled:j||!p.baseUrl.trim(),onClick:()=>void xe(),children:"测试连接"}),J&&R===ue?s.jsx("span",{className:"okline",children:J}):null,s.jsx("button",{className:"hob-btn",onClick:()=>void Re(),disabled:j||!p.baseUrl.trim(),children:j?"正在获取…":"获取模型列表"}),s.jsx("span",{className:"note",children:"从接口获取模型列表,选择需要使用的模型。"})]}),s.jsx(i0,{busy:j,error:B,dirty:ye,onCancel:Gt,onSave:()=>void le()})]})]}),T.length?s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"接口上的模型"}),s.jsx("div",{className:"chips",children:T.map(_=>{const te=p.models.some(ae=>ae.id===_.id);return s.jsx("button",{className:`chip${te?" on":""}`,onClick:()=>pt(_),disabled:j,children:_.name??_.id},_.id)})}),s.jsx("div",{className:"note",children:"点击添加或移除,添加后可在下方修改模型能力。"})]}):null,s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"模型"}),p.models.length?s.jsx("div",{className:"group-card settings-card",children:p.models.map(_=>s.jsxs("div",{className:"list-row setting-row",children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname mono",children:_.id}),s.jsxs("div",{className:"rfoot",children:[s.jsx("button",{className:`chip${_.input?.includes("image")?" on":""}`,onClick:()=>gt(_.id,{input:_.input?.includes("image")?["text"]:["text","image"]}),disabled:j,children:"支持图片输入"}),s.jsx("button",{className:`chip${_.reasoning?" on":""}`,onClick:()=>gt(_.id,{reasoning:!_.reasoning}),disabled:j,children:"支持推理"}),s.jsx("span",{className:"rtag",children:"上下文"}),s.jsx("input",{className:"pmctx",type:"number",min:1,defaultValue:_.contextWindow??cc,title:"上下文窗口(token)",onBlur:te=>{const ae=Number(te.target.value)||cc;ae!==(_.contextWindow??cc)&&gt(_.id,{contextWindow:ae})},onKeyDown:te=>{te.key==="Enter"&&te.currentTarget.blur()},disabled:j},`${_.id}:${_.contextWindow??cc}`)]}),ge(_),_.reasoning?oe(_.id)?s.jsx(a0,{modelRef:`${p.id}/${_.id}`,info:oe(_.id),disabled:j,onSaved:d}):s.jsx("div",{className:"note",children:"保存服务商后可以设置思考档。"}):null]}),s.jsx("button",{className:"rremove",title:"移除该模型",disabled:j,onClick:()=>void Te(p.models.filter(te=>te.id!==_.id)),children:s.jsx(Q,{name:"close",size:13})})]},_.id))}):s.jsx(ze,{children:"尚未添加模型。可获取模型列表后勾选,或手动填写模型 ID。"}),s.jsx(O3,{disabled:j,onAdd:wt})]})]}),p.kind==="builtin"&&!p.isNew?s.jsx(ke,{children:$(p.id)}):null,w?s.jsx("div",{className:w==="已保存"?"okline":"badline",role:"status",children:w}):null,h]})}function O3({disabled:n,onAdd:l}){const[i,o]=y.useState(""),c=()=>{i.trim()&&(l(i),o(""))};return s.jsxs("div",{className:"ctl",style:{gap:8,marginTop:10},children:[s.jsx("div",{className:"field",style:{flex:1},children:s.jsx("input",{value:i,placeholder:"手动填写模型 ID,如 gpt-4o-mini",onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c()},disabled:n})}),s.jsx("button",{className:"hob-btn",onClick:c,disabled:n||!i.trim(),children:"添加"})]})}function i0({busy:n,error:l,dirty:i,onCancel:o,onSave:c}){return s.jsxs(qn,{saved:!1,error:l,children:[!l&&i?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",onClick:o,disabled:n,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:c,disabled:n||!i,children:n?"正在验证…":"保存"})]})}function _3(){const n=we(),[l,i]=y.useState(null);return y.useEffect(()=>{wh().then(i)},[]),l?n.sub?.kind==="model"?s.jsx($3,{view:l,modelRef:n.sub.ref}):n.sub?.kind==="addModels"?s.jsx(U3,{view:l}):s.jsx(D3,{view:l}):s.jsx(ze,{children:"正在读取模型列表…"})}function ph(n,l){return{scores:n.scores??Ph(l??{id:n.ref.split("/").at(-1)??n.ref,name:"",reasoning:!1}),unconfirmed:!n.scores||n.scoresConfirmed!==!0}}function sk({entry:n,info:l,update:i,collapsible:o=!1}){const c=ph(n,l),[d,h]=y.useState(!o||c.unconfirmed),[m,p]=y.useState(c.scores),[g,v]=y.useState(n.note),x=y.useRef(!1),w=y.useRef(m);w.current=m,y.useEffect(()=>{x.current||p(ph(n,l).scores)},[n.scores,l]),y.useEffect(()=>v(n.note),[n.note]);const C=A=>i({scores:A,scoresConfirmed:!0}),T=()=>{if(!x.current)return;x.current=!1;const A=n.scores,M=w.current;(!A||n.scoresConfirmed!==!0||A.smart!==M.smart||A.cost!==M.cost||A.speed!==M.speed)&&C(M)};if(!d)return s.jsxs("div",{className:"ctl",children:[s.jsx("span",{className:"note",children:Py(n.scores??m)}),s.jsx("button",{className:"hob-btn",onClick:()=>h(!0),children:"修改"})]});const N={smart:"聪明程度",cost:"成本",speed:"速度"};return s.jsxs("div",{className:"group",children:[s.jsxs("div",{className:"note",children:["Hob 按用途选择分派任务的模型。",c.unconfirmed?"数值按模型名称推测,请确认。":""]}),Object.keys(N).map(A=>s.jsxs("div",{className:"score-row",children:[s.jsxs("div",{className:"score-head",children:[s.jsx("label",{htmlFor:`${n.ref}-${A}`,children:N[A]}),s.jsxs("span",{children:[e0(A,m[A])," · ",m[A],"%"]})]}),s.jsx("input",{id:`${n.ref}-${A}`,className:"score-range",type:"range",min:"0",max:"100",step:"5",value:m[A],onChange:M=>{x.current=!0,p({...w.current,[A]:Number(M.target.value)})},onPointerUp:T,onTouchEnd:T,onKeyUp:T,onBlur:T}),s.jsx("div",{className:"score-ticks",children:Jy[A].map(M=>s.jsx("button",{style:{left:`${M.value}%`},className:M.value===0?"first":M.value===100?"last":void 0,"aria-pressed":M.label===e0(A,m[A]),onClick:()=>{const R={...w.current,[A]:M.value};p(R),C(R)},children:M.label},M.value))})]},A)),s.jsx("div",{className:"field",children:s.jsx("input",{value:g,onChange:A=>v(A.target.value),onBlur:()=>{g!==n.note&&i({note:g})},onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()},placeholder:"补充说明(选填),如「中文写作特别好」"})}),o?s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"收起"})}):null]})}function Wh(){const l=we().settings.settings.models,i=La(),o=m=>void i.save({models:m});return{models:l,save:o,setRoster:m=>o({roster:m}),update:(m,p)=>void i.save(g=>({models:{roster:g.models.roster.map(v=>v.ref===m?{...v,...p}:v)}})),roles:m=>[l.conversation.ref===m?"对话":null,l.work.ref===m?"任务执行":null].filter(p=>p!==null),feedback:i}}function hn({label:n="模型"}){return s.jsxs("button",{className:"subback",onClick:Gt,children:[s.jsx(Q,{name:"left",size:15}),n]})}function D3({view:n}){const{models:l,save:i,roles:o,feedback:c}=Wh(),d=new Map(n.models.map(p=>[p.ref,p])),h=p=>[...l.roster.length?[]:[{value:"",text:"未设置"}],...l.roster.filter(g=>d.has(g.ref)||g.ref===p).map(g=>({value:g.ref,text:d.get(g.ref)?.name??g.ref}))],m=(p,g,v)=>s.jsxs("div",{className:"mline",children:[s.jsx("span",{className:"k",children:g}),s.jsxs("span",{className:"vals",children:[s.jsx(Fy,{value:l[p].ref,label:v,options:h(l[p].ref),onChange:x=>i({[p]:{ref:x,thinking:dr(d.get(x),l[p].thinking)}})}),s.jsx(Wy,{value:dr(d.get(l[p].ref),l[p].thinking),model:d.get(l[p].ref),onChange:x=>i({[p]:{...l[p],thinking:x}})})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"模型",desc:"可用模型来自「服务商」,默认模型从可用模型中选择。"}),s.jsx(Cn,{message:c.message,toast:!0}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"默认模型"}),s.jsxs("div",{className:"group-card settings-card",children:[m("conversation","对话","对话模型"),m("work","任务执行","默认任务模型")]}),s.jsx("div",{className:"note",children:"助手分派任务时未指定模型,使用任务执行的模型。"}),s.jsx("div",{className:"lbl",children:"任务的思考档"}),s.jsx(Bn,{items:[{key:"auto",label:"助手按任务选择"},{key:"fixed",label:"固定使用默认档"}],value:l.thinkingChoice??"auto",disabled:c.busy,onChange:p=>i({thinkingChoice:p})}),s.jsx("div",{className:"note",children:"按任务选择时,助手会给简单的活用低档、复杂的活用高档;固定时一律使用上面设置的默认档。"})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"可用模型"}),s.jsxs("div",{className:"group-card settings-card",children:[l.roster.map(p=>{const g=d.get(p.ref),v=g?.name??p.ref,x=ph(p,g);return s.jsxs("button",{className:`list-row model-row${g?"":" gone"}`,onClick:()=>En({kind:"model",ref:p.ref,title:v}),children:[s.jsxs("span",{className:"mtop",children:[s.jsx("span",{className:"mname",children:v}),s.jsx("span",{className:"sp"}),g?s.jsx(ek,{info:g}):s.jsx("span",{className:"mbad",children:"不可用"}),s.jsx(Q,{name:"chev",size:14})]}),s.jsxs("span",{className:"mprev",children:[o(p.ref).map(w=>s.jsx("span",{className:"mrole",children:w},w)),Py(x.scores),x.unconfirmed?s.jsx("span",{className:"model-use-warning",children:"请确认用途"}):null,g?null:" · 该模型的服务商已删除或未配置 Key"]})]},p.ref)}),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"addModels",title:"添加模型"}),children:[s.jsx(Q,{name:"plus",size:16}),"添加模型"]})]}),s.jsx("div",{className:"note",children:"助手分派任务时,按用途说明在可用模型中选择。"})]})]})}function $3({view:n,modelRef:l}){const{models:i,setRoster:o,update:c,roles:d,feedback:h}=Wh(),[m,p]=y.useState(!1),g=i.roster.find(w=>w.ref===l);if(y.useEffect(()=>{g||Gt()},[g]),!g)return null;const v=n.models.find(w=>w.ref===l),x=d(l);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{}),s.jsx(Qe,{title:v?.name??l,desc:s.jsx("span",{className:"mono",children:l})}),s.jsx(Cn,{message:h.message,toast:!0}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"用途说明"}),s.jsx(sk,{entry:g,info:v,update:w=>c(l,w)})]}),v?.reasoning?s.jsxs(ke,{children:[s.jsx("div",{className:"group-card settings-card",children:s.jsxs("div",{className:"mline",children:[s.jsx("span",{className:"k",children:"分派时的思考强度"}),s.jsx(Wy,{value:dr(v,g.thinking??i.work.thinking),model:v,onChange:w=>c(l,{thinking:w})})]})}),s.jsx("div",{className:"note",children:"助手把任务分派给这个模型时使用。作为默认模型时,以「默认模型」中的设置为准。"})]}):null,s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"信息"}),s.jsxs("div",{className:"kvcard",children:[s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:"服务商"}),s.jsx("span",{className:"v",children:v?.provider??"不可用"})]}),v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"kvrow",children:[s.jsxs("span",{className:"k kicon",children:[s.jsx(Q,{name:"image",size:14}),"图片输入"]}),s.jsx("span",{className:"v",children:v.input.includes("image")?"支持":"不支持"})]}),s.jsxs("div",{className:"kvrow",children:[s.jsxs("span",{className:"k kicon",children:[s.jsx(Q,{name:"bulb",size:14}),"推理"]}),s.jsx("span",{className:"v",children:v.reasoning?"支持":"不支持"})]}),s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:"上下文"}),s.jsx("span",{className:"v",children:Fh(v.contextWindow)})]})]}):null]})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"危险操作"}),s.jsx("div",{className:"group-card settings-card",children:m?s.jsxs("div",{className:"ctl",style:{flexWrap:"wrap",padding:12},children:[s.jsx("span",{children:"确定从可用模型中移除?"}),s.jsx("button",{className:"hob-btn",onClick:()=>p(!1),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>o(i.roster.filter(w=>w.ref!==l)),children:"确认移除"})]}):s.jsx("button",{className:"mline danger",disabled:x.length>0,onClick:()=>p(!0),children:"从可用模型中移除"})}),x.length?s.jsxs("div",{className:"note",children:["这是",x.join("和"),"的默认模型。要移除,请先在「默认模型」中更换。"]}):null]})]})}function U3({view:n}){const{models:l,setRoster:i,roles:o,update:c,feedback:d}=Wh(),[h,m]=y.useState(""),p=new Set(l.roster.map(N=>N.ref)),[g,v]=y.useState(()=>[...new Set(n.models.filter(N=>p.has(N.ref)).map(N=>N.provider))]),x=LE(UE(n.models,h)),w=h.trim().length>0,C=N=>v(A=>A.includes(N)?A.filter(M=>M!==N):[...A,N]),T=N=>i(p.has(N.ref)?l.roster.filter(A=>A.ref!==N.ref):[...l.roster,{ref:N.ref,scores:Ph(N),note:"",scoresConfirmed:!1,...N.reasoning?{thinking:dr(N,"medium")}:{}}]);return s.jsxs(s.Fragment,{children:[s.jsx(hn,{}),s.jsx(Qe,{title:"添加模型",desc:"「服务商」提供的全部模型,打勾的已在可用模型中。"}),s.jsx(Cn,{message:d.message,toast:!0}),n.models.length===0?s.jsxs(ke,{children:[s.jsx(ze,{children:"尚无可用模型。请先在「服务商」中配置服务商并填写 API Key。"}),s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>Rl("providers"),children:"配置服务商"})})]}):s.jsxs("div",{className:"group-card settings-card",children:[s.jsxs("label",{className:"mfind",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{value:h,placeholder:"搜索名称或引用,如 claude",onChange:N=>m(N.target.value)})]}),x.length===0?s.jsx(ze,{children:"没有匹配的模型。"}):x.map(N=>{const A=w||g.includes(N.provider),M=N.models.filter(R=>p.has(R.ref)).length;return s.jsxs(y.Fragment,{children:[s.jsxs("button",{className:"mgroup","aria-expanded":A,onClick:()=>C(N.provider),children:[s.jsx("span",{className:"n",children:N.provider}),s.jsx("span",{className:"c",children:M?`已加入 ${M} / ${N.models.length}`:N.models.length}),s.jsx(Q,{name:A?"down":"chev",size:14})]}),A?N.models.map(R=>{const O=p.has(R.ref),J=o(R.ref).length>0,ee=l.roster.find(B=>B.ref===R.ref);return s.jsxs("div",{children:[s.jsxs("button",{className:`madd${O?" on":""}`,disabled:J,title:J?"默认模型不能在这里移除":O?"从可用模型中移除":"加入可用模型",onClick:()=>T(R),children:[s.jsx("span",{className:"mname",children:R.name}),s.jsx(ek,{info:R}),s.jsx(Q,{name:O?"check":"plus",size:16,className:"mtog"})]}),ee?s.jsx("div",{className:"model-use-inline",children:s.jsx(sk,{entry:ee,info:R,collapsible:!0,update:B=>c(R.ref,B)})}):null]},R.ref)}):null]},N.provider)})]})]})}function L3(){const l=we().settings.settings.work,i=La(),o=c=>i.save({work:c});return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"任务",desc:"任务并行数、无响应判定时间,以及全部任务的任务记录。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"最大并行任务数"}),s.jsx("div",{className:"ctl",children:s.jsx("select",{className:"pick",value:l.maxJobs,disabled:i.busy,onChange:c=>void o({maxJobs:Number(c.target.value)}),children:[1,2,3,4,5,6,7,8].map(c=>s.jsx("option",{value:c,children:c},c))})}),s.jsx("div",{className:"note",children:"同时运行的最大任务数,超出后排队。"}),s.jsx(Cn,{message:i.message})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"无响应判定时间"}),s.jsx("div",{className:"lbl sub",children:"任务"}),s.jsxs("div",{className:"ctl",children:[s.jsx(Ha,{value:String(l.jobStallMinutes),onSave:c=>o({jobStallMinutes:Number(c)})}),s.jsx("span",{className:"note",children:"分钟"})]}),s.jsx("div",{className:"lbl sub",children:"助手回复"}),s.jsxs("div",{className:"ctl",children:[s.jsx(Ha,{value:String(l.routerStallMinutes),onSave:c=>o({routerStallMinutes:Number(c)})}),s.jsx("span",{className:"note",children:"分钟"})]}),s.jsx(Cn,{message:i.message}),s.jsx("div",{className:"note",children:"修改后立即生效,无需重启。"})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"任务记录"}),s.jsx("div",{className:"ctl",children:s.jsx("button",{className:"hob-btn",onClick:()=>B0(),children:"查看全部任务"})}),s.jsx("div",{className:"note",children:"可查看每个任务的完整执行过程。"})]})]})}function H3(){const n=we(),l=La(),[i,o]=y.useState(null),[c,d]=y.useState(null),[h,m]=y.useState(null),[p,g]=y.useState(null),[v,x]=y.useState(!1),[w,C]=y.useState(null),[T,N]=y.useState(null),A=xh(),M=()=>void bh().then(k=>m(k?.endpoint??null));if(y.useEffect(()=>{lr().then(k=>k.ok?o(k.view):d(k.error)),M()},[]),c)return s.jsx("div",{className:"note",children:c});if(!i)return s.jsx(ze,{children:"正在读取推送设置…"});const R=typeof Notification<"u"&&Notification.permission==="denied",O=!!(h&&i.devices.some(k=>k.endpoint===h)),J=async()=>{if(!v){x(!0),C(null),N(null);try{const k=O?await iS():await aS();if(!k.ok){C(k.error);return}o(k.view),M(),N(O?"此设备将不再接收推送":"此设备将接收推送")}finally{x(!1)}}},ee=async k=>{const j=await A0(k);if(!j.ok){C(j.error);return}o(j.view),g(null),M()},B=async()=>{if(!v){x(!0),C(null),N(null);try{const k=await oS();if(!k.ok){C(k.error);return}k.sent?N("测试通知已发送"):k.removed?(C("这台设备的订阅已失效,已移除;请重新开启本机推送"),lr().then(j=>j.ok&&o(j.view))):N("未发送:这台设备尚未订阅")}finally{x(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"通知",desc:"本机推送与已订阅的设备。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"本机推送"}),A?s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"需要确认或任务受阻时推送给我"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${O?"":" off"}`,title:O?"关闭本机推送":"开启本机推送",onClick:()=>void J(),disabled:v})]}):s.jsx("div",{className:"note",children:"这个浏览器不支持推送:请使用 Chrome、Edge、Safari 16.4+,或在 iPhone 上将 Hob 添加到主屏幕。"}),R?s.jsx("div",{className:"note",children:"浏览器已拒绝通知权限:点击地址栏左侧的图标 → 通知 → 允许,然后刷新本页并重新开启。"}):null,s.jsx("div",{className:"note",children:"页面在前台时不推送,页面不在前台或锁屏时才推送。各助手还需在助手设置中开启「需要确认时通知我」。"}),s.jsx("div",{className:"note",children:"在 iPhone 上需先将 Hob 添加到主屏幕,再从主屏幕打开才能接收推送。"})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"已订阅的设备"}),i.devices.length?i.devices.map(k=>s.jsxs("div",{className:"dev",children:[s.jsx("span",{className:"n",children:k.label}),s.jsx("span",{className:"tm",children:Dt(k.createdAt)}),s.jsx("span",{className:"sp"}),p===k.endpoint?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"note",children:"确认删除?"}),s.jsx("button",{className:"hob-btn",onClick:()=>g(null),children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void ee(k.endpoint),children:"确认删除"})]}):s.jsx("button",{className:"del",title:"删除这台设备",onClick:()=>g(k.endpoint),children:"删除"})]},k.endpoint)):s.jsx(ze,{children:"暂无已订阅的设备"}),s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void B(),disabled:v||!i.devices.length,children:"发送测试通知"}),T&&!w?s.jsx("span",{className:"okline",children:T}):null,w?s.jsx("span",{className:"badline",children:w}):null]})]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"推送服务联系邮箱(选填)"}),s.jsx(Ha,{placeholder:"name@example.com",value:n.settings.settings.push.email,onSave:k=>l.save({push:{email:k.trim()}})}),s.jsx(Cn,{message:l.message}),s.jsx("div",{className:"note",children:"推送服务使用此地址联系你;留空使用 Hob 的项目主页。"})]})]})}const Wi="https://api.loremem.com",B3={saas:"https://app.loremem.com/login"},q3=[{key:"saas",label:"Lore 云服务"},{key:"self",label:"自部署"}],I3=[{key:"local",label:"本地记忆"},{key:"lore",label:"Lore"},{key:"off",label:"关闭"}],r0={invalid_url:"服务地址无效。",insecure_http:"公网地址必须使用 https,明文 http 仅允许本机或局域网地址。",missing_token:"缺少 API Token。",unauthorized:"API Token 被拒绝。",unreachable:"无法连接该地址。"},gh=n=>n.trim().replace(/\/+$/,"");function o0(n){return n===null||gh(n)===Wi?"saas":"self"}function Y3(){const[n,l]=y.useState(null),[i,o]=y.useState(null),[c,d]=y.useState(null),[h,m]=y.useState("saas"),[p,g]=y.useState(Wi),[v,x]=y.useState(""),[w,C]=y.useState(!1),[T,N]=y.useState(!1),[A,M]=y.useState(null),[R,O]=y.useState(!1),[J,ee]=y.useState(null),[B,k]=y.useState(!1),[j,E]=y.useState(null),[U,X]=y.useState(null),[oe,ce]=y.useState(!1);y.useEffect(()=>{if(!B)return;const L=setTimeout(()=>k(!1),3e3);return()=>clearTimeout(L)},[B]);const ye=L=>{l(L),o(null),d(null),m(o0(L.lore.baseUrl)),g(L.lore.baseUrl??Wi),x(""),C(!1),N(!1),M(null),ee(null),k(!1)};if(y.useEffect(()=>{Tf().then(L=>{L.ok?ye(L.config):o(L.error)})},[]),i)return s.jsx("div",{className:"note",children:i});if(!n)return s.jsx(ze,{children:"正在读取记忆设置…"});const Ce=c??n.provider,ue=n.lore.tokenConfigured&&gh(p)===gh(n.lore.baseUrl??""),xe=c==="lore"&&!w?n.lore.configured:T,ge=c!==null||w,Re=async L=>{if(R)return;if(L===n.provider){d(null);return}if(ee(null),k(!1),L==="lore"&&!n.lore.configured){d("lore");return}O(!0);const Y=await Px(n.revision,L);if(O(!1),!Y.ok){ee(Y.error);return}ye(Y.config),k(!0)},Te=L=>{R||(L(),C(!0),N(!1),M(null),ee(null),k(!1))},pt=L=>Te(()=>{m(L),g(L==="saas"?Wi:o0(n.lore.baseUrl)==="self"?n.lore.baseUrl??"":"")}),wt=async()=>{if(R)return;O(!0),X(null),ce(!1);const L=await sS();if(!L.ok){O(!1),X(L.error);return}if(E({source:L.view.source,found:L.view.found}),!L.view.found){O(!1);return}const Y=await lS();if(O(!1),!Y.ok){X(Y.error);return}ye(Y.config),d("lore"),ce(!0)},gt=async()=>{if(R)return;O(!0),M(null);const L={baseUrl:p.trim(),...v?{token:v}:{}},Y=await Fx(L);if(O(!1),!Y.ok){M({ok:!1,text:Y.error});return}Y.result.ok?(N(!0),M({ok:!0,text:"已连接"})):M({ok:!1,text:r0[Y.result.reason]})},$=async()=>{if(R||!ge)return;if(O(!0),ee(null),Ce==="lore"&&!xe){const _=await Fx({baseUrl:p.trim(),...v?{token:v}:{}});if(!_.ok){O(!1),ee(_.error);return}if(!_.result.ok){O(!1),ee(r0[_.result.reason]);return}N(!0)}let L=n;if(Ce==="lore"&&w){const _=await nS({baseUrl:p.trim(),...v?{token:v}:{}});if(!_.ok){O(!1),ee(_.error);return}L=_.config}const Y=await Px(L.revision,Ce);if(O(!1),!Y.ok){ee(Y.error),/已刷新/.test(Y.error)&&Tf().then(_=>_.ok&&ye(_.config));return}ye(Y.config),k(!0)},le=n.provider==="lore"?n.lore.configured?`Lore · 已连接 · 插件 ${n.lorePlugin}`:"Lore · 尚未配置完成:请填写服务地址与 API Token 后保存":n.provider==="local"?"本地记忆 · 已启用":"关闭 · 助手不使用长期记忆";return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"记忆",desc:"所有助手共用同一份长期记忆。各助手需要知道的专属事实写在助手设置的「补充说明」中。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"提供者"}),s.jsx(Bn,{items:I3,value:Ce,onChange:L=>void Re(L),disabled:R}),s.jsx("div",{className:"sline",children:le}),s.jsx(Cn,{message:J??(B?"已保存":null)})]}),Ce==="lore"?s.jsxs(s.Fragment,{children:[s.jsx(ke,{children:s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"部署方式"}),s.jsx(Bn,{items:q3,value:h,onChange:pt,disabled:R}),s.jsx("div",{className:"lbl",children:"服务地址"}),h==="saas"?s.jsx("div",{className:"field ro",children:Wi}):s.jsx("div",{className:"field",children:s.jsx("input",{value:p,placeholder:"http://192.168.1.10:18901",onChange:L=>Te(()=>g(L.target.value)),disabled:R})}),s.jsxs("div",{className:"lblrow",children:[s.jsx("span",{className:"lbl",children:"Token"}),s.jsx("a",{className:"link",href:B3.saas,target:"_blank",rel:"noreferrer",children:"注册 / 登录 Lore"})]}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:v,placeholder:ue?"已保存,留空不变":"lm_…",onChange:L=>Te(()=>x(L.target.value)),disabled:R})}),s.jsxs(qn,{saved:B&&!ge,error:J,lead:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-btn",onClick:()=>void gt(),disabled:R||p.trim()==="",children:"测试连接"}),A?s.jsx("span",{className:A.ok?"okline":"badline",children:A.text}):null]}),children:[!J&&ge?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",onClick:()=>void Tf().then(L=>L.ok?ye(L.config):o(L.error)),disabled:R||!ge,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void $(),disabled:R||!ge,children:R?"正在验证…":"保存"})]})]})}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"本机配置"}),s.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[s.jsx("button",{className:"hob-btn",onClick:()=>void wt(),disabled:R,children:R?"正在导入…":"从本机导入"}),oe?s.jsx("span",{className:"okline",children:"已导入本机的连接"}):null]}),s.jsx("div",{className:"note",children:"读取这台电脑上已保存的 Lore 连接,导入后无需重新填写。"}),j?s.jsxs("div",{className:"sline",children:["来源:",j.source]}):null,j&&!j.found?s.jsx("div",{className:"note",children:"未找到可导入的配置。"}):null,U?s.jsx("div",{className:"badline",children:U}):null]})]}):null]})}const G3=[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],K3=["1024x1024","1536x1024","1024x1536","512x512"],lk=n=>n.trim().replace(/\/+$/,"");function X3(){const l=we().settings.settings.knowledge?.embedding??{source:"off"},[i,o]=y.useState(l.source),[c,d]=y.useState(l.source==="openai"?l.baseUrl:""),[h,m]=y.useState(l.source==="openai"?l.model:""),[p,g]=y.useState(""),[v,x]=y.useState(!1),[w,C]=y.useState(!1),[T,N]=y.useState(null);y.useEffect(()=>{JN().then(R=>x(R.keyConfigured)).catch(R=>N({ok:!1,text:`读取设置失败:${R instanceof Error?R.message:String(R)}`}))},[]);const A=i==="off"?{source:"off"}:{source:"openai",baseUrl:lk(c),model:h.trim()},M=async R=>{C(!0),N(null);try{if(R){const O=await FN(A,p.trim()||void 0);x(O.keyConfigured),g(""),N({ok:!0,text:"已保存"})}else{const O=await PN({embedding:A,...p.trim()?{apiKey:p.trim()}:{}});N(O.ok?{ok:!0,text:`连接成功 · ${O.dims} 维`}:{ok:!1,text:O.error})}}catch(O){N({ok:!1,text:O instanceof Error?O.message:String(O)})}finally{C(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"知识库",desc:"配置向量模型,关闭时只按关键词查找。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"向量模型"}),s.jsx(Bn,{items:[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],value:i,onChange:o,disabled:w})]}),i==="openai"?s.jsxs(ke,{children:[s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"服务地址",value:c,onChange:R=>d(R.target.value),disabled:w,placeholder:"http://127.0.0.1:8080/v1"})}),s.jsx("div",{className:"lbl",children:"模型名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"模型名称",value:h,onChange:R=>m(R.target.value),disabled:w})}),s.jsx("div",{className:"lbl",children:"API Key"}),s.jsx("div",{className:"field",children:s.jsx("input",{"aria-label":"API Key",type:"password",value:p,onChange:R=>g(R.target.value),disabled:w,placeholder:v?"已保存,留空不变":"请输入 API Key"})}),s.jsx(qn,{saved:T?.text==="已保存",error:null,lead:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"hob-btn",disabled:w,onClick:()=>void M(!1),children:"测试连接"}),T&&T.text!=="已保存"?s.jsx("span",{className:T.ok?"okline":"badline",role:"status",children:T.text}):null]}),children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w,onClick:()=>void M(!0),children:"保存"})})]}),s.jsx("div",{className:"note",children:"建索引和查询时,文件内容和问题会发给这个接口。"})]}):s.jsx(qn,{saved:T?.text==="已保存",error:T?.ok===!1?T.text:null,children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:w,onClick:()=>void M(!0),children:"保存"})})]})}function Z3(){const l=we().settings.settings.image,[i,o]=y.useState(l.source),[c,d]=y.useState(l.source==="openai"?l.baseUrl:""),[h,m]=y.useState(l.source==="openai"?l.model:""),[p,g]=y.useState(l.source==="openai"?l.size??"":""),[v,x]=y.useState(""),[w,C]=y.useState(!1),[T,N]=y.useState(null),[A,M]=y.useState(null),[R,O]=y.useState(!1),[J,ee]=y.useState(null),[B,k]=y.useState(null);y.useEffect(()=>{if(!J)return;const ce=setTimeout(()=>ee(null),3e3);return()=>clearTimeout(ce)},[J]),y.useEffect(()=>{tS().then(ce=>{ce&&C(ce.keyConfigured)})},[]);const j=i==="openai"?{source:"openai",baseUrl:lk(c),model:h.trim(),...p?{size:p}:{}}:{source:"off"},E=JSON.stringify(j)!==JSON.stringify(l)||v.trim()!=="",U=JSON.stringify({form:j,apiKey:v.trim()});y.useEffect(()=>{N(null),M(null)},[U]);const X=async()=>{if(R)return;O(!0),N(null);const ce=await Jx({image:j,...v.trim()?{apiKey:v.trim()}:{}});O(!1),ce.ok?(M(U),N({ok:!0,text:"生成成功",path:ce.path})):(M(null),N({ok:!1,text:ce.error}))},oe=async()=>{if(R||!E)return;if(O(!0),k(null),ee(null),j.source==="openai"&&A!==U){const ye=await Jx({image:j,...v.trim()?{apiKey:v.trim()}:{}});if(!ye.ok){O(!1),M(null),k(`测试连接失败:${ye.error}`);return}M(U),N({ok:!0,text:"生成成功",path:ye.path})}const ce=await Qx(j,v.trim()||void 0);if(O(!1),!ce.ok){k(ce.error);return}j.source==="openai"&&(d(j.baseUrl),m(j.model)),x(""),C(ce.keyConfigured),N(null),ee("已保存")};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"图像生成",desc:"选择图像生成方式:关闭,或使用 OpenAI 兼容接口。配置完成后,开启了图像生成能力的助手可以在任务中生成图片。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"生成方式"}),s.jsx(Bn,{items:G3,value:i,onChange:ce=>{N(null),k(null),ee(null),ce==="off"&&l.source!=="off"?(O(!0),Qx({source:"off"}).then(ye=>{if(O(!1),!ye.ok){k(ye.error);return}o("off"),x(""),ee("已保存")})):o(ce)},disabled:R})]}),i==="openai"?s.jsx(ke,{children:s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:c,placeholder:"http://127.0.0.1:8080/v1",onChange:ce=>d(ce.target.value),disabled:R})}),s.jsx("div",{className:"lbl",children:"模型名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:h,placeholder:"gpt-image-1",onChange:ce=>m(ce.target.value),disabled:R})}),s.jsx("div",{className:"lbl",children:"默认尺寸"}),s.jsx("div",{className:"ctl",children:s.jsxs("select",{className:"pick grow",value:p,onChange:ce=>g(ce.target.value),disabled:R,children:[s.jsx("option",{value:"",children:"不指定,使用接口默认值"}),K3.map(ce=>s.jsx("option",{value:ce,children:ce},ce))]})}),s.jsx("div",{className:"lbl",children:"API Key"}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:v,placeholder:w?"已保存,留空不变":"sk-…",onChange:ce=>x(ce.target.value),disabled:R})}),s.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。保存前会生成测试图片,可能产生费用。"}),T?s.jsx("div",{className:"testrow",children:T?s.jsxs("div",{className:"testout",children:[s.jsx("span",{className:T.ok?"okline":"badline",children:T.text}),T.ok&&T.path?s.jsx("button",{className:"imgcard testshot",onClick:()=>window.open(Yt(T.path),"_blank","noopener"),title:"查看原图",children:s.jsx("img",{src:Yt(T.path),alt:"生成的图片"})}):null]}):null}):null,s.jsxs(qn,{saved:J!==null&&!E,error:B,lead:s.jsx("button",{className:"hob-btn",onClick:()=>void X(),disabled:R,children:R?"正在生成…":"生成测试图片"}),children:[!B&&E?s.jsx("span",{className:"note",children:"未保存的修改"}):null,s.jsx("button",{className:"hob-btn",disabled:R||!E,onClick:()=>{o(l.source),d(l.source==="openai"?l.baseUrl:""),m(l.source==="openai"?l.model:""),g(l.source==="openai"?l.size??"":""),x(""),N(null),M(null),k(null)},children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void oe(),disabled:R||!E,children:R?"正在验证…":"保存"})]})]})}):s.jsx(Cn,{message:B??J})]})}const V3={hob:"Hob 的技能",common:"通用技能 · ~/.agents/skills",lore:"Lore 技能"},Q3=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"pi",label:"pi"}],If=n=>`${n.source}:${n.id}`,Ft=n=>n instanceof Error?n.message:String(n);function J3(){const n=we(),l=n.sub,[i,o]=y.useState(null),[c,d]=y.useState(null),[h,m]=y.useState(null),p=async()=>{try{o(await _N()),d(null)}catch(C){d(Ft(C))}};y.useEffect(()=>{p()},[]),y.useEffect(()=>{l&&m(null)},[l]);const g=async C=>{const T=`${C.source}:${C.name}`,N=n.settings.settings.skills?.disabled??[],A=C.enabled?[...N,T]:N.filter(M=>M!==T);await jh({skills:{disabled:A}})?await p():d(ys().notice??"保存失败")},v=C=>{p(),m(C),Gt()};if(!i)return c?s.jsx("div",{className:"badline",children:c}):s.jsx(ze,{children:"正在读取技能…"});if(l?.kind==="skill")return s.jsx(P3,{skill:i.skills.find(C=>If(C)===l.key),onDeleted:v});if(l?.kind==="importSkills")return s.jsx(F3,{onDone:v});const x=(C,T)=>C.length?C.map(N=>s.jsxs("div",{className:`list-row setting-row${N.enabled?"":" gone"}`,children:[s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"skill",key:If(N),title:N.name}),children:[s.jsxs("div",{className:"rname",children:[N.name,N.overridden?s.jsx("span",{className:"rtag",children:"被同名技能覆盖"}):null]}),s.jsx("div",{className:"rprov rclamp",children:N.description})]}),s.jsx("button",{className:`tog${N.enabled?"":" off"}`,"aria-label":`${N.name}启用`,"aria-pressed":N.enabled,onClick:()=>void g(N)})]},If(N))):s.jsx(ze,{children:T}),w=i.skills.filter(C=>C.source==="hob");return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"技能",desc:"技能是写好的做法说明,任务按需读取。同名时 Hob 的技能优先,其次是 Lore,最后是通用技能。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"Hob 的技能"}),s.jsxs("div",{className:"group-card settings-card",children:[x(w,"还没有技能,可以从其他工具导入"),s.jsxs("button",{className:"maddrow",onClick:()=>En({kind:"importSkills",title:"导入技能"}),children:[s.jsx(Q,{name:"plus",size:16}),"从 Claude Code、Codex、pi 导入"]})]}),h?s.jsx("div",{className:"okline",children:h}):null]}),s.jsxs(ke,{children:[s.jsxs("div",{className:"lbl",children:["通用技能 ",s.jsx("span",{className:"lbl-aside",children:"~/.agents/skills"})]}),s.jsx("div",{className:"group-card settings-card",children:x(i.skills.filter(C=>C.source==="common"),"目录中没有技能")})]}),s.jsxs(ke,{children:[s.jsxs("div",{className:"lbl",children:["Lore 技能",i.loreActive&&i.loreUrl?s.jsx("a",{className:"lbl-aside",href:i.loreUrl,target:"_blank",rel:"noreferrer",children:"在 Lore 控制台管理"}):null]}),i.loreError?s.jsxs("div",{className:"badline",role:"alert",children:[i.loreError," ",s.jsx("button",{onClick:()=>void p(),children:"重试"})]}):i.loreActive?s.jsx("div",{className:"group-card settings-card",children:x(i.skills.filter(C=>C.source==="lore"),"Lore 中没有技能")}):s.jsx("div",{className:"note",children:"在 设置 → 记忆 中连接 Lore 后,这里会列出 Lore 中的技能。"})]}),c?s.jsx("div",{className:"badline",role:"alert",children:c}):null]})}function P3({skill:n,onDeleted:l}){const[i,o]=y.useState(null);if(!n)return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx("div",{className:"note",children:"技能不存在或已删除。"})]});const c=async()=>{if(window.confirm(`删除技能「${n.name}」?此操作不能撤销。`))try{await UN(n.id),l(`已删除「${n.name}」`)}catch(d){o(Ft(d))}};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx(Qe,{title:n.name,desc:n.description}),s.jsxs("div",{className:"sline",children:[V3[n.source],n.overridden?" · 被优先级更高的同名技能覆盖":"",n.enabled?"":" · 已停用"]}),s.jsx(Ka,{className:"skill-doc fp-md markdown-body",text:n.content}),n.source==="hob"?s.jsx(qn,{saved:!1,error:i,children:s.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void c(),children:"删除技能"})}):null]})}function F3({onDone:n}){const[l,i]=y.useState("claude"),[o,c]=y.useState(null),[d,h]=y.useState([]),[m,p]=y.useState(!1),[g,v]=y.useState(!1),[x,w]=y.useState(null);y.useEffect(()=>{let T=!0;return c(null),h([]),w(null),DN(l).then(N=>{T&&c(N)}).catch(N=>{T&&w(Ft(N))}),()=>{T=!1}},[l]);const C=async()=>{v(!0),w(null);try{const T=await $N(l,d,m),N=[...T.skipped,...T.errors];N.length?w(N.join(";")):n(`已导入 ${T.imported.length} 个技能`)}catch(T){w(Ft(T))}finally{v(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"技能"}),s.jsx(Qe,{title:"导入技能",desc:"从其他工具的技能目录复制到 Hob,来源只读。"}),s.jsx(ke,{children:s.jsx(Bn,{items:Q3,value:l,onChange:i,disabled:g})}),s.jsxs(ke,{children:[o===null?x?null:s.jsx(ze,{children:"正在读取…"}):o.found?s.jsx("div",{className:"group-card settings-card",children:o.skills.length?o.skills.map(T=>s.jsxs("label",{className:"list-row setting-row",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:d.includes(T.id),disabled:g,onChange:N=>h(N.target.checked?[...d,T.id]:d.filter(A=>A!==T.id))}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[T.name,T.exists?s.jsx("span",{className:"rtag",children:"已存在"}):null]}),s.jsx("div",{className:"rprov rclamp",children:T.description})]})]},T.id)):s.jsx(ze,{children:"目录中没有技能"})}):s.jsx(ze,{children:"未找到这个工具的技能目录。"}),o?.skipped.map(T=>s.jsx("div",{className:"note",children:T},T))]}),o?.skills.some(T=>T.exists)?s.jsxs("label",{className:"ctl skill-overwrite",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:m,onChange:T=>p(T.target.checked)}),"覆盖已存在的同名技能"]}):null,s.jsxs(qn,{saved:!1,error:x,children:[s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:g,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:g||!d.length,onClick:()=>void C(),children:g?"正在导入…":d.length?`导入 ${d.length} 个`:"导入所选"})]})]})}const W3={pi:"pi",claude:"Claude Code",cursor:"Cursor"};function eA(n,l){return n.valid?n.enabled?l?l.state==="probing"?"检测中…":l.state==="connected"?l.tools?.length?`已连接 · ${l.tools.length} 个工具`:"已连接 · 没有工具":l.state==="needs_auth"?"需要登录,暂不支持":"连接失败":"未测试":"已停用":"配置无效"}function tA(){const n=we().sub,[l,i]=y.useState(null),[o,c]=y.useState(null),[d,h]=y.useState(null),[m,p]=y.useState({}),g=y.useRef(new Set);y.useEffect(()=>{Vx().then(i).catch(T=>c(Ft(T)))},[]),y.useEffect(()=>{n&&h(null)},[n]);const v=async(T,N=!1)=>{if(T.valid){p(A=>({...A,[T.name]:{state:"probing"}}));try{const A=await GN(T.name,N);p(M=>({...M,[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(l)for(const T of l.servers)!T.valid||!T.enabled||g.current.has(T.name)||(g.current.add(T.name),v(T))},[l]);const x=T=>{Vx().then(i).catch(()=>{}),h(T),Gt()};if(o)return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具。"}),s.jsx("div",{className:"badline",role:"alert",children:o}),s.jsx("div",{className:"note",children:"请修复数据目录 engine/mcp.json 后重试;修复前任务不会加载 MCP 服务。"})]});if(!l)return s.jsx(ze,{children:"正在读取 MCP 服务…"});if(n?.kind==="mcpServer")return s.jsx(aA,{server:l.servers.find(T=>T.name===n.name),setView:i,probe:m[n.name],onProbe:v,onDone:x});if(n?.kind==="addMcp")return s.jsx(lA,{onDone:x});if(n?.kind==="importMcp")return s.jsx(iA,{onDone:x});const w=T=>T.kind==="http"?"远程地址":"本地命令",C=async T=>{try{const N=await E0(T.name,{enabled:!T.enabled});if(i(N),!T.enabled)for(const A of N.servers)A.name===T.name&&A.valid&&v(A,!0)}catch(N){h(Ft(N))}};return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具,所有助手派出的任务共用这份配置;对话不直接使用。配置改动对之后新开的任务生效,进行中的任务不受影响。"}),s.jsxs(ke,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>En({kind:"addMcp",title:"添加 MCP 服务"}),children:"添加服务"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:"hob-btn",onClick:()=>En({kind:"importMcp",title:"从本机导入 MCP 服务"}),children:"从本机导入"})]}),s.jsx("div",{className:"lbl",children:"已配置的服务"}),s.jsxs("div",{className:"group-card settings-card",children:[l.servers.map(T=>s.jsxs("div",{className:`list-row setting-row${T.enabled&&T.valid?"":" gone"}`,children:[s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"mcpServer",name:T.name,title:T.name}),children:[s.jsxs("div",{className:"rname",children:[T.name,T.valid?null:s.jsx("span",{className:"rtag",children:"配置无效"})]}),s.jsx("div",{className:"rprov rclamp",children:T.valid?T.kind==="http"?T.url:[T.command,...T.args??[]].join(" "):T.invalidReason})]}),s.jsx("span",{className:"note",style:{flex:"none"},children:`${w(T)} · ${eA(T,m[T.name])}`}),T.valid?s.jsx("button",{className:`tog${T.enabled?"":" off"}`,"aria-label":`${T.name}启用`,"aria-pressed":T.enabled,onClick:()=>void C(T)}):null]},T.name)),l.servers.length?null:s.jsx(ze,{children:"还没有配置 MCP 服务"})]}),d?s.jsx("div",{className:d.startsWith("已")?"okline":"badline",role:"status",children:d}):null,s.jsx("div",{className:"note",children:"环境变量和请求头的值只保存在本机,保存后不再显示。远程服务需要 OAuth 登录时这版暂不支持。"})]})]})}function c0(n){return Object.entries(n??{}).map(([l,i])=>({key:l,value:i.redacted?"":i.value??"",secret:i.redacted}))}function u0(n,l){const i={},o=new Set(l.filter(c=>c.key.trim()).map(c=>c.key.trim()));for(const c of Object.keys(n??{}))o.has(c)||(i[c]={mode:"remove"});for(const c of l){const d=c.key.trim();d&&(c.value===""&&c.secret?i[d]={mode:"preserve"}:c.value!==""&&(i[d]={mode:"replace",value:c.value}))}return Object.keys(i).length?i:void 0}function d0({rows:n,onChange:l,keyLabel:i,valueLabel:o}){const c=(d,h)=>l(n.map((m,p)=>p===d?{...m,...h}:m));return s.jsxs("div",{className:"pairlist",children:[n.map((d,h)=>s.jsxs("div",{className:"pairrow",children:[s.jsx("label",{className:"field",children:s.jsx("input",{className:"mono",value:d.key,placeholder:i,onChange:m=>c(h,{key:m.target.value})})}),s.jsx("label",{className:"field",children:s.jsx("input",{className:"mono",type:"password",value:d.value,placeholder:d.secret&&d.value===""?"已保存,留空不变":o,onChange:m=>c(h,{value:m.target.value})})}),s.jsx("button",{className:"hob-icon-btn",title:"删除这一项",onClick:()=>l(n.filter((m,p)=>p!==h)),children:s.jsx(Q,{name:"close",size:15})})]},h)),s.jsx("div",{children:s.jsx("button",{className:"hob-btn",onClick:()=>l([...n,{key:"",value:"",secret:!1}]),children:"添加一项"})})]})}const nA={kind:"stdio",command:"",args:"",env:[],cwd:"",url:"",headers:[],description:""};function sA(n){return{kind:n.kind??"stdio",command:n.command??"",args:(n.args??[]).join(`
280
+ `),env:c0(n.env),cwd:n.cwd??"",url:n.url??"",headers:c0(n.headers),description:n.description??""}}function ak({initial:n,name:l,onName:i,fixedName:o,onSaved:c,saveLabel:d}){const[h,m]=y.useState(n),[p,g]=y.useState(!1),[v,x]=y.useState(null),w=T=>m(N=>({...N,...T})),C=async()=>{x(null);const T=l.trim();if(!/^[A-Za-z0-9_-]{1,64}$/.test(T)){x("名称只能用字母、数字、_ 和 -,最长 64 字符。");return}const N=Object.fromEntries(n.env.map(O=>[O.key,O.secret?{redacted:!0}:{redacted:!1,value:O.value}])),A=Object.fromEntries(n.headers.map(O=>[O.key,O.secret?{redacted:!0}:{redacted:!1,value:O.value}])),M=u0(n.env.length?N:void 0,h.env),R=u0(n.headers.length?A:void 0,h.headers);g(!0);try{await IN(T,{kind:h.kind,...h.kind==="stdio"?{command:h.command.trim(),...h.args.trim()?{args:h.args.split(/\r?\n/).map(O=>O.trim()).filter(Boolean)}:{},...h.cwd.trim()?{cwd:h.cwd.trim()}:{},...M?{env:M}:{}}:{url:h.url.trim(),...R?{headers:R}:{}},...h.description.trim()?{description:h.description.trim()}:{}}),c(o?`已保存「${T}」`:`已添加「${T}」`)}catch(O){x(Ft(O))}finally{g(!1)}};return s.jsxs("div",{className:"formcard",children:[s.jsx("div",{className:"lbl",children:"名称"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:l,readOnly:o,placeholder:"如 filesystem",onChange:T=>i?.(T.target.value)})}),o?null:s.jsx("div",{className:"note",children:"字母、数字、_ 和 -;- 和 _ 视为同名。改名请删除后重新添加。"}),s.jsx("div",{className:"lbl",children:"类型"}),s.jsx(Bn,{items:[{key:"stdio",label:"本地命令"},{key:"http",label:"远程地址"}],value:h.kind,onChange:T=>w({kind:T}),disabled:p}),s.jsx("div",{className:`expand settings-motion${h.kind==="stdio"?" open":""}`,inert:h.kind!=="stdio",children:s.jsxs("div",{children:[s.jsx("div",{className:"lbl",children:"命令"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.command,placeholder:"如 npx 或 uvx(一个可执行文件,不是整条命令行)",onChange:T=>w({command:T.target.value})})}),s.jsx("div",{className:"lbl",children:"参数"}),s.jsx("div",{className:"field",children:s.jsx("textarea",{className:"mono",rows:3,value:h.args,placeholder:`-y
281
+ @modelcontextprotocol/server-filesystem
282
+ .`,onChange:T=>w({args:T.target.value})})}),s.jsx("div",{className:"note",children:"一行一个参数。"}),s.jsx("div",{className:"lbl",children:"环境变量"}),s.jsx(d0,{rows:h.env,onChange:T=>w({env:T}),keyLabel:"变量名",valueLabel:"值"}),s.jsx("div",{className:"lbl",children:"工作目录"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.cwd,placeholder:"可空;相对路径按任务的工作目录解析",onChange:T=>w({cwd:T.target.value})})})]})}),s.jsx("div",{className:`expand settings-motion${h.kind==="http"?" open":""}`,inert:h.kind!=="http",children:s.jsxs("div",{children:[s.jsx("div",{className:"lbl",children:"地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{className:"mono",value:h.url,placeholder:"https://example.com/mcp(streamable HTTP,不支持 /sse 结尾)",onChange:T=>w({url:T.target.value})})}),s.jsx("div",{className:"lbl",children:"请求头"}),s.jsx(d0,{rows:h.headers,onChange:T=>w({headers:T}),keyLabel:"名称",valueLabel:"值"})]})}),s.jsx("div",{className:"lbl",children:"说明"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:h.description,placeholder:"这个服务提供什么,一句话(可空)",onChange:T=>w({description:T.target.value})})}),v?s.jsx("div",{className:"badline",role:"alert",children:v}):null,s.jsx(qn,{saved:!1,error:null,children:s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:p,onClick:()=>void C(),children:p?"正在保存…":d})})]})}function lA({onDone:n}){const[l,i]=y.useState("");return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:"添加 MCP 服务",desc:"本地命令(stdio)或远程地址(streamable HTTP)。保存后可以在详情里测试连接并开关单个工具。"}),s.jsx(ke,{children:s.jsx(ak,{initial:nA,name:l,onName:i,fixedName:!1,onSaved:n,saveLabel:"添加"})})]})}function aA({server:n,setView:l,probe:i,onProbe:o,onDone:c}){const[d,h]=y.useState(null),[m,p]=y.useState(!1),[g,v]=y.useState(!1),[x,w]=y.useState(null);if(y.useEffect(()=>{n||Gt()},[n]),!n)return null;const C=x??n.hiddenTools??[],T=i?.state==="connected"?i.tools??[]:void 0,N=async O=>{p(!0),h(null);try{const J=await E0(n.name,O);return l(J),J}catch(J){return h(Ft(J)),null}finally{p(!1)}},A=async()=>{v(!0);try{await o(n,!0)}finally{v(!1)}},M=async()=>{if(window.confirm(`删除 MCP 服务「${n.name}」?此操作不能撤销。`))try{l(await YN(n.name)),c(`已删除「${n.name}」`)}catch(O){h(Ft(O))}},R=n.kind==="http"?"远程地址":"本地命令";return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:n.name,desc:n.description??(n.valid?`${R}的 MCP 服务`:n.invalidReason)}),n.valid?s.jsxs(ke,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${n.name}启用`,"aria-pressed":n.enabled,disabled:m,onClick:()=>void N({enabled:!n.enabled})})]}),s.jsx("div",{className:"lbl",children:"提供方式"}),s.jsx(Bn,{items:[{key:"direct",label:"直接提供"},{key:"deferred",label:"按需搜索"}],value:n.exposure,disabled:m,onChange:O=>void N({exposure:O})}),s.jsx("div",{className:"note",children:"直接提供:工具和内置工具一样声明给模型,适合工具少的服务。按需搜索:模型先搜索再调用,适合工具多的服务。"})]}):s.jsxs(ke,{children:[s.jsxs("div",{className:"badline",role:"alert",children:["配置无效:",n.invalidReason]}),s.jsx("div",{className:"note",children:"删除后重新添加,或在下方按表单保存一次即可修复。"})]}),n.valid?s.jsxs(ke,{children:[s.jsxs("div",{className:"testrow",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void A(),disabled:g,children:g?"正在测试…":"测试连接"}),i?s.jsx("span",{className:i.state==="connected"?"okline":"badline",children:i.state==="connected"?`已连接 · ${i.tools?.length??0} 个工具`:i.state==="needs_auth"?"需要登录,暂不支持":i.error??"连接失败"}):s.jsx("span",{className:"note",children:"连接后列出服务提供的工具"})]}),i&&i.state!=="connected"&&i.stderrTail?.length?s.jsx("div",{className:"note mono",children:i.stderrTail.join(`
283
+ `)}):null,T?T.length?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"lbl",children:["工具(",T.length,")"]}),s.jsx("div",{className:"group-card settings-card",children:T.map(O=>{const J=C.includes(O.name);return s.jsxs("div",{className:`list-row setting-row${J?" gone":""}`,children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname mono",children:O.name}),s.jsx("div",{className:"rprov rclamp",children:O.description||"(没有说明)"})]}),s.jsx("button",{className:`tog${J?" off":""}`,"aria-label":`${O.name}启用`,"aria-pressed":!J,disabled:m,onClick:()=>{const ee=J?C.filter(B=>B!==O.name):[...C,O.name];w(ee),N({hiddenTools:ee})}})]},O.name)})}),s.jsx("div",{className:"note",children:"关掉的工具不声明给模型;改动对之后新开的任务生效。"})]}):s.jsx("div",{className:"note",children:"服务已连接,但没有提供工具。"}):s.jsx("div",{className:"note",children:"先测试连接,取得服务的工具列表后可以单独开关每个工具。"})]}):null,s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:n.valid?"编辑":"重新保存"}),s.jsx(ak,{initial:sA(n),name:n.name,fixedName:!0,onSaved:c,saveLabel:"保存"})]}),s.jsxs(ke,{children:[s.jsx("button",{className:"hob-btn hob-btn-danger",disabled:m,onClick:()=>void M(),children:"删除服务"}),d?s.jsx("div",{className:"badline",role:"alert",children:d}):null]}),s.jsx("div",{className:"note",children:"环境变量和请求头的值不回显;留空表示沿用已保存的值。删除整行表示删掉这个值。"})]})}function iA({onDone:n}){const[l,i]=y.useState(null),[o,c]=y.useState([]),[d,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{let x=!0;return KN().then(w=>{x&&i(w)}).catch(w=>{x&&p(Ft(w))}),()=>{x=!1}},[]);const g=async()=>{h(!0),p(null);try{const x=await XN(o),w=x.skipped.length?`,跳过 ${x.skipped.length} 个(同名)`:"";n(`已导入 ${x.imported.length} 个服务${w}`)}catch(x){p(Ft(x))}finally{h(!1)}},v=l?.items??[];return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"MCP"}),s.jsx(Qe,{title:"从本机导入 MCP 服务",desc:"读取本机 pi、Claude Code、Cursor 里已配置的 MCP 服务,复制到 Hob;来源只读,同名跳过。"}),s.jsxs(ke,{children:[l?.sources.length?s.jsxs("div",{className:"note",children:["读取位置:",l.sources.join(";")]}):null,s.jsx("div",{className:"group-card settings-card",children:v.length?v.map(x=>s.jsxs("label",{className:"list-row setting-row",children:[s.jsx("input",{type:"checkbox",className:"rcheck",checked:o.includes(x.id),disabled:d||!x.selectable,onChange:w=>c(w.target.checked?[...o,x.id]:o.filter(C=>C!==x.id))}),s.jsxs("div",{className:"rmain",children:[s.jsxs("div",{className:"rname",children:[x.name,s.jsx("span",{className:"rtag",children:W3[x.source]}),x.exists?s.jsx("span",{className:"rtag",children:"同名跳过"}):null]}),s.jsxs("div",{className:"rprov rclamp",children:[x.kind==="http"?"远程地址":"本地命令",x.note?` · ${x.note}`:""]})]})]},x.id)):s.jsx(ze,{children:"没有找到可导入的 MCP 服务"})}),s.jsxs(qn,{saved:!1,error:m,children:[s.jsx("button",{className:"hob-btn",onClick:Gt,disabled:d,children:"取消"}),s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:d||!o.length,onClick:()=>void g(),children:d?"正在导入…":o.length?`导入 ${o.length} 个`:"导入所选"})]})]})]})}const Tl={searxng:{label:"SearXNG",desc:"自建的元搜索服务,填写服务地址即可",url:!0,keyOptional:!0},exa:{label:"Exa",desc:"语义搜索,适合查找技术资料"},tavily:{label:"Tavily",desc:"面向 AI 的搜索接口"},brave:{label:"Brave Search",desc:"Brave 的独立网页索引"},serper:{label:"Serper",desc:"Google 搜索结果"},jina:{label:"Jina",desc:"搜索并读取网页正文"},firecrawl:{label:"Firecrawl",desc:"搜索并抓取网页正文"},perplexity:{label:"Perplexity",desc:"带摘要的搜索结果"},youcom:{label:"You.com",desc:"You.com 搜索接口"},ollama:{label:"Ollama",desc:"Ollama 的网页搜索",url:!0}};function rA(){const n=we(),l=n.sub,i=n.settings.settings.search,[o,c]=y.useState(null),[d,h]=y.useState(null),[m,p]=y.useState(!1),g=async()=>c(await ZN());y.useEffect(()=>{g().catch(N=>h(Ft(N)))},[]),y.useEffect(()=>{l&&h(null)},[l]);const v=N=>o?.providers.find(A=>A.name===N)?.keyConfigured??!1,x=async(N,A)=>{p(!0);try{const M=await QN(N,A);return M?(h(M),M):(await g(),null)}catch(M){const R=Ft(M);return h(R),R}finally{p(!1)}},w=i.filter(N=>N.enabled),C=(N,A)=>{const M=w.map(J=>J.name),R=M.indexOf(N),O=R+A;O<0||O>=M.length||([M[R],M[O]]=[M[O],M[R]],x([...M.map(J=>i.find(ee=>ee.name===J)),...i.filter(J=>!J.enabled)]))};if(l?.kind==="searchProvider"){const N=i.find(A=>A.name===l.name);return N?s.jsx(oA,{provider:N,configured:v(N.name),busy:m,save:(A,M)=>x(i.map(R=>R.name===A.name?A:R),M===void 0?void 0:{[A.name]:M})}):s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"联网搜索"}),s.jsx("div",{className:"note",children:"没有这个服务商。"})]})}const T=N=>v(N.name)?"已配置 Key":N.baseUrl?"已填服务地址":"未配置";return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"联网搜索",desc:"助手和任务通过这里的服务商搜索网页、读取正文。可以启用多个,按顺序使用,前一个失败时自动换下一个。"}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:"已启用"}),w.length?s.jsx("div",{className:"group-card settings-card",children:w.map((N,A)=>s.jsxs("div",{className:"list-row setting-row",children:[s.jsx("span",{className:"rorder",children:A+1}),s.jsxs("button",{className:"rmain rbtn",onClick:()=>En({kind:"searchProvider",name:N.name,title:Tl[N.name].label}),children:[s.jsx("div",{className:"rname",children:Tl[N.name].label}),s.jsx("div",{className:"rprov",children:Tl[N.name].desc})]}),s.jsx("button",{className:"hob-icon-btn rmove",title:"上移",disabled:m||A===0,onClick:()=>C(N.name,-1),children:s.jsx(Q,{name:"down",size:15,className:"up"})}),s.jsx("button",{className:"hob-icon-btn rmove",title:"下移",disabled:m||A===w.length-1,onClick:()=>C(N.name,1),children:s.jsx(Q,{name:"down",size:15})})]},N.name))}):s.jsx("div",{className:"note",children:"尚未启用服务商,助手和任务暂时不能联网搜索。"}),d?s.jsx("div",{className:"badline",children:d}):null]}),s.jsxs(ke,{children:[s.jsx("div",{className:"lbl",children:w.length?"其他服务商":"选择服务商"}),s.jsx("div",{className:"group-card settings-card",children:i.filter(N=>!N.enabled).map(N=>s.jsxs("button",{className:"list-row setting-row",onClick:()=>En({kind:"searchProvider",name:N.name,title:Tl[N.name].label}),children:[s.jsxs("div",{className:"rmain",children:[s.jsx("div",{className:"rname",children:Tl[N.name].label}),s.jsx("div",{className:"rprov",children:Tl[N.name].desc})]}),s.jsx("span",{className:"note",children:T(N)}),s.jsx(Q,{name:"chev",size:15,className:"rgo"})]},N.name))})]})]})}function oA({provider:n,configured:l,busy:i,save:o}){const c=Tl[n.name],[d,h]=y.useState(n.baseUrl??""),[m,p]=y.useState(""),[g,v]=y.useState(null),[x,w]=y.useState(!1),[C,T]=y.useState(null),[N,A]=y.useState(!1);y.useEffect(()=>h(n.baseUrl??""),[n.baseUrl]);const M=d.trim()!==(n.baseUrl??"")||!!m.trim(),R=l||!!m.trim()||c.keyOptional&&!!d.trim(),O=async()=>{w(!0),v(null);try{const B=await VN(n.name,d.trim(),m.trim()||void 0);return v({ok:B.ok,text:B.ok?`搜索成功,返回 ${B.count} 条结果`:B.error??"搜索失败"}),B.ok}catch(B){return v({ok:!1,text:Ft(B)}),!1}finally{w(!1)}},J=async(B,k)=>{T(null),A(!1);const j=await o(B,k);return j?(T(j),!1):(A(!0),!0)},ee=async()=>{await O()&&await J({...n,baseUrl:d.trim()||void 0},m.trim()||void 0)&&p("")};return s.jsxs(s.Fragment,{children:[s.jsx(hn,{label:"联网搜索"}),s.jsx(Qe,{title:c.label,desc:c.desc}),s.jsxs(ke,{children:[s.jsxs("div",{className:"ctl",children:[s.jsx("span",{style:{fontSize:14},children:"启用"}),s.jsx("span",{className:"sp"}),s.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${c.label}启用`,"aria-pressed":n.enabled,disabled:i||!n.enabled&&!R,onClick:()=>void J({...n,enabled:!n.enabled})})]}),!n.enabled&&!R?s.jsxs("div",{className:"note",children:[c.url?"填写服务地址":"填写 API Key","并保存后即可启用。"]}):null]}),s.jsx(ke,{children:s.jsxs("div",{className:"formcard",children:[c.url?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"lbl",children:"服务地址"}),s.jsx("div",{className:"field",children:s.jsx("input",{value:d,onChange:B=>{h(B.target.value),v(null)},placeholder:"http://127.0.0.1:8888",disabled:i})})]}):null,s.jsxs("div",{className:"lbl",children:["API Key",c.keyOptional?"(可选)":""]}),s.jsx("div",{className:"field",children:s.jsx("input",{type:"password",value:m,onChange:B=>{p(B.target.value),v(null)},placeholder:l?"已保存,留空不变":"填写 API Key",disabled:i})}),s.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。"}),s.jsxs("div",{className:"testrow",children:[s.jsx("button",{className:"hob-btn",onClick:()=>void O(),disabled:i||x,children:x?"正在搜索…":"测试搜索"}),g?s.jsx("span",{className:g.ok?"okline":"badline",children:g.text}):null]}),s.jsxs(qn,{saved:N&&!M,error:C,children:[l?s.jsx("button",{className:"hob-btn",disabled:i,onClick:()=>void J(n,""),children:"删除 Key"}):null,s.jsx("button",{className:"hob-btn hob-btn-primary",disabled:i||x||!M,onClick:()=>void ee(),children:"保存"})]})]})})]})}function cA(){const[n,l]=y.useState(null);if(y.useEffect(()=>{wN().then(l)},[]),!n)return s.jsx(ze,{children:"正在读取版本信息…"});const i=[["Hob 版本",n.version],["数据目录",n.home]];return s.jsxs(s.Fragment,{children:[s.jsx(Qe,{title:"关于",desc:"Hob 的版本与数据目录。"}),s.jsx("div",{className:"kvcard",children:i.map(([o,c])=>s.jsxs("div",{className:"kvrow",children:[s.jsx("span",{className:"k",children:o}),s.jsx("span",{className:"v",children:c})]},o))})]})}const uA=n=>n.id;function dA(){const n=we(),l=Zh(n.assistants,n.query),i=qy(l,n.query.trim().length>0),o=Cw(i.order,uA),c=Vy(l.length);return s.jsxs("aside",{className:"side",children:[s.jsxs("div",{className:"side-top",children:[s.jsxs("div",{className:"search",children:[s.jsx(Q,{name:"search",size:15}),s.jsx("input",{value:n.query,placeholder:"搜索助手",onChange:d=>X0(d.target.value)})]}),s.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:I0,children:s.jsx(Q,{name:"plus",size:18})})]}),s.jsxs("div",{className:"side-scroll",children:[s.jsx("div",{className:`pins${c.cls}${i.locked?" locked":""}`,ref:i.grid,children:o.map(d=>s.jsx("div",{className:["srow",d.state==="still"?"":d.state,i.className(d.item.id)].filter(Boolean).join(" "),"data-pin":d.key,children:s.jsx("div",{className:"srowclip",children:s.jsx(Zy,{a:d.item,sel:d.item.id===n.sel,size:c.size,drag:i.target(d.item.id)})})},d.key))}),s.jsx(Qy,{size:42,markSel:!0})]}),s.jsxs("div",{className:"side-foot",children:[s.jsxs("button",{className:"frow",onClick:zh,children:[s.jsx(Q,{name:"archive",size:18}),s.jsx("span",{className:"sp",children:"知识库"})]}),s.jsxs("button",{className:"frow",onClick:Oc,children:[s.jsx(Q,{name:"gear",size:18}),s.jsx("span",{className:"sp",children:"设置"})]})]})]})}function fA(){"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(n=>{const l=i=>{i&&i.addEventListener("statechange",()=>{i.state==="installed"&&navigator.serviceWorker.controller&&BS()})};l(n.installing),n.addEventListener("updatefound",()=>l(n.installing))}).catch(()=>{})})}async function hA(){if(!("serviceWorker"in navigator)){location.reload();return}let n=!1;const l=()=>{n||(n=!0,location.reload())};navigator.serviceWorker.addEventListener("controllerchange",l,{once:!0}),(await navigator.serviceWorker.getRegistration())?.waiting?.postMessage("skip-waiting"),setTimeout(l,1200)}function mA(n,l){const[i,o]=y.useState({stack:n,owner:l}),[c,d]=y.useState([]);if(i.stack!==n||i.owner!==l){const h=new Set(n.map(qa));d(i.owner!==l?[]:[...c.filter(m=>!h.has(qa(m.page))),...hN(i.stack,n)]),o({stack:n,owner:l})}return y.useEffect(()=>{if(!c.length)return;const h=setTimeout(()=>d([]),240);return()=>clearTimeout(h)},[c]),mN(n,c)}function pA(n){return n.replace(/^无法连接 Hob:/,"")}function gA(){const n=we(),[l,i]=y.useState(()=>window.innerWidth<768),o=fn(n.mobile==="chat"&&!!n.sel,240),c=fn(n.page==="settings",180),d=fn(n.page==="knowledge",180),h=fn(n.sheet,180),m=n.panelStack.at(-1),p=mA(n.panelStack,n.sel),g=p.map(({page:C,leaving:T})=>s.jsx("div",{className:`mlayer${T?" leaving":""}`,children:C.kind==="file"?s.jsx(mc,{page:C}):C.kind==="job"||C.kind==="jobs"?s.jsx($f,{page:C}):s.jsx(Wb,{page:C,leaving:!1})},qa(C)));if(y.useLayoutEffect(()=>{k0(n,l)},[n.phase,n.page,n.mobile,n.sheet,n.panelStack,n.theme,l]),y.useEffect(()=>{cS()},[]),y.useEffect(()=>{if(!n.panelStack.length)return;const C=T=>{T.key==="Escape"&&!T.defaultPrevented&&fr()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[n.panelStack]),y.useEffect(()=>{const C=()=>i(window.innerWidth<768);return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),y.useEffect(()=>{const C=setInterval(()=>qS(),3e4);return()=>clearInterval(C)},[]),y.useEffect(()=>{const C=n.assistants.reduce((T,N)=>T+N.unread,0);document.title=C>0?`(${C}) Hob`:"Hob"},[n.assistants]),y.useEffect(()=>{if(!n.notice)return;const C=setTimeout(()=>HS(),6e3);return()=>clearTimeout(C)},[n.notice]),n.phase==="login")return s.jsx(nE,{});if(n.phase==="error")return s.jsx("div",{className:"boot",children:s.jsxs("div",{className:"boot-card",children:[s.jsx("div",{className:"t",children:"无法连接 Hob"}),s.jsx("div",{className:"d",children:"请检查网络,或确认 Hob 服务已启动。"}),s.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>location.reload(),children:"重试"}),n.error?s.jsx("div",{className:"raw",children:pA(n.error)}):null]})});if(n.phase==="loading")return s.jsx("div",{className:"boot",children:s.jsxs("div",{className:"boot-loading",children:[s.jsx(ot,{sprite:"hob",size:92,motion:"think"}),s.jsx("span",{className:"activity-shimmer",children:"正在连接 Hob…"})]})});const v=n.notice?s.jsx("div",{className:"toast",children:n.notice}):n.updateReady?s.jsx("button",{className:"upd",onClick:()=>void hA(),children:"有新版本,点击更新"}):null,x=s.jsx(NC,{});if(c.mounted)return s.jsxs(s.Fragment,{children:[s.jsx(g3,{narrow:l,leaving:c.leaving}),l?g:s.jsxs(s.Fragment,{children:[s.jsx($f,{}),s.jsx(mc,{})]}),x,v]});if(d.mounted)return s.jsxs(s.Fragment,{children:[s.jsx(mE,{narrow:l,leaving:d.leaving}),l?g:null,v]});const w=m?.kind==="file"?m:null;return l?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mapp",children:[s.jsx("div",{className:`mpane list${n.mobile==="chat"?" back":""}`,children:s.jsx(s3,{})}),o.mounted?s.jsx("div",{className:`mpane chat${o.leaving?" out":""}`,children:s.jsx(kC,{})}):null,h.mounted?s.jsx(Wb,{leaving:h.leaving,page:null}):null,g]}),s.jsx(hb,{}),x,v]}):s.jsxs("div",{className:`app${w?.full?" preview-full":""}`,children:[s.jsx(dA,{}),s.jsx(yC,{}),s.jsxs("div",{className:`panelwrap${w?.full?" full":n.collapsed?" off":n.nowWide?" wide":""}`,children:[s.jsx(hh,{page:null}),p.map(({page:C,leaving:T})=>s.jsx("div",{className:`panel-layer${C.kind==="file"||C.kind==="job"||C.kind==="jobs"?" wide":""}${T?" leaving":""}`,children:C.kind==="file"?s.jsx(mc,{embedded:!0,page:C}):C.kind==="job"||C.kind==="jobs"?s.jsx($f,{embedded:!0,page:C}):s.jsx(hh,{page:C})},qa(C)))]}),s.jsx(hb,{}),n.offline?s.jsx("div",{className:"toast",children:n.offline}):null,x,v]})}function Yf(n,l){if(!l)return[];const i=[];n.page==="knowledge"?i.push("knowledge"):n.page==="settings"?(i.push("settings"),n.section&&i.push("section"),n.sub&&i.push("sub")):(n.mobile==="chat"&&n.sel&&i.push("chat"),n.sheet&&i.push("sheet"));for(const o of n.panelStack)i.push("panelPage");return i}const vA={panelPage:fr,sheet:Z0,knowledge:()=>{rr(),eh("list")},chat:()=>eh("list"),sub:Gt,section:()=>Rl(null),settings:Wf};function xA(n=()=>window.innerWidth<768){let l=0,i=0,o=!1;const c=()=>location.pathname+location.search+pw(ys(),n());history.replaceState({hobDepth:0},"",c());const d=()=>{if(o||i>0)return;const h=Yf(ys(),n()).length;if(l>h){i++,history.go(h-l),l=h;return}for(;l<h;)history.pushState({hobDepth:++l},"",c());c()!==location.pathname+location.search+location.hash&&history.replaceState(history.state,"",c())};window.addEventListener("popstate",h=>{if(i>0){i--,d();return}const m=Number(h.state?.hobDepth??0);l=m,o=!0;for(let p=0;p<10;p++){const g=Yf(ys(),n()).at(-1);if(!g||Yf(ys(),n()).length<=m)break;vA[g]()}o=!1,d()}),C0(d),d()}uw.createRoot(document.getElementById("root")).render(s.jsx(gA,{}));xA();document.addEventListener("gesturestart",n=>n.preventDefault());fA();export{Q as I,Ol as M,HE as a,Za as b,bc as d,s as j,y as r,yA as s,we as u};