@teammy/server 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +36 -18
- package/dist/web/assets/Assistant-DJV9aVRy.js +1 -0
- package/dist/web/assets/{Dashboard-BzmrE4Xv.js → Dashboard-CDLBK91Q.js} +1 -1
- package/dist/web/assets/{Files-BvCYgjVV.js → Files-Ctal40MO.js} +1 -1
- package/dist/web/assets/{Markdown-BRPMsc7D.js → Markdown-TnAER8HW.js} +1 -1
- package/dist/web/assets/{Materials-DK3CkLr0.js → Materials-CFm4FvpO.js} +1 -1
- package/dist/web/assets/{Sessions-D_579m-e.js → Sessions-CAEjqZpk.js} +1 -1
- package/dist/web/assets/{WorkspaceTree-fMDtGIFa.js → WorkspaceTree-DN1U-aDQ.js} +1 -1
- package/dist/web/assets/{file-links-I1K8CwVK.js → file-links-bWpY4fpg.js} +1 -1
- package/dist/web/assets/{index-DQsx-e5d.js → index-DouLQdFE.js} +2 -2
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/Assistant-BeYamS0w.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,M as r,O as i,S as a,c as o,d as s,s as c,u as l,v as u}from"./index-
|
|
1
|
+
import{$ as e,A as t,D as n,M as r,O as i,S as a,c as o,d as s,s as c,u as l,v as u}from"./index-DouLQdFE.js";var d=e(),f=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function p(e,t){return f.compare(e,t)||(e<t?-1:+(e>t))}var m=t();function h(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)],r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var g=(e,t)=>`${e}/${t}`,_=e=>({"--tree-level":e});function v({members:e,...t}){let[n,r]=(0,d.useState)(`folder:${g(e[0]?.id??``,``)}`);return(0,m.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:h,children:(0,m.jsx)(b,{owner:c,path:``,level:1,members:e.filter(e=>e.hasFiles),context:{...t,focused:n,onFocus:r}})})}function y({owner:e,path:t,level:n,context:r}){let i=r.expanded.has(g(e,t)),a=`folder:${g(e,t)}`;return(0,m.jsxs)(`div`,{role:`none`,children:[(0,m.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:_(n),"aria-label":t||e,"aria-level":n,"aria-expanded":i,"aria-selected":r.selected?.kind===`directory`&&r.selected.owner===e&&r.selected.path===t,tabIndex:r.focused===a?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>r.onFocus(a),onClick:()=>r.onToggle(e,t),leading:(0,m.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,m.jsx)(u,{name:`chevron`,size:`small`})}),children:[(0,m.jsx)(u,{name:`files`}),(0,m.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),i&&(0,m.jsx)(b,{owner:e,path:t,level:n+1,context:r})]})}function b({owner:e,path:t,level:c,context:f,members:h=[]}){let{api:v,projectId:b}=l(),x=(0,d.useCallback)(n=>v.tree(e,t,void 0,``,n),[e,t]),S=n(x,!1,i(b,`file-tree`,e,t)),[C,w]=(0,d.useState)(),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),k=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>k.current?.abort(),[]);let A=C?.revision===S.data?.revision?C:void 0,j=A?A.nextCursor:S.data?.nextCursor;async function M(){if(!j||!S.data||T)return;E(!0),O(``);let n=new AbortController;k.current=n;try{let r=await v.tree(e,t,S.data.revision,j,n.signal);n.signal.aborted||w({...r,entries:[...A?.entries??[],...r.entries]})}catch(e){n.signal.aborted||O(r(e))}finally{n.signal.aborted||E(!1)}}let N=[...(S.data?.entries??[]).filter(e=>!o(e.path)),...(A?.entries??[]).filter(e=>!o(e.path))],P=f.revealed;if(P?.owner===e&&!o(P.path)&&(!t||P.path.startsWith(t+`/`))){let e=t?P.path.slice(t.length+1):P.path,n=e.indexOf(`/`),r=n<0?P.path:[t,e.slice(0,n)].filter(Boolean).join(`/`);N.some(e=>e.path===r)||N.push(n<0?{...P.file,kind:`file`}:{kind:`directory`,path:r})}let F=[...N.map(t=>({...t,owner:e})),...h.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?p(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,m.jsxs)(`div`,{role:`group`,"aria-label":g(e===`_project`?`workspaces`:e,t),"aria-busy":S.loading||T,children:[S.loading&&(0,m.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,m.jsx)(a,{error:!0,children:S.error||D}),S.error&&(0,m.jsx)(`button`,{className:`tree-action`,onClick:()=>void S.reload(),children:`重试`}),F.map(t=>t.kind===`directory`?(0,m.jsx)(y,{owner:t.owner,path:t.path,level:c,context:f},g(t.owner,t.path)):(0,m.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item`,style:_(c),"aria-label":t.path,"aria-level":c,"aria-selected":f.selected?.kind===`file`&&f.selected.owner===e&&f.selected.path===t.path,tabIndex:f.focused===`file:${g(e,t.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":e,"data-file-path":t.path,onFocus:()=>f.onFocus(`file:${g(e,t.path)}`),onClick:()=>f.onSelect(e,t.path),leading:(0,m.jsx)(`span`,{className:`tree-chevron`}),children:[(0,m.jsx)(u,{name:`file`}),(0,m.jsx)(`span`,{className:`tree-name`,children:t.path.split(`/`).at(-1)})]},t.path)),j&&(0,m.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:T,onClick:()=>void M(),children:T?`正在加载…`:`加载更多`})]})}export{p as i,g as n,h as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./index-
|
|
1
|
+
import{L as e}from"./index-DouLQdFE.js";function t(t,n){if(!n||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(n))return null;try{let r=n.split(/[?#]/,1)[0],i=r?t.split(`/`).slice(0,-1):t.split(`/`);for(let e of r.split(`/`)){let t=decodeURIComponent(e);if(t&&t!==`.`){if(t===`..`){if(!i.length)return null;i.pop()}else{if(t.includes(`/`)||t.includes(`\\`))return null;i.push(t)}}}return{path:i.length?e.parse(i.join(`/`)):``,directory:r.endsWith(`/`),anchor:n.includes(`#`)?decodeURIComponent(n.slice(n.indexOf(`#`)+1)):``}}catch{return null}}export{t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Materials-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Materials-CFm4FvpO.js","./Markdown-TnAER8HW.js","./WorkspaceTree-DN1U-aDQ.js","./Materials-CK-mbNmo.css","./Files-Ctal40MO.js","./project-links-XbF78Bal.js","./file-links-bWpY4fpg.js","./Assistant-DJV9aVRy.js","./Assistant-C7QfFYLo.css","./Dashboard-CDLBK91Q.js","./Dashboard-C6aBw_W-.css","./Sessions-CAEjqZpk.js","./Sessions-BwXwXx6i.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function u(){return document.querySelector(`meta[name="teammy-base-path"]`)?.content??``}function d(e){let t=u();return!e.startsWith(`/`)||e.startsWith(`//`)||!t||e===t||e.startsWith(t+`/`)||e.startsWith(t+`?`)?e:t+e}function f(){let e=u();return e&&(location.pathname===e||location.pathname.startsWith(e+`/`))?location.pathname.slice(e.length)||`/`:location.pathname}function p(){return location.origin+u()}var m=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function ee(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var te=ee.prototype=new b;te.constructor=ee,_(te,y.prototype),te.isPureReactComponent=!0;var ne=Array.isArray;function re(){}var x={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function S(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ae(e,t){return S(e.type,t,e.props)}function oe(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function se(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ce=/\/+/g;function le(e,t){return typeof e==`object`&&e&&e.key!=null?se(``+e.key):t.toString(36)}function ue(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(re,re):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function de(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,de(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+le(e,0):a,ne(o)?(i=``,c!=null&&(i=c.replace(ce,`$&/`)+`/`),de(o,r,i,``,function(e){return e})):o!=null&&(oe(o)&&(o=ae(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ce,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ne(e))for(var u=0;u<e.length;u++)a=e[u],s=l+le(a,u),c+=de(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+le(a,u++),c+=de(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return de(ue(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function fe(e,t,n){if(e==null)return e;var r=[],i=0;return de(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function pe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var me=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&&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)};function he(e){var t=x.T,n={};n.types=t===null?null:t.types,x.T=n;try{var r=e(),i=x.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(re,me)}catch(e){me(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),x.T=t}}function ge(e){var t=x.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else he(ge.bind(null,e))}var _e={map:fe,forEach:function(e,t,n){fe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return fe(e,function(){t++}),t},toArray:function(e){return fe(e,function(e){return e})||[]},only:function(e){if(!oe(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=_e,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=ee,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=x,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return x.H.useMemoCache(e)}},e.addTransitionType=ge,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ie.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return S(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ie.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return S(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=oe,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:pe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=he,e.unstable_useCacheRefresh=function(){return x.H.useCacheRefresh()},e.use=function(e){return x.H.use(e)},e.useActionState=function(e,t,n){return x.H.useActionState(e,t,n)},e.useCallback=function(e,t){return x.H.useCallback(e,t)},e.useContext=function(e){return x.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return x.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return x.H.useEffect(e,t)},e.useEffectEvent=function(e){return x.H.useEffectEvent(e)},e.useId=function(){return x.H.useId()},e.useImperativeHandle=function(e,t,n){return x.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return x.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return x.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return x.H.useMemo(e,t)},e.useOptimistic=function(e,t){return x.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return x.H.useReducer(e,t,n)},e.useRef=function(e){return x.H.useRef(e)},e.useState=function(e){return x.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return x.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return x.H.useTransition()},e.version=`19.3.1`})),h=o(((e,t)=>{t.exports=m()})),g=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,te||(te=!0,ae());else{var t=n(l);t!==null&&ce(ee,t.startTime-e)}}}var te=!1,ne=-1,re=5,x=-1;function ie(){return g?!0:!(e.unstable_now()-x<re)}function S(){if(g=!1,te){var t=e.unstable_now();x=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ne),ne=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():te=!1}}}var ae;if(typeof y==`function`)ae=function(){y(S)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=S,ae=function(){se.postMessage(null)}}else ae=function(){_(S,0)};function ce(t,n){ne=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):re=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ne),ne=-1):h=!0,ce(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te||(te=!0,ae()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_=o(((e,t)=>{t.exports=g()})),v=o((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),y=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=o((e=>{var t=_(),n=h(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(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 m(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 g(e){var t=[null,null],n=p(e);return n===null||v(t,e,n.child,{foundSelf:!1}),t}function v(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&v(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var ee=null,te=null;function ne(e,t,n){return e===n||e===t&&(ee=e,!0)}function re(e,t,n){return e===n?(te=e,!1):e===t&&(te!==null&&(ee=e),!0)}function x(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 ie(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var S=Object.assign,ae=Symbol.for(`react.element`),oe=Symbol.for(`react.transitional.element`),se=Symbol.for(`react.portal`),ce=Symbol.for(`react.fragment`),le=Symbol.for(`react.strict_mode`),ue=Symbol.for(`react.profiler`),de=Symbol.for(`react.consumer`),fe=Symbol.for(`react.context`),pe=Symbol.for(`react.forward_ref`),me=Symbol.for(`react.suspense`),he=Symbol.for(`react.suspense_list`),ge=Symbol.for(`react.memo`),_e=Symbol.for(`react.lazy`),ve=Symbol.for(`react.activity`),ye=Symbol.for(`react.legacy_hidden`),be=Symbol.for(`react.memo_cache_sentinel`),xe=Symbol.for(`react.view_transition`),Se=Symbol.for(`react.recoverable`),Ce=Symbol.iterator;function we(e){return typeof e!=`object`||!e?null:(e=Ce&&e[Ce]||e[`@@iterator`],typeof e==`function`?e:null)}var C=Symbol.for(`react.client.reference`);function Te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===C?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ce:return`Fragment`;case ue:return`Profiler`;case le:return`StrictMode`;case me:return`Suspense`;case he:return`SuspenseList`;case ve:return`Activity`;case xe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case se:return`Portal`;case fe:return e.displayName||`Context`;case de:return(e._context.displayName||`Context`)+`.Consumer`;case pe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ge:return t=e.displayName||null,t===null?Te(e.type)||`Memo`:t;case _e:t=e._payload,e=e._init;try{return Te(e(t))}catch{}}return null}var Ee=Array.isArray,w=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De={pending:!1,data:null,method:null,action:null},Oe=[],ke=-1;function Ae(e){return{current:e}}function je(e){0>ke||(e.current=Oe[ke],Oe[ke]=null,ke--)}function Me(e,t){ke++,Oe[ke]=e.current,e.current=t}var Ne=Ae(null),Pe=Ae(null),Fe=Ae(null),Ie=Ae(null);function Le(e,t){switch(Me(Fe,t),Me(Pe,e),Me(Ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}je(Ne),Me(Ne,e)}function Re(){je(Ne),je(Pe),je(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,Me(Ie,e)),t=Ne.current;var n=dp(t,e.type);t!==n&&(Me(Pe,e),Me(Ne,n))}function Be(e){Pe.current===e&&(je(Ne),je(Pe)),Ie.current===e&&(je(Ie),sh._currentValue=De)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ve+e+He}var We=!1;function Ge(e,t){if(!e||We)return``;We=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -63,4 +63,4 @@ Error generating stack: `+e.message+`
|
|
|
63
63
|
|
|
64
64
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qa=[`oneOf`,`anyOf`];function $a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}se(n,r,e.length===1?e[0]:eo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$a(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function to(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Za)if(t in e)return;let n=t.filter(e=>Qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eo(t);else{let e=n[0],i=Qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Wa(e,r))}function no(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Wa(i,s),Wa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])to(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Wa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,se(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ro(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ro(r.element,n);if(r.type===`set`)return ro(r.valueType,n);if(r.type===`lazy`)return ro(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return ro(r.innerType,n);if(r.type===`intersection`)return ro(r.left,n)||ro(r.right,n);if(r.type===`record`||r.type===`map`)return ro(r.keyType,n)||ro(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ro(r.in,n)||ro(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ro(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ro(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ro(e,n))return!0;return!!(r.rest&&ro(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=Ga({...n,processors:t});return qa(e,r),Ya(r,e),no(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return qa(e,o),Ya(o,e),no(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(w),bigint_format:go(T),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function vo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var yo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bo=new Map([[Sr,an],[wr,on]]),xo=e=>bo.get(e)??e,So=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=vo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=yo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(xo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=vo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ka(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},wo=(e,t,n,r)=>{n.type=`boolean`},To=(e,t,n,r)=>{n.not={}},Eo=(e,t,n,r)=>{let i=e._zod.def,a=te(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Do=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ka(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ka(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Oo=(e,t,n,r)=>{Ka(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{Ka(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=vo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=qa(a.element,t,{...r,path:[...r.path,`items`]})};function jo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?jo(t.out):t.type===`catch`?jo(t.innerType):e._zod.optin}var Mo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ka(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)se(i.properties,e,qa(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?jo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=qa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},No=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>qa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Po=(e,t,n,r)=>{let i=e._zod.def,a=qa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=qa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=qa(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Io=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=Symbol();function Ro(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ka(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Lo):JSON.parse(o)}var zo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ro(i.defaultValue,e,t,n,r);o!==Lo&&(n.default=o)},Bo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ro(i.defaultValue,e,t,n,r);o!==Lo&&(n._prefault=o)},Vo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ka(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ho=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;qa(o,t,r);let s=t.seen.get(e);s.ref=o},Uo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wo=(e,t,n,r)=>{let i=e._zod.def;qa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Go=new WeakSet([Object.prototype,Error.prototype]);function Ko(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var qo=(e,t)=>{yt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Go.has(n)||(Go.add(n),Ko(n,`format`,e=>t=>St(e,t)),Ko(n,`flatten`,e=>t=>xt(e,t)),Ko(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,re,2)}),Ko(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,re,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Jo=D(`ZodError`,qo),Yo=D(`ZodError`,qo,void 0,{Parent:Error}),Xo=wt(Yo),Zo=Tt(Yo),Qo=Et(Yo),$o=Ot(Yo),A=Pt(Yo),es=Ft(Yo),ts=It(Yo),ns=Lt(Yo),rs=Rt(Yo),is=zt(Yo),as=Bt(Yo),os=Vt(Yo);function ss(){ft.localeError||pt(Ii())}function cs(){ft.memoizer||pt({memoizer:Ni()})}var j=D(`ZodType`,(e,t)=>(ss(),Bn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(me(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return we(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Cc(e,t))},superRefine(e,t){return this.check(wc(e,t))},overwrite(e){return this.check(Pa(e))},optional(){return ac(this)},exactOptional(){return sc(this)},nullable(){return lc(this)},nullish(){return ac(lc(this))},nonoptional(e){return hc(this,e)},array(){return F(this)},or(e){return Js([this,e])},and(e){return Qs(this,e)},transform(e){return yc(this,rc(e))},default(e){return dc(this,e)},prefault(e){return pc(this,e)},catch(e){return _c(this,e)},pipe(e){return yc(this,e)},readonly(){return xc(this)},describe(e){let t=this.clone();return Bi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bi.get(this);let t=this.clone();return Bi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Xe(this,`~standard`,{...Un(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){Ye(this,`~standard`,e)},parse:function e(t,n){return Xo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeParse(e,t){return Qo(this,e,t)},async safeParseAsync(e,t){return $o(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ye(this,`spa`,e)},validate(e,t){return jt(this,e,t)},validateAsync(e,t){return Nt(this,e,t)},encode:function e(t,n){return A(this,t,n,{callee:e})},decode:function e(t,n){return es(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ts(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ns(this,t,n,{callee:e})},safeEncode(e,t){return rs(this,e,t)},safeDecode(e,t){return is(this,e,t)},async safeEncodeAsync(e,t){return as(this,e,t)},async safeDecodeAsync(e,t){return os(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Bi.get(this)?.description},get _def(){return this._zod.def}}),ls=D(`_ZodString`,(e,t)=>{Wn.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},Ze({format:e=>vo(e).format??null,minLength:e=>vo(e).minimum??null,maxLength:e=>vo(e).maximum??null},{regex(...e){return this.check(Oa(...e))},includes(...e){return this.check(ja(...e))},startsWith(...e){return this.check(Ma(...e))},endsWith(...e){return this.check(Na(...e))},min(...e){return this.check(Ea(...e))},max(...e){return this.check(Ta(...e))},length(...e){return this.check(Da(...e))},nonempty(...e){return this.check(Ea(1,...e))},lowercase(e){return this.check(ka(e))},uppercase(e){return this.check(Aa(e))},trim(){return this.check(Ia())},normalize(...e){return this.check(Fa(...e))},toLowerCase(){return this.check(La())},toUpperCase(){return this.check(Ra())},slugify(){return this.check(za())}})),us=D(`ZodString`,(e,t)=>{Wn.init(e,t),ls.init(e,t)},{email(e){return this.check(Ui(gs,e))},url(e){return this.check(Yi(bs,e))},jwt(e){return this.check(ua(Is,e))},emoji(e){return this.check(Xi(Ss,e))},guid(e){return this.check(Wi(_s,e))},uuid(e){return this.check(Gi(vs,e))},uuidv4(e){return this.check(Ki(vs,e))},uuidv6(e){return this.check(qi(vs,e))},uuidv7(e){return this.check(Ji(vs,e))},nanoid(e){return this.check(Zi(Cs,e))},cuid(e){return this.check(Qi(ws,e))},cuid2(e){return this.check($i(Ts,e))},ulid(e){return this.check(ea(Es,e))},base64(e){return this.check(sa(Ns,e))},base64url(e){return this.check(ca(Ps,e))},xid(e){return this.check(ta(Ds,e))},ksuid(e){return this.check(na(Os,e))},ipv4(e){return this.check(ra(ks,e))},ipv6(e){return this.check(ia(As,e))},cidrv4(e){return this.check(aa(js,e))},cidrv6(e){return this.check(oa(Ms,e))},e164(e){return this.check(la(Fs,e))},datetime(e){return this.check(da(fs,e))},date(e){return this.check(fa(ps,e))},time(e){return this.check(pa(ms,e))},duration(e){return this.check(ma(hs,e))}});function M(e){return Hi(us,e)}var ds=D(`ZodStringFormat`,(e,t)=>{Gn.init(e,t),ls.init(e,t)}),fs=D(`ZodISODateTime`,(e,t)=>{ur.init(e,t),ds.init(e,t)}),ps=D(`ZodISODate`,(e,t)=>{dr.init(e,t),ds.init(e,t)}),ms=D(`ZodISOTime`,(e,t)=>{fr.init(e,t),ds.init(e,t)}),hs=D(`ZodISODuration`,(e,t)=>{pr.init(e,t),ds.init(e,t)}),gs=D(`ZodEmail`,(e,t)=>{Jn.init(e,t),ds.init(e,t)}),_s=D(`ZodGUID`,(e,t)=>{Kn.init(e,t),ds.init(e,t)}),vs=D(`ZodUUID`,(e,t)=>{qn.init(e,t),ds.init(e,t)});function ys(e){return Gi(vs,e)}var bs=D(`ZodURL`,(e,t)=>{nr.init(e,t),ds.init(e,t)});function xs(e){return Yi(bs,e)}var Ss=D(`ZodEmoji`,(e,t)=>{rr.init(e,t),ds.init(e,t)}),Cs=D(`ZodNanoID`,(e,t)=>{ir.init(e,t),ds.init(e,t)}),ws=D(`ZodCUID`,(e,t)=>{ar.init(e,t),ds.init(e,t)}),Ts=D(`ZodCUID2`,(e,t)=>{or.init(e,t),ds.init(e,t)}),Es=D(`ZodULID`,(e,t)=>{sr.init(e,t),ds.init(e,t)}),Ds=D(`ZodXID`,(e,t)=>{cr.init(e,t),ds.init(e,t)}),Os=D(`ZodKSUID`,(e,t)=>{lr.init(e,t),ds.init(e,t)}),ks=D(`ZodIPv4`,(e,t)=>{mr.init(e,t),ds.init(e,t)}),As=D(`ZodIPv6`,(e,t)=>{_r.init(e,t),ds.init(e,t)}),js=D(`ZodCIDRv4`,(e,t)=>{vr.init(e,t),ds.init(e,t)}),Ms=D(`ZodCIDRv6`,(e,t)=>{br.init(e,t),ds.init(e,t)}),Ns=D(`ZodBase64`,(e,t)=>{Cr.init(e,t),ds.init(e,t)}),Ps=D(`ZodBase64URL`,(e,t)=>{Er.init(e,t),ds.init(e,t)}),Fs=D(`ZodE164`,(e,t)=>{Dr.init(e,t),ds.init(e,t)}),Is=D(`ZodJWT`,(e,t)=>{kr.init(e,t),ds.init(e,t)}),Ls=D(`ZodNumber`,(e,t)=>{Ar.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.isFinite=!0},Ze({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=vo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=vo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=vo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>vo(e).format??null},{gt(e,t){return this.check(Sa(e,t))},gte(e,t){return this.check(Ca(e,t))},min(e,t){return this.check(Ca(e,t))},lt(e,t){return this.check(ba(e,t))},lte(e,t){return this.check(xa(e,t))},max(e,t){return this.check(xa(e,t))},int(e){return this.check(zs(e))},safe(e){return this.check(zs(e))},positive(e){return this.check(Sa(0,e))},nonnegative(e){return this.check(Ca(0,e))},negative(e){return this.check(ba(0,e))},nonpositive(e){return this.check(xa(0,e))},multipleOf(e,t){return this.check(wa(e,t))},step(e,t){return this.check(wa(e,t))},finite(){return this}}));function N(e){return ha(Ls,e)}var Rs=D(`ZodNumberFormat`,(e,t)=>{jr.init(e,t),Ls.init(e,t)});function zs(e){return ga(Rs,e)}var Bs=D(`ZodBoolean`,(e,t)=>{Mr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function P(e){return _a(Bs,e)}var Vs=D(`ZodUnknown`,(e,t)=>{Nr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Hs(){return va(Vs)}var Us=D(`ZodNever`,(e,t)=>{Pr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function Ws(e){return ya(Us,e)}var Gs=D(`ZodArray`,(e,t)=>{cs(),Rr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ea(e,t))},nonempty(e){return this.check(Ea(1,e))},max(e,t){return this.check(Ta(e,t))},length(e,t){return this.check(Da(e,t))},unwrap(){return this.element}});function F(e,t){return Ba(Gs,e,t)}var Ks=D(`ZodObject`,(e,t)=>{cs(),Wr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),rt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return L(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(me(this._zod.def,{catchall:e}))},passthrough(){return this.clone(me(this._zod.def,{catchall:Hs()}))},loose(){return this.clone(me(this._zod.def,{catchall:Hs()}))},strict(){return this.clone(me(this._zod.def,{catchall:Ws()}))},strip(){return this.clone(me(this._zod.def,{catchall:void 0}))},extend(e){return Ae(this,e)},safeExtend(e){return Me(this,e)},merge(e){return Ne(this,e)},pick(e){return De(this,e)},omit(e){return ke(this,e)},partial(...e){return Pe(ic,this,e[0])},exactPartial(...e){return Pe(oc,this,e[0],`exactPartial`)},required(...e){return Fe(mc,this,e[0])}});function I(e,t){return new Ks({type:`object`,shape:e??{},...C(t)})}var qs=D(`ZodUnion`,(e,t)=>{Kr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.options=t.options});function Js(e,t){return new qs({type:`union`,options:e,...C(t)})}var Ys=D(`ZodDiscriminatedUnion`,(e,t)=>{qs.init(e,t),Jr.init(e,t)});function Xs(e,t,n){return new Ys({type:`union`,options:t,discriminator:e,...C(n)})}var Zs=D(`ZodIntersection`,(e,t)=>{Yr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r)});function Qs(e,t){return new Zs({type:`intersection`,left:e,right:t})}var $s=D(`ZodEnum`,(e,t)=>{Qr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new $s({...t,checks:[],...C(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new $s({...t,checks:[],...C(r),entries:i})}});function L(e,t){return new $s({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...C(t)})}var ec=D(`ZodLiteral`,(e,t)=>{$r.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function tc(e,t){return new ec({type:`literal`,values:Array.isArray(e)?e:[e],...C(t)})}var nc=D(`ZodTransform`,(e,t)=>{cs(),ei.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new dt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(qe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(qe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rc(e){return new nc({type:`transform`,transform:e})}var ic=D(`ZodOptional`,(e,t)=>{ni.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new ic({type:`optional`,innerType:e})}var oc=D(`ZodExactOptional`,(e,t)=>{ri.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new oc({type:`optional`,innerType:e})}var cc=D(`ZodNullable`,(e,t)=>{ii.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new cc({type:`nullable`,innerType:e})}var uc=D(`ZodDefault`,(e,t)=>{ai.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dc(e,t){return new uc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var fc=D(`ZodPrefault`,(e,t)=>{si.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e,t){return new fc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var mc=D(`ZodNonOptional`,(e,t)=>{ci.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new mc({type:`nonoptional`,innerType:e,...C(t)})}var gc=D(`ZodCatch`,(e,t)=>{di.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _c(e,t){return new gc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:at(t)})}var vc=D(`ZodPipe`,(e,t)=>{fi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.in=t.in,e.out=t.out});function yc(e,t){return new vc({type:`pipe`,in:e,out:t})}var bc=D(`ZodReadonly`,(e,t)=>{mi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e){return new bc({type:`readonly`,innerType:e})}var Sc=D(`ZodCustom`,(e,t)=>{gi.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function Cc(e,t={}){return Va(Sc,e,t)}function wc(e,t){return Ha(e,t)}var R=h(),Tc=ee(),z=M().regex(/^[a-z][a-z0-9_-]{0,63}$/),Ec=ys();I({deviceId:Ec,projectId:z.optional()}).strict(),I({workspaceId:z,memberId:z,deviceId:Ec}),I({members:F(z)});var Dc=134217728,Oc=10485760,kc=3e5,Ac=M().regex(/^[a-f0-9]{64}$/),jc=N().int().nonnegative().max(2**53-1),Mc=M().min(1).max(1024).refine(e=>e!==e.normalize(`NFC`)||/[\\\x00-\x1f\x7f:<>"|?*]/.test(e)?!1:e.split(`/`).every(e=>e.length>0&&e.length<=255&&e!==`.`&&e!==`..`&&!/[. ]$/.test(e)&&!/^\.teammy(?:-|$)/i.test(e)&&!/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(e)),`Path must be a portable, normalized relative file path.`),Nc=I({sha256:Ac,size:N().int().min(0).max(Dc)}),Pc=Nc.extend({size:N().int().min(0).max(Oc)}),Fc=Xs(`kind`,[Pc.extend({kind:tc(`upsert`),path:Mc}).strict(),I({kind:tc(`delete`),path:Mc}).strict()]);I({operationId:ys(),parentRevision:jc,changes:F(Fc)}).strict().refine(e=>new Set(e.changes.map(e=>e.path)).size===e.changes.length,`Duplicate paths in a publication.`),I({operationId:ys(),revision:jc});var Ic=Pc.extend({path:Mc,revision:jc});I({revision:jc,complete:P().default(!1),files:F(Ic),nextCursor:M().nullable()}),I({headRevision:jc,revisions:F(I({revision:jc,operationId:ys(),createdAt:M(),changes:F(Fc)}))}),I({hashes:F(Ac).max(200)}).strict(),I({missing:F(Ac)});var Lc=Xs(`kind`,[Ic.extend({kind:tc(`file`)}),I({kind:tc(`directory`),path:Mc,fileCount:N().int().positive()})]),Rc=I({revision:jc,path:Js([tc(``),Mc]),entries:F(Lc),nextCursor:M().nullable()}),zc=I({revision:jc,file:Ic}),Bc=M().url().max(2048).refine(e=>{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)&&!t.username&&!t.password&&!t.search&&!t.hash},`Use an HTTP(S) server URL without credentials, query or fragment.`),Vc=I({checkIntervalSeconds:N().int().min(1).max(86400),fileSettleSeconds:N().int().min(0).max(86400)}).strict(),Hc=I({schemaVersion:tc(1),projectId:z,projectName:M().trim().min(1).max(120),description:M().max(2e3),publicServerUrl:Bc,configRevision:jc,scopeProfile:tc(`workspace-and-sessions-v1`),sync:Vc}).strict(),Uc=I({operationId:ys(),publicServerUrl:Bc,adminId:z}).strict(),Wc=I({initialized:P()}),Gc=Hc.pick({projectName:!0,description:!0}).extend({expectedRevision:jc.optional()}).strict(),Kc=I({id:z,displayName:M().max(120),enabled:P(),accountEnabled:P(),revision:jc,bound:P(),fileRevision:jc,lastPublishedAt:M().nullable(),hasFiles:P().default(!1),hasSessions:P().default(!1)}),qc=I({memberId:z,displayName:M(),siteRole:L([`admin`,`member`])}),Jc=qc.extend({workspaceId:z}),Yc=I({id:z}).strict(),Xc=I({expectedRevision:jc,displayName:M().trim().max(120).optional(),enabled:P().optional()}).strict();I({operationId:ys(),projectName:M().trim().min(1).max(120),description:M().max(2e3).default(``),workspacePath:M().trim().min(1).optional()}).strict();var Zc=I({projects:F(I({projectId:z,projectName:M(),description:M()}))}),Qc=I({sync:Vc,publicServerUrl:Bc,revision:jc}),$c=I({publicServerUrl:Bc.optional(),sync:Vc.optional(),expectedRevision:jc}).strict().refine(e=>e.publicServerUrl!==void 0||e.sync!==void 0,`Provide a setting to update.`),el=I({id:z,displayName:M(),siteRole:L([`admin`,`member`]),enabled:P(),revision:jc}),tl=I({id:z,displayName:M().trim().max(120).default(``),siteRole:L([`admin`,`member`]).default(`member`)}).strict(),nl=I({expectedRevision:jc,displayName:M().trim().max(120).optional(),enabled:P().optional(),siteRole:L([`admin`,`member`]).optional()}).strict(),B={brand:`Teammy`,navigation:`主导航`,filePreview:`文件预览`,versionPicker:`选择目录版本`,connectCommand:`连接命令`,syncCommand:`开启同步命令`,syncStopCommand:`停止同步命令`,installCommandLabel:`安装命令`,skipToMain:`跳到主要内容`,loading:`正在加载…`,retry:`重试`,refresh:`刷新`,cancel:`取消`,close:`关闭`,save:`保存`,saving:`正在保存…`,next:`下一步`,back:`上一步`,confirm:`确认`,logout:`退出登录`,menu:`导航菜单`,files:`工作区`,dashboard:`工作看板`,sessions:`对话库`,members:`成员`,settings:`设置`,account:`个人账户`,project:`项目`,projectName:`项目名称`,description:`项目说明`,address:`团队接入地址`,addressHint:`填写成员设备能够访问的服务地址。`,adminId:`管理员 ID`,memberId:`成员 ID`,idHint:`以小写字母开头,最多 64 位,可包含数字、短横线或下划线。ID 创建后不可修改。`,displayName:`显示名称`,admin:`管理员`,member:`成员`,enabled:`已启用`,disabled:`已停用`,login:`进入工作台`,loginTitle:`连接你的团队`,loginHint:`输入管理员预先建立的成员 ID。`,existing:`接入已有工作区`,choose:`请选择`,interval:`文件检查间隔(秒)`,settle:`文件稳定等待(秒)`,timingHint:`文件停止修改后开始计时。新设置约 30 秒后下发,当前批次结束后生效。`,scope:`共享范围`,owner:`文件所属成员`,noFiles:`该目录版本暂无文件`,noFilesHint:`运行客户端同步后查看。`,pickFile:`选择文件,查看内容`,more:`加载更多`,name:`文件路径`,size:`大小`,version:`版本`,directoryVersion:`目录版本`,latest:`最新版本`,viewVersion:`查看版本`,download:`下载原文件`,raw:`原文`,rendered:`预览`,previewUnavailable:`该文件不支持文本预览,请下载查看。`,previewLarge:`文件超过 512 KiB,请下载查看完整内容。`,readOnly:`只读`,refreshFiles:`刷新目录`,remoteImage:`图片`,addMember:`添加成员`,editName:`修改名称`,disableMember:`停用成员`,enableMember:`启用成员`,resetDevice:`重置设备`,resetHint:`撤销该成员的设备凭证,保留共享文件与历史。成员需要重新运行 connect --reconnect。`,disableHint:`停止该成员访问和同步本项目,保留历史资料。其他项目不受影响。`,enableHint:`恢复本项目访问权限。设备需要重新接入。`,bound:`设备已绑定`,unbound:`尚未绑定设备`,noContact:`尚无状态报告`,lastContact:`最近联系`,lastPublished:`最近发布`,noPublication:`尚未发布文件`,stale:`报告已超过 2 分钟`,applied:`已应用`,waiting:`等待应用`,failed:`应用失败`,received:`已接收`,saved:`服务端已保存`,override:`含命令行覆盖`,effective:`当前有效策略`,syncResult:`最近同步`,pending:`待发文件`,clientVersion:`客户端版本`,syncIssues:`同步提示`,statusHint:`最近上报状态,非实时在线状态。`,connectTitle:`连接项目目录`,connectHint:`在工作目录(例如 utu/)运行以下命令,并在打开的网页中确认用户 ID,将当前工作目录连接到 Teammy 服务:`,connectAfter:`注意:会话采集以工作目录为范围,只采集该目录及其子目录中的 Agent 会话。因此,建议在项目根目录(例如 utu/)执行此命令。`,install:`首次使用`,installHint:`需要 Node.js 22.19+。安装后按上方说明连接项目。`,copy:`复制`,copied:`已复制`,copyFailed:`复制失败,请手动选择命令。`,configSaved:`设置已保存,等待客户端接收并上报。`,reloadConfig:`读取最新设置`,configConflict:`设置已被其他成员修改。先读取最新设置,再重新编辑。`,permissionHint:`公共设置由管理员维护。`,application:`配置应用情况`,serverVersion:`服务端版本`,notReported:`未上报`,seconds:`秒`,errors:{AI_DEFAULT_REQUIRED:`请选择模型,或先设置默认接入点。`,AI_PROFILE_DISABLED:`该模型接入点已停用,请重新选择。`,AI_CONFIG_CONFLICT:`模型设置已更新,请重新载入后保存。`,SITE_ADMIN_REQUIRED:`此操作需要站点管理员身份。`,USER_NOT_FOUND:`用户尚未建立或账号已停用,请联系站点管理员。`,USER_EXISTS:`该用户 ID 已存在。`,PROJECT_NOT_FOUND:`项目不存在或你已不再是该项目成员。`,PROJECT_REQUIRED:`请选择一个项目。`,PROJECT_MISMATCH:`设备凭证属于其他项目。`,UNKNOWN_MEMBER:`成员 ID 不存在或已被停用。`,LOGIN_REQUIRED:`登录已失效,请重新登录。`,ADMIN_REQUIRED:`此操作需要管理员身份。`,STALE_CONFIG:`设置已变更,请读取最新设置后重试。`,STALE_MEMBER:`成员信息已变更,请刷新后重试。`,LAST_ADMIN:`至少需要保留一位启用的管理员。`,MEMBER_EXISTS:`该成员 ID 已存在。`,ALREADY_INITIALIZED:`服务已初始化,请刷新页面进入登录。`,INVALID_REQUEST:`请检查输入内容和数值范围。`,INVALID_RESPONSE:`服务返回了无法识别的响应,请刷新后重试。`,GATEWAY_ERROR:`服务网关未能转发请求,请检查部署配置。`,FORBIDDEN:`没有执行此操作的权限。`,INVALID_REVISION:`该目录版本不存在。`}};function rl(e){let t=e.replace(/\s+/g,` `).trim()||`未命名对话`,n=Array.from(t);return n.length>56?n.slice(0,56).join(``)+`…`:t}var il=class extends Error{code;status;constructor(e,t,n){super(B.errors[e]??t),this.code=e,this.status=n}},al;async function V(e,t,n={}){let r=n.method??`GET`,i=await fetch(d(`/api/v1/${e}`),{method:r===`PATCH`?`POST`:r,headers:{accept:`application/json`,...r===`PATCH`?{"x-http-method-override":`PATCH`}:{},...n.body===void 0?{}:{"content-type":`application/json`},...r===`GET`?{}:{"x-teammy-web":`1`}},body:n.body===void 0?void 0:JSON.stringify(n.body),signal:n.signal?AbortSignal.any([n.signal,AbortSignal.timeout(n.timeoutMs??15e3)]):AbortSignal.timeout(n.timeoutMs??15e3),credentials:`same-origin`}),a=i.headers.get(`x-teammy-data-generation`);if(a){let e=al!==void 0&&al!==a;al=a,e&&window.dispatchEvent(new Event(`teammy:data-reset`))}let o=await i.json().catch(()=>{throw new il(`INVALID_RESPONSE`,``,i.status)});if(o?.Response?.Error)throw new il(`GATEWAY_ERROR`,``,i.status);if(!i.ok){let e=new il(o?.error?.code??`HTTP_ERROR`,o?.error?.message??`HTTP ${i.status}`,i.status);throw e.code===`LOGIN_REQUIRED`&&window.dispatchEvent(new Event(`teammy:logout`)),e}let s=t.safeParse(o);if(!s.success)throw new il(`INVALID_RESPONSE`,``,i.status);return s.data}var ol={server:e=>V(`server`,I({version:M()}),{signal:e}),projects:e=>V(`projects`,Zc,{signal:e}),setup:e=>V(`setup`,Wc,{signal:e}),session:e=>V(`web/session`,qc,{signal:e}),login:e=>V(`web/session`,qc,{method:`POST`,body:{id:e}}),logout:()=>V(`web/session`,I({ok:P()}),{method:`DELETE`})};function sl(e){return{config:t=>e(`project/config`,Hc,{signal:t}),members:t=>e(`web/members`,I({members:F(Kc)}),{signal:t}),file:(t,n,r,i)=>e(`files/${encodeURIComponent(t)}/entry?${new URLSearchParams({path:n,...r===void 0?{}:{revision:String(r)}})}`,zc,{signal:i}),tree:(t,n,r,i,a)=>e(`files/${encodeURIComponent(t)}/tree?${new URLSearchParams({path:n,after:i,limit:`100`,...r===void 0?{}:{revision:String(r)}})}`,Rc,{signal:a})}}function H(e){return e instanceof Jo?B.errors.INVALID_REQUEST:e instanceof Error?e.message:String(e)}function cl(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function ll(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}async function ul(e,t,n){let r=await fetch(d(`${n}/blobs/${e.sha256}`),{signal:AbortSignal.any([t,AbortSignal.timeout(kc)])});if(!r.ok)throw r.status===401&&window.dispatchEvent(new Event(`teammy:logout`)),new il(`HTTP_ERROR`,`HTTP ${r.status}`,r.status);let i=await r.arrayBuffer();if(i.byteLength!==e.size)throw Error(`File size mismatch.`);let a;try{a=new TextDecoder(`utf-8`,{fatal:!0}).decode(i)}catch{throw Error(B.previewUnavailable)}if(a.includes(`\0`))throw Error(B.previewUnavailable);return a}var dl=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),fl=o(((e,t)=>{t.exports=dl()})),U=fl(),pl=class{values=new Map;get(e){return this.values.get(e)}set(e,t){this.values.set(e,t)}delete(e){this.values.delete(e)}},ml=(0,R.createContext)(void 0);function hl({children:e}){let[{cache:t,generation:n},r]=(0,R.useState)(()=>({cache:new pl,generation:0}));return(0,R.useEffect)(()=>{let e=()=>{let e=new URL(location.href);for(let t of[`chat`,`message`])e.searchParams.delete(t);history.replaceState(history.state,``,e),r(e=>({cache:new pl,generation:e.generation+1}))};return window.addEventListener(`teammy:data-reset`,e),()=>window.removeEventListener(`teammy:data-reset`,e)},[]),(0,U.jsx)(ml.Provider,{value:t,children:(0,U.jsx)(R.Fragment,{children:e},n)})}var gl=()=>(0,R.useContext)(ml),_l=(...e)=>JSON.stringify(e);function W(e,t=!1,n){let r=gl(),i=n??e,a=()=>n?r?.get(n):void 0,[o,s]=(0,R.useState)(()=>({source:i,data:a(),error:``,loading:!0})),c=o.source===i?o:{source:i,data:a(),error:``,loading:!0},l=(0,R.useRef)(null),u=(0,R.useRef)(0),d=(0,R.useCallback)(async()=>{l.current?.abort();let t=new AbortController;l.current=t;let o=++u.current;s(e=>({source:i,data:e.source===i?e.data:a(),error:``,loading:!0}));try{let a=await e(t.signal);o===u.current&&(n&&r?.set(n,a),s({source:i,data:a,error:``,loading:!1}))}catch(e){if(!t.signal.aborted&&o===u.current){let t=e instanceof il&&[401,403,404].includes(e.status);t&&n&&r?.delete(n),s(n=>({...n,data:t?void 0:n.data,error:H(e)}))}}finally{o===u.current&&(s(e=>({...e,loading:!1})),l.current=null)}},[e,n,r]);return(0,R.useEffect)(()=>{d();let e=()=>{!document.hidden&&!l.current&&d()},n=t?setInterval(e,typeof t==`number`?t:3e4):void 0;return t&&document.addEventListener(`visibilitychange`,e),()=>{u.current++,l.current?.abort(),l.current=null,clearInterval(n),document.removeEventListener(`visibilitychange`,e)}},[d,t]),{data:c.data,error:c.error,loading:c.loading,reload:d}}function vl(){let[e]=(0,R.useState)(()=>new AbortController);return(0,R.useEffect)(()=>()=>e.abort(),[e]),e.signal}async function yl(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.activeElement,n=window.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t).cloneRange()):[],i=document.createElement(`textarea`);i.value=e,i.readOnly=!0,i.style.cssText=`position:fixed;left:0;top:0;opacity:0;pointer-events:none;`,document.body.append(i);try{if(i.focus({preventScroll:!0}),i.select(),!document.execCommand(`copy`))throw Error(`Clipboard copy was denied.`)}finally{if(i.remove(),t instanceof HTMLElement&&t.focus({preventScroll:!0}),n){n.removeAllRanges();for(let e of r)n.addRange(e)}}}var bl=new URL(`teammy-wordmark-ZFwxG0yl.png`,import.meta.url).href,xl=new URL(`teammy-mark-CxBtF1-X.png`,import.meta.url).href,Sl=new URL(`teammy-calm-DVuoOK0F.png`,import.meta.url).href,Cl=new URL(`teammy-wave-CVTgecuC.png`,import.meta.url).href,wl=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Tl(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:wl(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var El=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Dl=e=>{let t=El(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ol=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),kl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Al(e){return e!=null}function jl(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??kl.width,a=e.size??e.height??kl.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Ol(...c):Ol(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??kl[`stroke-width`])*Number(e.size??e.width??kl.width)/Number(t.size??t.width??kl.width):t.strokeWidth??kl[`stroke-width`];return[`svg`,{...Object.entries(kl).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Al(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Al(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Al(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Ml(e,t={}){return jl(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Nl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Pl=(0,R.createContext)({}),Fl=()=>(0,R.useContext)(Pl),Il=(0,R.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Fl()??{},y=!!c||Nl(d),[b,ee,te=[]]=Ml(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Ol(v,s),hasA11yProp:y,attributes:d});return(0,R.createElement)(b,{ref:f,...ee},[...te.map(([e,t])=>(0,R.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function G(e,t=[],n=[]){let r=typeof e==`string`?Tl(e,t,n):e,i=(0,R.forwardRef)(({className:e,...t},n)=>(0,R.createElement)(Il,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Dl(r.name)),i}var Ll={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Ll.node;var Rl=G(Ll),zl={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};zl.node;var Bl=G(zl),Vl={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};Vl.node;var Hl=G(Vl),Ul={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};Ul.node;var Wl=G(Ul),Gl={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Gl.node;var Kl=G(Gl),ql={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};ql.node;var Jl=G(ql),Yl={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Yl.node;var Xl=G(Yl),Zl={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Zl.node;var Ql=G(Zl),$l={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};$l.node;var eu=G($l),tu={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};tu.node;var nu=G(tu),ru={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};ru.node;var K=G(ru),iu={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};iu.node;var au=G(iu),ou={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};ou.node;var su=G(ou),cu={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};cu.node;var lu=G(cu),uu={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};uu.node;var du=G(uu),fu={name:`file-image`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]};fu.node;var pu=G(fu),mu={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};mu.node;var hu=G(mu),gu={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};gu.node;var _u=G(gu),vu={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};vu.node;var yu=G(vu),bu={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};bu.node;var xu=G(bu),Su={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Su.node;var Cu=G(Su),wu={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};wu.node;var Tu=G(wu),Eu={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Eu.node;var Du=G(Eu),Ou={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Ou.node;var ku=G(Ou),Au={name:`list-plus`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]};Au.node;var ju=G(Au),Mu={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Mu.node;var Nu=G(Mu),Pu={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Pu.node;var Fu=G(Pu),Iu={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};Iu.node;var Lu=G(Iu),Ru={name:`messages-square`,size:24,node:[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]};Ru.node;var zu=G(Ru),Bu={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Bu.node;var Vu=G(Bu),Hu={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};Hu.node;var Uu=G(Hu),Wu={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Wu.node;var Gu=G(Wu),Ku={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Ku.node;var qu=G(Ku),Ju={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Ju.node;var Yu=G(Ju),Xu={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Xu.node;var Zu=G(Xu),Qu={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Qu.node;var q=G(Qu),$u={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};$u.node;var J=G($u),Y={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Y.node;var ed=G(Y),td={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};td.node;var nd=G(td),rd={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};rd.node;var id=G(rd),ad={name:`user-round-check`,size:24,node:[[`path`,{d:`M2 21a8 8 0 0 1 13.292-6`,key:`bjp14o`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]],aliases:[`user-check-2`]};ad.node;var od=G(ad),sd={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};sd.node;var cd=G(sd),ld={name:`user-round-x`,size:24,node:[[`path`,{d:`m16.5 16.5 5 5`,key:`zc9lw7`}],[`path`,{d:`M2 21a8 8 0 0 1 11.531-7.18`,key:`x5izle`}],[`path`,{d:`m21.5 16.5-5 5`,key:`1empo3`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}]],aliases:[`user-x-2`]};ld.node;var ud=G(ld),dd={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};dd.node;var fd=G(dd),pd={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};pd.node;var md=G(pd);function hd({compact:e=!1}){return(0,U.jsx)(`div`,{className:`brand ${e?`brand-compact`:``}`,children:(0,U.jsx)(`img`,{src:e?xl:bl,alt:`Teammy`})})}function gd({pose:e=`calm`}){return(0,U.jsx)(`img`,{className:`mascot mascot-${e}`,src:e===`wave`?Cl:Sl,alt:``,"aria-hidden":`true`})}function _d({name:e,small:t=!1}){return(0,U.jsx)(`span`,{className:`avatar ${t?`small`:``}`,"aria-hidden":`true`,children:Array.from(e)[0]?.toUpperCase()})}function vd({children:e}){return(0,U.jsx)(`span`,{className:`count`,children:e})}function yd({title:e,description:t,icon:n,mascot:r=!1,children:i}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[r?(0,U.jsx)(gd,{}):n?(0,U.jsx)(Od,{name:n}):null,(0,U.jsx)(`h3`,{children:e}),t&&(0,U.jsx)(`p`,{children:t}),i]})}function bd({title:e,count:t,children:n}){return(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsxs)(`h2`,{children:[e,t!==void 0&&(0,U.jsx)(vd,{children:t})]}),n]})}function xd({label:e,children:t}){return(0,U.jsx)(`div`,{className:`toolbar-actions`,role:`group`,"aria-label":e,children:t})}function X({children:e,error:t=!1}){return e?(0,U.jsx)(`div`,{"data-testid":`notice`,"data-kind":t?`error`:`info`,className:`notice ${t?`error`:``}`,role:t?`alert`:`status`,children:e}):null}function Z({id:e,name:t,label:n,hint:r,children:i}){let a=[i.props[`aria-describedby`],r?`${e}-hint`:void 0].filter(Boolean).join(` `)||void 0;return(0,U.jsxs)(`label`,{className:`field`,htmlFor:e,children:[(0,U.jsx)(`span`,{id:`${e}-label`,children:n}),(0,R.cloneElement)(i,{id:e,name:t??i.props.name??e,"data-testid":e,"aria-labelledby":`${e}-label`,"aria-describedby":a}),r&&(0,U.jsx)(`small`,{id:`${e}-hint`,children:r})]})}function Sd({title:e,description:t,children:n}){return(0,U.jsxs)(`header`,{className:`page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:e}),t&&(0,U.jsx)(`p`,{children:t})]}),n]})}function Cd({id:e,title:t,children:n,onClose:r}){let i=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let e=document.activeElement;return i.current?.showModal(),()=>{i.current?.close(),e?.focus()}},[]),(0,U.jsx)(`dialog`,{id:e,"data-testid":e,"aria-labelledby":`${e}-title`,ref:i,onCancel:r,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,U.jsxs)(`div`,{className:`dialog-content`,children:[(0,U.jsxs)(`header`,{className:`dialog-header`,children:[(0,U.jsx)(`h2`,{id:`${e}-title`,children:t}),(0,U.jsx)(kd,{icon:`close`,label:B.close,"data-testid":`dialog-close`,onClick:r})]}),n]})})}function wd({id:e,label:t,value:n}){let[r,i]=(0,R.useState)(``);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`command`,"data-testid":e,children:[(0,U.jsx)(`code`,{"data-testid":`${e}-value`,children:n}),(0,U.jsx)(kd,{icon:`copy`,"data-testid":`${e}-copy`,label:`${B.copy}${t}`,onClick:async()=>{try{await yl(n),i(B.copied)}catch{i(B.copyFailed)}}})]}),r&&(0,U.jsx)(`small`,{"data-testid":`${e}-feedback`,role:`status`,children:r})]})}function Td({value:e}){return e?(0,U.jsx)(`time`,{dateTime:e,children:new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}):(0,U.jsx)(`span`,{children:`—`})}var Ed={assistant:nd,archive:Rl,send:Bl,dashboard:Du,sessions:zu,message:Lu,files:Cu,materials:Wl,folderOpen:xu,chevronUp:Ql,chevronDown:Jl,members:fd,settings:J,refresh:Zu,chevron:Xl,file:yu,text:id,link:ku,attachment:Uu,imageFile:pu,spreadsheetFile:_u,codeFile:du,addText:ju,addFile:hu,download:su,code:nu,preview:lu,sparkles:nd,close:md,plus:Yu,edit:Gu,device:Vu,disable:ud,enable:od,reset:Tu,menu:Fu,logout:Nu,account:cd,copy:K,general:ed,connect:qu,model:au,check:Kl,search:q,notifications:Hl,attention:eu},Dd={small:16,normal:24,navigation:38};function Od({name:e,size:t=`normal`}){let n=Ed[e];return(0,U.jsx)(n,{className:`icon`,size:Dd[t],strokeWidth:2,absoluteStrokeWidth:!0,"aria-hidden":`true`})}function kd({label:e,icon:t,tooltip:n=t!==`refresh`,className:r=``,variant:i=`ghost`,...a}){return(0,U.jsx)(`button`,{type:`button`,...a,className:`icon-button ${i===`primary`?`primary`:``} ${r}`,"aria-label":e,"data-tooltip":n?e:void 0,children:(0,U.jsx)(Od,{name:t})})}var Ad=L([`planned`,`in_progress`,`in_review`,`completed`]),jd=I({title:M().trim(),goal:M().trim().nullable(),status:Ad.nullable(),progress:M().trim(),needsConfirmation:P().default(!1)}).strict(),Md=I({kind:L([`workspace`,`material`]).optional(),materialId:M().regex(/^R\d{6,}$/).optional(),path:Mc,sha256:Ac,revision:jc,syncedAt:M()}),Nd=jd.extend({id:ys(),owner:z,jobId:ys().nullable(),revision:jc.default(1),origin:L([`workspace`,`confirmed`]).default(`workspace`),sources:F(Md),syncedAt:M().nullable(),corrected:P(),needsReview:P()});I({expectedRevision:jc.optional(),title:jd.shape.title.optional(),status:Ad.nullable().optional(),goal:jd.shape.goal.optional(),progress:jd.shape.progress.optional(),needsConfirmation:P().optional()}).strict().refine(e=>Object.keys(e).some(e=>e!==`expectedRevision`),`Provide a correction.`);var Pd=I({tasks:F(Nd),members:F(I({owner:z,jobId:ys().nullable(),status:L([`empty`,`waiting`,`queued`,`running`,`succeeded`,`failed`,`cancelled`]),error:M().nullable(),sourceChanged:P(),uncertainties:F(M())})),modelAvailable:P()}),Fd=I({id:z,name:M().trim().min(1).max(120),protocol:L([`openai-completions`,`openai-responses`,`anthropic-messages`]),baseUrl:Bc,model:M().trim().min(1).max(200),enabled:P().default(!0)}).strict(),Id=Fd.safeExtend({revision:N().int(),keyConfigured:P()}),Ld=I({expectedRevision:N().int().nonnegative(),profile:Fd,apiKey:M().min(1).max(4096).nullable().optional()}).strict(),Rd=I({profiles:F(Id)});I({expectedRevision:N().int().nonnegative(),profileId:z.nullable()}).strict();var zd=I({revision:N().int().nonnegative(),profileId:z.nullable(),effectiveProfileId:z.nullable(),source:L([`site`,`project`,`none`]),available:P()}),Bd=I({mode:L([`text`,`tools`,`json`])}).strict(),Vd=I({ok:tc(!0),mode:Bd.shape.mode,streamed:P(),inputTokens:N(),outputTokens:N()}),Hd=I({owner:z,kind:L([`file`,`directory`]),path:Js([tc(``),Mc]),revision:N().int().nonnegative().optional()}).strict().refine(e=>e.kind===`directory`||e.path!==``,`A file path is required.`),Ud=I({operationId:ys(),profileId:z.optional(),workflow:L([`file-summary`,`directory-analysis`,`task-bootstrap`]),selection:Hd,question:M().trim().default(``)}).strict(),Wd=I({path:Mc,startLine:N().int().positive(),endLine:N().int().positive(),sha256:Ac}),Gd=I({totalFiles:N().int(),readFiles:F(Mc),accessTracking:tc(`unavailable`).optional(),limitations:F(M())}),Kd=Js([I({summary:M(),findings:F(M()),uncertainties:F(M()).default([]),citations:F(Wd),coverage:Gd}),I({kind:tc(`task-bootstrap`),updateMode:tc(`patch`).optional(),archive:F(ys()).optional(),tasks:F(jd.extend({taskId:ys().nullable().optional(),sources:F(Md)})),uncertainties:F(M()).optional(),coverage:Gd})]),qd=I({inputTokens:N().nonnegative(),outputTokens:N().nonnegative()}),Jd=I({id:ys(),requester:z,workflow:Ud.shape.workflow,question:M(),profileId:z,model:M(),profileRevision:N().int(),promptVersion:M(),origin:L([`manual`,`automatic`]).default(`manual`),status:L([`queued`,`running`,`succeeded`,`failed`,`cancelled`]),createdAt:M(),updatedAt:M(),attemptCount:N().int(),error:M().nullable(),input:I({owner:z,kind:L([`file`,`directory`]),path:M(),revision:N().int(),fileCount:N().int(),fingerprint:Ac}),result:Kd.nullable(),sourceChanged:P()});I({jobs:F(Jd),nextCursor:M().nullable()}),I({events:F(I({seq:N().int(),attempt:N().int(),kind:M(),message:M(),createdAt:M()})),nextCursor:N().int()}),I({job:Jd,attempts:F(I({number:N().int(),status:M(),startedAt:M(),endedAt:M().nullable(),error:M().nullable(),usage:qd.nullable()}))});var Yd=I({state:L([`unknown`,`online`,`offline`]),lastSeenAt:M().nullable()}),Xd=I({state:L([`unconfigured`,`pending`,`cloning`,`fetching`,`ready`,`failed`,`interrupted`]),lastSuccessAt:M().nullable()}),Zd=I({worker:Yd.shape.state,modelAvailable:P(),activities:F(I({kind:L([`repository`,`import`,`tasks`,`sessions`,`project`,`chat`]),state:L([`queued`,`running`,`failed`]),count:N().int().positive()}))}),Qd=I({state:L([`unknown`,`ready`,`failed`]),mode:L([`full`,`none`])}),$d=I({adminId:M(),publicServerUrl:M(),model:Fd.nullable(),modelKeyConfigured:P(),projectName:M(),repositoryUrl:M(),initialProjectId:M().nullable(),runtime:I({storage:tc(`ready`),worker:Yd,sandbox:Qd})});Ld.extend({usePresetKey:P().default(!1)});function ef({options:e,onDone:t}){let[n,r]=(0,R.useState)(e?.model??{id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:``,model:``,enabled:!0}),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(``),m=!o||[`protocol`,`baseUrl`,`model`].some(e=>n[e]!==o[e])||!!i;return(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-model-form`,onSubmit:async t=>{t.preventDefault(),l(!0),d(``),p(``);try{let t=await V(`setup/model`,Id,{method:`POST`,body:{expectedRevision:o?.revision??0,profile:n,...i?{apiKey:i}:{},usePresetKey:!o&&!!e?.modelKeyConfigured&&e.model?.baseUrl===n.baseUrl&&e.model?.protocol===n.protocol}});s(t),a(``),p(`已保存为全站默认接入点。`)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsx)(`h1`,{children:`连接模型`}),(0,U.jsx)(`p`,{children:`可稍后在设置中配置。`}),(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`setup-model-protocol`,label:`协议`,children:(0,U.jsxs)(`select`,{value:n.protocol,onChange:e=>r({...n,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`setup-model-url`,label:`接入地址`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,placeholder:`https://gateway.example/v1`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`setup-model-id`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,value:n.model,onChange:e=>r({...n,model:e.target.value})})}),(0,U.jsx)(Z,{id:`setup-model-key`,label:`API 密钥`,hint:o?.keyConfigured?`已保存;留空保留。`:e?.modelKeyConfigured?`部署已提供密钥;更换接入地址时请重新填写。`:`无需密钥的网关可以留空。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:i,onChange:e=>a(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(X,{children:f}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:c,"data-testid":`setup-model-save`,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:c||m,onClick:async()=>{l(!0),d(``),p(``);try{await V(`ai/profiles/${n.id}/test`,Vd,{method:`POST`,body:{mode:`text`},timeoutMs:305e3}),p(`连接测试通过。`)}catch(e){d(H(e))}finally{l(!1)}},children:`测试连接`})]}),(0,U.jsx)(`button`,{type:`button`,disabled:c,"data-testid":`setup-finish`,onClick:t,children:o?`进入工作台`:`暂时跳过`})]})}function tf({children:e}){return(0,U.jsxs)(`div`,{className:`access`,children:[(0,U.jsxs)(`aside`,{className:`access-aside`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`div`,{className:`access-art`,children:(0,U.jsx)(gd,{pose:`wave`})}),(0,U.jsx)(`div`,{className:`access-copy`,children:(0,U.jsx)(`h2`,{children:`工作有条理,团队用 Teammy`})})]}),(0,U.jsx)(`main`,{className:`access-main`,children:e})]})}function nf({onLogin:e}){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1);async function s(n){n.preventDefault(),o(!0),i(``);try{e(await ol.login(t.trim()))}catch(e){i(H(e))}finally{o(!1)}}return(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`login-form`,"aria-label":B.loginTitle,"aria-busy":a,onSubmit:s,children:[(0,U.jsx)(`h1`,{children:B.loginTitle}),(0,U.jsx)(`p`,{children:B.loginHint}),(0,U.jsx)(Z,{id:`login-member-id`,name:`memberId`,label:B.memberId,children:(0,U.jsx)(`input`,{autoFocus:!0,autoComplete:`username`,required:!0,maxLength:64,value:t,onChange:e=>n(e.target.value),placeholder:`caffei`})}),(0,U.jsx)(X,{error:!0,children:r}),(0,U.jsx)(`button`,{"data-testid":`login-submit`,className:`primary wide`,disabled:a,children:a?B.loading:B.login})]})})}var rf=`teammy:site-setup-draft-v2`,af=e=>V(`setup/options`,$d,{signal:e});function of(){try{let e=JSON.parse(sessionStorage.getItem(rf)??`null`);if(typeof e?.operationId==`string`&&typeof e?.adminId==`string`)return{operationId:e.operationId,adminId:e.adminId,publicServerUrl:p()}}catch{}return{operationId:ll(),adminId:``,publicServerUrl:p()}}function sf({onDone:e}){let[t,n]=(0,R.useState)(of),r=W(af,5e3),i=(0,R.useRef)(!1),[a,o]=(0,R.useState)();(0,R.useEffect)(()=>{r.data&&!i.current&&(i.current=!0,n(e=>({...e,adminId:e.adminId||r.data.adminId,publicServerUrl:r.data.publicServerUrl||e.publicServerUrl})))},[r.data]);let[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(!1);(0,R.useEffect)(()=>{try{sessionStorage.setItem(rf,JSON.stringify(t))}catch{}},[t]);async function d(e){e.preventDefault(),c(``),u(!0);try{let e=await V(`setup`,qc,{method:`POST`,body:Uc.parse({...t,adminId:t.adminId.trim(),publicServerUrl:t.publicServerUrl})});try{sessionStorage.removeItem(rf)}catch{}o(e)}catch(e){c(H(e))}finally{u(!1)}}return a?(0,U.jsx)(tf,{children:(0,U.jsx)(ef,{options:r.data,onDone:()=>e(a)})}):(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-form`,"aria-label":`创建管理员`,"aria-busy":l,onSubmit:d,children:[(0,U.jsx)(`h1`,{children:`欢迎使用 Teammy`}),(0,U.jsx)(`p`,{children:`创建管理员,开始管理项目与成员。`}),(0,U.jsx)(Z,{id:`setup-admin-id`,name:`adminId`,label:B.adminId,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`username`,pattern:`[a-z][a-z0-9_\\-]{0,63}`,maxLength:64,value:t.adminId,onChange:e=>n({...t,adminId:e.target.value}),placeholder:`caffei`,disabled:l})}),r.data&&(0,U.jsxs)(`div`,{className:`setup-runtime`,role:`status`,children:[(0,U.jsx)(`span`,{children:`存储已连接`}),(0,U.jsx)(`span`,{children:r.data.runtime.worker.state===`online`?`后台运行中`:`后台尚未就绪`}),(0,U.jsx)(`span`,{children:{ready:`隔离环境可用`,failed:`隔离环境检查失败`,unknown:`隔离环境检查中`}[r.data.runtime.sandbox.state]})]}),(0,U.jsx)(X,{error:!0,children:s||r.error}),(0,U.jsx)(`button`,{"data-testid":`setup-submit`,className:`primary wide`,disabled:l,children:l?B.saving:`创建管理员`})]})})}var cf=M().regex(/^[a-f0-9]{64}$/);I({id:ys(),projectId:z,deviceId:Ec,secret:cf,label:M().min(1).max(255)}).strict(),I({id:ys(),expiresAt:N()});var lf=Xs(`state`,[I({state:tc(`pending`)}),I({state:tc(`approved`),memberId:z})]),uf=I({projectName:M(),label:M(),approvedBy:z.nullable(),expiresAt:N()});function df({session:e,onLogout:t}){let n=new URLSearchParams(location.search).get(`request`)??``,r=W((0,R.useCallback)(e=>V(`devices/connect/${encodeURIComponent(n)}`,uf,{signal:e}),[n])),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=o||r.data?.approvedBy===e.memberId;return(0,U.jsx)(tf,{children:(0,U.jsxs)(`form`,{className:`access-form`,"data-testid":`client-connect-form`,onSubmit:async e=>{e.preventDefault(),a(!0),l(``);try{await V(`devices/connect/${encodeURIComponent(n)}/approve`,lf,{method:`POST`}),s(!0)}catch(e){l(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h1`,{children:u?`身份已确认`:`连接工作目录`}),r.data&&(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:r.data.projectName}),(0,U.jsx)(`br`,{}),r.data.label]}),u?(0,U.jsx)(`p`,{role:`status`,children:`请返回终端继续连接。`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`使用 `,(0,U.jsx)(`strong`,{children:e.displayName||e.memberId}),e.displayName&&e.displayName!==e.memberId?`(${e.memberId})`:` `,`连接此项目。`]}),(0,U.jsx)(X,{error:!0,children:c||r.error}),r.loading&&!r.data&&(0,U.jsx)(`p`,{role:`status`,children:`加载中…`}),(0,U.jsx)(`button`,{className:`primary wide`,disabled:i||!r.data||!!r.error,"data-testid":`client-connect-approve`,children:i?`正在确认…`:`确认连接`}),(0,U.jsx)(`button`,{type:`button`,className:`wide`,disabled:i,onClick:async()=>{try{await ol.logout(),t()}catch(e){l(H(e))}},children:`更换用户`})]})]})})}function ff(){let[e]=(0,R.useState)(()=>{let e=460+Math.random()*140;return{"--selection-duration":`${e}ms`,"--selection-tail-delay":`${e*.82}ms`,"--selection-tail-duration":`${80+Math.random()*40}ms`,"--selection-easing":`cubic-bezier(${.22+Math.random()*.12}, 0.05, ${.12+Math.random()*.14}, 1)`}});return(0,U.jsxs)(`svg`,{className:`selection-mark`,style:e,viewBox:`0 0 240 56`,preserveAspectRatio:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsx)(`path`,{d:`M216 9 C177 3 97 6 48 7 C22 7 9 12 8 26 C7 42 26 48 57 47 L174 48 C205 48 226 43 229 30 C232 18 220 10 200 8`,vectorEffect:`non-scaling-stroke`,strokeWidth:`2.1`,pathLength:`1`}),(0,U.jsx)(`path`,{className:`selection-mark-tail`,d:`M199 8 C211 8 224 11 231 17`,vectorEffect:`non-scaling-stroke`,strokeWidth:`1.3`,pathLength:`1`})]})}function Q(e){return e[`aria-selected`]===!0||e[`aria-selected`]===`true`||e[`aria-current`]===`page`||e[`aria-pressed`]===!0||e[`aria-pressed`]===`true`}function pf({children:e,selected:t,variant:n=`hand-drawn`}){return(0,U.jsxs)(`span`,{className:`selection-content`,children:[t&&n===`hand-drawn`&&(0,U.jsx)(ff,{}),(0,U.jsx)(`span`,{className:`selection-inner`,children:e})]})}function mf({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,U.jsxs)(`button`,{type:`button`,...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":Q(i)||void 0,children:[n,(0,U.jsx)(pf,{selected:Q(i),variant:r,children:e})]})}function hf({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,U.jsxs)(`a`,{...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":Q(i)||void 0,children:[n,(0,U.jsx)(pf,{selected:Q(i),variant:r,children:e})]})}function gf({prefix:e,tabs:t,selected:n,onSelect:r,orientation:i=`vertical`}){return(0,U.jsx)(`div`,{className:`settings-tabs`,role:`tablist`,"aria-orientation":i,"aria-label":`设置分类`,onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`[role="tab"]`)],n=t.indexOf(e.target);if(n<0)return;let r=e.key===`ArrowRight`||e.key===`ArrowDown`?(n+1)%t.length:e.key===`ArrowLeft`||e.key===`ArrowUp`?(n+t.length-1)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r].click(),t[r].focus())},children:t.map(t=>(0,U.jsxs)(mf,{id:`${e}-tab-${t.id}`,role:`tab`,"data-testid":`${e}-tab-${t.id}`,"aria-controls":`${e}-panel-${t.id}`,"aria-selected":n===t.id,tabIndex:n===t.id?0:-1,onClick:()=>r(t.id),children:[(0,U.jsx)(Od,{name:t.icon}),(0,U.jsx)(`span`,{children:t.title})]},t.id))})}function _f(e){let t=`projects/${encodeURIComponent(e)}`,n=(e,n,r)=>V(`${t}/${e}`,n,r);return{projectId:e,request:n,api:sl(n),blobUrl:e=>d(`/api/v1/${t}/blobs/${e}`),readTextBlob:(e,n)=>ul(e,n,`/api/v1/${t}`)}}var vf=(0,R.createContext)(null);function yf(){let e=(0,R.useContext)(vf);if(!e)throw Error(`Project context is required.`);return e}function bf({action:e,onClose:t,onSaved:n}){let{request:r}=yf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(e.kind===`add`?``:e.member.displayName),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=e.kind===`add`?B.addMember:e.kind===`name`?B.editName:`退出项目`;return(0,U.jsx)(Cd,{id:`member-dialog`,title:f,onClose:c?()=>{}:t,children:(0,U.jsxs)(`form`,{"data-testid":`member-form`,"data-action":e.kind,"data-member-id":e.kind===`add`?void 0:e.member.id,"aria-label":f,"aria-busy":c,className:`stack`,onSubmit:async t=>{t.preventDefault(),l(!0),d(``);try{e.kind===`add`?await r(`web/members`,Kc,{method:`POST`,body:Yc.parse({id:i})}):e.kind===`leave`?await r(`membership`,I({ok:P()}),{method:`DELETE`}):await r(`web/members/${e.member.id}`,Kc,{method:`PATCH`,body:Xc.parse({expectedRevision:e.member.revision,displayName:o})}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`member-id`,name:`memberId`,label:B.memberId,hint:B.idHint,children:(0,U.jsx)(`input`,{autoFocus:!0,required:!0,maxLength:64,value:i,onChange:e=>a(e.target.value),disabled:c})}),e.kind===`name`&&(0,U.jsx)(Z,{id:`member-display-name`,name:`displayName`,label:B.displayName,hint:`仅用于当前项目。`,children:(0,U.jsx)(`input`,{autoFocus:!0,maxLength:120,value:o,onChange:e=>s(e.target.value),disabled:c})}),e.kind===`leave`&&(0,U.jsx)(`p`,{children:`退出后停止同步该项目,已经共享的资料会保留。`}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"data-testid":`member-cancel`,disabled:c,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`member-submit`,disabled:c,children:c?B.saving:e.kind===`leave`?`退出项目`:B.confirm})]})]})})}function xf({members:e,session:t,reload:n,onLeave:r}){let[i,a]=(0,R.useState)(),o=e.filter(e=>e.enabled&&e.accountEnabled);return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(bd,{title:`成员`,count:o.length,children:(0,U.jsxs)(xd,{label:`成员操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新成员`,"data-testid":`members-refresh`,onClick:n}),(0,U.jsx)(kd,{icon:`plus`,variant:`primary`,label:B.addMember,"data-testid":`member-add`,onClick:()=>a({kind:`add`})})]})}),(0,U.jsx)(`div`,{className:`member-list`,children:o.map(e=>(0,U.jsxs)(`article`,{"data-testid":`member-card`,"data-member-id":e.id,"aria-label":e.displayName,className:`member-card`,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:e.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:e.displayName}),(0,U.jsx)(`small`,{children:e.id})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:B.editName,"data-testid":`member-edit-name`,onClick:()=>a({kind:`name`,member:e})}),e.id===t.memberId&&(0,U.jsx)(kd,{icon:`logout`,label:`退出项目`,"data-testid":`project-leave`,onClick:()=>a({kind:`leave`,member:e})})]})]},e.id))}),i&&(0,U.jsx)(bf,{action:i,onClose:()=>a(void 0),onSaved:async()=>{i.kind===`leave`?await r():(a(void 0),n())}})]})}function Sf({id:e,label:t,trigger:n,triggerId:r,className:i=``,routeKey:a,children:o}){let[s,c]=(0,R.useState)(!1),l=(0,R.useRef)(null),u=(0,R.useRef)(null),d=(0,R.useRef)(!1);return(0,R.useEffect)(()=>c(!1),[a]),(0,R.useEffect)(()=>{if(!s)return;let e=l.current?.querySelectorAll(`[role="menuitem"]`);e?.[d.current?e.length-1:0]?.focus();let t=e=>{l.current?.contains(e.target)||c(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[s]),(0,U.jsxs)(`div`,{className:`dropdown ${i}`,ref:l,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},onKeyDown:e=>{e.key===`Escape`&&s&&(e.stopPropagation(),c(!1),u.current?.focus())},children:[(0,U.jsx)(`button`,{ref:u,className:`dropdown-trigger`,"data-testid":r,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":s,"aria-controls":e,onClick:()=>{d.current=!1,c(!s)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),d.current=e.key===`ArrowUp`,c(!0))},children:n}),s&&(0,U.jsx)(`div`,{id:e,className:`dropdown-menu`,role:`menu`,"aria-label":t,"data-testid":e,onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]:not(:disabled)`)],n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?(n+1)%t.length:e.key===`ArrowUp`?(n+t.length-1)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r]?.focus())},children:o(()=>{c(!1),u.current?.focus()})})]})}var Cf={repository:`同步中`,import:`导入中`,tasks:`整理中`,sessions:`整理中`,project:`分析中`,chat:`回复中`};function wf(e,t){if(t)return{state:`failed`,text:`异常`};if(!e)return{state:`idle`,text:`读取中`};if(e.worker===`offline`)return{state:`failed`,text:`离线`};if(e.worker===`unknown`)return{state:`idle`,text:`待启动`};if(e.activities.some(e=>e.state===`failed`))return{state:`failed`,text:`异常`};let n=e.activities.filter(e=>e.state===`running`),r=n.reduce((e,t)=>e+t.count,0);return r?{state:`running`,text:r===1?Cf[n[0].kind]:`处理中`}:e.modelAvailable?e.activities.some(e=>e.state===`queued`)?{state:`queued`,text:`待处理`}:{state:`idle`,text:`空闲`}:{state:`idle`,text:`待配置`}}function Tf({projectId:e}){let t=W((0,R.useCallback)(t=>V(`projects/${encodeURIComponent(e)}/project/activity`,Zd,{signal:t}),[e]),3e3),n=wf(t.data,t.error);return(0,U.jsxs)(`span`,{className:`project-activity`,"data-state":n.state,"data-testid":`project-activity`,role:`status`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`project-activity-dot`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`project-activity-label`,children:n.text})]})}var Ef=[`dashboard`,`assistant`,`files`,`materials`,`sessions`,`settings`],Df=(e,t)=>`/projects/${encodeURIComponent(e)}/${t}`,Of={dashboard:`看板`,assistant:`Tim`,files:`工作区`,materials:`资料`,sessions:B.sessions,settings:`设置`};function kf({projectId:e,page:t,navigate:n}){let r=W((0,R.useCallback)(t=>e?V(`projects/${encodeURIComponent(e)}/agents/outbox/unread`,I({unread:N()}),{signal:t}):Promise.resolve({unread:0}),[e]),5e3);(0,R.useEffect)(()=>{let e=()=>void r.reload();return window.addEventListener(`teammy:outbox`,e),()=>window.removeEventListener(`teammy:outbox`,e)},[r.reload]);function i(e,t){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))}return(0,U.jsxs)(`aside`,{id:`workspace-navigation`,className:`sidebar`,children:[(0,U.jsx)(`a`,{className:`brand-home`,"data-testid":`home-link`,href:d(`/projects`),"aria-label":`项目主页`,"aria-current":t===`projects`?`page`:void 0,onClick:e=>i(e,`/projects`),children:(0,U.jsx)(hd,{compact:!0})}),e&&(0,U.jsx)(`nav`,{"aria-label":B.navigation,children:Ef.map(n=>(0,U.jsxs)(hf,{variant:`inverse`,href:d(Df(e,n)),"data-testid":`nav-${n}`,"aria-label":Of[n],"aria-current":t===n?`page`:void 0,onClick:t=>i(t,Df(e,n)),children:[(0,U.jsx)(Od,{name:n,size:`navigation`}),(0,U.jsx)(`span`,{className:`navigation-label`,children:Of[n]}),n===`assistant`&&!!r.data?.unread&&(0,U.jsx)(`span`,{className:`navigation-unread`,role:`img`,"aria-label":`${r.data.unread} 条未读消息`})]},n))}),e&&(0,U.jsx)(Tf,{projectId:e},e)]})}function Af({session:e,navigate:t,onLogout:n,routeKey:r}){let[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,U.jsx)(Sf,{id:`account-menu`,triggerId:`account-menu-trigger`,className:`account-menu-wrap`,label:`用户菜单 · ${e.displayName}`,trigger:(0,U.jsx)(`strong`,{children:e.displayName}),routeKey:r,children:e=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{role:`menuitem`,"data-testid":`account-settings`,onClick:()=>{e(),t(`/site-settings`)},children:[(0,U.jsx)(Od,{name:`settings`}),`设置`]}),(0,U.jsxs)(`button`,{role:`menuitem`,"data-testid":`logout`,disabled:i,onClick:async()=>{a(!0),s(``);try{await ol.logout(),n()}catch(e){s(H(e)),a(!1)}},children:[(0,U.jsx)(Od,{name:`logout`}),`退出登录`]}),(0,U.jsx)(X,{error:!0,children:o})]})})}function jf({session:e,navigate:t,onLogout:n,routeKey:r,children:i}){return(0,U.jsxs)(`div`,{className:`site-page`,children:[(0,U.jsxs)(`header`,{className:`site-brand-header`,children:[(0,U.jsx)(`a`,{href:d(`/projects`),"aria-label":`项目主页`,"data-testid":`home-link`,onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t(`/projects`))},children:(0,U.jsx)(hd,{})}),(0,U.jsx)(Af,{session:e,navigate:t,onLogout:n,routeKey:r})]}),i]})}function Mf({title:e,navigation:t,children:n}){return(0,U.jsxs)(`div`,{className:`split-layout settings-layout`,children:[(0,U.jsxs)(`aside`,{className:`settings-navigation`,children:[(0,U.jsx)(Sd,{title:e}),t]}),(0,U.jsx)(`div`,{className:`settings-content`,children:n})]})}function Nf({title:e,icon:t,count:n,children:r}){return(0,U.jsxs)(`header`,{className:`explorer-heading`,children:[(0,U.jsxs)(`h1`,{children:[t&&(0,U.jsx)(Od,{name:t}),e,n!==void 0&&(0,U.jsx)(vd,{children:n})]}),r]})}var Pf=`_project`;Js([z,tc(Pf)]);var Ff=M().max(255).refine(e=>{let t=e.endsWith(`/`),n=t?e.slice(0,-1):e;return Mc.safeParse(n).success&&!n.includes(`/`)&&!n.startsWith(`.`)&&!/^_?teammy/i.test(n)&&(t?n.startsWith(`_`):n.includes(`.`))},`Use a root file (README.md) or an underscore-prefixed directory (_template/).`),If=I({maintainer:z.nullable(),paths:F(Ff).max(30).refine(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length),revision:jc}).strict();If.omit({revision:!0}).extend({expectedRevision:jc}).strict();function Lf(e){return e.split(`/`).some(e=>/^\.teammy(?:[-.]|$)/i.test(e))}function Rf({members:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/shared-files`,If,{signal:e}),[t])),[r,i]=(0,R.useState)(``);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`公共资料`,children:[(0,U.jsx)(`h2`,{children:`公共资料`}),(0,U.jsx)(X,{error:!0,children:n.error}),n.data&&(0,U.jsx)(zf,{config:n.data,members:e,reload:async()=>{await n.reload(),i(`公共资料设置已保存`)}},n.data.revision),(0,U.jsx)(X,{children:r})]})}function zf({config:e,members:t,reload:n}){let{request:r}=yf(),[i,a]=(0,R.useState)(e.maintainer??``),[o,s]=(0,R.useState)(e.paths.join(`
|
|
65
65
|
`)),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``);return(0,U.jsxs)(`form`,{className:`stack`,"aria-label":`公共资料设置`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=await r(`project/shared-files`,If);await r(`project/shared-files`,If,{method:`PATCH`,body:{expectedRevision:e.revision,maintainer:i||null,paths:o.split(`
|
|
66
|
-
`).map(e=>e.trim()).filter(Boolean)}}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{disabled:c,className:`stack`,children:[(0,U.jsx)(Z,{id:`shared-files-maintainer`,label:`维护成员`,children:(0,U.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂停发布`}),t.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:!e.enabled||!e.accountEnabled,children:e.displayName||e.id},e.id))]})}),(0,U.jsx)(Z,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹;例如 README.md、_template/。由维护成员更新,其他成员自动接收。`,children:(0,U.jsx)(`textarea`,{rows:3,value:o,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`保存公共资料设置`})})]})}I({text:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({body:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({to:Js([tc(`debug`),F(z).min(1)]),body:M().trim().min(1),branch:M().trim().min(1).optional()}).strict();var Bf=N().int().positive().nullable(),$=L([`github`,`gongfeng`]),Vf={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hf=I({provider:$.default(`github`),repositoryUrl:M().trim().default(``),repository:M().trim().default(``),apiUrl:M().url().optional(),githubApiUrl:M().url().optional(),debugRecipient:z.nullable().default(null),contextWindow:N().int().positive().default(256e3),compactAt:N().int().positive().default(22e4),fetchIntervalSeconds:Bf.default(300),idleSeconds:Bf.default(1800),restartSeconds:Bf.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vf[n.provider]).replace(/\/+$/,``)}));I({config:Hf,token:M().nullable().optional(),webhookSecret:M().nullable().optional(),sshPrivateKey:M().nullable().optional(),sshKnownHosts:M().nullable().optional()}).strict();var Uf=I({config:Hf,tokenConfigured:P(),webhookConfigured:P(),sshConfigured:P(),sshPublicKey:M().nullable().optional(),webhookUrl:M().optional()}),Wf=I({id:M(),name:M(),url:M()}),Gf=I({id:M(),text:M(),answer:M(),author:M().nullable().optional(),source:tc(`wecom`).optional(),state:L([`queued`,`running`,`succeeded`,`failed`]),error:M().nullable(),createdAt:M()}),Kf=I({id:M(),seq:N(),runId:M().nullable(),role:L([`user`,`assistant`]),author:M(),body:M(),state:Gf.shape.state,source:M().nullable(),createdAt:M()}),qf=I({chats:F(I({id:M(),title:M(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),unread:P().optional(),createdAt:M(),updatedAt:M(),state:Gf.shape.state.nullable()}))}),Jf=I({id:M(),title:M().optional(),runs:F(Gf),messages:F(Kf),readCursor:N(),redirect:M().nullable().optional(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),pending:I({members:F(M()),question:M()}).nullable().optional(),hold:I({scope:L([`all`,`writes`]),reason:M()}).passthrough().nullable().optional(),participants:F(M()).optional(),visibility:L([`project`,`participants`]).optional(),cursor:N()}),Yf=I({id:M(),body:M(),box:L([`normal`,`debug`]),taskId:N().nullable(),createdAt:M(),readAt:M().nullable(),archivedAt:M().nullable(),conversationId:M().nullable(),recipients:F(I({userId:M()}))}),Xf=I({messages:F(Yf),unread:N()}),Zf=e=>V(`site/worker-status`,Yd,{signal:e}),Qf=()=>W(Zf,5e3);function $f(){let e=Qf(),t=e.data;return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`后台服务`}),(0,U.jsx)(X,{error:!0,children:e.error}),(0,U.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,U.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function ep({generation:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`agents/repository/status`,Xd,{signal:e}),[t,e]),5e3),r=n.data,i=r&&[`pending`,`cloning`,`fetching`].includes(r.state),a=r&&[`failed`,`interrupted`].includes(r.state);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,U.jsx)(Od,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,U.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,U.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,U.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,U.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tp({members:e}){let{request:t,projectId:n}=yf(),r=W((0,R.useCallback)(e=>t(`agents/settings`,Uf,{signal:e}),[t])),[i,a]=(0,R.useState)(0),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(()=>Hf.parse({})),[u,d]=(0,R.useState)(``),[f,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(!1),[ee,te]=(0,R.useState)(``),[ne,re]=(0,R.useState)(!1),[x,ie]=(0,R.useState)(``);(0,R.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,R.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{!e.repositoryUrl||e.initialProjectId&&e.initialProjectId!==n||l(t=>{if(t.repositoryUrl)return t;let n=e.repositoryUrl,r=n.includes(`git.tencent.com`)?`gongfeng`:t.provider,i=n.replace(/^[^@]+@[^:]+:/,``).replace(/^https?:\/\/[^/]+\//,``).replace(/\.git$/,``);return{...t,repositoryUrl:n,repository:i,provider:r,apiUrl:Vf[r]}})}).catch(()=>{}),()=>e.abort()},[!!r.data,n]);async function S(e,n=!1){e?.preventDefault(),b(!0),te(``),re(!1),ie(``);try{await t(`agents/settings`,Uf,{method:`PUT`,body:{config:c,...u?{token:u}:{},...f?{webhookSecret:f}:{},...h?{sshPrivateKey:h}:{},..._?{sshKnownHosts:_}:{}}}),d(``),m(``),g(``),v(``),await r.reload(),a(e=>e+1),re(!0),n&&(await t(`agents/repository/transport-check`,I({ok:P()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(H(e))}finally{b(!1)}}return(0,U.jsx)(`div`,{className:`settings-section`,children:(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,U.jsx)(`h2`,{children:`仓库连接`}),(0,U.jsx)(ep,{generation:i}),(0,U.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,U.jsx)(Z,{id:`agent-provider`,label:`Git 平台`,children:(0,U.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vf[t]}),ie(``)},children:[(0,U.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,U.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,U.jsx)(Z,{id:`agent-repository-url`,label:`仓库地址`,children:(0,U.jsx)(`input`,{value:c.repositoryUrl,placeholder:c.provider===`gongfeng`?`https://git.tencent.com/group/repository.git`:`https://github.com/owner/repository.git`,onChange:e=>l({...c,repositoryUrl:e.target.value}),onBlur:()=>{if(!c.repository){let e=``;try{e=new URL(c.repositoryUrl).pathname}catch{e=c.repositoryUrl.match(/^[^@]+@[^:]+:(.+)$/)?.[1]??``}e&&l({...c,repository:e.replace(/^\/+|\/+$/g,``).replace(/\.git$/,``)})}}})}),(0,U.jsx)(Z,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,U.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-api-url`,label:`API 地址`,children:(0,U.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,U.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,U.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(wd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,U.jsx)(Z,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,U.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,U.jsxs)(`section`,{className:`stack`,children:[(0,U.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,U.jsx)(wd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`agent-generate-key`,disabled:y,onClick:async()=>{b(!0),te(``);try{let e=await t(`agents/repository/ssh-key`,Uf,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(H(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,U.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(Z,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,U.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,U.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`运行设置`}),(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`仓库 fetch 间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,U.jsx)(Z,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,U.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,U.jsx)(X,{error:!0,children:ee||r.error}),(0,U.jsx)(X,{children:x||(ne?`已保存。`:null)}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wf,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(H(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var np=Xs(`kind`,[I({kind:tc(`repository`),path:M().trim().min(1)}).strict(),I({kind:tc(`directory`),path:M().trim().min(1)}).strict()]),rp=I({members:F(M()),fileCount:N().int().nonnegative(),preserved:F(M()),skipped:F(M())}),ip=I({state:L([`none`,`pending`,`running`,`succeeded`,`failed`]),source:np.nullable(),result:rp.nullable(),error:M().nullable()});function ap({onImported:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/workspace-import`,ip,{signal:e}),[t]),5e3),r=Qf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,R.useRef)(null);(0,R.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,R.useEffect)(()=>{u?.source?.kind===`directory`&&a(u.source.path)},[u?.source?.kind,u?.source?.path]);async function p(e=!1){s(!0),l(``);try{await t(`project/workspace-import`,ip,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(H(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,U.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,U.jsx)(`h2`,{children:`工作区初始化`}),(0,U.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 workspaces,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,U.jsxs)(`div`,{role:`status`,"data-testid":`workspace-import-status`,children:[u.state===`pending`&&`等待后台导入`,u.state===`running`&&(r.data?.state===`online`?`正在导入工作区`:`等待后台继续导入`),u.state===`succeeded`&&`已识别 ${u.result?.members.length??0} 位成员,导入 ${u.result?.fileCount??0} 个文件。`,u.source&&(0,U.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,U.jsx)(X,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,U.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`从服务器目录导入`}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsx)(Z,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/workspaces。`,children:(0,U.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/workspaces`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var op=e=>V(`ai/profiles`,Rd,{signal:e});function sp({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=W((0,R.useCallback)(e=>V(o,zd,{signal:e}),[o,i]));return(0,U.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,U.jsx)(X,{error:!0,children:s.error}),s.data?(0,U.jsx)(cp,{value:s.data,path:o,id:e??`site`,title:t,profiles:n,admin:r,onChanged:()=>{s.reload(),a()},reload:()=>void s.reload()},`${s.data.revision}/${s.data.effectiveProfileId}/${s.data.available}`):(0,U.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,U.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cp({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,R.useState)(e.profileId??``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(``),m=vl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,U.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await V(t,zd,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(H(e))}finally{d(!1)}},children:[(0,U.jsxs)(`div`,{className:`model-default-controls`,children:[(0,U.jsx)(Z,{id:`ai-default-${n}`,label:r,children:(0,U.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,U.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,U.jsx)(kd,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,U.jsx)(`p`,{className:`muted`,role:`status`,"data-testid":`ai-default-status-${n}`,children:e.available?`已配置 · ${h?.name??e.effectiveProfileId}`:e.effectiveProfileId?`接入点已停用`:`尚未配置默认接入点`}),!e.available&&e.effectiveProfileId&&(0,U.jsx)(X,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,U.jsx)(X,{error:!0,children:f}),f&&(0,U.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lp(){let{projectId:e}=yf(),t=W(op),[n,r]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(sp,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}I({enabled:P(),botId:M().trim().min(1),secret:M().trim().min(1).optional()}).strict();var up=I({enabled:P(),botId:M(),secretConfigured:P(),state:L([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:M().nullable(),pending:N()}),dp=I({available:P(),bound:P(),subscribed:P(),activeProject:M().nullable(),pending:N(),error:M().nullable()}),fp=I({code:M(),expiresAt:N()}),pp=I({groups:F(I({id:M(),boundBy:M(),createdAt:M()}))}),mp=I({channels:F(I({id:M(),name:M()})),selected:M().nullable(),selectedName:M().nullable(),missingMentions:F(M()),refreshing:P(),updatedAt:N().nullable(),error:M().nullable(),pending:N()}),hp=e=>V(`site/wecom`,up,{signal:e}),gp={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _p(){let e=W(hp,3e3),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await V(`site/wecom`,up,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(H(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信机器人`}),(0,U.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,U.jsx)(X,{error:!0,children:e.error||s}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,U.jsx)(Z,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,U.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,U.jsx)(Z,{id:`wecom-secret`,label:`Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,required:!d?.secretConfigured||f.botId!==d.botId,value:r,placeholder:d?.secretConfigured?`已保存,留空保持不变`:`填写长连接专用 Secret`,onChange:e=>i(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用企业微信`,"aria-checked":f.enabled,className:f.enabled?`primary`:``,onClick:()=>n({...f,enabled:!f.enabled}),children:f.enabled?`已启用`:`已停用`})})]}),(0,U.jsx)(X,{children:l}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,U.jsxs)(`p`,{role:`status`,children:[d?gp[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:d?.error??``}),(0,U.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/channels`,mp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mp,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,U.jsx)(`h3`,{children:`项目频道`}),(0,U.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,U.jsx)(X,{error:!0,children:o||t.error||c?.error||``}),(0,U.jsx)(Z,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,U.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,U.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,U.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.missingMentions.length?(0,U.jsxs)(`p`,{className:`muted`,children:[`暂无法 @:`,c.missingMentions.join(`、`),`。成员完成下方个人绑定并加入频道后即可生效。`]}):null,c?.pending?(0,U.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function yp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom`,dp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);(0,R.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dp,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fp,{method:`POST`})),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}let l=t.data;return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信`}),(0,U.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,U.jsx)(X,{error:!0,children:t.error||o}),l?.available&&(0,U.jsx)(vp,{}),l?.available&&(0,U.jsx)(`h3`,{children:`个人绑定`}),l?l.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:l.error??``}),l.subscribed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`获取绑定码后,在企业微信中私聊机器人,发送下面的绑定消息。绑定码 10 分钟内有效。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,U.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,U.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,U.jsx)(bp,{})]})}function bp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/groups`,pp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fp,{method:`POST`}))}catch(e){s(H(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pp,{method:`DELETE`}),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,U.jsx)(`h3`,{children:`群接入`}),(0,U.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,U.jsx)(X,{error:!0,children:o||t.error}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,U.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,U.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xp({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=yf(),s=[{id:`general`,title:`基础设置`,icon:`general`},...t.siteRole===`admin`?[{id:`repository`,title:`代码仓库`,icon:`code`}]:[],{id:`members`,title:`成员`,icon:`members`},{id:`connect`,title:`客户端接入`,icon:`connect`},{id:`wecom`,title:`企业微信`,icon:`message`}],[c,l]=(0,R.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,R.useState)(e),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``);async function y(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Hc,{method:`PATCH`,body:Gc.parse({projectName:u.projectName,description:u.description})});f(e),v(B.configSaved),n()}catch(e){g(H(e))}finally{m(!1)}}return(0,U.jsxs)(Mf,{title:B.settings,navigation:(0,U.jsx)(gf,{prefix:`settings`,selected:c,onSelect:e=>{l(e);let t=new URL(location.href);e===`general`?t.searchParams.delete(`tab`):t.searchParams.set(`tab`,e),history.replaceState(null,``,t)},tabs:s}),children:[(0,U.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,U.jsx)(yp,{})}),(0,U.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,U.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":B.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,U.jsx)(`h2`,{children:`项目信息`}),(0,U.jsx)(Z,{id:`project-name`,name:`projectName`,label:B.projectName,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,U.jsx)(Z,{id:`project-description`,name:`description`,label:B.description,children:(0,U.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,U.jsx)(X,{error:!0,children:h}),(0,U.jsx)(X,{children:_}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?B.saving:B.save})})]})]}),(0,U.jsx)(lp,{}),(0,U.jsx)(Rf,{members:r}),t.siteRole===`admin`&&(0,U.jsx)(ap,{onImported:n})]}),t.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,U.jsx)(tp,{members:r})}),(0,U.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,U.jsx)(xf,{members:r,session:t,reload:n,onLeave:i})}),(0,U.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.connectTitle}),(0,U.jsx)(`p`,{children:B.connectHint}),(0,U.jsx)(wd,{id:`connect-command`,label:B.connectCommand,value:`teammy connect --url ${cl(e.publicServerUrl)} --project ${cl(e.projectId)}`}),(0,U.jsx)(`p`,{children:B.connectAfter})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.install}),(0,U.jsx)(`p`,{children:B.installHint}),(0,U.jsx)(wd,{id:`install-command`,label:B.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:`Agent 接入`}),(0,U.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,U.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]})]})}function Sp({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,R.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Sd,{title:`我的项目`,children:(0,U.jsxs)(xd,{label:`项目操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})]})}),(0,U.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,U.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,U.jsx)(Od,{name:`files`,size:`navigation`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:e.projectName}),e.description&&(0,U.jsx)(`small`,{children:e.description})]}),(0,U.jsx)(Od,{name:`chevron`})]},e.projectId))}),!e.length&&(0,U.jsx)(yd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})}),i&&(0,U.jsx)(Cp,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cp({onClose:e,onCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=(0,R.useRef)({fingerprint:``,id:ll()});return(0,R.useEffect)(()=>{let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,U.jsx)(Cd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`project-create-form`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=JSON.stringify([n,i,o]);f.current.fingerprint!==e&&(f.current={fingerprint:e,id:ll()}),await t((await V(`projects`,Hc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`new-project-name`,label:`项目名称`,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-description`,label:`说明`,children:(0,U.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 workspaces 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,U.jsx)(`input`,{value:o,placeholder:`/imports/utu/workspaces`,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wp({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,R.useState)(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),e&&(0,U.jsx)(kd,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,U.jsx)(X,{error:!0,children:n}),n&&(0,U.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,U.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,U.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:t.name}),(0,U.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,U.jsx)(kd,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,U.jsx)(Ep,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,U.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tp(e){let{revision:t,keyConfigured:n,...r}=e;return Fd.parse(r)}function Ep({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,R.useState)(e?Tp(e):Fd.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=vl(),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tp(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await V(`ai/profiles/${encodeURIComponent(r.id)}`,Id,{method:`PUT`,signal:a,body:Ld.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(H(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await op(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tp(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(H(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await V(`ai/profiles/${encodeURIComponent(r.id)}/test`,Vd,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(H(e))}finally{p(!1)}}return(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,U.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-name`,label:`模型名称`,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,U.jsx)(Z,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,U.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-model`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,U.jsx)(X,{error:!0,children:m}),(0,U.jsx)(X,{children:g}),(0,U.jsxs)(`div`,{className:`row wrap`,children:[(0,U.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,U.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,U.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-probe-${e}`,disabled:f||v,onClick:()=>void ee(e),children:{text:`测试文本`,tools:`测试工具`,json:`测试 JSON`}[e]},e))}),o&&(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,U.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dp=e=>V(`site/config`,Qc,{signal:e});function Op(){let e=W(Dp);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:e.error}),e.data&&(0,U.jsx)(Ap,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,U.jsx)(kp,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,U.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function kp({config:e,reload:t}){let[n,r]=(0,R.useState)(e.sync),[i,a]=(0,R.useState)(e.revision),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(``);return(0,R.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,U.jsx)(`form`,{className:`stack`,"data-testid":`site-sync-form`,"aria-busy":o,"data-config-revision":i,onSubmit:async e=>{e.preventDefault(),s(!0),l(``),d(``);try{let e=await V(`site/config`,Qc,{method:`PATCH`,body:$c.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(H(e))}finally{s(!1)}},children:(0,U.jsxs)(`section`,{className:`settings-section stack`,children:[(0,U.jsx)(`h2`,{children:`同步策略`}),(0,U.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,U.jsx)(Z,{id:`sync-check-interval`,label:B.interval,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`sync-file-settle`,label:B.settle,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,U.jsx)(X,{error:!0,children:c}),(0,U.jsx)(X,{children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Ap({config:e,reload:t}){let[n,r]=(0,R.useState)(e.publicServerUrl),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,R.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,U.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await V(`site/config`,Qc,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h2`,{children:`访问地址`}),(0,U.jsx)(Z,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,U.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:o}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jp=e=>V(`users`,I({users:F(el)}),{signal:e});function Mp({me:e}){let t=W(jp),[n,r]=(0,R.useState)();return(0,U.jsxs)(`div`,{className:`settings-section stack`,children:[(0,U.jsx)(bd,{title:`用户信息`,children:(0,U.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,U.jsx)(Od,{name:`plus`}),`新增用户`]})}),(0,U.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.error&&(0,U.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,U.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,U.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:t.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t.displayName}),(0,U.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,U.jsx)(kd,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,U.jsx)(Np,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Np({action:e,onClose:t,onSaved:n}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,U.jsx)(Cd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`user-form`,"aria-label":d,"aria-busy":s,onSubmit:async t=>{t.preventDefault(),c(!0),u(``);try{e.kind===`add`?await V(`users`,el,{method:`POST`,body:tl.parse({id:r.trim(),displayName:a})}):await V(`users/${encodeURIComponent(e.user.id)}`,el,{method:`PATCH`,body:nl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(H(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`user-id`,label:`用户 ID`,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`off`,maxLength:64,pattern:`[a-z][a-z0-9_\\-]{0,63}`,value:r,disabled:s,onChange:e=>i(e.target.value)})}),e.kind===`toggle`?(0,U.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,U.jsx)(Z,{id:`user-display-name`,label:B.displayName,children:(0,U.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:l}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?B.saving:B.confirm})]})]})})}function Pp({session:e}){let t=W(op),n=W(ol.server),[r,i]=(0,R.useState)(`general`),[a,o]=(0,R.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,U.jsxs)(`div`,{className:`site-settings`,children:[(0,U.jsx)(Sd,{title:`设置`}),(0,U.jsx)(gf,{prefix:`site`,orientation:`horizontal`,selected:r,onSelect:i,tabs:[{id:`general`,title:`通用`,icon:`general`},{id:`models`,title:`接入点`,icon:`model`},...e.siteRole===`admin`?[{id:`users`,title:`用户`,icon:`members`},{id:`wecom`,title:`企业微信`,icon:`message`}]:[]]}),(0,U.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,U.jsx)(_p,{})}),(0,U.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,U.jsx)(Op,{}):(0,U.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,U.jsx)($f,{}),(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`服务端版本`}),(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,U.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,U.jsx)(`div`,{className:`settings-section-actions`,children:(0,U.jsx)(kd,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,U.jsx)(wp,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,U.jsx)(`h2`,{children:`默认接入点`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(U.Fragment,{children:(0,U.jsx)(sp,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]})]}),e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,U.jsx)(Mp,{me:e.memberId})})]})]})}var Fp=`modulepreload`,Ip=function(e,t){return new URL(e,t).href},Lp={},Rp=function(e){return e.pathname.endsWith(`.css`)},zp=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ip(t,n);let r=s(t),i=Rp(r);return zp(Lp,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fp,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vp=(0,R.lazy)(()=>Bp(()=>import(`./Materials-DK3CkLr0.js`).then(e=>({default:e.Materials})),__vite__mapDeps([0,1,2,3]),import.meta.url)),Hp=(0,R.lazy)(()=>Bp(()=>import(`./Files-BvCYgjVV.js`).then(e=>({default:e.Files})),__vite__mapDeps([4,1,5,6,2]),import.meta.url)),Up=(0,R.lazy)(()=>Bp(()=>import(`./Assistant-BeYamS0w.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([7,1,8]),import.meta.url)),Wp=(0,R.lazy)(()=>Bp(()=>import(`./Dashboard-BzmrE4Xv.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([9,5,6,10]),import.meta.url)),Gp=(0,R.lazy)(()=>Bp(()=>import(`./Sessions-D_579m-e.js`).then(e=>({default:e.Sessions})),__vite__mapDeps([11,1,5,2,12]),import.meta.url));function Kp(){let[e,t]=(0,R.useState)(),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(0);return(0,R.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await ol.setup(e.signal),i;if(n.initialized)try{i=await ol.session(e.signal)}catch(e){if(!(e instanceof il&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(H(t))}})(),()=>e.abort()},[o]),(0,R.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(X,{error:!0,children:i}),(0,U.jsx)(`button`,{onClick:()=>s(e=>e+1),children:B.retry})]}):n===void 0?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`p`,{role:`status`,children:B.loading})]}):n?e?f()===`/connect`?(0,U.jsx)(df,{session:e,onLogout:()=>t(void 0)}):(0,U.jsx)(hl,{children:(0,U.jsx)(Jp,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,U.jsx)(nf,{onLogin:t}):(0,U.jsx)(sf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function qp(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|files|materials|sessions|members|settings)$/);if(e)return{projectId:e[1],page:e[2]};let t=f()===`/account`?`site-settings`:f().slice(1);return{projectId:``,page:[`projects`,`site-settings`,`members`,...Ef].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function Jp({session:e,onLogout:t}){let n=W(ol.projects,!0),[r,i]=(0,R.useState)(qp),a=(0,R.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(qp()),document.querySelector(`main`)?.focus()},[]);(0,R.useEffect)(()=>{let e=()=>{i(qp())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,R.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(Df(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||!Ef.includes(r.page)&&r.page!==`members`||!o)return;let t=``;try{t=localStorage.getItem(`teammy-project:${e.memberId}`)??``}catch{}let n=o.find(e=>e.projectId===t)??o[0];a(n?Df(n.projectId,r.page===`members`?`settings`:r.page)+(r.page===`members`?`?tab=members`:``):`/projects`,!0)},[r.projectId,r.page,o,a,e.memberId]);let s=o?.find(e=>e.projectId===r.projectId);(0,R.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,R.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,R.useMemo)(()=>r.projectId?_f(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,U.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,U.jsx)(`a`,{className:`skip-link`,href:`#main`,children:B.skipToMain}),!l&&(0,U.jsx)(kf,{projectId:r.projectId,page:r.page,navigate:a}),(0,U.jsx)(`div`,{className:`main-shell`,children:(0,U.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,U.jsx)(X,{error:!0,children:n.error}),l?(0,U.jsx)(jf,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,U.jsx)(Pp,{session:e}):(0,U.jsx)(Sp,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(Df(e,`dashboard`))})}):c&&s?(0,U.jsx)(vf.Provider,{value:c,children:(0,U.jsx)(Yp,{page:r.page,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,U.jsx)(X,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})]})})]})}function Yp({page:e,onLeave:t}){let n=yf(),r=W((0,R.useCallback)(async e=>{let[t,r,i]=await Promise.all([n.api.config(e),n.api.members(e),n.request(`identity`,Jc,{signal:e})]);return{config:t,members:r.members,session:i}},[n]),!0),i=r.data;return r.error?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{error:!0,children:r.error}),(0,U.jsx)(`button`,{onClick:()=>void r.reload(),children:`重试`})]}):i?(0,U.jsx)(R.Suspense,{fallback:(0,U.jsx)(`p`,{role:`status`,children:B.loading}),children:e===`files`?(0,U.jsx)(Hp,{members:i.members,me:i.session.memberId,onRefresh:()=>void r.reload()}):e===`dashboard`?(0,U.jsx)(Wp,{members:i.members,config:i.config}):e===`materials`?(0,U.jsx)(Vp,{}):e===`sessions`?(0,U.jsx)(Gp,{members:i.members}):e===`assistant`?(0,U.jsx)(Up,{me:i.session.memberId}):(0,U.jsx)(xp,{config:i.config,session:i.session,reload:()=>void r.reload(),members:i.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})}(0,Tc.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(Kp,{}));export{h as $,fl as A,z as B,Sd as C,W as D,vl as E,B as F,tc as G,L as H,Nc as I,M as J,N as K,Mc as L,H as M,ll as N,_l as O,rl as P,k as Q,Ac as R,X as S,Td as T,F as U,Ls as V,P as W,xs as X,Js as Y,ys as Z,Z as _,Xf as a,gd as b,Lf as c,mf as d,d as et,pf as f,yd as g,vd as h,Gf as i,il as j,gl as k,Nf as l,Nd as m,Jf as n,s as nt,Yf as o,Pd as p,I as q,Kf as r,l as rt,Pf as s,qf as t,o as tt,yf as u,Od as v,xd as w,Cd as x,kd as y,jc as z};
|
|
66
|
+
`).map(e=>e.trim()).filter(Boolean)}}),await n()}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{disabled:c,className:`stack`,children:[(0,U.jsx)(Z,{id:`shared-files-maintainer`,label:`维护成员`,children:(0,U.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂停发布`}),t.map(e=>(0,U.jsx)(`option`,{value:e.id,disabled:!e.enabled||!e.accountEnabled,children:e.displayName||e.id},e.id))]})}),(0,U.jsx)(Z,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹;例如 README.md、_template/。由维护成员更新,其他成员自动接收。`,children:(0,U.jsx)(`textarea`,{rows:3,value:o,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`保存公共资料设置`})})]})}I({text:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({body:M().trim().min(1),requestId:M().min(1).optional()}).strict(),I({to:Js([tc(`debug`),F(z).min(1)]),body:M().trim().min(1),branch:M().trim().min(1).optional()}).strict();var Bf=N().int().positive().nullable(),$=L([`github`,`gongfeng`]),Vf={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hf=I({provider:$.default(`github`),repositoryUrl:M().trim().default(``),repository:M().trim().default(``),apiUrl:M().url().optional(),githubApiUrl:M().url().optional(),debugRecipient:z.nullable().default(null),contextWindow:N().int().positive().default(256e3),compactAt:N().int().positive().default(22e4),fetchIntervalSeconds:Bf.default(300),idleSeconds:Bf.default(1800),restartSeconds:Bf.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vf[n.provider]).replace(/\/+$/,``)}));I({config:Hf,token:M().nullable().optional(),webhookSecret:M().nullable().optional(),sshPrivateKey:M().nullable().optional(),sshKnownHosts:M().nullable().optional()}).strict();var Uf=I({config:Hf,tokenConfigured:P(),webhookConfigured:P(),sshConfigured:P(),sshPublicKey:M().nullable().optional(),webhookUrl:M().optional()}),Wf=I({id:M(),name:M(),url:M()}),Gf=I({id:M(),text:M(),answer:M(),author:M().nullable().optional(),source:tc(`wecom`).optional(),state:L([`queued`,`running`,`succeeded`,`failed`]),error:M().nullable(),createdAt:M()}),Kf=I({id:M(),seq:N(),runId:M().nullable(),role:L([`user`,`assistant`]),author:M(),body:M(),state:Gf.shape.state,source:M().nullable(),createdAt:M()}),qf=I({chats:F(I({id:M(),title:M(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),unread:P().optional(),createdAt:M(),updatedAt:M(),state:Gf.shape.state.nullable()}))}),Jf=I({id:M(),title:M().optional(),runs:F(Gf),messages:F(Kf),readCursor:N(),redirect:M().nullable().optional(),kind:L([`matter`,`notice`]).optional(),status:L([`active`,`waiting`,`completed`]).optional(),pending:I({members:F(M()),question:M()}).nullable().optional(),hold:I({scope:L([`all`,`writes`]),reason:M()}).passthrough().nullable().optional(),participants:F(M()).optional(),visibility:L([`project`,`participants`]).optional(),cursor:N()}),Yf=I({id:M(),body:M(),box:L([`normal`,`debug`]),taskId:N().nullable(),createdAt:M(),readAt:M().nullable(),archivedAt:M().nullable(),conversationId:M().nullable(),recipients:F(I({userId:M()}))}),Xf=I({messages:F(Yf),unread:N()}),Zf=e=>V(`site/worker-status`,Yd,{signal:e}),Qf=()=>W(Zf,5e3);function $f(){let e=Qf(),t=e.data;return(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`后台服务`}),(0,U.jsx)(X,{error:!0,children:e.error}),(0,U.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,U.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function ep({generation:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`agents/repository/status`,Xd,{signal:e}),[t,e]),5e3),r=n.data,i=r&&[`pending`,`cloning`,`fetching`].includes(r.state),a=r&&[`failed`,`interrupted`].includes(r.state);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,U.jsx)(Od,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,U.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,U.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,U.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,U.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tp({members:e}){let{request:t,projectId:n}=yf(),r=W((0,R.useCallback)(e=>t(`agents/settings`,Uf,{signal:e}),[t])),[i,a]=(0,R.useState)(0),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(()=>Hf.parse({})),[u,d]=(0,R.useState)(``),[f,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(!1),[ee,te]=(0,R.useState)(``),[ne,re]=(0,R.useState)(!1),[x,ie]=(0,R.useState)(``);(0,R.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,R.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{!e.repositoryUrl||e.initialProjectId&&e.initialProjectId!==n||l(t=>{if(t.repositoryUrl)return t;let n=e.repositoryUrl,r=n.includes(`git.tencent.com`)?`gongfeng`:t.provider,i=n.replace(/^[^@]+@[^:]+:/,``).replace(/^https?:\/\/[^/]+\//,``).replace(/\.git$/,``);return{...t,repositoryUrl:n,repository:i,provider:r,apiUrl:Vf[r]}})}).catch(()=>{}),()=>e.abort()},[!!r.data,n]);async function S(e,n=!1){e?.preventDefault(),b(!0),te(``),re(!1),ie(``);try{await t(`agents/settings`,Uf,{method:`PUT`,body:{config:c,...u?{token:u}:{},...f?{webhookSecret:f}:{},...h?{sshPrivateKey:h}:{},..._?{sshKnownHosts:_}:{}}}),d(``),m(``),g(``),v(``),await r.reload(),a(e=>e+1),re(!0),n&&(await t(`agents/repository/transport-check`,I({ok:P()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(H(e))}finally{b(!1)}}return(0,U.jsx)(`div`,{className:`settings-section`,children:(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,U.jsx)(`h2`,{children:`仓库连接`}),(0,U.jsx)(ep,{generation:i}),(0,U.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,U.jsx)(Z,{id:`agent-provider`,label:`Git 平台`,children:(0,U.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vf[t]}),ie(``)},children:[(0,U.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,U.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,U.jsx)(Z,{id:`agent-repository-url`,label:`仓库地址`,children:(0,U.jsx)(`input`,{value:c.repositoryUrl,placeholder:c.provider===`gongfeng`?`https://git.tencent.com/group/repository.git`:`https://github.com/owner/repository.git`,onChange:e=>l({...c,repositoryUrl:e.target.value}),onBlur:()=>{if(!c.repository){let e=``;try{e=new URL(c.repositoryUrl).pathname}catch{e=c.repositoryUrl.match(/^[^@]+@[^:]+:(.+)$/)?.[1]??``}e&&l({...c,repository:e.replace(/^\/+|\/+$/g,``).replace(/\.git$/,``)})}}})}),(0,U.jsx)(Z,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,U.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-api-url`,label:`API 地址`,children:(0,U.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,U.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,U.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(wd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,U.jsx)(Z,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,U.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,U.jsxs)(`section`,{className:`stack`,children:[(0,U.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,U.jsx)(wd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`agent-generate-key`,disabled:y,onClick:async()=>{b(!0),te(``);try{let e=await t(`agents/repository/ssh-key`,Uf,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(H(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,U.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,U.jsxs)(`div`,{className:`stack`,children:[(0,U.jsx)(Z,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,U.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,U.jsx)(Z,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,U.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`运行设置`}),(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,U.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`仓库 fetch 间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,U.jsx)(Z,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,U.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,U.jsx)(X,{error:!0,children:ee||r.error}),(0,U.jsx)(X,{children:x||(ne?`已保存。`:null)}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,U.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wf,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(H(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var np=Xs(`kind`,[I({kind:tc(`repository`),path:M().trim().min(1)}).strict(),I({kind:tc(`directory`),path:M().trim().min(1)}).strict()]),rp=I({members:F(M()),fileCount:N().int().nonnegative(),preserved:F(M()),skipped:F(M())}),ip=I({state:L([`none`,`pending`,`running`,`succeeded`,`failed`]),source:np.nullable(),result:rp.nullable(),error:M().nullable()});function ap({onImported:e}){let{request:t}=yf(),n=W((0,R.useCallback)(e=>t(`project/workspace-import`,ip,{signal:e}),[t]),5e3),r=Qf(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,R.useRef)(null);(0,R.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,R.useEffect)(()=>{u?.source?.kind===`directory`&&a(u.source.path)},[u?.source?.kind,u?.source?.path]);async function p(e=!1){s(!0),l(``);try{await t(`project/workspace-import`,ip,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(H(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,U.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,U.jsx)(`h2`,{children:`工作区初始化`}),(0,U.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 workspaces,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,U.jsxs)(`div`,{role:`status`,"data-testid":`workspace-import-status`,children:[u.state===`pending`&&`等待后台导入`,u.state===`running`&&(r.data?.state===`online`?`正在导入工作区`:`等待后台继续导入`),u.state===`succeeded`&&`已识别 ${u.result?.members.length??0} 位成员,导入 ${u.result?.fileCount??0} 个文件。`,u.source&&(0,U.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,U.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,U.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,U.jsx)(X,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,U.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`从服务器目录导入`}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsx)(Z,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/workspaces。`,children:(0,U.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/workspaces`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var op=e=>V(`ai/profiles`,Rd,{signal:e});function sp({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=W((0,R.useCallback)(e=>V(o,zd,{signal:e}),[o,i]));return(0,U.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,U.jsx)(X,{error:!0,children:s.error}),s.data?(0,U.jsx)(cp,{value:s.data,path:o,id:e??`site`,title:t,profiles:n,admin:r,onChanged:()=>{s.reload(),a()},reload:()=>void s.reload()},`${s.data.revision}/${s.data.effectiveProfileId}/${s.data.available}`):(0,U.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,U.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cp({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,R.useState)(e.profileId??``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(``),m=vl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,U.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await V(t,zd,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(H(e))}finally{d(!1)}},children:[(0,U.jsxs)(`div`,{className:`model-default-controls`,children:[(0,U.jsx)(Z,{id:`ai-default-${n}`,label:r,children:(0,U.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,U.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,U.jsx)(kd,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,U.jsx)(`p`,{className:`muted`,role:`status`,"data-testid":`ai-default-status-${n}`,children:e.available?`已配置 · ${h?.name??e.effectiveProfileId}`:e.effectiveProfileId?`接入点已停用`:`尚未配置默认接入点`}),!e.available&&e.effectiveProfileId&&(0,U.jsx)(X,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,U.jsx)(X,{error:!0,children:f}),f&&(0,U.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lp(){let{projectId:e}=yf(),t=W(op),[n,r]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(sp,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}I({enabled:P(),botId:M().trim().min(1),secret:M().trim().min(1).optional()}).strict();var up=I({enabled:P(),botId:M(),secretConfigured:P(),state:L([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:M().nullable(),pending:N()}),dp=I({available:P(),bound:P(),subscribed:P(),activeProject:M().nullable(),pending:N(),error:M().nullable()}),fp=I({code:M(),expiresAt:N()}),pp=I({groups:F(I({id:M(),boundBy:M(),createdAt:M()}))}),mp=I({channels:F(I({id:M(),name:M()})),selected:M().nullable(),selectedName:M().nullable(),missingMentions:F(M()),refreshing:P(),updatedAt:N().nullable(),error:M().nullable(),pending:N()}),hp=e=>V(`site/wecom`,up,{signal:e}),gp={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _p(){let e=W(hp,3e3),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await V(`site/wecom`,up,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(H(e))}finally{o(!1)}}return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信机器人`}),(0,U.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,U.jsx)(X,{error:!0,children:e.error||s}),(0,U.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,U.jsx)(Z,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,U.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,U.jsx)(Z,{id:`wecom-secret`,label:`Secret`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,required:!d?.secretConfigured||f.botId!==d.botId,value:r,placeholder:d?.secretConfigured?`已保存,留空保持不变`:`填写长连接专用 Secret`,onChange:e=>i(e.target.value)})}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用企业微信`,"aria-checked":f.enabled,className:f.enabled?`primary`:``,onClick:()=>n({...f,enabled:!f.enabled}),children:f.enabled?`已启用`:`已停用`})})]}),(0,U.jsx)(X,{children:l}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,U.jsxs)(`p`,{role:`status`,children:[d?gp[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:d?.error??``}),(0,U.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/channels`,mp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mp,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,U.jsx)(`h3`,{children:`项目频道`}),(0,U.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,U.jsx)(X,{error:!0,children:o||t.error||c?.error||``}),(0,U.jsx)(Z,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,U.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,U.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,U.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.missingMentions.length?(0,U.jsxs)(`p`,{className:`muted`,children:[`暂无法 @:`,c.missingMentions.join(`、`),`。成员完成下方个人绑定并加入频道后即可生效。`]}):null,c?.pending?(0,U.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function yp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom`,dp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);(0,R.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dp,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fp,{method:`POST`})),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}let l=t.data;return(0,U.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,U.jsx)(`h2`,{children:`企业微信`}),(0,U.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,U.jsx)(X,{error:!0,children:t.error||o}),l?.available&&(0,U.jsx)(vp,{}),l?.available&&(0,U.jsx)(`h3`,{children:`个人绑定`}),l?l.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,U.jsx)(X,{error:!0,children:l.error??``}),l.subscribed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`muted`,children:`获取绑定码后,在企业微信中私聊机器人,发送下面的绑定消息。绑定码 10 分钟内有效。`}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,U.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,U.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,U.jsx)(bp,{})]})}function bp(){let{request:e}=yf(),t=W((0,R.useCallback)(t=>e(`wecom/groups`,pp,{signal:t}),[e]),3e3),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fp,{method:`POST`}))}catch(e){s(H(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pp,{method:`DELETE`}),await t.reload()}catch(e){s(H(e))}finally{a(!1)}}return(0,U.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,U.jsx)(`h3`,{children:`群接入`}),(0,U.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,U.jsx)(X,{error:!0,children:o||t.error}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,U.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,U.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,U.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xp({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=yf(),s=[{id:`general`,title:`基础设置`,icon:`general`},...t.siteRole===`admin`?[{id:`repository`,title:`代码仓库`,icon:`code`}]:[],{id:`members`,title:`成员`,icon:`members`},{id:`connect`,title:`客户端接入`,icon:`connect`},{id:`wecom`,title:`企业微信`,icon:`message`}],[c,l]=(0,R.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,R.useState)(e),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``);async function y(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Hc,{method:`PATCH`,body:Gc.parse({projectName:u.projectName,description:u.description})});f(e),v(B.configSaved),n()}catch(e){g(H(e))}finally{m(!1)}}return(0,U.jsxs)(Mf,{title:B.settings,navigation:(0,U.jsx)(gf,{prefix:`settings`,selected:c,onSelect:e=>{l(e);let t=new URL(location.href);e===`general`?t.searchParams.delete(`tab`):t.searchParams.set(`tab`,e),history.replaceState(null,``,t)},tabs:s}),children:[(0,U.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,U.jsx)(yp,{})}),(0,U.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,U.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":B.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,U.jsx)(`h2`,{children:`项目信息`}),(0,U.jsx)(Z,{id:`project-name`,name:`projectName`,label:B.projectName,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,U.jsx)(Z,{id:`project-description`,name:`description`,label:B.description,children:(0,U.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,U.jsx)(X,{error:!0,children:h}),(0,U.jsx)(X,{children:_}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?B.saving:B.save})})]})]}),(0,U.jsx)(lp,{}),(0,U.jsx)(Rf,{members:r}),t.siteRole===`admin`&&(0,U.jsx)(ap,{onImported:n})]}),t.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,U.jsx)(tp,{members:r})}),(0,U.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,U.jsx)(xf,{members:r,session:t,reload:n,onLeave:i})}),(0,U.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.connectTitle}),(0,U.jsx)(`p`,{children:B.connectHint}),(0,U.jsx)(wd,{id:`connect-command`,label:B.connectCommand,value:`teammy connect --url ${cl(e.publicServerUrl)} --project ${cl(e.projectId)}`}),(0,U.jsx)(`p`,{children:B.connectAfter})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:B.install}),(0,U.jsx)(`p`,{children:B.installHint}),(0,U.jsx)(wd,{id:`install-command`,label:B.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,U.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,U.jsx)(`h2`,{children:`Agent 接入`}),(0,U.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,U.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]})]})}function Sp({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,R.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Sd,{title:`我的项目`,children:(0,U.jsxs)(xd,{label:`项目操作`,children:[(0,U.jsx)(kd,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})]})}),(0,U.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,U.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,U.jsx)(Od,{name:`files`,size:`navigation`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:e.projectName}),e.description&&(0,U.jsx)(`small`,{children:e.description})]}),(0,U.jsx)(Od,{name:`chevron`})]},e.projectId))}),!e.length&&(0,U.jsx)(yd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,U.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,U.jsx)(Od,{name:`plus`}),`新建项目`]})}),i&&(0,U.jsx)(Cp,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cp({onClose:e,onCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=(0,R.useRef)({fingerprint:``,id:ll()});return(0,R.useEffect)(()=>{let e=new AbortController;return V(`setup/options`,$d,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,U.jsx)(Cd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`project-create-form`,onSubmit:async e=>{e.preventDefault(),l(!0),d(``);try{let e=JSON.stringify([n,i,o]);f.current.fingerprint!==e&&(f.current={fingerprint:e,id:ll()}),await t((await V(`projects`,Hc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(H(e))}finally{l(!1)}},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,U.jsx)(Z,{id:`new-project-name`,label:`项目名称`,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-description`,label:`说明`,children:(0,U.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,U.jsx)(Z,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 workspaces 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,U.jsx)(`input`,{value:o,placeholder:`/imports/utu/workspaces`,onChange:e=>s(e.target.value)})})]}),(0,U.jsx)(X,{error:!0,children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,U.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wp({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,R.useState)(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(0);return(0,U.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsx)(`h2`,{children:`模型接入`}),e&&(0,U.jsx)(kd,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,U.jsx)(X,{error:!0,children:n}),n&&(0,U.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,U.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,U.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:t.name}),(0,U.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,U.jsx)(kd,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,U.jsx)(Ep,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,U.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tp(e){let{revision:t,keyConfigured:n,...r}=e;return Fd.parse(r)}function Ep({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,R.useState)(e?Tp(e):Fd.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=vl(),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tp(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await V(`ai/profiles/${encodeURIComponent(r.id)}`,Id,{method:`PUT`,signal:a,body:Ld.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(H(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await op(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tp(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(H(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await V(`ai/profiles/${encodeURIComponent(r.id)}/test`,Vd,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(H(e))}finally{p(!1)}}return(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,U.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,U.jsxs)(`div`,{className:`form-grid`,children:[(0,U.jsx)(Z,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,U.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-name`,label:`模型名称`,children:(0,U.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,U.jsx)(Z,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,U.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,U.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,U.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,U.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,U.jsx)(Z,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,U.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-model`,label:`模型 ID`,children:(0,U.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,U.jsx)(Z,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,U.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,U.jsx)(X,{error:!0,children:m}),(0,U.jsx)(X,{children:g}),(0,U.jsxs)(`div`,{className:`row wrap`,children:[(0,U.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,U.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,U.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-probe-${e}`,disabled:f||v,onClick:()=>void ee(e),children:{text:`测试文本`,tools:`测试工具`,json:`测试 JSON`}[e]},e))}),o&&(0,U.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,U.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dp=e=>V(`site/config`,Qc,{signal:e});function Op(){let e=W(Dp);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{error:!0,children:e.error}),e.data&&(0,U.jsx)(Ap,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,U.jsx)(kp,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,U.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function kp({config:e,reload:t}){let[n,r]=(0,R.useState)(e.sync),[i,a]=(0,R.useState)(e.revision),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(``);return(0,R.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,U.jsx)(`form`,{className:`stack`,"data-testid":`site-sync-form`,"aria-busy":o,"data-config-revision":i,onSubmit:async e=>{e.preventDefault(),s(!0),l(``),d(``);try{let e=await V(`site/config`,Qc,{method:`PATCH`,body:$c.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(H(e))}finally{s(!1)}},children:(0,U.jsxs)(`section`,{className:`settings-section stack`,children:[(0,U.jsx)(`h2`,{children:`同步策略`}),(0,U.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,U.jsx)(Z,{id:`sync-check-interval`,label:B.interval,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,U.jsx)(Z,{id:`sync-file-settle`,label:B.settle,children:(0,U.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,U.jsx)(X,{error:!0,children:c}),(0,U.jsx)(X,{children:u}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Ap({config:e,reload:t}){let[n,r]=(0,R.useState)(e.publicServerUrl),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(``);return(0,R.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,U.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await V(`site/config`,Qc,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(H(e))}finally{a(!1)}},children:[(0,U.jsx)(`h2`,{children:`访问地址`}),(0,U.jsx)(Z,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,U.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:o}),(0,U.jsx)(`div`,{className:`actions`,children:(0,U.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jp=e=>V(`users`,I({users:F(el)}),{signal:e});function Mp({me:e}){let t=W(jp),[n,r]=(0,R.useState)();return(0,U.jsxs)(`div`,{className:`settings-section stack`,children:[(0,U.jsx)(bd,{title:`用户信息`,children:(0,U.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,U.jsx)(Od,{name:`plus`}),`新增用户`]})}),(0,U.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.error&&(0,U.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,U.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,U.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,U.jsxs)(`div`,{className:`member-heading`,children:[(0,U.jsx)(_d,{name:t.displayName}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t.displayName}),(0,U.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,U.jsxs)(`div`,{className:`member-actions`,children:[(0,U.jsx)(kd,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,U.jsx)(kd,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,U.jsx)(Np,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Np({action:e,onClose:t,onSaved:n}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,U.jsx)(Cd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,U.jsxs)(`form`,{className:`stack`,"data-testid":`user-form`,"aria-label":d,"aria-busy":s,onSubmit:async t=>{t.preventDefault(),c(!0),u(``);try{e.kind===`add`?await V(`users`,el,{method:`POST`,body:tl.parse({id:r.trim(),displayName:a})}):await V(`users/${encodeURIComponent(e.user.id)}`,el,{method:`PATCH`,body:nl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(H(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,U.jsx)(Z,{id:`user-id`,label:`用户 ID`,hint:B.idHint,children:(0,U.jsx)(`input`,{required:!0,autoFocus:!0,autoComplete:`off`,maxLength:64,pattern:`[a-z][a-z0-9_\\-]{0,63}`,value:r,disabled:s,onChange:e=>i(e.target.value)})}),e.kind===`toggle`?(0,U.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,U.jsx)(Z,{id:`user-display-name`,label:B.displayName,children:(0,U.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,U.jsx)(X,{error:!0,children:l}),(0,U.jsxs)(`div`,{className:`actions`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:B.cancel}),(0,U.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?B.saving:B.confirm})]})]})})}function Pp({session:e}){let t=W(op),n=W(ol.server),[r,i]=(0,R.useState)(`general`),[a,o]=(0,R.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,U.jsxs)(`div`,{className:`site-settings`,children:[(0,U.jsx)(Sd,{title:`设置`}),(0,U.jsx)(gf,{prefix:`site`,orientation:`horizontal`,selected:r,onSelect:i,tabs:[{id:`general`,title:`通用`,icon:`general`},{id:`models`,title:`接入点`,icon:`model`},...e.siteRole===`admin`?[{id:`users`,title:`用户`,icon:`members`},{id:`wecom`,title:`企业微信`,icon:`message`}]:[]]}),(0,U.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,U.jsx)(_p,{})}),(0,U.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,U.jsx)(Op,{}):(0,U.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,U.jsx)($f,{}),(0,U.jsxs)(`div`,{className:`settings-section`,children:[(0,U.jsx)(`h2`,{children:`服务端版本`}),(0,U.jsx)(X,{error:!0,children:n.error}),(0,U.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,U.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,U.jsx)(`div`,{className:`settings-section-actions`,children:(0,U.jsx)(kd,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,U.jsx)(wp,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,U.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,U.jsx)(`h2`,{children:`默认接入点`}),(0,U.jsx)(X,{error:!0,children:t.error}),t.data&&(0,U.jsx)(U.Fragment,{children:(0,U.jsx)(sp,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]})]}),e.siteRole===`admin`&&(0,U.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,U.jsx)(Mp,{me:e.memberId})})]})]})}var Fp=`modulepreload`,Ip=function(e,t){return new URL(e,t).href},Lp={},Rp=function(e){return e.pathname.endsWith(`.css`)},zp=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ip(t,n);let r=s(t),i=Rp(r);return zp(Lp,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fp,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vp=(0,R.lazy)(()=>Bp(()=>import(`./Materials-CFm4FvpO.js`).then(e=>({default:e.Materials})),__vite__mapDeps([0,1,2,3]),import.meta.url)),Hp=(0,R.lazy)(()=>Bp(()=>import(`./Files-Ctal40MO.js`).then(e=>({default:e.Files})),__vite__mapDeps([4,1,5,6,2]),import.meta.url)),Up=(0,R.lazy)(()=>Bp(()=>import(`./Assistant-DJV9aVRy.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([7,1,8]),import.meta.url)),Wp=(0,R.lazy)(()=>Bp(()=>import(`./Dashboard-CDLBK91Q.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([9,5,6,10]),import.meta.url)),Gp=(0,R.lazy)(()=>Bp(()=>import(`./Sessions-CAEjqZpk.js`).then(e=>({default:e.Sessions})),__vite__mapDeps([11,1,5,2,12]),import.meta.url));function Kp(){let[e,t]=(0,R.useState)(),[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(0);return(0,R.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await ol.setup(e.signal),i;if(n.initialized)try{i=await ol.session(e.signal)}catch(e){if(!(e instanceof il&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(H(t))}})(),()=>e.abort()},[o]),(0,R.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(X,{error:!0,children:i}),(0,U.jsx)(`button`,{onClick:()=>s(e=>e+1),children:B.retry})]}):n===void 0?(0,U.jsxs)(`main`,{className:`boot`,children:[(0,U.jsx)(hd,{}),(0,U.jsx)(`p`,{role:`status`,children:B.loading})]}):n?e?f()===`/connect`?(0,U.jsx)(df,{session:e,onLogout:()=>t(void 0)}):(0,U.jsx)(hl,{children:(0,U.jsx)(Jp,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,U.jsx)(nf,{onLogin:t}):(0,U.jsx)(sf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function qp(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|files|materials|sessions|members|settings)$/);if(e)return{projectId:e[1],page:e[2]};let t=f()===`/account`?`site-settings`:f().slice(1);return{projectId:``,page:[`projects`,`site-settings`,`members`,...Ef].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function Jp({session:e,onLogout:t}){let n=W(ol.projects,!0),[r,i]=(0,R.useState)(qp),a=(0,R.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(qp()),document.querySelector(`main`)?.focus()},[]);(0,R.useEffect)(()=>{let e=()=>{i(qp())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,R.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(Df(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||!Ef.includes(r.page)&&r.page!==`members`||!o)return;let t=``;try{t=localStorage.getItem(`teammy-project:${e.memberId}`)??``}catch{}let n=o.find(e=>e.projectId===t)??o[0];a(n?Df(n.projectId,r.page===`members`?`settings`:r.page)+(r.page===`members`?`?tab=members`:``):`/projects`,!0)},[r.projectId,r.page,o,a,e.memberId]);let s=o?.find(e=>e.projectId===r.projectId);(0,R.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,R.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,R.useMemo)(()=>r.projectId?_f(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,U.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,U.jsx)(`a`,{className:`skip-link`,href:`#main`,children:B.skipToMain}),!l&&(0,U.jsx)(kf,{projectId:r.projectId,page:r.page,navigate:a}),(0,U.jsx)(`div`,{className:`main-shell`,children:(0,U.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,U.jsx)(X,{error:!0,children:n.error}),l?(0,U.jsx)(jf,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,U.jsx)(Pp,{session:e}):(0,U.jsx)(Sp,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(Df(e,`dashboard`))})}):c&&s?(0,U.jsx)(vf.Provider,{value:c,children:(0,U.jsx)(Yp,{page:r.page,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,U.jsx)(X,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})]})})]})}function Yp({page:e,onLeave:t}){let n=yf(),r=W((0,R.useCallback)(async e=>{let[t,r,i]=await Promise.all([n.api.config(e),n.api.members(e),n.request(`identity`,Jc,{signal:e})]);return{config:t,members:r.members,session:i}},[n]),!0),i=r.data;return r.error?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{error:!0,children:r.error}),(0,U.jsx)(`button`,{onClick:()=>void r.reload(),children:`重试`})]}):i?(0,U.jsx)(R.Suspense,{fallback:(0,U.jsx)(`p`,{role:`status`,children:B.loading}),children:e===`files`?(0,U.jsx)(Hp,{members:i.members,me:i.session.memberId,onRefresh:()=>void r.reload()}):e===`dashboard`?(0,U.jsx)(Wp,{members:i.members,config:i.config}):e===`materials`?(0,U.jsx)(Vp,{}):e===`sessions`?(0,U.jsx)(Gp,{members:i.members}):e===`assistant`?(0,U.jsx)(Up,{me:i.session.memberId}):(0,U.jsx)(xp,{config:i.config,session:i.session,reload:()=>void r.reload(),members:i.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,U.jsx)(`p`,{role:`status`,children:B.loading})}(0,Tc.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(Kp,{}));export{h as $,fl as A,z as B,Sd as C,W as D,vl as E,B as F,tc as G,L as H,Nc as I,M as J,N as K,Mc as L,H as M,ll as N,_l as O,rl as P,k as Q,Ac as R,X as S,Td as T,F as U,Ls as V,P as W,xs as X,Js as Y,ys as Z,Z as _,Xf as a,gd as b,Lf as c,mf as d,d as et,pf as f,yd as g,vd as h,Gf as i,il as j,gl as k,Nf as l,Nd as m,Jf as n,s as nt,Yf as o,Pd as p,I as q,Kf as r,l as rt,Pf as s,qf as t,o as tt,yf as u,Od as v,xd as w,Cd as x,kd as y,jc as z};
|
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="theme-color" content="#161615" />
|
|
7
7
|
<title>Teammy 工作台</title>
|
|
8
8
|
<link rel="icon" type="image/png" href="./assets/teammy-favicon-BiDvlPj2.png" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-DouLQdFE.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="./assets/index-CTIAGUGG.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|