@teammy/server 0.2.2 → 0.2.3

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResourceLibrary-RyTep8PC.js","./Markdown-Drn0H2RJ.js","./Conversation-CZ8mOF1T.js","./Conversation-B-uSxDxY.css","./WorkspaceTree-BEiahyEL.js","./project-links-Dy6-B89_.js","./HtmlPreview-TOlZ7wbO.js","./ResourceLibrary-COmSSC8U.css","./Help-DGI26Qe5.js","./Help-DX51vBK7.css","./Files-DD-tWR-r.js","./file-links-BYBi3BDP.js","./Assistant-ZM9at-n8.js","./MessageComposer-SftlQB1e.js","./MessageComposer-DavJdQPa.css","./Computers-CV-4FaxZ.js","./Computers-B9XbkIvb.css","./Dashboard-wZpQ1Qxb.js","./Dashboard-DIunax0h.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResourceLibrary-CXqTEv7V.js","./Markdown-Bb9dy2Sh.js","./Conversation-1APTn0kq.js","./Conversation-B-uSxDxY.css","./WorkspaceTree-D0UUUBtF.js","./project-links-Dy6-B89_.js","./HtmlPreview-BcspnVI6.js","./ResourceLibrary-COmSSC8U.css","./Help-BXvLax7h.js","./Help-DX51vBK7.css","./Files-BdfIlw8b.js","./file-links-B0q73ekI.js","./Assistant-Ceif-ARy.js","./MessageComposer-B6iTInqD.js","./MessageComposer-DavJdQPa.css","./Computers-B_8KVFSv.js","./Computers-B9XbkIvb.css","./Dashboard-B-LuQT0a.js","./Dashboard-DIunax0h.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 Za(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;Za(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 Qa=new Set([`type`,`properties`,`required`,`additionalProperties`]),$a=[`oneOf`,`anyOf`];function eo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function to(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Qa.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]??eo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}se(n,r,e.length===1?e[0]:to(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=eo(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 no(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Qa)if(t in e)return;let n=t.filter(e=>$a.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=to(t);else{let e=n[0],i=$a.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=>to([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ga(e,r))}function ro(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)):Ga(i,s),Ga(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())Za(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)??[])no(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)}Ga(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:oo(t,`input`,e.processors),output:oo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function io(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 io(r.element,n);if(r.type===`set`)return io(r.valueType,n);if(r.type===`lazy`)return io(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 io(r.innerType,n);if(r.type===`intersection`)return io(r.left,n)||io(r.right,n);if(r.type===`record`||r.type===`map`)return io(r.keyType,n)||io(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:io(r.in,n)||io(r.out,n);if(r.type===`object`){for(let e in r.shape)if(io(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(io(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(io(e,n))return!0;return!!(r.rest&&io(r.rest,n))}return!1}var ao=(e,t={})=>n=>{let r=Ka({...n,processors:t});return Ja(e,r),Xa(r,e),ro(r,e)},oo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ka({...i??{},target:a,io:t,processors:n});return Ja(e,o),Xa(o,e),ro(o,e)},so=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},co=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},lo=(e,t)=>{so(e,`minimum`,t),co(e,`maximum`,t)},uo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},fo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},po=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},mo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ho=(e,t)=>so(e,`minimum`,t.minimum),go=(e,t)=>co(e,`maximum`,t.maximum),_o=e=>(t,n)=>{mo(t,n.format);let[r,i]=e[n.format];so(t,`minimum`,r),co(t,`maximum`,i)},vo={greater_than:(e,t)=>so(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>co(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>uo(e,t.value),number_format:_o(w),bigint_format:_o(T),min_length:ho,max_length:go,length_equals:(e,t)=>lo(e,t.length),min_size:ho,max_size:go,size_equals:(e,t)=>lo(e,t.size),string_format:(e,t)=>{mo(e,t.format),t.pattern&&fo(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)=>po(e,t.mime)};function yo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)vo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&so(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&so(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&co(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&co(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&uo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&po(t,i.mime);for(let e of i.patterns??[])fo(t,e);return t}var bo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},xo=new Map([[Sr,an],[wr,on]]),So=e=>xo.get(e)??e,Co=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=yo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=bo[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(So);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}))])}},wo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=yo(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)):qa(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}))])}},To=(e,t,n,r)=>{n.type=`boolean`},Eo=(e,t,n,r)=>{n.not={}},Do=(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)},Oo=(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(qa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(qa(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}},ko=(e,t,n,r)=>{qa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{qa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=yo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ja(a.element,t,{...r,path:[...r.path,`items`]})};function Mo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Mo(t.out):t.type===`catch`?Mo(t.innerType):e._zod.optin}var No=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&qa(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,Ja(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`?Mo(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=Ja(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Po=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ja(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fo=(e,t,n,r)=>{let i=e._zod.def,a=Ja(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ja(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)};function Io(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Io(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Io(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?_n:gn).source)),p}var Lo=new WeakMap;function Ro(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Lo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Io(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var zo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=yo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ja(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)se(i.patternProperties,So(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Ja(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Lo.get(t);n||(n=[],Lo.set(t,n),t.deferred.push(()=>Ro(t))),n.push(e)}i.additionalProperties=Ja(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Mo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Bo=(e,t,n,r)=>{let i=e._zod.def,a=Ja(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`}]},Vo=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ho=Symbol();function Uo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(qa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ho):JSON.parse(o)}var Wo=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Uo(i.defaultValue,e,t,n,r);o!==Ho&&(n.default=o)},Go=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Uo(i.defaultValue,e,t,n,r);o!==Ho&&(n._prefault=o)},Ko=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{qa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},qo=(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;Ja(o,t,r);let s=t.seen.get(e);s.ref=o},Jo=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yo=(e,t,n,r)=>{let i=e._zod.def;Ja(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xo=new WeakSet([Object.prototype,Error.prototype]);function Zo(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);Xo.has(n)||(Xo.add(n),Zo(n,`format`,e=>t=>St(e,t)),Zo(n,`flatten`,e=>t=>xt(e,t)),Zo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,re,2)}),Zo(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}}))},j=D(`ZodError`,Qo),M=D(`ZodError`,Qo,void 0,{Parent:Error}),$o=wt(M),es=Tt(M),ts=Et(M),ns=Ot(M),rs=Pt(M),is=Ft(M),as=It(M),os=Lt(M),ss=Rt(M),cs=zt(M),ls=Bt(M),us=Vt(M);function ds(){ft.localeError||pt(Li())}function fs(){ft.memoizer||pt({memoizer:Pi()})}var ps=D(`ZodType`,(e,t)=>(ds(),k.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(kc(e,t))},superRefine(e,t){return this.check(Ac(e,t))},overwrite(e){return this.check(Fa(e))},optional(){return dc(this)},exactOptional(){return pc(this)},nullable(){return hc(this)},nullish(){return dc(hc(this))},nonoptional(e){return xc(this,e)},array(){return L(this)},or(e){return Qs([this,e])},and(e){return nc(this,e)},transform(e){return Tc(this,lc(e))},default(e){return _c(this,e)},prefault(e){return yc(this,e)},catch(e){return Cc(this,e)},pipe(e){return Tc(this,e)},readonly(){return Dc(this)},describe(e){let t=this.clone();return Vi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Vi.get(this);let t=this.clone();return Vi.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:oo(this,`input`),output:oo(this,`output`)}})},set"~standard"(e){Ye(this,`~standard`,e)},parse:function e(t,n){return $o(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await es(this,t,n,{callee:e})},safeParse(e,t){return ts(this,e,t)},async safeParseAsync(e,t){return ns(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 rs(this,t,n,{callee:e})},decode:function e(t,n){return is(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await as(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await os(this,t,n,{callee:e})},safeEncode(e,t){return ss(this,e,t)},safeDecode(e,t){return cs(this,e,t)},async safeEncodeAsync(e,t){return ls(this,e,t)},async safeDecodeAsync(e,t){return us(this,e,t)},toJSONSchema(e){return ao(this,{})(e)},get description(){return Vi.get(this)?.description},get _def(){return this._zod.def}}),ms=D(`_ZodString`,(e,t)=>{Wn.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)},Ze({format:e=>yo(e).format??null,minLength:e=>yo(e).minimum??null,maxLength:e=>yo(e).maximum??null},{regex(...e){return this.check(ka(...e))},includes(...e){return this.check(Ma(...e))},startsWith(...e){return this.check(Na(...e))},endsWith(...e){return this.check(Pa(...e))},min(...e){return this.check(Da(...e))},max(...e){return this.check(Ea(...e))},length(...e){return this.check(Oa(...e))},nonempty(...e){return this.check(Da(1,...e))},lowercase(e){return this.check(Aa(e))},uppercase(e){return this.check(ja(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})),hs=D(`ZodString`,(e,t)=>{Wn.init(e,t),ms.init(e,t)},{email(e){return this.check(Wi(bs,e))},url(e){return this.check(Xi(ws,e))},jwt(e){return this.check(da(Bs,e))},emoji(e){return this.check(Zi(Es,e))},guid(e){return this.check(Gi(xs,e))},uuid(e){return this.check(Ki(Ss,e))},uuidv4(e){return this.check(qi(Ss,e))},uuidv6(e){return this.check(Ji(Ss,e))},uuidv7(e){return this.check(Yi(Ss,e))},nanoid(e){return this.check(Qi(Ds,e))},cuid(e){return this.check($i(Os,e))},cuid2(e){return this.check(ea(ks,e))},ulid(e){return this.check(ta(As,e))},base64(e){return this.check(ca(Ls,e))},base64url(e){return this.check(la(Rs,e))},xid(e){return this.check(na(js,e))},ksuid(e){return this.check(ra(Ms,e))},ipv4(e){return this.check(ia(Ns,e))},ipv6(e){return this.check(aa(Ps,e))},cidrv4(e){return this.check(oa(Fs,e))},cidrv6(e){return this.check(sa(Is,e))},e164(e){return this.check(ua(zs,e))},datetime(e){return this.check(fa(gs,e))},date(e){return this.check(pa(_s,e))},time(e){return this.check(ma(vs,e))},duration(e){return this.check(A(ys,e))}});function N(e){return Ui(hs,e)}var P=D(`ZodStringFormat`,(e,t)=>{Gn.init(e,t),ms.init(e,t)}),gs=D(`ZodISODateTime`,(e,t)=>{ur.init(e,t),P.init(e,t)}),_s=D(`ZodISODate`,(e,t)=>{dr.init(e,t),P.init(e,t)}),vs=D(`ZodISOTime`,(e,t)=>{fr.init(e,t),P.init(e,t)}),ys=D(`ZodISODuration`,(e,t)=>{pr.init(e,t),P.init(e,t)}),bs=D(`ZodEmail`,(e,t)=>{Jn.init(e,t),P.init(e,t)}),xs=D(`ZodGUID`,(e,t)=>{Kn.init(e,t),P.init(e,t)}),Ss=D(`ZodUUID`,(e,t)=>{qn.init(e,t),P.init(e,t)});function Cs(e){return Ki(Ss,e)}var ws=D(`ZodURL`,(e,t)=>{nr.init(e,t),P.init(e,t)});function Ts(e){return Xi(ws,e)}var Es=D(`ZodEmoji`,(e,t)=>{rr.init(e,t),P.init(e,t)}),Ds=D(`ZodNanoID`,(e,t)=>{ir.init(e,t),P.init(e,t)}),Os=D(`ZodCUID`,(e,t)=>{ar.init(e,t),P.init(e,t)}),ks=D(`ZodCUID2`,(e,t)=>{or.init(e,t),P.init(e,t)}),As=D(`ZodULID`,(e,t)=>{sr.init(e,t),P.init(e,t)}),js=D(`ZodXID`,(e,t)=>{cr.init(e,t),P.init(e,t)}),Ms=D(`ZodKSUID`,(e,t)=>{lr.init(e,t),P.init(e,t)}),Ns=D(`ZodIPv4`,(e,t)=>{mr.init(e,t),P.init(e,t)}),Ps=D(`ZodIPv6`,(e,t)=>{_r.init(e,t),P.init(e,t)}),Fs=D(`ZodCIDRv4`,(e,t)=>{vr.init(e,t),P.init(e,t)}),Is=D(`ZodCIDRv6`,(e,t)=>{br.init(e,t),P.init(e,t)}),Ls=D(`ZodBase64`,(e,t)=>{Cr.init(e,t),P.init(e,t)}),Rs=D(`ZodBase64URL`,(e,t)=>{Er.init(e,t),P.init(e,t)}),zs=D(`ZodE164`,(e,t)=>{Dr.init(e,t),P.init(e,t)}),Bs=D(`ZodJWT`,(e,t)=>{kr.init(e,t),P.init(e,t)}),Vs=D(`ZodNumber`,(e,t)=>{Ar.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.isFinite=!0},Ze({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=yo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=yo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=yo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>yo(e).format??null},{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(Us(e))},safe(e){return this.check(Us(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Ta(e,t))},step(e,t){return this.check(Ta(e,t))},finite(){return this}}));function F(e){return ha(Vs,e)}var Hs=D(`ZodNumberFormat`,(e,t)=>{jr.init(e,t),Vs.init(e,t)});function Us(e){return _a(Hs,e)}var Ws=D(`ZodBoolean`,(e,t)=>{Mr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function I(e){return va(Ws,e)}var Gs=D(`ZodUnknown`,(e,t)=>{Nr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ks(){return ya(Gs)}var qs=D(`ZodNever`,(e,t)=>{Pr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Js(e){return ba(qs,e)}var Ys=D(`ZodArray`,(e,t)=>{fs(),Rr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Da(e,t))},nonempty(e){return this.check(Da(1,e))},max(e,t){return this.check(Ea(e,t))},length(e,t){return this.check(Oa(e,t))},unwrap(){return this.element}});function L(e,t){return Va(Ys,e,t)}var Xs=D(`ZodObject`,(e,t)=>{fs(),Wr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),rt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return z(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:Ks()}))},loose(){return this.clone(me(this._zod.def,{catchall:Ks()}))},strict(){return this.clone(me(this._zod.def,{catchall:Js()}))},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(uc,this,e[0])},exactPartial(...e){return Pe(fc,this,e[0],`exactPartial`)},required(...e){return Fe(bc,this,e[0])}});function R(e,t){return new Xs({type:`object`,shape:e??{},...C(t)})}var Zs=D(`ZodUnion`,(e,t)=>{Kr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.options=t.options});function Qs(e,t){return new Zs({type:`union`,options:e,...C(t)})}var $s=D(`ZodDiscriminatedUnion`,(e,t)=>{Zs.init(e,t),Jr.init(e,t)});function ec(e,t,n){return new $s({type:`union`,options:t,discriminator:e,...C(n)})}var tc=D(`ZodIntersection`,(e,t)=>{Yr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r)});function nc(e,t){return new tc({type:`intersection`,left:e,right:t})}var rc=D(`ZodRecord`,(e,t)=>{fs(),Qr.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ic(e,t,n){return!t||!t._zod?new rc({type:`record`,keyType:N(),valueType:e,...C(t)}):new rc({type:`record`,keyType:e,valueType:t,...C(n)})}var ac=D(`ZodEnum`,(e,t)=>{$r.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(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 ac({...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 ac({...t,checks:[],...C(r),entries:i})}});function z(e,t){return new ac({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...C(t)})}var oc=D(`ZodLiteral`,(e,t)=>{ei.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(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 sc(e,t){return new oc({type:`literal`,values:Array.isArray(e)?e:[e],...C(t)})}var cc=D(`ZodTransform`,(e,t)=>{fs(),ti.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(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 lc(e){return new cc({type:`transform`,transform:e})}var uc=D(`ZodOptional`,(e,t)=>{ri.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}var fc=D(`ZodExactOptional`,(e,t)=>{ii.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}var mc=D(`ZodNullable`,(e,t)=>{ai.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`nullable`,innerType:e})}var gc=D(`ZodDefault`,(e,t)=>{oi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _c(e,t){return new gc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var vc=D(`ZodPrefault`,(e,t)=>{ci.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xe(t)}})}var bc=D(`ZodNonOptional`,(e,t)=>{li.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`nonoptional`,innerType:e,...C(t)})}var Sc=D(`ZodCatch`,(e,t)=>{fi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cc(e,t){return new Sc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:at(t)})}var wc=D(`ZodPipe`,(e,t)=>{pi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.in=t.in,e.out=t.out});function Tc(e,t){return new wc({type:`pipe`,in:e,out:t})}var Ec=D(`ZodReadonly`,(e,t)=>{hi.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Ec({type:`readonly`,innerType:e})}var Oc=D(`ZodCustom`,(e,t)=>{_i.init(e,t),ps.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function kc(e,t={}){return Ha(Oc,e,t)}function Ac(e,t){return Ua(e,t)}var B=h(),jc=ee(),V=N().regex(/^[a-z][a-z0-9_-]{0,63}$/),Mc=Cs();R({deviceId:Mc,projectId:V.optional()}).strict(),R({workspaceId:V,memberId:V,deviceId:Mc}),R({members:L(V)});var Nc=134217728,Pc=10485760,Fc=3e5,Ic=N().regex(/^[a-f0-9]{64}$/),Lc=F().int().nonnegative().max(2**53-1),Rc=N().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.`),zc=R({sha256:Ic,size:F().int().min(0).max(Nc)}),Bc=zc.extend({size:F().int().min(0).max(Pc)}),Vc=ec(`kind`,[Bc.extend({kind:sc(`upsert`),path:Rc}).strict(),R({kind:sc(`delete`),path:Rc}).strict()]);R({operationId:Cs(),parentRevision:Lc,changes:L(Vc)}).strict().refine(e=>new Set(e.changes.map(e=>e.path)).size===e.changes.length,`Duplicate paths in a publication.`),R({operationId:Cs(),revision:Lc});var Hc=Bc.extend({path:Rc,revision:Lc});R({revision:Lc,complete:I().default(!1),files:L(Hc),nextCursor:N().nullable()}),R({headRevision:Lc,revisions:L(R({revision:Lc,operationId:Cs(),createdAt:N(),changes:L(Vc)}))}),R({hashes:L(Ic).max(200)}).strict(),R({missing:L(Ic)});var Uc=ec(`kind`,[Hc.extend({kind:sc(`file`)}),R({kind:sc(`directory`),path:Rc,fileCount:F().int().positive()})]),Wc=R({revision:Lc,path:Qs([sc(``),Rc]),entries:L(Uc),nextCursor:N().nullable()}),Gc=R({revision:Lc,file:Hc}),Kc=N().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.`),qc=R({checkIntervalSeconds:F().int().min(1).max(86400),fileSettleSeconds:F().int().min(0).max(86400)}).strict(),Jc=R({schemaVersion:sc(1),projectId:V,projectName:N().trim().min(1).max(120),description:N().max(2e3),publicServerUrl:Kc,configRevision:Lc,scopeProfile:sc(`workspace-and-sessions-v1`),sync:qc}).strict(),Yc=R({operationId:Cs(),publicServerUrl:Kc,adminId:V}).strict(),Xc=R({initialized:I()}),Zc=Jc.pick({projectName:!0,description:!0}).extend({expectedRevision:Lc.optional()}).strict(),Qc=R({id:V,displayName:N().max(120),enabled:I(),accountEnabled:I(),revision:Lc,bound:I(),fileRevision:Lc,lastPublishedAt:N().nullable(),hasFiles:I().default(!1),hasSessions:I().default(!1)}),$c=R({memberId:V,displayName:N(),siteRole:z([`admin`,`member`])}),el=$c.extend({workspaceId:V}),tl=R({id:V}).strict(),nl=R({expectedRevision:Lc,displayName:N().trim().max(120).optional(),enabled:I().optional()}).strict();R({operationId:Cs(),projectName:N().trim().min(1).max(120),description:N().max(2e3).default(``),workspacePath:N().trim().min(1).optional()}).strict();var rl=R({projects:L(R({projectId:V,projectName:N(),description:N()}))}),il=R({sync:qc,publicServerUrl:Kc,revision:Lc}),al=R({publicServerUrl:Kc.optional(),sync:qc.optional(),expectedRevision:Lc}).strict().refine(e=>e.publicServerUrl!==void 0||e.sync!==void 0,`Provide a setting to update.`),ol=R({id:V,displayName:N(),siteRole:z([`admin`,`member`]),enabled:I(),revision:Lc}),sl=R({id:V,displayName:N().trim().max(120).default(``),siteRole:z([`admin`,`member`]).default(`member`)}).strict(),cl=R({expectedRevision:Lc,displayName:N().trim().max(120).optional(),enabled:I().optional(),siteRole:z([`admin`,`member`]).optional()}).strict(),H={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 ll(e){let t=e.replace(/\s+/g,` `).trim()||`未命名对话`,n=Array.from(t);return n.length>56?n.slice(0,56).join(``)+`…`:t}var ul=class extends Error{code;status;constructor(e,t,n){super(H.errors[e]??t),this.code=e,this.status=n}},dl;async function U(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=dl!==void 0&&dl!==a;dl=a,e&&window.dispatchEvent(new Event(`teammy:data-reset`))}let o=await i.json().catch(()=>{throw new ul(`INVALID_RESPONSE`,``,i.status)});if(o?.Response?.Error)throw new ul(`GATEWAY_ERROR`,``,i.status);if(!i.ok){let e=new ul(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 ul(`INVALID_RESPONSE`,``,i.status);return s.data}var fl={clientLatest:e=>U(`client/latest`,R({version:N().min(1)}),{signal:e}),server:e=>U(`server`,R({version:N()}),{signal:e}),projects:e=>U(`projects`,rl,{signal:e}),setup:e=>U(`setup`,Xc,{signal:e}),session:e=>U(`web/session`,$c,{signal:e}),login:e=>U(`web/session`,$c,{method:`POST`,body:{id:e}}),logout:()=>U(`web/session`,R({ok:I()}),{method:`DELETE`})};function pl(e){return{config:t=>e(`project/config`,Jc,{signal:t}),members:t=>e(`web/members`,R({members:L(Qc)}),{signal:t}),file:(t,n,r,i)=>e(`files/${encodeURIComponent(t)}/entry?${new URLSearchParams({path:n,...r===void 0?{}:{revision:String(r)}})}`,Gc,{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)}})}`,Wc,{signal:a})}}function W(e){return e instanceof j?H.errors.INVALID_REQUEST:e instanceof Error?e.message:String(e)}function ml(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function hl(){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 gl(e,t,n){let r=await fetch(d(`${n}/blobs/${e.sha256}`),{signal:AbortSignal.any([t,AbortSignal.timeout(Fc)])});if(!r.ok)throw r.status===401&&window.dispatchEvent(new Event(`teammy:logout`)),new ul(`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(H.previewUnavailable)}if(a.includes(`\0`))throw Error(H.previewUnavailable);return a}var _l=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})),vl=o(((e,t)=>{t.exports=_l()})),G=vl(),yl=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)}},bl=(0,B.createContext)(void 0);function xl({children:e}){let[{cache:t,generation:n},r]=(0,B.useState)(()=>({cache:new yl,generation:0}));return(0,B.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 yl,generation:e.generation+1}))};return window.addEventListener(`teammy:data-reset`,e),()=>window.removeEventListener(`teammy:data-reset`,e)},[]),(0,G.jsx)(bl.Provider,{value:t,children:(0,G.jsx)(B.Fragment,{children:e},n)})}var Sl=()=>(0,B.useContext)(bl),Cl=(...e)=>JSON.stringify(e);function K(e,t=!1,n){let r=Sl(),i=n??e,a=()=>n?r?.get(n):void 0,[o,s]=(0,B.useState)(()=>({source:i,data:a(),error:``,loading:!0})),c=o.source===i?o:{source:i,data:a(),error:``,loading:!0},l=(0,B.useRef)(null),u=(0,B.useRef)(0),d=(0,B.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 ul&&[401,403,404].includes(e.status);t&&n&&r?.delete(n),s(n=>({...n,data:t?void 0:n.data,error:W(e)}))}}finally{o===u.current&&(s(e=>({...e,loading:!1})),l.current=null)}},[e,n,r]);return(0,B.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 wl(){let[e]=(0,B.useState)(()=>new AbortController);return(0,B.useEffect)(()=>()=>e.abort(),[e]),e.signal}async function Tl(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 El=new URL(`teammy-wordmark-ZFwxG0yl.png`,import.meta.url).href,Dl=new URL(`teammy-mark-CxBtF1-X.png`,import.meta.url).href,Ol=new URL(`teammy-calm-DVuoOK0F.png`,import.meta.url).href,kl=new URL(`teammy-wave-CVTgecuC.png`,import.meta.url).href,Al=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function jl(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:Al(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Ml=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},Nl=e=>{let t=Ml(e);return t.charAt(0).toUpperCase()+t.slice(1)},Pl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Fl={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 Il(e){return e!=null}function Ll(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??Fl.width,a=e.size??e.height??Fl.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?Pl(...c):Pl(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??Fl[`stroke-width`])*Number(e.size??e.width??Fl.width)/Number(t.size??t.width??Fl.width):t.strokeWidth??Fl[`stroke-width`];return[`svg`,{...Object.entries(Fl).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Il(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Il(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Il(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 Rl(e,t={}){return Ll(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var zl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Bl=(0,B.createContext)({}),Vl=()=>(0,B.useContext)(Bl),Hl=(0,B.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=``}=Vl()??{},y=!!c||zl(d),[b,ee,te=[]]=Rl(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Pl(v,s),hasA11yProp:y,attributes:d});return(0,B.createElement)(b,{ref:f,...ee},[...te.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function q(e,t=[],n=[]){let r=typeof e==`string`?jl(e,t,n):e,i=(0,B.forwardRef)(({className:e,...t},n)=>(0,B.createElement)(Hl,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Nl(r.name)),i}var Ul={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`}]]};Ul.node;var Wl=q(Ul),Gl={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Gl.node;var Kl=q(Gl),ql={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`}]]};ql.node;var Jl=q(ql),Yl={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`}]]};Yl.node;var Xl=q(Yl),Zl={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};Zl.node;var Ql=q(Zl),$l={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};$l.node;var eu=q($l),tu={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};tu.node;var nu=q(tu),ru={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ru.node;var iu=q(ru),au={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};au.node;var ou=q(au),su={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`]};su.node;var cu=q(su),lu={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};lu.node;var uu=q(lu),du={name:`clock-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]};du.node;var fu=q(du),pu={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`]};pu.node;var mu=q(pu),hu={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`}]]};hu.node;var gu=q(hu),_u={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`}]]};_u.node;var vu=q(_u),yu={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`}]]};yu.node;var bu=q(yu),xu={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`}]]};xu.node;var Su=q(xu),Cu={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`}]]};Cu.node;var wu=q(Cu),Tu={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`}]]};Tu.node;var Eu=q(Tu),Du={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`]};Du.node;var Ou=q(Du),ku={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`}]]};ku.node;var Au=q(ku),ju={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`}]]};ju.node;var Mu=q(ju),Nu={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`}]]};Nu.node;var Pu=q(Nu),Fu={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`}]]};Fu.node;var Iu=q(Fu),Lu={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Lu.node;var Ru=q(Lu),zu={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};zu.node;var Bu=q(zu),Vu={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`}]]};Vu.node;var Hu=q(Vu),Uu={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`}]]};Uu.node;var Wu=q(Uu),Gu={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`}]]};Gu.node;var Ku=q(Gu),qu={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`}]]};qu.node;var Ju=q(qu),Yu={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`}]]};Yu.node;var Xu=q(Yu),Zu={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Zu.node;var J=q(Zu),Qu={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`}]]};Qu.node;var Y=q(Qu),X={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`}]]};X.node;var $u=q(X),ed={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};ed.node;var td=q(ed),nd={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`}]]};nd.node;var rd=q(nd),id={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`}]]};id.node;var ad=q(id),od={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`}]]};od.node;var sd=q(od),cd={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`}]]};cd.node;var ld=q(cd),ud={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};ud.node;var dd=q(ud),fd={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`}]]};fd.node;var pd=q(fd),md={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};md.node;var hd=q(md),gd={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};gd.node;var _d=q(gd),vd={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`}]]};vd.node;var yd=q(vd),bd={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`}]]};bd.node;var xd=q(bd),Sd={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`]};Sd.node;var Cd=q(Sd),wd={name:`square-slash`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]],aliases:[`slash-square`]};wd.node;var Td=q(wd),Ed={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Ed.node;var Dd=q(Ed),Od={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`]};Od.node;var kd=q(Od),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 jd=q(Ad),Md={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`]};Md.node;var Nd=q(Md),Pd={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`]};Pd.node;var Fd=q(Pd),Id={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`}]]};Id.node;var Ld=q(Id),Rd={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Rd.node;var zd=q(Rd);function Bd({compact:e=!1}){return(0,G.jsx)(`div`,{className:`brand ${e?`brand-compact`:``}`,children:(0,G.jsx)(`img`,{src:e?Dl:El,alt:`Teammy`})})}function Vd({pose:e=`calm`}){return(0,G.jsx)(`img`,{className:`mascot mascot-${e}`,src:e===`wave`?kl:Ol,alt:``,"aria-hidden":`true`})}function Hd({name:e,small:t=!1}){return(0,G.jsx)(`span`,{className:`avatar ${t?`small`:``}`,"aria-hidden":`true`,children:Array.from(e)[0]?.toUpperCase()})}function Ud({children:e}){return(0,G.jsx)(`span`,{className:`count`,children:e})}function Wd({title:e,description:t,icon:n,mascot:r=!1,children:i}){return(0,G.jsxs)(`div`,{className:`empty-state`,children:[r?(0,G.jsx)(Vd,{}):n?(0,G.jsx)($d,{name:n}):null,(0,G.jsx)(`h3`,{children:e}),t&&(0,G.jsx)(`p`,{children:t}),i]})}function Gd({title:e,count:t,children:n}){return(0,G.jsxs)(`div`,{className:`section-heading`,children:[(0,G.jsxs)(`h2`,{children:[e,t!==void 0&&(0,G.jsx)(Ud,{children:t})]}),n]})}function Kd({label:e,children:t}){return(0,G.jsx)(`div`,{className:`toolbar-actions`,role:`group`,"aria-label":e,children:t})}function Z({children:e,error:t=!1}){return e?(0,G.jsx)(`div`,{"data-testid":`notice`,"data-kind":t?`error`:`info`,className:`notice ${t?`error`:``}`,role:t?`alert`:`status`,children:e}):null}function Q({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,G.jsxs)(`label`,{className:`field`,htmlFor:e,children:[(0,G.jsx)(`span`,{id:`${e}-label`,children:n}),(0,B.cloneElement)(i,{id:e,name:t??i.props.name??e,"data-testid":e,"aria-labelledby":`${e}-label`,"aria-describedby":a}),r&&(0,G.jsx)(`small`,{id:`${e}-hint`,children:r})]})}function qd({title:e,description:t,children:n}){return(0,G.jsxs)(`header`,{className:`page-header`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{children:e}),t&&(0,G.jsx)(`p`,{children:t})]}),n]})}function Jd({id:e,title:t,children:n,onClose:r}){let i=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=document.activeElement;return i.current?.showModal(),()=>{i.current?.close(),e?.focus()}},[]),(0,G.jsx)(`dialog`,{id:e,"data-testid":e,"aria-labelledby":`${e}-title`,ref:i,onCancel:r,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,G.jsxs)(`div`,{className:`dialog-content`,children:[(0,G.jsxs)(`header`,{className:`dialog-header`,children:[(0,G.jsx)(`h2`,{id:`${e}-title`,children:t}),(0,G.jsx)(ef,{icon:`close`,label:H.close,"data-testid":`dialog-close`,onClick:r})]}),n]})})}function Yd({id:e,label:t,value:n}){let[r,i]=(0,B.useState)(``);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`command`,"data-testid":e,children:[(0,G.jsx)(`code`,{"data-testid":`${e}-value`,children:n}),(0,G.jsx)(ef,{icon:`copy`,"data-testid":`${e}-copy`,label:`${H.copy}${t}`,onClick:async()=>{try{await Tl(n),i(H.copied)}catch{i(H.copyFailed)}}})]}),r&&(0,G.jsx)(`small`,{"data-testid":`${e}-feedback`,role:`status`,children:r})]})}function Xd({value:e}){return e?(0,G.jsx)(`time`,{dateTime:e,children:new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}):(0,G.jsx)(`span`,{children:`—`})}var Zd={assistant:Cd,messages:Y,channels:$u,computers:rd,archive:Wl,send:Kl,dashboard:Wu,home:Bu,clock:fu,slash:Td,sessions:$u,message:Y,files:Iu,materials:Xl,memory:Ql,question:uu,folderOpen:Pu,chevronUp:ou,chevronDown:nu,members:Ld,settings:yd,help:uu,filter:Ru,compact:td,stop:Dd,restore:hd,refresh:pd,chevron:iu,file:Mu,text:kd,link:Ku,attachment:ad,imageFile:Eu,spreadsheetFile:Au,codeFile:wu,addText:Ju,addFile:Ou,download:bu,code:mu,preview:Su,sparkles:Cd,close:zd,plus:dd,edit:sd,device:rd,disable:Fd,enable:jd,reset:Hu,menu:J,logout:Xu,account:Nd,copy:gu,general:xd,connect:ld,model:vu,check:eu,search:_d,notifications:Jl,attention:cu},Qd={small:16,normal:24,navigation:38};function $d({name:e,size:t=`normal`}){let n=Zd[e];return(0,G.jsx)(n,{className:`icon`,size:Qd[t],strokeWidth:2,absoluteStrokeWidth:!0,"aria-hidden":`true`})}function ef({label:e,icon:t,tooltip:n=t!==`refresh`,className:r=``,variant:i=`ghost`,...a}){return(0,G.jsx)(`button`,{type:`button`,...a,className:`icon-button ${i===`primary`?`primary`:``} ${r}`,"aria-label":e,"data-tooltip":n?e:void 0,children:(0,G.jsx)($d,{name:t})})}var tf=z([`planned`,`in_progress`,`in_review`,`completed`]).describe(`planned:计划;in_progress:进行中;in_review:任务成果已提交,等待验收或最终确认;completed:整体完成。前置审批或方案决策按是否已开展工作归入 planned 或 in_progress,按任务自身目标判断成果边界。`),nf=R({title:N().trim(),goal:N().trim().nullable(),status:tf.nullable(),progress:N().trim(),needsConfirmation:I().default(!1)}).strict(),rf=R({kind:z([`workspace`,`material`]).optional(),materialId:N().regex(/^R\d{6,}$/).optional(),path:Rc,sha256:Ic,revision:Lc,syncedAt:N()}),af=nf.extend({id:Cs(),owner:V,jobId:Cs().nullable(),revision:Lc.default(1),origin:z([`workspace`,`confirmed`]).default(`workspace`),sources:L(rf),syncedAt:N().nullable(),statusSince:N()});R({expectedRevision:Lc.optional(),title:nf.shape.title.optional(),status:tf.nullable().optional(),goal:nf.shape.goal.optional(),progress:nf.shape.progress.optional(),needsConfirmation:I().optional()}).strict().refine(e=>Object.keys(e).some(e=>e!==`expectedRevision`),`Provide a correction.`);var of=R({tasks:L(af),members:L(R({owner:V,jobId:Cs().nullable(),status:z([`empty`,`waiting`,`queued`,`running`,`succeeded`,`failed`,`cancelled`]),error:N().nullable(),sourceChanged:I(),uncertainties:L(N())})),modelAvailable:I()}),sf=R({id:V,name:N().trim().min(1).max(120),protocol:z([`openai-completions`,`openai-responses`,`anthropic-messages`]),baseUrl:Kc,model:N().trim().min(1).max(200),enabled:I().default(!0)}).strict(),cf=sf.safeExtend({revision:F().int(),keyConfigured:I()}),lf=R({expectedRevision:F().int().nonnegative(),profile:sf,apiKey:N().min(1).max(4096).nullable().optional()}).strict(),uf=R({profiles:L(cf)});R({expectedRevision:F().int().nonnegative(),profileId:V.nullable()}).strict();var df=R({revision:F().int().nonnegative(),profileId:V.nullable(),effectiveProfileId:V.nullable(),source:z([`site`,`project`,`none`]),available:I()}),ff=R({mode:z([`text`,`tools`,`json`])}).strict(),pf=R({ok:sc(!0),mode:ff.shape.mode,streamed:I(),inputTokens:F(),outputTokens:F()}),mf=R({owner:V,kind:z([`file`,`directory`]),path:Qs([sc(``),Rc]),revision:F().int().nonnegative().optional()}).strict().refine(e=>e.kind===`directory`||e.path!==``,`A file path is required.`),hf=R({operationId:Cs(),profileId:V.optional(),workflow:z([`file-summary`,`directory-analysis`,`task-bootstrap`]),selection:mf,question:N().trim().default(``)}).strict(),gf=R({path:Rc,startLine:F().int().positive(),endLine:F().int().positive(),sha256:Ic}),_f=R({totalFiles:F().int(),readFiles:L(Rc),accessTracking:sc(`unavailable`).optional(),limitations:L(N())}),vf=Qs([R({summary:N(),findings:L(N()),uncertainties:L(N()).default([]),citations:L(gf),coverage:_f}),R({kind:sc(`task-bootstrap`),updateMode:sc(`patch`).optional(),archive:L(Cs()).optional(),tasks:L(nf.extend({taskId:Cs().nullable().optional(),sources:L(rf)})),uncertainties:L(N()).optional(),coverage:_f})]),yf=R({inputTokens:F().nonnegative(),outputTokens:F().nonnegative()}),bf=R({id:Cs(),requester:V,workflow:hf.shape.workflow,question:N(),profileId:V,model:N(),profileRevision:F().int(),promptVersion:N(),origin:z([`manual`,`automatic`]).default(`manual`),status:z([`queued`,`running`,`succeeded`,`failed`,`cancelled`]),createdAt:N(),updatedAt:N(),attemptCount:F().int(),error:N().nullable(),input:R({owner:V,kind:z([`file`,`directory`]),path:N(),revision:F().int(),fileCount:F().int(),fingerprint:Ic}),result:vf.nullable(),sourceChanged:I()});R({jobs:L(bf),nextCursor:N().nullable()}),R({events:L(R({seq:F().int(),attempt:F().int(),kind:N(),message:N(),createdAt:N()})),nextCursor:F().int()}),R({job:bf,attempts:L(R({number:F().int(),status:N(),startedAt:N(),endedAt:N().nullable(),error:N().nullable(),usage:yf.nullable()}))});var xf=R({state:z([`unknown`,`online`,`offline`]),lastSeenAt:N().nullable()}),Sf=R({state:z([`unconfigured`,`pending`,`cloning`,`fetching`,`ready`,`failed`,`interrupted`]),lastSuccessAt:N().nullable()}),Cf=R({worker:xf.shape.state,modelAvailable:I(),activities:L(R({kind:z([`repository`,`import`,`tasks`,`sessions`,`materials`,`project`,`chat`]),state:z([`queued`,`running`,`failed`]),count:F().int().positive()}))}),wf=R({state:z([`unknown`,`ready`,`failed`]),mode:z([`full`,`none`])}),Tf=R({adminId:N(),publicServerUrl:N(),model:sf.nullable(),modelKeyConfigured:I(),projectName:N(),repositoryUrl:N(),initialProjectId:N().nullable(),runtime:R({storage:sc(`ready`),worker:xf,sandbox:wf})});lf.extend({usePresetKey:I().default(!1)});function Ef({options:e,onDone:t}){let[n,r]=(0,B.useState)(e?.model??{id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:``,model:``,enabled:!0}),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``),m=!o||[`protocol`,`baseUrl`,`model`].some(e=>n[e]!==o[e])||!!i;return(0,G.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-model-form`,onSubmit:async t=>{t.preventDefault(),l(!0),d(``),p(``);try{let t=await U(`setup/model`,cf,{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(W(e))}finally{l(!1)}},children:[(0,G.jsx)(`h1`,{children:`连接模型`}),(0,G.jsx)(`p`,{children:`可稍后在设置中配置。`}),(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,G.jsx)(Q,{id:`setup-model-protocol`,label:`协议`,children:(0,G.jsxs)(`select`,{value:n.protocol,onChange:e=>r({...n,protocol:e.target.value}),children:[(0,G.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,G.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,G.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,G.jsx)(Q,{id:`setup-model-url`,label:`接入地址`,children:(0,G.jsx)(`input`,{required:!0,type:`url`,placeholder:`https://gateway.example/v1`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})}),(0,G.jsx)(Q,{id:`setup-model-id`,label:`模型 ID`,children:(0,G.jsx)(`input`,{required:!0,value:n.model,onChange:e=>r({...n,model:e.target.value})})}),(0,G.jsx)(Q,{id:`setup-model-key`,label:`API 密钥`,hint:o?.keyConfigured?`已保存;留空保留。`:e?.modelKeyConfigured?`部署已提供密钥;更换接入地址时请重新填写。`:`无需密钥的网关可以留空。`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:i,onChange:e=>a(e.target.value)})})]}),(0,G.jsx)(Z,{error:!0,children:u}),(0,G.jsx)(Z,{children:f}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{className:`primary`,disabled:c,"data-testid":`setup-model-save`,children:`保存`}),(0,G.jsx)(`button`,{type:`button`,disabled:c||m,onClick:async()=>{l(!0),d(``),p(``);try{await U(`ai/profiles/${n.id}/test`,pf,{method:`POST`,body:{mode:`text`},timeoutMs:305e3}),p(`连接测试通过。`)}catch(e){d(W(e))}finally{l(!1)}},children:`测试连接`})]}),(0,G.jsx)(`button`,{type:`button`,disabled:c,"data-testid":`setup-finish`,onClick:t,children:o?`进入工作台`:`暂时跳过`})]})}function Df({children:e}){return(0,G.jsxs)(`div`,{className:`access`,children:[(0,G.jsxs)(`aside`,{className:`access-aside`,children:[(0,G.jsx)(Bd,{}),(0,G.jsx)(`div`,{className:`access-art`,children:(0,G.jsx)(Vd,{pose:`wave`})}),(0,G.jsx)(`div`,{className:`access-copy`,children:(0,G.jsx)(`h2`,{children:`工作有条理,团队用 Teammy`})})]}),(0,G.jsx)(`main`,{className:`access-main`,children:e})]})}function Of({onLogin:e}){let[t,n]=(0,B.useState)(``),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1);async function s(n){n.preventDefault(),o(!0),i(``);try{e(await fl.login(t.trim()))}catch(e){i(W(e))}finally{o(!1)}}return(0,G.jsx)(Df,{children:(0,G.jsxs)(`form`,{className:`access-form`,"data-testid":`login-form`,"aria-label":H.loginTitle,"aria-busy":a,onSubmit:s,children:[(0,G.jsx)(`h1`,{children:H.loginTitle}),(0,G.jsx)(`p`,{children:H.loginHint}),(0,G.jsx)(Q,{id:`login-member-id`,name:`memberId`,label:H.memberId,children:(0,G.jsx)(`input`,{autoFocus:!0,autoComplete:`username`,required:!0,maxLength:64,value:t,onChange:e=>n(e.target.value),placeholder:`caffei`})}),(0,G.jsx)(Z,{error:!0,children:r}),(0,G.jsx)(`button`,{"data-testid":`login-submit`,className:`primary wide`,disabled:a,children:a?H.loading:H.login})]})})}var kf=`teammy:site-setup-draft-v2`,Af=e=>U(`setup/options`,Tf,{signal:e});function jf(){try{let e=JSON.parse(sessionStorage.getItem(kf)??`null`);if(typeof e?.operationId==`string`&&typeof e?.adminId==`string`)return{operationId:e.operationId,adminId:e.adminId,publicServerUrl:p()}}catch{}return{operationId:hl(),adminId:``,publicServerUrl:p()}}function Mf({onDone:e}){let[t,n]=(0,B.useState)(jf),r=K(Af,5e3),i=(0,B.useRef)(!1),[a,o]=(0,B.useState)();(0,B.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,B.useState)(``),[l,u]=(0,B.useState)(!1);(0,B.useEffect)(()=>{try{sessionStorage.setItem(kf,JSON.stringify(t))}catch{}},[t]);async function d(e){e.preventDefault(),c(``),u(!0);try{let e=await U(`setup`,$c,{method:`POST`,body:Yc.parse({...t,adminId:t.adminId.trim(),publicServerUrl:t.publicServerUrl})});try{sessionStorage.removeItem(kf)}catch{}o(e)}catch(e){c(W(e))}finally{u(!1)}}return a?(0,G.jsx)(Df,{children:(0,G.jsx)(Ef,{options:r.data,onDone:()=>e(a)})}):(0,G.jsx)(Df,{children:(0,G.jsxs)(`form`,{className:`access-form`,"data-testid":`setup-form`,"aria-label":`创建管理员`,"aria-busy":l,onSubmit:d,children:[(0,G.jsx)(`h1`,{children:`欢迎使用 Teammy`}),(0,G.jsx)(`p`,{children:`创建管理员,开始管理项目与成员。`}),(0,G.jsx)(Q,{id:`setup-admin-id`,name:`adminId`,label:H.adminId,hint:H.idHint,children:(0,G.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,G.jsxs)(`div`,{className:`setup-runtime`,role:`status`,children:[(0,G.jsx)(`span`,{children:`存储已连接`}),(0,G.jsx)(`span`,{children:r.data.runtime.worker.state===`online`?`后台运行中`:`后台尚未就绪`}),(0,G.jsx)(`span`,{children:{ready:`隔离环境可用`,failed:`隔离环境检查失败`,unknown:`隔离环境检查中`}[r.data.runtime.sandbox.state]})]}),(0,G.jsx)(Z,{error:!0,children:s||r.error}),(0,G.jsx)(`button`,{"data-testid":`setup-submit`,className:`primary wide`,disabled:l,children:l?H.saving:`创建管理员`})]})})}var Nf=N().regex(/^[a-f0-9]{64}$/);R({id:Cs(),projectId:V,deviceId:Mc,secret:Nf,label:N().min(1).max(255)}).strict(),R({id:Cs(),expiresAt:F()});var Pf=ec(`state`,[R({state:sc(`pending`)}),R({state:sc(`approved`),memberId:V})]),Ff=R({projectName:N(),label:N(),approvedBy:V.nullable(),expiresAt:F()});function If({session:e,onLogout:t}){let n=new URLSearchParams(location.search).get(`request`)??``,r=K((0,B.useCallback)(e=>U(`devices/connect/${encodeURIComponent(n)}`,Ff,{signal:e}),[n])),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),u=o||r.data?.approvedBy===e.memberId;return(0,G.jsx)(Df,{children:(0,G.jsxs)(`form`,{className:`access-form`,"data-testid":`client-connect-form`,onSubmit:async e=>{e.preventDefault(),a(!0),l(``);try{await U(`devices/connect/${encodeURIComponent(n)}/approve`,Pf,{method:`POST`}),s(!0)}catch(e){l(W(e))}finally{a(!1)}},children:[(0,G.jsx)(`h1`,{children:u?`身份已确认`:`连接工作目录`}),r.data&&(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`strong`,{children:r.data.projectName}),(0,G.jsx)(`br`,{}),r.data.label]}),u?(0,G.jsx)(`p`,{role:`status`,children:`请返回终端继续连接。`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`使用 `,(0,G.jsx)(`strong`,{children:e.displayName||e.memberId}),e.displayName&&e.displayName!==e.memberId?`(${e.memberId})`:` `,`连接此项目。`]}),(0,G.jsx)(Z,{error:!0,children:c||r.error}),r.loading&&!r.data&&(0,G.jsx)(`p`,{role:`status`,children:`加载中…`}),(0,G.jsx)(`button`,{className:`primary wide`,disabled:i||!r.data||!!r.error,"data-testid":`client-connect-approve`,children:i?`正在确认…`:`确认连接`}),(0,G.jsx)(`button`,{type:`button`,className:`wide`,disabled:i,onClick:async()=>{try{await fl.logout(),t()}catch(e){l(W(e))}},children:`更换用户`})]})]})})}var Lf=R({model:N().min(1).nullable().default(null),effort:N().min(1).nullable().default(null),permission:z([`read-only`,`workspace-write`,`full-access`]).default(`workspace-write`)}),Rf=R({id:N(),directory:N(),member:N(),title:N(),revision:F().int(),config:Lf,archived:I(),bound:I(),bindingRevision:F().int(),replyContext:N(),state:N(),error:N().nullable(),appliedRevision:F().int().nullable(),effectiveConfig:Lf.nullable(),cwd:N().nullable(),executionDirectory:N().nullable().default(null),createdAt:N(),updatedAt:N(),unread:I()}),zf=z([`compact`,`stop`,`archive`,`restore`,`goal`]);R({id:Cs(),kind:zf,argument:N().trim().default(``)});var Bf=R({name:N(),description:N(),kind:z([`command`,`skill`]),path:N().optional()}),$=R({directory:N(),cwd:N(),commands:L(Bf),error:N().nullable()}),Vf=R({id:Cs(),session:N(),kind:zf,argument:N().default(``),inputId:N().nullable().default(null),state:z([`queued`,`running`,`succeeded`,`failed`,`uncertain`]),error:N().nullable()}),Hf=R({id:N(),state:z([`idle`,`working`,`waiting`,`queued`,`uncertain`]),appliedRevision:F().int().nullable(),effectiveConfig:Lf.nullable(),cwd:N(),error:N().nullable()}),Uf=R({id:N(),name:N(),efforts:L(N()),defaultEffort:N().nullable(),isDefault:I().default(!1)}),Wf=R({answers:ic(N(),N()).default({}),decision:I().optional(),inputId:N().optional()}),Gf=R({id:N(),seq:F().int(),role:z([`user`,`assistant`,`system`]),body:N(),source:N(),state:N(),createdAt:N(),question:R({id:N(),code:N(),state:N(),approval:I(),response:Wf.nullable().default(null),submissionState:N().nullable().default(null),questions:L(R({id:N(),text:N(),options:L(N()),freeText:I()}))}).nullable()}),Kf=R({cursor:F().int(),session:Rf,messages:L(Gf),commands:L(Vf)}),qf=N().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/),Jf=e=>N().trim().min(1).max(e),Yf=R({opened:I().default(!1),allowedMembers:L(V).nullable(),accessible:I(),enabled:I(),revision:F().int().nonnegative()});R({opened:I().optional(),allowedMembers:L(V).nullable().optional(),enabled:I().optional(),expectedRevision:F().int().nonnegative()}).strict();var Xf=N().regex(/^\[[A-F0-9]{8}\]$/),Zf=R({name:Jf(80),responsibilities:N().trim().max(2e3).default(``),expectedRevision:F().int().nonnegative(),enabled:I(),provider:sc(`codex`)}).strict().omit({expectedRevision:!0}).extend({id:qf,member:V,revision:F().int().positive(),bindingRevision:F().int().nonnegative(),bound:I(),replyContext:qf.nullable(),available:I(),reason:N().nullable(),defaultSession:N().optional(),defaults:Lf.optional()});R({instance:Cs(),syncEnabled:I(),taskRoot:N().optional(),syncRootValid:I().default(!0),capabilities:L(N()).optional(),computer:R({id:N(),name:N(),platform:N()}).optional(),models:L(Uf).optional(),catalogs:L($).optional(),sessions:L(Hf).optional(),directories:L(R({id:qf,ready:I(),reason:Jf(500).nullable()}).strict()).max(100)}).strict();var Qf=z([`work.requested`,`work.revised`,`local.query`,`task.conflict`,`mr.review`,`background.notice`,`directory.message`]),$f=z([`query`,`record_only`,`execute`]),ep=R({originalText:Jf(24e3),brief:Jf(8e3),intent:$f,constraints:L(Jf(1e3)).max(30).default([])}).strict();R({id:qf,sequence:F().int().positive(),member:V,kind:Qf,source:R({type:Jf(80),ref:Jf(500)}).strict(),work:R({ref:qf,revision:F().int().positive()}).strict().nullable(),content:ep,target:R({consumer:z([`coordinator`,`directory`,`question`]),directory:qf.nullable(),session:qf.optional(),bindingRevision:F().int().nonnegative()}).strict(),replyContext:qf.nullable(),skills:L(R({name:N(),path:N()})).optional(),interaction:R({question:qf,action:sc(`answer`),decision:I().optional()}).optional(),fingerprint:N().length(64),quote:R({text:Jf(24e3)}).strict().optional(),state:z([`offered`,`accepted`,`human_routed`]),acceptedInstance:Cs().nullable(),readAt:N().nullable().default(null),expiresAt:F().int(),reason:N().nullable()}),R({instance:Cs(),fingerprint:N().length(64)}).strict(),R({instance:Cs(),directory:qf,bindingRevision:F().int().nonnegative()}).strict();var tp=R({id:qf,session:qf,code:Xf,approval:I().optional(),questions:L(R({id:Jf(200),text:Jf(2e3),options:L(Jf(500)).max(20),freeText:I()}).strict()).min(1).max(10)}).strict();R({operationId:Cs(),replyContext:qf,body:Jf(24e3),inputId:qf.optional(),inputIds:L(qf).optional(),question:tp.optional(),final:I().optional()}).strict(),R({operationId:Cs(),state:z([`pending`,`sent`,`cancelled`,`failed`]),question:R({state:z([`pending`,`answered`,`expired`,`uncertain`]),replyReceived:I()}).optional()}),R({state:z([`answered`,`expired`,`uncertain`]),response:Wf.optional()}).strict(),R({workRef:qf,inputId:qf,path:Rc,sha256:N().regex(/^[a-f0-9]{64}$/)}).strict(),R({}).strict(),R({member:V,text:Jf(24e3),intent:$f,directory:qf.optional().describe(`已明确的目录 ID;省略时由本地协调者选择。`)}).strict(),R({member:V.optional(),directory:N().optional().describe(`目录 ID 或名称;省略时查询可见的全部目录。`),before:F().int().positive().optional(),limit:F().int().positive().max(100).default(20)}).strict();function np(e){let t=`projects/${encodeURIComponent(e)}`,n=(e,n,r)=>U(`${t}/${e}`,n,r);return{projectId:e,request:n,api:pl(n),blobUrl:e=>d(`/api/v1/${t}/blobs/${e}`),readTextBlob:(e,n)=>gl(e,n,`/api/v1/${t}`)}}var rp=(0,B.createContext)(null);function ip(){let e=(0,B.useContext)(rp);if(!e)throw Error(`Project context is required.`);return e}function ap({members:e,memberId:t,admin:n}){let{request:r,projectId:i}=ip(),a=K((0,B.useCallback)(e=>r(`web/local-agent-settings`,Yf,{signal:e}),[r])),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(!1),[u,f]=(0,B.useState)(``),p=a.data,m=o??{scope:p?.opened?p.allowedMembers===null?`all`:`members`:`closed`,members:p?.allowedMembers??[t],revision:p?.revision??0};async function h(){if(o&&!c){l(!0),f(``);try{await r(`web/local-agent-settings`,Yf,{method:`PUT`,body:{opened:o.scope!==`closed`,allowedMembers:o.scope===`all`?null:o.members,expectedRevision:o.revision}}),await a.reload(),s(void 0),window.dispatchEvent(new Event(`teammy:local-access`))}catch(e){f(W(e))}finally{l(!1)}}}return(0,G.jsxs)(`div`,{className:`settings-section stack`,children:[(0,G.jsx)(`h2`,{children:`本地 Agent`}),n&&p&&(0,G.jsxs)(`fieldset`,{disabled:c,className:`stack`,children:[(0,G.jsx)(Q,{id:`local-agent-access-scope`,label:`开放范围`,children:(0,G.jsxs)(`select`,{value:m.scope,onChange:e=>s({...m,scope:e.target.value}),children:[(0,G.jsx)(`option`,{value:`closed`,children:`关闭`}),(0,G.jsx)(`option`,{value:`members`,children:`指定成员`}),(0,G.jsx)(`option`,{value:`all`,children:`全体成员`})]})}),m.scope===`members`&&(0,G.jsx)(`div`,{className:`local-agent-members`,role:`group`,"aria-label":`开放成员`,children:e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,G.jsxs)(`label`,{className:`check-label`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:m.members.includes(e.id),onChange:t=>s({...m,members:t.target.checked?[...m.members,e.id]:m.members.filter(t=>t!==e.id)})}),e.displayName||e.id]},e.id))}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:!o,onClick:()=>void h(),children:`保存开放范围`})})]}),p?.accessible?(0,G.jsx)(`a`,{href:d(`/projects/${i}/computers`),children:`打开电脑,管理目录与会话`}):(0,G.jsx)(`p`,{children:`本项目暂未向你开放本地 Agent;文件同步与会话采集不受影响。`}),(0,G.jsx)(Z,{error:!0,children:u||a.error})]})}var op=R({enabled:I()});function sp(){let{request:e}=ip(),[t,n]=(0,B.useState)(),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(``);(0,B.useEffect)(()=>{let t=new AbortController;return e(`web/session-library`,op,{signal:t.signal}).then(e=>n(e.enabled)).catch(e=>{t.signal.aborted||o(W(e))}),()=>t.abort()},[e]);async function s(r){let a=t;n(r),i(!0),o(``);try{let t=await e(`web/session-library`,op,{method:`PUT`,body:{enabled:r}});n(t.enabled)}catch(e){n(a),o(W(e))}finally{i(!1)}}return(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsxs)(`label`,{className:`check-field`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t??!0,disabled:t===void 0||r,onChange:e=>void s(e.target.checked)}),`自动更新会话库`]}),(0,G.jsx)(`p`,{className:`muted`,children:`关闭后,将暂停你的新会话到会话库展示。`}),(0,G.jsx)(Z,{error:!0,children:a})]})}function cp(){let[e]=(0,B.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,G.jsxs)(`svg`,{className:`selection-mark`,style:e,viewBox:`0 0 240 56`,preserveAspectRatio:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,G.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,G.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 lp(e){return e[`aria-selected`]===!0||e[`aria-selected`]===`true`||e[`aria-current`]===`page`||e[`aria-pressed`]===!0||e[`aria-pressed`]===`true`}function up({children:e,selected:t,variant:n=`hand-drawn`}){return(0,G.jsxs)(`span`,{className:`selection-content`,children:[t&&n===`hand-drawn`&&(0,G.jsx)(cp,{}),(0,G.jsx)(`span`,{className:`selection-inner`,children:e})]})}function dp({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,G.jsxs)(`button`,{type:`button`,...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":lp(i)||void 0,children:[n,(0,G.jsx)(up,{selected:lp(i),variant:r,children:e})]})}function fp({children:e,className:t=``,leading:n,variant:r=`hand-drawn`,...i}){return(0,G.jsxs)(`a`,{...i,className:`selection-item ${t}`,"data-selection-variant":r,"data-selected":lp(i)||void 0,children:[n,(0,G.jsx)(up,{selected:lp(i),variant:r,children:e})]})}function pp({prefix:e,tabs:t,selected:n,onSelect:r,orientation:i=`vertical`}){return(0,G.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,G.jsxs)(dp,{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,G.jsx)($d,{name:t.icon}),(0,G.jsx)(`span`,{children:t.title})]},t.id))})}function mp({action:e,onClose:t,onSaved:n}){let{request:r}=ip(),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(e.kind===`add`?``:e.member.displayName),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=e.kind===`add`?H.addMember:e.kind===`name`?H.editName:e.kind===`disconnect`?`解除文件夹绑定`:`退出项目`;return(0,G.jsx)(Jd,{id:`member-dialog`,title:f,onClose:c?()=>{}:t,children:(0,G.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`,Qc,{method:`POST`,body:tl.parse({id:i})}):e.kind===`leave`?await r(`membership`,R({ok:I()}),{method:`DELETE`}):e.kind===`disconnect`?await r(`web/members/${e.member.id}/device-reset`,R({ok:I()}),{method:`POST`,body:{expectedRevision:e.member.revision}}):await r(`web/members/${e.member.id}`,Qc,{method:`PATCH`,body:nl.parse({expectedRevision:e.member.revision,displayName:o})}),await n()}catch(e){d(W(e))}finally{l(!1)}},children:[e.kind===`add`&&(0,G.jsx)(Q,{id:`member-id`,name:`memberId`,label:H.memberId,hint:H.idHint,children:(0,G.jsx)(`input`,{autoFocus:!0,required:!0,maxLength:64,value:i,onChange:e=>a(e.target.value),disabled:c})}),e.kind===`name`&&(0,G.jsx)(Q,{id:`member-display-name`,name:`displayName`,label:H.displayName,hint:`仅用于当前项目。`,children:(0,G.jsx)(`input`,{autoFocus:!0,maxLength:120,value:o,onChange:e=>s(e.target.value),disabled:c})}),e.kind===`leave`&&(0,G.jsx)(`p`,{children:`退出后停止同步该项目,已经共享的资料会保留。`}),e.kind===`disconnect`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`解除 `,e.member.displayName||e.member.id,` `,`在本项目的客户端连接,之后可在正确目录重新执行 teammy connect。`]}),(0,G.jsx)(`p`,{className:`muted`,children:`本地文件、项目资料和历史保留。已运行的本地 Agent 不会被远程停止;请在原目录关闭同步与会话采集。`})]}),(0,G.jsx)(Z,{error:!0,children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,"data-testid":`member-cancel`,disabled:c,onClick:t,children:H.cancel}),(0,G.jsx)(`button`,{className:`primary`,"data-testid":`member-submit`,disabled:c,children:c?H.saving:e.kind===`leave`?`退出项目`:e.kind===`disconnect`?`解除绑定`:H.confirm})]})]})})}function hp({members:e,session:t,reload:n,onLeave:r}){let[i,a]=(0,B.useState)(),o=e.filter(e=>e.enabled&&e.accountEnabled);return(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(Gd,{title:`成员`,count:o.length,children:(0,G.jsxs)(Kd,{label:`成员操作`,children:[(0,G.jsx)(ef,{icon:`refresh`,label:`刷新成员`,"data-testid":`members-refresh`,onClick:n}),(0,G.jsx)(ef,{icon:`plus`,variant:`primary`,label:H.addMember,"data-testid":`member-add`,onClick:()=>a({kind:`add`})})]})}),(0,G.jsx)(`div`,{className:`member-list`,children:o.map(e=>(0,G.jsxs)(`article`,{"data-testid":`member-card`,"data-member-id":e.id,"aria-label":e.displayName,className:`member-card`,children:[(0,G.jsxs)(`div`,{className:`member-heading`,children:[(0,G.jsx)(Hd,{name:e.displayName}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:e.displayName}),(0,G.jsx)(`small`,{children:e.id})]})]}),(0,G.jsxs)(`div`,{className:`member-actions`,children:[e.bound&&(e.id===t.memberId||t.siteRole===`admin`)&&(0,G.jsx)(`button`,{onClick:()=>a({kind:`disconnect`,member:e}),children:`解除文件夹绑定`}),(0,G.jsx)(ef,{icon:`edit`,label:H.editName,"data-testid":`member-edit-name`,onClick:()=>a({kind:`name`,member:e})}),e.id===t.memberId&&(0,G.jsx)(ef,{icon:`logout`,label:`退出项目`,"data-testid":`project-leave`,onClick:()=>a({kind:`leave`,member:e})})]})]},e.id))}),i&&(0,G.jsx)(mp,{action:i,onClose:()=>a(void 0),onSaved:async()=>{i.kind===`leave`?await r():(a(void 0),n())}})]})}function gp({id:e,label:t,trigger:n,triggerId:r,className:i=``,disabled:a=!1,placement:o=`bottom`,routeKey:s,children:c,open:l,onOpenChange:u,focusFirst:d=!0}){let[f,p]=(0,B.useState)(!1),m=l??f,h=e=>{p(e),u?.(e)},g=(0,B.useRef)(null),_=(0,B.useRef)(null),v=(0,B.useRef)(!1),y=(0,B.useRef)(null),[b,ee]=(0,B.useState)();return(0,B.useLayoutEffect)(()=>{if(!m||o!==`top`)return;let e=()=>{if(!_.current||!y.current)return;let e=_.current.getBoundingClientRect(),t=y.current.getBoundingClientRect().width;ee({position:`fixed`,top:`auto`,bottom:innerHeight-e.top+8,left:Math.max(8,Math.min(e.left,innerWidth-t-8)),maxHeight:`min(var(--dropdown-max-height, 70dvh), ${Math.max(80,e.top-24)}px)`})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m,o]),(0,B.useEffect)(()=>h(!1),[s]),(0,B.useEffect)(()=>{if(!m)return;let e=g.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`);d&&e?.[v.current?e.length-1:0]?.focus();let t=e=>{g.current?.contains(e.target)||h(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[m]),(0,G.jsxs)(`div`,{className:`dropdown ${i}`,ref:g,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onKeyDown:e=>{e.key===`Escape`&&m&&(e.stopPropagation(),h(!1),_.current?.focus())},children:[(0,G.jsx)(`button`,{ref:_,type:`button`,disabled:a,className:`dropdown-trigger`,"data-testid":r,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":m,"aria-controls":e,onClick:()=>{v.current=!1,h(!m)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),v.current=e.key===`ArrowUp`,h(!0))},children:n}),m&&(0,G.jsx)(`div`,{id:e,ref:y,style:o===`top`?b:void 0,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:c(()=>{h(!1),_.current?.focus()})})]})}var _p={repository:`同步中`,import:`导入中`,tasks:`整理中`,sessions:`整理中`,materials:`整理中`,project:`分析中`,chat:`回复中`};function vp(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?_p[n[0].kind]:`处理中`}:e.modelAvailable?e.activities.some(e=>e.state===`queued`)?{state:`queued`,text:`待处理`}:{state:`idle`,text:`空闲`}:{state:`idle`,text:`待配置`}}function yp({projectId:e}){let t=K((0,B.useCallback)(t=>U(`projects/${encodeURIComponent(e)}/project/activity`,Cf,{signal:t}),[e]),3e3),n=vp(t.data,t.error);return(0,G.jsxs)(`span`,{className:`project-activity`,"data-state":n.state,"data-testid":`project-activity`,role:`status`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{className:`project-activity-dot`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`project-activity-label`,children:n.text})]})}var bp=[`dashboard`,`messages`,`channels`,`computers`,`files`,`materials`,`help`,`settings`],xp=(e,t)=>`/projects/${encodeURIComponent(e)}/${t}`,Sp={dashboard:`看板`,messages:`对话`,channels:`频道`,computers:`电脑`,files:`工作区`,materials:`资料`,help:`帮助`,settings:`设置`};function Cp({projectId:e,page:t,navigate:n}){let r=K((0,B.useCallback)(t=>e?U(`projects/${encodeURIComponent(e)}/communication/unread`,R({messages:F(),channels:F(),computers:F()}),{signal:t}):Promise.resolve({messages:0,channels:0,computers:0}),[e]),5e3),i=K((0,B.useCallback)(t=>U(`projects/${encodeURIComponent(e)}/web/local-agent-settings`,Yf,{signal:t}),[e]),3e4);(0,B.useEffect)(()=>{let e=()=>void i.reload();return window.addEventListener(`teammy:local-access`,e),()=>window.removeEventListener(`teammy:local-access`,e)},[i.reload]),(0,B.useEffect)(()=>{let e=()=>void r.reload();return window.addEventListener(`teammy:outbox`,e),()=>window.removeEventListener(`teammy:outbox`,e)},[r.reload]);function a(e,t){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))}return(0,G.jsxs)(`aside`,{id:`workspace-navigation`,className:`sidebar`,children:[e&&(0,G.jsx)(`nav`,{"aria-label":H.navigation,children:bp.filter(e=>e!==`computers`||i.data?.accessible).map(n=>(0,G.jsxs)(fp,{variant:`inverse`,href:d(xp(e,n)),"data-testid":`nav-${n}`,"aria-label":Sp[n],"aria-current":t===n||n===`materials`&&(t===`sessions`||t===`memory`)?`page`:void 0,onClick:t=>a(t,xp(e,n)),children:[(0,G.jsx)($d,{name:n,size:`navigation`}),(0,G.jsx)(`span`,{className:`navigation-label`,children:Sp[n]}),(n===`messages`||n===`channels`||n===`computers`)&&!!r.data?.[n]&&(0,G.jsx)(`span`,{className:`navigation-unread`,role:`img`,"aria-label":`${r.data[n]} 条未读消息`})]},n))}),e&&(0,G.jsx)(yp,{projectId:e},e)]})}function wp({session:e,navigate:t,onLogout:n,routeKey:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);return(0,G.jsx)(gp,{id:`account-menu`,triggerId:`account-menu-trigger`,className:`account-menu-wrap`,label:`用户菜单 · ${e.displayName}`,trigger:(0,G.jsx)(`strong`,{children:e.displayName}),routeKey:r,children:e=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{role:`menuitem`,"data-testid":`account-settings`,onClick:()=>{e(),t(`/site-settings`)},children:[(0,G.jsx)($d,{name:`settings`}),`设置`]}),(0,G.jsxs)(`button`,{role:`menuitem`,"data-testid":`logout`,disabled:i,onClick:async()=>{a(!0),s(``);try{await fl.logout(),n()}catch(e){s(W(e)),a(!1)}},children:[(0,G.jsx)($d,{name:`logout`}),`退出登录`]}),(0,G.jsx)(Z,{error:!0,children:o})]})})}function Tp({session:e,navigate:t,onLogout:n,routeKey:r,children:i}){return(0,G.jsxs)(`div`,{className:`site-page`,children:[(0,G.jsxs)(`header`,{className:`site-brand-header`,children:[(0,G.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,G.jsx)(Bd,{})}),(0,G.jsx)(wp,{session:e,navigate:t,onLogout:n,routeKey:r})]}),i]})}function Ep({title:e,navigation:t,children:n}){return(0,G.jsx)(Dp,{className:`settings-layout`,navigation:(0,G.jsxs)(`aside`,{className:`settings-navigation`,children:[(0,G.jsx)(qd,{title:e}),t]}),children:(0,G.jsx)(`div`,{className:`settings-content`,children:n})})}function Dp({navigation:e,children:t,className:n=``,...r}){return(0,G.jsxs)(`div`,{...r,className:`split-layout ${n}`,children:[e,t]})}function Op({navigation:e,label:t,reading:n=!1,children:r,className:i=``,...a}){return(0,G.jsx)(Dp,{...a,className:`file-explorer ${n?`session-explorer`:``} ${i}`,navigation:(0,G.jsx)(`aside`,{className:`file-tree-pane`,"aria-label":t,children:e}),children:r})}function kp({title:e,icon:t,count:n,children:r}){return(0,G.jsxs)(`header`,{className:`explorer-heading`,children:[(0,G.jsxs)(`h1`,{children:[t&&(0,G.jsx)($d,{name:t}),e,n!==void 0&&(0,G.jsx)(Ud,{children:n})]}),r]})}var Ap=`_project`,jp=`_resources`,Mp=e=>e===`_project`||e===`_resources`,Np=e=>/^_memory(?:\/|$)/i.test(e);Qs([V,sc(Ap),sc(jp)]);var Pp=N().max(255).refine(e=>{let t=e.endsWith(`/`),n=t?e.slice(0,-1):e;return Rc.safeParse(n).success&&!n.includes(`/`)&&!n.startsWith(`.`)&&!/^_?teammy/i.test(n)&&!Np(n)&&(t?n.startsWith(`_`):n.includes(`.`))},`Use a root file (README.md) or an underscore-prefixed directory (_template/).`),Fp=R({maintainer:V.nullable(),paths:L(Pp).max(30).refine(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length),revision:Lc}).strict();Fp.omit({revision:!0}).extend({expectedRevision:Lc}).strict();function Ip(e){return e.split(`/`).some(e=>/^\.teammy(?:[-.]|$)/i.test(e))}function Lp(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`project/shared-files`,Fp,{signal:t}),[e])),[n,r]=(0,B.useState)(``);return(0,G.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`公共资料`,children:[(0,G.jsx)(`h2`,{children:`公共资料`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.data&&(0,G.jsx)(Rp,{config:t.data,reload:async()=>{await t.reload(),r(`公共资料设置已保存`)}},t.data.revision),(0,G.jsx)(Z,{children:n})]})}function Rp({config:e,reload:t}){let{request:n}=ip(),[r,i]=(0,B.useState)(e.paths.join(`
65
65
  `)),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``);return(0,G.jsxs)(`form`,{className:`stack`,"aria-label":`公共资料设置`,onSubmit:async i=>{i.preventDefault(),o(!0),c(``);try{let i=await n(`project/shared-files`,Fp);await n(`project/shared-files`,Fp,{method:`PATCH`,body:{expectedRevision:e.revision,maintainer:i.maintainer,paths:r.split(`
66
- `).map(e=>e.trim()).filter(Boolean)}}),await t()}catch(e){c(W(e))}finally{o(!1)}},children:[(0,G.jsx)(`fieldset`,{disabled:a,className:`stack`,children:(0,G.jsx)(Q,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹,例如 README.md、_template/。所有成员均可编辑并同步,同一文件以后提交的内容为准。`,children:(0,G.jsx)(`textarea`,{rows:3,value:r,onChange:e=>i(e.target.value)})})}),(0,G.jsx)(Z,{error:!0,children:s}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:a,children:`保存公共资料设置`})})]})}R({text:N().trim().min(1),requestId:N().min(1).optional()}).strict(),R({body:N().trim().min(1),requestId:N().min(1).optional()}).strict(),R({to:L(V).min(1),body:N().trim().min(1),branch:N().trim().min(1).optional()}).strict().extend({to:Qs([sc(`debug`),L(V).min(1)])});var zp=F().int().positive().nullable(),Bp=z([`github`,`gongfeng`]),Vp={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hp=R({provider:Bp.default(`github`),repositoryUrl:N().trim().default(``),repository:N().trim().default(``),apiUrl:N().url().optional(),githubApiUrl:N().url().optional(),debugRecipient:V.nullable().default(null),contextWindow:F().int().positive().default(256e3),compactAt:F().int().positive().default(22e4),fetchIntervalSeconds:zp.default(300),idleSeconds:zp.default(1800),restartSeconds:zp.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vp[n.provider]).replace(/\/+$/,``)}));R({config:Hp,token:N().nullable().optional(),webhookSecret:N().nullable().optional(),sshPrivateKey:N().nullable().optional(),sshKnownHosts:N().nullable().optional()}).strict();var Up=R({config:Hp,tokenConfigured:I(),webhookConfigured:I(),sshConfigured:I(),sshPublicKey:N().nullable().optional(),webhookUrl:N().optional()}),Wp=R({id:N(),name:N(),url:N()}),Gp=R({id:N(),text:N(),answer:N(),author:N().nullable().optional(),source:sc(`wecom`).optional(),state:z([`queued`,`running`,`succeeded`,`failed`]),error:N().nullable(),createdAt:N()}),Kp=R({id:N(),seq:F(),runId:N().nullable(),role:z([`user`,`assistant`]),author:N(),body:N(),state:Gp.shape.state,source:N().nullable(),createdAt:N()}),qp=R({chats:L(R({id:N(),title:N(),kind:z([`matter`,`notice`,`group`]).optional(),status:z([`active`,`waiting`,`completed`]).optional(),unread:I().optional(),createdAt:N(),updatedAt:N(),state:Gp.shape.state.nullable()}))}),Jp=R({entry:z([`messages`,`channel`]).optional(),closed:I().optional(),id:N(),title:N().optional(),runs:L(Gp),messages:L(Kp),readCursor:F(),redirect:N().nullable().optional(),kind:z([`matter`,`notice`,`group`]).optional(),status:z([`active`,`waiting`,`completed`]).optional(),pending:R({members:L(N()),question:N()}).nullable().optional(),hold:R({scope:z([`all`,`writes`]),reason:N()}).passthrough().nullable().optional(),participants:L(N()).optional(),visibility:z([`project`,`participants`]).optional(),cursor:F()}),Yp=R({id:N(),body:N(),box:z([`normal`,`debug`]),taskId:F().nullable(),createdAt:N(),readAt:N().nullable(),archivedAt:N().nullable(),conversationId:N().nullable(),recipients:L(R({userId:N()}))}),Xp=R({messages:L(Yp),unread:F()}),Zp=e=>U(`site/worker-status`,xf,{signal:e}),Qp=()=>K(Zp,5e3);function $p(){let e=Qp(),t=e.data;return(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`h2`,{children:`后台服务`}),(0,G.jsx)(Z,{error:!0,children:e.error}),(0,G.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,G.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,G.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function em({generation:e}){let{request:t}=ip(),n=K((0,B.useCallback)(e=>t(`agents/repository/status`,Sf,{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,G.jsxs)(`div`,{children:[(0,G.jsx)(Z,{error:!0,children:n.error}),(0,G.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,G.jsx)($d,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,G.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,G.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,G.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,G.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tm({members:e}){let{request:t,projectId:n}=ip(),r=K((0,B.useCallback)(e=>t(`agents/settings`,Up,{signal:e}),[t])),[i,a]=(0,B.useState)(0),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(()=>Hp.parse({})),[u,d]=(0,B.useState)(``),[f,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(!1),[ee,te]=(0,B.useState)(``),[ne,re]=(0,B.useState)(!1),[x,ie]=(0,B.useState)(``);(0,B.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,B.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return U(`setup/options`,Tf,{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:Vp[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`,Up,{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`,R({ok:I()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(W(e))}finally{b(!1)}}return(0,G.jsx)(`div`,{className:`settings-section`,children:(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,G.jsx)(`h2`,{children:`仓库连接`}),(0,G.jsx)(em,{generation:i}),(0,G.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,G.jsx)(Q,{id:`agent-provider`,label:`Git 平台`,children:(0,G.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vp[t]}),ie(``)},children:[(0,G.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,G.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,G.jsx)(Q,{id:`agent-repository-url`,label:`仓库地址`,children:(0,G.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,G.jsx)(Q,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,G.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,G.jsx)(Q,{id:`agent-api-url`,label:`API 地址`,children:(0,G.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,G.jsx)(Q,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,G.jsx)(Q,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,G.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,G.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,G.jsxs)(`div`,{className:`stack`,children:[(0,G.jsx)(Yd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,G.jsx)(Q,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,G.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,G.jsxs)(`section`,{className:`stack`,children:[(0,G.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,G.jsx)(Yd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,G.jsx)(`div`,{className:`actions`,children:(0,G.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`,Up,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(W(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,G.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,G.jsxs)(`div`,{className:`stack`,children:[(0,G.jsx)(Q,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,G.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,G.jsx)(Q,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,G.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`运行设置`}),(0,G.jsxs)(`div`,{className:`form-grid`,children:[(0,G.jsx)(Q,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,G.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,G.jsx)(Q,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,G.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`参考仓库更新间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,G.jsx)(Q,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,G.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,G.jsx)(Z,{error:!0,children:ee||r.error}),(0,G.jsx)(Z,{children:x||(ne?`已保存。`:null)}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,G.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,G.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wp,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(W(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var nm=ec(`kind`,[R({kind:sc(`repository`),path:N().trim().min(1)}).strict(),R({kind:sc(`directory`),path:N().trim().min(1)}).strict()]),rm=R({members:L(N()),fileCount:F().int().nonnegative(),preserved:L(N()),skipped:L(N())}),im=R({state:z([`none`,`pending`,`running`,`succeeded`,`failed`]),source:nm.nullable(),result:rm.nullable(),error:N().nullable()});function am({onImported:e}){let{request:t}=ip(),n=K((0,B.useCallback)(e=>t(`project/workspace-import`,im,{signal:e}),[t]),5e3),r=Qp(),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,B.useRef)(null);(0,B.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,B.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`,im,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(W(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,G.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,G.jsx)(`h2`,{children:`工作区初始化`}),(0,G.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 teamcontext,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,G.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,G.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,G.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,G.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,G.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,G.jsx)(Z,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,G.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`从服务器目录导入`}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,G.jsx)(Q,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/teamcontext。`,children:(0,G.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/teamcontext`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var om=e=>U(`ai/profiles`,uf,{signal:e});function sm({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=K((0,B.useCallback)(e=>U(o,df,{signal:e}),[o,i]));return(0,G.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,G.jsx)(Z,{error:!0,children:s.error}),s.data?(0,G.jsx)(cm,{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,G.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,G.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cm({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,B.useState)(e.profileId??``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(``),m=wl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,G.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await U(t,df,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(W(e))}finally{d(!1)}},children:[(0,G.jsxs)(`div`,{className:`model-default-controls`,children:[(0,G.jsx)(Q,{id:`ai-default-${n}`,label:r,children:(0,G.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,G.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,G.jsx)(ef,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,G.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,G.jsx)(Z,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,G.jsx)(Z,{error:!0,children:f}),f&&(0,G.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lm(){let{projectId:e}=ip(),t=K(om),[n,r]=(0,B.useState)(0);return(0,G.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,G.jsx)(`h2`,{children:`模型接入`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.data&&(0,G.jsx)(sm,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}R({enabled:I(),botId:N().trim().min(1),secret:N().trim().min(1).optional()}).strict();var um=R({enabled:I(),botId:N(),secretConfigured:I(),state:z([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:N().nullable(),pending:F()}),dm=R({available:I(),bound:I(),subscribed:I(),activeProject:N().nullable(),unboundMembers:L(N()),pending:F(),error:N().nullable()}),fm=R({code:N(),expiresAt:F()}),pm=R({groups:L(R({id:N(),boundBy:N(),createdAt:N()}))}),mm=R({channels:L(R({id:N(),name:N()})),selected:N().nullable(),selectedName:N().nullable(),missingMentions:L(N()),refreshing:I(),updatedAt:F().nullable(),error:N().nullable(),pending:F()}),hm=e=>U(`site/wecom`,um,{signal:e}),gm={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _m(){let e=K(hm,3e3),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await U(`site/wecom`,um,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(W(e))}finally{o(!1)}}return(0,G.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,G.jsx)(`h2`,{children:`企业微信机器人`}),(0,G.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,G.jsx)(Z,{error:!0,children:e.error||s}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,G.jsx)(Q,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,G.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,G.jsx)(Q,{id:`wecom-secret`,label:`Secret`,children:(0,G.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,G.jsx)(`div`,{className:`actions`,children:(0,G.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,G.jsx)(Z,{children:l}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,G.jsxs)(`p`,{role:`status`,children:[d?gm[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,G.jsx)(Z,{error:!0,children:d?.error??``}),(0,G.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vm(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom/channels`,mm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mm,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,G.jsx)(`h3`,{children:`项目频道`}),(0,G.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,G.jsx)(Z,{error:!0,children:o||t.error||c?.error||``}),(0,G.jsx)(Q,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,G.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,G.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,G.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,G.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.pending?(0,G.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function ym(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom`,dm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);(0,B.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dm,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fm,{method:`POST`})),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}let l=t.data;return(0,G.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,G.jsx)(`h2`,{children:`企业微信`}),(0,G.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,G.jsx)(Z,{error:!0,children:t.error||o}),l?.available&&(0,G.jsx)(vm,{}),l?l.available?(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-personal-settings`,children:[(0,G.jsx)(`h3`,{children:`个人绑定`}),l.unboundMembers.length>0&&(0,G.jsxs)(`p`,{className:`muted`,"data-testid":`wecom-unbound-members`,children:[`待绑定成员:`,l.unboundMembers.join(`、`)]}),(0,G.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,G.jsx)(Z,{error:!0,children:l.error??``}),l.subscribed?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`muted`,children:`私聊 Tim 发送绑定命令即可完成身份关联,无需加入频道。绑定码 10 分钟内有效。`}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Yd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,G.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,G.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,G.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,G.jsx)(bm,{})]})}function bm(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom/groups`,pm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fm,{method:`POST`}))}catch(e){s(W(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pm,{method:`DELETE`}),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,G.jsx)(`h3`,{children:`群接入`}),(0,G.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,G.jsx)(Z,{error:!0,children:o||t.error}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Yd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,G.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,G.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,G.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xm({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=ip(),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,B.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,B.useState)(e),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(),ee=r.find(e=>e.id===t.memberId);async function te(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Jc,{method:`PATCH`,body:Zc.parse({projectName:u.projectName,description:u.description})});f(e),v(H.configSaved),n()}catch(e){g(W(e))}finally{m(!1)}}return(0,G.jsxs)(Ep,{title:H.settings,navigation:(0,G.jsx)(pp,{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,G.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,G.jsx)(ym,{})}),(0,G.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,G.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":H.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,G.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,G.jsx)(`h2`,{children:`项目信息`}),(0,G.jsx)(Q,{id:`project-name`,name:`projectName`,label:H.projectName,children:(0,G.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,G.jsx)(Q,{id:`project-description`,name:`description`,label:H.description,children:(0,G.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,G.jsx)(Z,{error:!0,children:h}),(0,G.jsx)(Z,{children:_}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?H.saving:H.save})})]})]}),(0,G.jsx)(sp,{}),(0,G.jsx)(lm,{}),(0,G.jsx)(Lp,{}),t.siteRole===`admin`&&(0,G.jsx)(am,{onImported:n})]}),t.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,G.jsx)(tm,{members:r})}),(0,G.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,G.jsx)(hp,{members:r,session:t,reload:n,onLeave:i})}),(0,G.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,G.jsxs)(`div`,{className:`settings-section stack`,children:[(0,G.jsx)(`h2`,{children:`项目文件夹绑定`}),(0,G.jsx)(`p`,{children:ee?.bound?`当前账号已连接客户端文件夹。`:`当前账号尚未连接客户端文件夹。`}),ee?.bound&&(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{onClick:()=>b(ee),children:`解除文件夹绑定`})})]}),(0,G.jsx)(ap,{members:r,memberId:t.memberId,admin:t.siteRole===`admin`}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:H.connectTitle}),(0,G.jsx)(`p`,{children:H.connectHint}),(0,G.jsx)(Yd,{id:`connect-command`,label:H.connectCommand,value:`teammy connect --url ${ml(e.publicServerUrl)} --project ${ml(e.projectId)}`}),(0,G.jsx)(`p`,{children:H.connectAfter})]}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:H.install}),(0,G.jsx)(`p`,{children:H.installHint}),(0,G.jsx)(Yd,{id:`install-command`,label:H.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:`Agent 接入`}),(0,G.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,G.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]}),y&&(0,G.jsx)(mp,{action:{kind:`disconnect`,member:y},onClose:()=>b(void 0),onSaved:async()=>{b(void 0),n()}})]})}function Sm({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,B.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qd,{title:`我的项目`,children:(0,G.jsxs)(Kd,{label:`项目操作`,children:[(0,G.jsx)(ef,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,G.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,G.jsx)($d,{name:`plus`}),`新建项目`]})]})}),(0,G.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,G.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,G.jsx)($d,{name:`files`,size:`navigation`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.projectName}),e.description&&(0,G.jsx)(`small`,{children:e.description})]}),(0,G.jsx)($d,{name:`chevron`})]},e.projectId))}),!e.length&&(0,G.jsx)(Wd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,G.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,G.jsx)($d,{name:`plus`}),`新建项目`]})}),i&&(0,G.jsx)(Cm,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cm({onClose:e,onCreated:t}){let[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)({fingerprint:``,id:hl()});return(0,B.useEffect)(()=>{let e=new AbortController;return U(`setup/options`,Tf,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,G.jsx)(Jd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,G.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:hl()}),await t((await U(`projects`,Jc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(W(e))}finally{l(!1)}},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,G.jsx)(Q,{id:`new-project-name`,label:`项目名称`,children:(0,G.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,G.jsx)(Q,{id:`new-project-description`,label:`说明`,children:(0,G.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,G.jsx)(Q,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 teamcontext 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,G.jsx)(`input`,{value:o,placeholder:`/imports/utu/teamcontext`,onChange:e=>s(e.target.value)})})]}),(0,G.jsx)(Z,{error:!0,children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,G.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wm({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,B.useState)(),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(0);return(0,G.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,G.jsxs)(`div`,{className:`section-heading`,children:[(0,G.jsx)(`h2`,{children:`模型接入`}),e&&(0,G.jsx)(ef,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,G.jsx)(Z,{error:!0,children:n}),n&&(0,G.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,G.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,G.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.name}),(0,G.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,G.jsx)(ef,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,G.jsx)(Em,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,G.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tm(e){let{revision:t,keyConfigured:n,...r}=e;return sf.parse(r)}function Em({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,B.useState)(e?Tm(e):sf.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=wl(),[o,s]=(0,B.useState)(e),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tm(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await U(`ai/profiles/${encodeURIComponent(r.id)}`,cf,{method:`PUT`,signal:a,body:lf.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(W(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await om(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tm(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(W(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await U(`ai/profiles/${encodeURIComponent(r.id)}/test`,pf,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(W(e))}finally{p(!1)}}return(0,G.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,G.jsxs)(`div`,{className:`form-grid`,children:[(0,G.jsx)(Q,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,G.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-name`,label:`模型名称`,children:(0,G.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,G.jsx)(Q,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,G.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,G.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,G.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,G.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,G.jsx)(Q,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,G.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-model`,label:`模型 ID`,children:(0,G.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,G.jsx)(Z,{error:!0,children:m}),(0,G.jsx)(Z,{children:g}),(0,G.jsxs)(`div`,{className:`row wrap`,children:[(0,G.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,G.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,G.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,G.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,G.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,G.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dm=e=>U(`site/config`,il,{signal:e});function Om(){let e=K(Dm);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Z,{error:!0,children:e.error}),e.data&&(0,G.jsx)(Am,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,G.jsx)(km,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,G.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function km({config:e,reload:t}){let[n,r]=(0,B.useState)(e.sync),[i,a]=(0,B.useState)(e.revision),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``);return(0,B.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,G.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 U(`site/config`,il,{method:`PATCH`,body:al.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(W(e))}finally{s(!1)}},children:(0,G.jsxs)(`section`,{className:`settings-section stack`,children:[(0,G.jsx)(`h2`,{children:`同步策略`}),(0,G.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,G.jsx)(Q,{id:`sync-check-interval`,label:H.interval,children:(0,G.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,G.jsx)(Q,{id:`sync-file-settle`,label:H.settle,children:(0,G.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,G.jsx)(Z,{error:!0,children:c}),(0,G.jsx)(Z,{children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,G.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Am({config:e,reload:t}){let[n,r]=(0,B.useState)(e.publicServerUrl),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);return(0,B.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,G.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await U(`site/config`,il,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(W(e))}finally{a(!1)}},children:[(0,G.jsx)(`h2`,{children:`访问地址`}),(0,G.jsx)(Q,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,G.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,G.jsx)(Z,{error:!0,children:o}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jm=e=>U(`users`,R({users:L(ol)}),{signal:e});function Mm({me:e}){let t=K(jm),[n,r]=(0,B.useState)();return(0,G.jsxs)(`div`,{className:`settings-section stack`,children:[(0,G.jsx)(Gd,{title:`用户信息`,children:(0,G.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,G.jsx)($d,{name:`plus`}),`新增用户`]})}),(0,G.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.error&&(0,G.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,G.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,G.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,G.jsxs)(`div`,{className:`member-heading`,children:[(0,G.jsx)(Hd,{name:t.displayName}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:t.displayName}),(0,G.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,G.jsxs)(`div`,{className:`member-actions`,children:[(0,G.jsx)(ef,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,G.jsx)(ef,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,G.jsx)(Nm,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Nm({action:e,onClose:t,onSaved:n}){let[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,G.jsx)(Jd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,G.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 U(`users`,ol,{method:`POST`,body:sl.parse({id:r.trim(),displayName:a})}):await U(`users/${encodeURIComponent(e.user.id)}`,ol,{method:`PATCH`,body:cl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(W(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,G.jsx)(Q,{id:`user-id`,label:`用户 ID`,hint:H.idHint,children:(0,G.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,G.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,G.jsx)(Q,{id:`user-display-name`,label:H.displayName,children:(0,G.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,G.jsx)(Z,{error:!0,children:l}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:H.cancel}),(0,G.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?H.saving:H.confirm})]})]})})}var Pm=R({enabled:I(),keyConfigured:I(),revision:F().int().nonnegative()});R({enabled:I(),expectedRevision:F().int().nonnegative(),apiKey:N().trim().min(1).max(4096).nullable().optional()}).strict();var Fm=R({ok:sc(!0),milliseconds:F().nonnegative(),results:F().int().nonnegative()}),Im=e=>U(`site/web-search`,Pm,{signal:e});function Lm(){let e=K(Im),t=wl(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),f=e.data,p=n??f?.enabled??!1,m=!!i||n!==null&&n!==f?.enabled;async function h(){if(f){s(`save`),l(``),d(``);try{await U(`site/web-search`,Pm,{method:`PUT`,signal:t,body:{enabled:p,expectedRevision:f.revision,...i.trim()?{apiKey:i.trim()}:{}}}),a(``),r(null),await e.reload(),d(`已保存,后续工具调用使用新配置。`)}catch(e){l(W(e))}finally{s(``)}}}async function g(){s(`probe`),l(``),d(``);try{let e=await U(`site/web-search/probe`,Fm,{method:`POST`,signal:t,timeoutMs:5e4});d(`连接正常 · ${(e.milliseconds/1e3).toFixed(1)} 秒`)}catch(e){l(W(e))}finally{s(``)}}return(0,G.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`网页搜索`,"data-testid":`web-search-settings`,children:[(0,G.jsx)(`h2`,{children:`网页搜索`}),(0,G.jsx)(`p`,{className:`muted`,children:`使用 DeepSeek 为 Tim 搜索和读取公开网页。`}),(0,G.jsx)(Z,{error:!0,children:c||e.error}),e.error&&(0,G.jsx)(`button`,{onClick:()=>void e.reload(),children:`重新加载搜索设置`}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:!!o||!f,children:[(0,G.jsx)(Q,{id:`web-search-api-key`,label:`DeepSeek API Key`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:i,required:p&&!f?.keyConfigured,placeholder:f?.keyConfigured?`已保存,留空保持不变`:`填写 DeepSeek 官方 API Key`,onChange:e=>{a(e.target.value),d(``)}})}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用网页搜索`,"aria-checked":p,className:p?`primary`:``,onClick:()=>{r(!p),d(``)},children:p?`已启用`:`已停用`})})]}),(0,G.jsx)(Z,{children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{className:`primary`,disabled:!!o||!f||!m,children:o===`save`?`保存中…`:`保存`}),(0,G.jsx)(`button`,{type:`button`,disabled:!!o||m||!f?.enabled||!f.keyConfigured,onClick:()=>void g(),children:o===`probe`?`测试中…`:`测试连接`}),c&&(0,G.jsx)(`button`,{type:`button`,disabled:!!o,onClick:()=>{r(null),a(``),l(``),e.reload()},children:`刷新配置`})]})]}),(0,G.jsx)(`small`,{className:`muted`,children:`搜索与网页读取按次计费,测试连接会调用一次搜索。`})]})}function Rm({session:e}){let t=K(om),n=K(fl.server),[r,i]=(0,B.useState)(`general`),[a,o]=(0,B.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,G.jsxs)(`div`,{className:`site-settings`,children:[(0,G.jsx)(qd,{title:`设置`}),(0,G.jsx)(pp,{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,G.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,G.jsx)(_m,{})}),(0,G.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,G.jsx)(Om,{}):(0,G.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,G.jsx)($p,{}),(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`h2`,{children:`服务端版本`}),(0,G.jsx)(Z,{error:!0,children:n.error}),(0,G.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,G.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,G.jsx)(`div`,{className:`settings-section-actions`,children:(0,G.jsx)(ef,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,G.jsx)(wm,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,G.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,G.jsx)(`h2`,{children:`默认接入点`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.data&&(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(sm,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]}),e.siteRole===`admin`&&r===`models`&&(0,G.jsx)(Lm,{})]}),e.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,G.jsx)(Mm,{me:e.memberId})})]})]})}var zm=`modulepreload`,Bm=function(e,t){return new URL(e,t).href},Vm={},Hm=function(e){return e.pathname.endsWith(`.css`)},Um=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},Wm=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=Bm(t,n);let r=s(t),i=Hm(r);return Um(Vm,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`:zm,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)})},Gm=(0,B.lazy)(()=>Wm(()=>import(`./ResourceLibrary-RyTep8PC.js`).then(e=>({default:e.ResourceLibrary})),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),Km=(0,B.lazy)(()=>Wm(()=>import(`./Help-DGI26Qe5.js`).then(e=>({default:e.Help})),__vite__mapDeps([8,1,9]),import.meta.url)),qm=(0,B.lazy)(()=>Wm(()=>import(`./Files-DD-tWR-r.js`).then(e=>({default:e.Files})),__vite__mapDeps([10,1,4,5,11,6]),import.meta.url)),Jm=(0,B.lazy)(()=>Wm(()=>import(`./Assistant-ZM9at-n8.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([12,1,2,3,13,14]),import.meta.url)),Ym=(0,B.lazy)(()=>Wm(()=>import(`./Computers-CV-4FaxZ.js`).then(e=>({default:e.Computers})),__vite__mapDeps([15,1,2,3,13,14,4,16]),import.meta.url)),Xm=(0,B.lazy)(()=>Wm(()=>import(`./Dashboard-wZpQ1Qxb.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([17,5,11,18]),import.meta.url));function Zm(){let[e,t]=(0,B.useState)(),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(0);return(0,B.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await fl.setup(e.signal),i;if(n.initialized)try{i=await fl.session(e.signal)}catch(e){if(!(e instanceof ul&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(W(t))}})(),()=>e.abort()},[o]),(0,B.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,G.jsxs)(`main`,{className:`boot`,children:[(0,G.jsx)(Bd,{}),(0,G.jsx)(Z,{error:!0,children:i}),(0,G.jsx)(`button`,{onClick:()=>s(e=>e+1),children:H.retry})]}):n===void 0?(0,G.jsxs)(`main`,{className:`boot`,children:[(0,G.jsx)(Bd,{}),(0,G.jsx)(`p`,{role:`status`,children:H.loading})]}):n?e?f()===`/connect`?(0,G.jsx)(If,{session:e,onLogout:()=>t(void 0)}):(0,G.jsx)(xl,{children:(0,G.jsx)($m,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,G.jsx)(Of,{onLogin:t}):(0,G.jsx)(Mf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function Qm(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|messages|channels|computers|files|materials|memory|sessions|help|members|settings)$/);if(e?.[2]===`files`&&new URLSearchParams(location.search).get(`owner`)===`_resources`)return history.replaceState(null,``,d(`/projects/${e[1]}/memory`)),{projectId:e[1],page:`memory`};if(e?.[2]===`assistant`)return history.replaceState(null,``,d(`/projects/${e[1]}/messages${location.search}`)),{projectId:e[1],page:`messages`};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`,`memory`,`sessions`,...bp].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function $m({session:e,onLogout:t}){let n=K(fl.projects,!0),[r,i]=(0,B.useState)(Qm),a=(0,B.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(Qm()),document.querySelector(`main`)?.focus()},[]);(0,B.useEffect)(()=>{let e=()=>{i(Qm())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,B.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(xp(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||![...bp,`memory`,`sessions`,`members`].includes(r.page)||!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?xp(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,B.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,B.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,B.useMemo)(()=>r.projectId?np(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,G.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,G.jsx)(`a`,{className:`skip-link`,href:`#main`,children:H.skipToMain}),!l&&(0,G.jsx)(Cp,{projectId:r.projectId,page:r.page,navigate:a}),(0,G.jsx)(`div`,{className:`main-shell`,children:(0,G.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,G.jsx)(Z,{error:!0,children:n.error}),l?(0,G.jsx)(Tp,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,G.jsx)(Rm,{session:e}):(0,G.jsx)(Sm,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(xp(e,`dashboard`))})}):c&&s?(0,G.jsx)(rp.Provider,{value:c,children:(0,G.jsx)(eh,{page:r.page,navigate:a,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,G.jsx)(Z,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,G.jsx)(`p`,{role:`status`,children:H.loading})]})})]})}function eh({page:e,onLeave:t,navigate:n}){let r=ip(),i=K((0,B.useCallback)(async e=>{let[t,n,i]=await Promise.all([r.api.config(e),r.api.members(e),r.request(`identity`,el,{signal:e})]);return{config:t,members:n.members,session:i}},[r]),!0),a=i.data;return i.error?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{error:!0,children:i.error}),(0,G.jsx)(`button`,{onClick:()=>void i.reload(),children:`重试`})]}):a?(0,G.jsx)(B.Suspense,{fallback:(0,G.jsx)(`p`,{role:`status`,children:H.loading}),children:e===`files`?(0,G.jsx)(qm,{members:a.members,onRefresh:()=>void i.reload()}):e===`dashboard`?(0,G.jsx)(Xm,{members:a.members,config:a.config,userName:a.session.displayName||a.session.memberId}):e===`materials`||e===`memory`||e===`sessions`?(0,G.jsx)(Gm,{section:e,members:a.members,navigate:n}):e===`help`?(0,G.jsx)(Km,{config:a.config,navigate:n}):[`assistant`,`messages`,`channels`].includes(e)?(0,G.jsx)(Jm,{me:a.session.memberId,mode:e===`channels`?`channels`:`messages`},e):e===`computers`?(0,G.jsx)(Ym,{}):(0,G.jsx)(xm,{config:a.config,session:a.session,reload:()=>void i.reload(),members:a.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,G.jsx)(`p`,{role:`status`,children:H.loading})}(0,jc.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(Zm,{}));export{zc as $,Ud as A,Xd as B,Rf as C,of as D,Lf as E,Vd as F,vl as G,K as H,Jd as I,W as J,ul as K,Z as L,Q as M,$d as N,af as O,ef as P,H as Q,qd as R,Kf as S,l as St,Uf as T,Cl as U,wl as V,Sl as W,ml as X,hl as Y,ll as Z,fp as _,h as _t,Xp as a,z as at,Zf as b,o as bt,Np as c,sc as ct,kp as d,N as dt,Rc as et,Op as f,Qs as ft,up as g,ga as gt,dp as h,Cs as ht,Gp as i,Vs as it,Wd as j,Yd as k,Ip as l,F as lt,gp as m,Ts as mt,Jp as n,Lc as nt,Yp as o,L as ot,Dp as p,Ks as pt,fl as q,Kp as r,V as rt,Ap as s,I as st,qp as t,Ic as tt,Mp as u,R as ut,np as v,d as vt,$ as w,Yf as x,s as xt,ip as y,f as yt,Kd as z};
66
+ `).map(e=>e.trim()).filter(Boolean)}}),await t()}catch(e){c(W(e))}finally{o(!1)}},children:[(0,G.jsx)(`fieldset`,{disabled:a,className:`stack`,children:(0,G.jsx)(Q,{id:`shared-files-paths`,label:`公共资料路径`,hint:`每行一个根目录文件或以下划线开头的文件夹,例如 README.md、_template/。所有成员均可编辑并同步,同一文件以后提交的内容为准。`,children:(0,G.jsx)(`textarea`,{rows:3,value:r,onChange:e=>i(e.target.value)})})}),(0,G.jsx)(Z,{error:!0,children:s}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:a,children:`保存公共资料设置`})})]})}R({text:N().trim().min(1),requestId:N().min(1).optional()}).strict(),R({body:N().trim().min(1),requestId:N().min(1).optional()}).strict(),R({to:L(V).min(1),body:N().trim().min(1),branch:N().trim().min(1).optional()}).strict().extend({to:Qs([sc(`debug`),L(V).min(1)])});var zp=F().int().positive().nullable(),Bp=z([`github`,`gongfeng`]),Vp={github:`https://api.github.com`,gongfeng:`https://git.tencent.com/api/v3`},Hp=R({provider:Bp.default(`github`),repositoryUrl:N().trim().default(``),repository:N().trim().default(``),apiUrl:N().url().optional(),githubApiUrl:N().url().optional(),debugRecipient:V.nullable().default(null),contextWindow:F().int().positive().default(256e3),compactAt:F().int().positive().default(22e4),fetchIntervalSeconds:zp.default(300),idleSeconds:zp.default(1800),restartSeconds:zp.default(86400)}).strict().refine(e=>e.compactAt<e.contextWindow,`压缩阈值应小于模型上下文窗口。`).transform(({githubApiUrl:e,apiUrl:t,...n})=>({...n,apiUrl:(t??e??Vp[n.provider]).replace(/\/+$/,``)}));R({config:Hp,token:N().nullable().optional(),webhookSecret:N().nullable().optional(),sshPrivateKey:N().nullable().optional(),sshKnownHosts:N().nullable().optional()}).strict();var Up=R({config:Hp,tokenConfigured:I(),webhookConfigured:I(),sshConfigured:I(),sshPublicKey:N().nullable().optional(),webhookUrl:N().optional()}),Wp=R({id:N(),name:N(),url:N()}),Gp=R({id:N(),text:N(),answer:N(),author:N().nullable().optional(),source:sc(`wecom`).optional(),state:z([`queued`,`running`,`succeeded`,`failed`]),error:N().nullable(),createdAt:N()}),Kp=R({id:N(),seq:F(),runId:N().nullable(),role:z([`user`,`assistant`]),author:N(),body:N(),state:Gp.shape.state,source:N().nullable(),createdAt:N()}),qp=R({chats:L(R({id:N(),title:N(),kind:z([`matter`,`notice`,`group`]).optional(),status:z([`active`,`waiting`,`completed`]).optional(),unread:I().optional(),createdAt:N(),updatedAt:N(),state:Gp.shape.state.nullable()}))}),Jp=R({entry:z([`messages`,`channel`]).optional(),closed:I().optional(),id:N(),title:N().optional(),runs:L(Gp),messages:L(Kp),readCursor:F(),redirect:N().nullable().optional(),kind:z([`matter`,`notice`,`group`]).optional(),status:z([`active`,`waiting`,`completed`]).optional(),pending:R({members:L(N()),question:N()}).nullable().optional(),hold:R({scope:z([`all`,`writes`]),reason:N()}).passthrough().nullable().optional(),participants:L(N()).optional(),visibility:z([`project`,`participants`]).optional(),cursor:F()}),Yp=R({id:N(),body:N(),box:z([`normal`,`debug`]),taskId:F().nullable(),createdAt:N(),readAt:N().nullable(),archivedAt:N().nullable(),conversationId:N().nullable(),recipients:L(R({userId:N()}))}),Xp=R({messages:L(Yp),unread:F()}),Zp=e=>U(`site/worker-status`,xf,{signal:e}),Qp=()=>K(Zp,5e3);function $p(){let e=Qp(),t=e.data;return(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`h2`,{children:`后台服务`}),(0,G.jsx)(Z,{error:!0,children:e.error}),(0,G.jsx)(`p`,{role:`status`,"data-testid":`worker-status`,children:t?{online:`运行中`,offline:`暂未响应`,unknown:`未检测到后台服务`}[t.state]:`正在读取…`}),t?.lastSeenAt&&t.state!==`online`&&(0,G.jsxs)(`p`,{className:`muted`,children:[`最近响应:`,new Date(t.lastSeenAt).toLocaleString()]}),t&&t.state!==`online`&&(0,G.jsx)(`p`,{className:`muted`,children:`请检查部署中的 ai-worker 是否已启动。`})]})}function em({generation:e}){let{request:t}=ip(),n=K((0,B.useCallback)(e=>t(`agents/repository/status`,Sf,{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,G.jsxs)(`div`,{children:[(0,G.jsx)(Z,{error:!0,children:n.error}),(0,G.jsxs)(`div`,{className:`repository-status-card${i?` active`:``}${a?` error`:``}`,role:`status`,children:[(0,G.jsx)($d,{name:a?`attention`:r?.state===`ready`?`check`:`download`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{"data-testid":`repository-status`,children:r?{unconfigured:`尚未配置仓库`,pending:`等待后台下载仓库`,cloning:`正在下载仓库`,fetching:`正在拉取远端更新`,ready:`仓库已下载`,failed:`仓库下载失败`,interrupted:`仓库下载已中断`}[r.state]:`正在读取仓库状态…`}),i&&(0,G.jsx)(`p`,{children:`包含默认启用的子模块,可离开此页,后台会继续处理。`}),r?.state===`failed`&&(0,G.jsx)(`p`,{children:`请查看诊断日志,确认主仓库及子模块的访问权限与网络连接。`}),r?.state===`interrupted`&&(0,G.jsx)(`p`,{children:`等待后台重试。`}),r?.lastSuccessAt&&(0,G.jsxs)(`p`,{children:[`最近完成:`,new Date(r.lastSuccessAt).toLocaleString()]})]})]})]})}function tm({members:e}){let{request:t,projectId:n}=ip(),r=K((0,B.useCallback)(e=>t(`agents/settings`,Up,{signal:e}),[t])),[i,a]=(0,B.useState)(0),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(()=>Hp.parse({})),[u,d]=(0,B.useState)(``),[f,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(!1),[ee,te]=(0,B.useState)(``),[ne,re]=(0,B.useState)(!1),[x,ie]=(0,B.useState)(``);(0,B.useEffect)(()=>{r.data&&(l(r.data.config),s(r.data.sshPublicKey??null))},[r.data]),(0,B.useEffect)(()=>{if(!r.data||r.data.config.repositoryUrl)return;let e=new AbortController;return U(`setup/options`,Tf,{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:Vp[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`,Up,{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`,R({ok:I()}),{method:`POST`,timeoutMs:305e3}),ie(`远端连接检查通过。完整下载及子模块状态见上方,工作区将在下载完成后导入。`))}catch(e){te(W(e))}finally{b(!1)}}return(0,G.jsx)(`div`,{className:`settings-section`,children:(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>void S(e),"data-testid":`project-agent-settings`,children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:y||r.loading,children:[(0,G.jsx)(`h2`,{children:`仓库连接`}),(0,G.jsx)(em,{generation:i}),(0,G.jsx)(`p`,{className:`muted`,children:`请配置仓库连接、访问密钥及 PR/MR 评论账号;评论可使用管理员账号。`}),(0,G.jsx)(Q,{id:`agent-provider`,label:`Git 平台`,children:(0,G.jsxs)(`select`,{value:c.provider,onChange:e=>{let t=e.target.value;l({...c,provider:t,apiUrl:Vp[t]}),ie(``)},children:[(0,G.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,G.jsx)(`option`,{value:`gongfeng`,children:`工蜂`})]})}),(0,G.jsx)(Q,{id:`agent-repository-url`,label:`仓库地址`,children:(0,G.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,G.jsx)(Q,{id:`agent-repository`,label:c.provider===`gongfeng`?`工蜂仓库`:`GitHub 仓库`,children:(0,G.jsx)(`input`,{value:c.repository,placeholder:c.provider===`gongfeng`?`group/repository 或项目 ID`:`owner/repository`,onChange:e=>l({...c,repository:e.target.value})})}),(0,G.jsx)(Q,{id:`agent-api-url`,label:`API 地址`,children:(0,G.jsx)(`input`,{type:`url`,value:c.apiUrl,onChange:e=>l({...c,apiUrl:e.target.value})})}),(0,G.jsx)(Q,{id:`agent-token`,label:`访问与评论令牌`,hint:c.provider===`gongfeng`?`使用具有 api 权限的个人访问令牌;HTTPS 拉取还需 read_repository 权限。`:`令牌需具备仓库读取和发表评论权限。`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,placeholder:r.data?.tokenConfigured?`已配置;留空保持现状`:``,onChange:e=>d(e.target.value)})}),(0,G.jsx)(Q,{id:`agent-debug-recipient`,label:`运行提醒收件人`,children:(0,G.jsxs)(`select`,{value:c.debugRecipient??``,onChange:e=>l({...c,debugRecipient:e.target.value||null}),children:[(0,G.jsx)(`option`,{value:``,children:`管理员`}),e.filter(e=>e.enabled&&e.accountEnabled).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.displayName||e.id},e.id))]})}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`PR/MR 事件接入`}),(0,G.jsxs)(`div`,{className:`stack`,children:[(0,G.jsx)(Yd,{id:`agent-webhook-url`,label:`Webhook 地址`,value:r.data?.webhookUrl??`${p()}/api/v1/projects/${encodeURIComponent(n)}/agents/${c.provider}/events`}),(0,G.jsx)(Q,{id:`agent-webhook-secret`,label:`Webhook Secret`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:f,placeholder:r.data?.webhookConfigured?`已配置;留空保持现状`:``,onChange:e=>m(e.target.value)})}),(0,G.jsx)(`p`,{className:`muted`,children:c.provider===`gongfeng`?`订阅合并请求、评论和评审事件,填写相同秘密令牌,并在工蜂中测试、激活 Webhook。建议先保存并检查仓库。`:`在仓库中使用 JSON webhook,订阅 Pull requests、Issue comments、Pull request reviews 和 Pull request review comments。`})]})]}),(0,G.jsxs)(`section`,{className:`stack`,children:[(0,G.jsx)(`h3`,{children:`项目 SSH 公钥`}),o&&(0,G.jsx)(Yd,{id:`agent-ssh-public-key`,label:c.provider===`gongfeng`?`复制到工蜂账号的 SSH 密钥中`:`复制到 GitHub 仓库的 Deploy keys 中`,value:o}),!o&&(0,G.jsx)(`div`,{className:`actions`,children:(0,G.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`,Up,{method:`POST`});s(e.sshPublicKey??null)}catch(e){te(W(e))}finally{b(!1)}},children:`生成项目公钥`})}),(0,G.jsxs)(`small`,{children:[c.provider===`gongfeng`?`使用 SSH 仓库地址时,将公钥添加到工蜂的「个人设置 → SSH 密钥」,访问权限继承该账号。`:`使用 SSH 仓库地址时,将公钥添加到 GitHub 仓库的「Settings → Deploy keys」。`,`首次连接记录主机公钥,后续变化会拒绝连接。`]})]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`已有 SSH 凭据`}),(0,G.jsxs)(`div`,{className:`stack`,children:[(0,G.jsx)(Q,{id:`agent-ssh-key`,label:`SSH 私钥`,children:(0,G.jsx)(`textarea`,{rows:3,value:h,placeholder:r.data?.sshConfigured?`已配置;留空保持现状`:``,onChange:e=>g(e.target.value)})}),(0,G.jsx)(Q,{id:`agent-ssh-hosts`,label:`已确认的服务器公钥(known_hosts)`,children:(0,G.jsx)(`textarea`,{rows:2,value:_,onChange:e=>v(e.target.value)})})]})]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`运行设置`}),(0,G.jsxs)(`div`,{className:`form-grid`,children:[(0,G.jsx)(Q,{id:`agent-context-window`,label:`模型上下文窗口(tokens)`,children:(0,G.jsx)(`input`,{type:`number`,value:c.contextWindow,onChange:e=>l({...c,contextWindow:Number(e.target.value)})})}),(0,G.jsx)(Q,{id:`agent-compact-at`,label:`提前压缩位置(tokens)`,children:(0,G.jsx)(`input`,{type:`number`,value:c.compactAt,onChange:e=>l({...c,compactAt:Number(e.target.value)})})}),[[`fetchIntervalSeconds`,`参考仓库更新间隔(秒)`],[`idleSeconds`,`额外 Pi 进程空闲回收(秒)`],[`restartSeconds`,`空闲时重建沙箱的周期(秒)`]].map(([e,t])=>(0,G.jsx)(Q,{id:`agent-${e}`,label:t,hint:`留空关闭;不打断正在执行的回答。`,children:(0,G.jsx)(`input`,{type:`number`,value:c[e]??``,onChange:t=>l({...c,[e]:t.target.value?Number(t.target.value):null})})},e))]})]})]}),(0,G.jsx)(Z,{error:!0,children:ee||r.error}),(0,G.jsx)(Z,{children:x||(ne?`已保存。`:null)}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{className:`primary`,disabled:y||r.loading,children:`保存`}),(0,G.jsx)(`button`,{type:`button`,disabled:y||r.loading||!c.repositoryUrl,onClick:()=>void S(void 0,!0),children:`保存并检查仓库`}),(0,G.jsx)(`button`,{type:`button`,disabled:y||!c.repository,onClick:async()=>{b(!0),te(``),ie(``);try{let e=await t(`agents/repository/check`,Wp,{method:`POST`,timeoutMs:305e3});ie(`工蜂 / GitHub API 可读:${e.name}。`)}catch(e){te(W(e))}finally{b(!1)}},children:`检查已保存的 API 配置`})]})]})})}var nm=ec(`kind`,[R({kind:sc(`repository`),path:N().trim().min(1)}).strict(),R({kind:sc(`directory`),path:N().trim().min(1)}).strict()]),rm=R({members:L(N()),fileCount:F().int().nonnegative(),preserved:L(N()),skipped:L(N())}),im=R({state:z([`none`,`pending`,`running`,`succeeded`,`failed`]),source:nm.nullable(),result:rm.nullable(),error:N().nullable()});function am({onImported:e}){let{request:t}=ip(),n=K((0,B.useCallback)(e=>t(`project/workspace-import`,im,{signal:e}),[t]),5e3),r=Qp(),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),u=n.data,d=u?.state===`succeeded`?JSON.stringify(u):null,f=(0,B.useRef)(null);(0,B.useEffect)(()=>{let t=f.current!==d;f.current=d,d&&t&&e()},[d,e]),(0,B.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`,im,{method:`POST`,body:e?u?.source:{kind:`directory`,path:i.trim()}}),await n.reload()}catch(e){l(W(e))}finally{s(!1)}}let m=u?.state===`pending`||u?.state===`running`;return(0,G.jsxs)(`div`,{className:`settings-section`,"data-testid":`workspace-import-settings`,children:[(0,G.jsx)(`h2`,{children:`工作区初始化`}),(0,G.jsx)(`p`,{className:`muted`,children:`连接仓库后自动导入其中的 teamcontext,也可从服务器目录导入。原文件和已有同步版本保留。`}),u?.state!==`none`&&u&&(0,G.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,G.jsx)(`p`,{className:`muted`,children:u.source.path}),!!u.result?.preserved.length&&(0,G.jsxs)(`p`,{className:`muted`,children:[`保留已有版本:`,u.result.preserved.map(e=>e===`_project`?`公共资料`:e).join(`、`)]}),!!u.result?.skipped.length&&(0,G.jsxs)(`p`,{className:`muted`,children:[`未纳入同步范围:`,u.result.skipped.join(`、`)]})]}),m&&r.data&&r.data.state!==`online`&&(0,G.jsx)(`p`,{className:`muted`,children:`后台服务暂未响应,请检查 ai-worker 是否已启动。`}),(0,G.jsx)(Z,{error:!0,children:u?.error||n.error||c}),u?.state===`failed`&&(0,G.jsx)(`button`,{disabled:o,onClick:()=>void p(!0),children:`重试导入`}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`从服务器目录导入`}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,G.jsx)(Q,{id:`import-workspace-path`,label:`工作区路径`,hint:`容器部署时填写只读挂载后的路径,例如 /imports/utu/teamcontext。`,children:(0,G.jsx)(`input`,{required:!0,value:i,placeholder:`/imports/utu/teamcontext`,disabled:o||m,onChange:e=>a(e.target.value)})}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:o||m||!i.trim(),children:`导入工作区`})})]})]})]})}var om=e=>U(`ai/profiles`,uf,{signal:e});function sm({projectId:e,title:t,profiles:n,admin:r,generation:i,onChanged:a}){let o=e?`projects/${encodeURIComponent(e)}/ai/default`:`ai/default`,s=K((0,B.useCallback)(e=>U(o,df,{signal:e}),[o,i]));return(0,G.jsxs)(`div`,{className:`model-default-row`,"data-testid":`ai-default-row`,"data-scope":e??`site`,children:[(0,G.jsx)(Z,{error:!0,children:s.error}),s.data?(0,G.jsx)(cm,{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,G.jsx)(`span`,{role:`status`,children:`正在加载…`}),s.error&&(0,G.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`})]})}function cm({value:e,path:t,id:n,title:r,profiles:i,admin:a,onChanged:o,reload:s}){let[c,l]=(0,B.useState)(e.profileId??``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(``),m=wl(),h=i.find(t=>t.id===e.effectiveProfileId);return(0,G.jsxs)(`form`,{"aria-label":`${r}默认接入点`,"aria-busy":u,onSubmit:async n=>{n.preventDefault(),d(!0),p(``);try{await U(t,df,{method:`PUT`,signal:m,body:{expectedRevision:e.revision,profileId:c||null}}),o()}catch(e){m.aborted||p(W(e))}finally{d(!1)}},children:[(0,G.jsxs)(`div`,{className:`model-default-controls`,children:[(0,G.jsx)(Q,{id:`ai-default-${n}`,label:r,children:(0,G.jsxs)(`select`,{disabled:!a||u,value:c,onChange:e=>l(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:n===`site`?`未设置`:`继承全站默认${e.source===`site`&&h?` · ${h.name}`:``}`}),i.map(e=>(0,G.jsxs)(`option`,{value:e.id,disabled:!e.enabled,children:[e.name,e.enabled?``:`(已停用)`]},e.id))]})}),a&&(0,G.jsx)(ef,{icon:`check`,type:`submit`,label:`保存${r}默认接入点`,"data-testid":`ai-default-save`,disabled:u||c===(e.profileId??``)})]}),(0,G.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,G.jsx)(Z,{error:!0,children:`默认接入点已停用,请重新选择。`}),(0,G.jsx)(Z,{error:!0,children:f}),f&&(0,G.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`重新载入`})]})}function lm(){let{projectId:e}=ip(),t=K(om),[n,r]=(0,B.useState)(0);return(0,G.jsxs)(`section`,{className:`settings-section`,"aria-label":`模型接入`,children:[(0,G.jsx)(`h2`,{children:`模型接入`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.data&&(0,G.jsx)(sm,{projectId:e,title:`项目默认`,profiles:t.data.profiles,admin:!0,generation:n,onChanged:()=>r(e=>e+1)})]})}R({enabled:I(),botId:N().trim().min(1),secret:N().trim().min(1).optional()}).strict();var um=R({enabled:I(),botId:N(),secretConfigured:I(),state:z([`disabled`,`connecting`,`connected`,`disconnected`,`error`]),error:N().nullable(),pending:F()}),dm=R({available:I(),bound:I(),subscribed:I(),activeProject:N().nullable(),unboundMembers:L(N()),pending:F(),error:N().nullable()}),fm=R({code:N(),expiresAt:F()}),pm=R({groups:L(R({id:N(),boundBy:N(),createdAt:N()}))}),mm=R({channels:L(R({id:N(),name:N()})),selected:N().nullable(),selectedName:N().nullable(),missingMentions:L(N()),refreshing:I(),updatedAt:F().nullable(),error:N().nullable(),pending:F()}),hm=e=>U(`site/wecom`,um,{signal:e}),gm={disabled:`未启用`,connecting:`连接中`,connected:`已连接`,disconnected:`未连接`,error:`连接异常`};function _m(){let e=K(hm,3e3),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),d=e.data,f=t??{botId:d?.botId??``,enabled:d?.enabled??!0};async function p(){o(!0),c(``),u(``);try{await U(`site/wecom`,um,{method:`PUT`,body:{...f,...r?{secret:r}:{}}}),i(``),n(null),await e.reload(),u(`已保存,连接状态会自动更新。`)}catch(e){c(W(e))}finally{o(!1)}}return(0,G.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-site-settings`,children:[(0,G.jsx)(`h2`,{children:`企业微信机器人`}),(0,G.jsx)(`p`,{className:`muted`,children:`将Tim的消息转发到企业微信。原消息与回复仍保存在网页中。`}),(0,G.jsx)(Z,{error:!0,children:e.error||s}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:a||!d,children:[(0,G.jsx)(Q,{id:`wecom-bot-id`,label:`Bot ID`,children:(0,G.jsx)(`input`,{required:!0,value:f.botId,onChange:e=>n({...f,botId:e.target.value})})}),(0,G.jsx)(Q,{id:`wecom-secret`,label:`Secret`,children:(0,G.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,G.jsx)(`div`,{className:`actions`,children:(0,G.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,G.jsx)(Z,{children:l}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:a||!d,children:a?`保存中…`:`保存`})})]}),(0,G.jsxs)(`p`,{role:`status`,children:[d?gm[d.state]:`加载中…`,d?.pending?` · ${d.pending} 条待转发`:``]}),(0,G.jsx)(Z,{error:!0,children:d?.error??``}),(0,G.jsx)(`p`,{className:`muted`,children:`使用 API 模式的长连接机器人。保存后,成员可在项目设置中绑定账号。`})]})}function vm(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom/channels`,mm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),c=t.data,l=n??c?.selected??``;async function u(n){a(!0),s(``);try{await e(n?`wecom/channels/refresh`:`wecom/channels`,mm,{method:n?`POST`:`PUT`,...n?{}:{body:{topicId:l||null}}}),n||r(null),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-channel-settings`,children:[(0,G.jsx)(`h3`,{children:`项目频道`}),(0,G.jsx)(`p`,{className:`muted`,children:`每件事项独立成帖,按需 @ 相关成员,回复与网页同步。频道成员均可查看共享事项。`}),(0,G.jsx)(Z,{error:!0,children:o||t.error||c?.error||``}),(0,G.jsx)(Q,{id:`wecom-channel`,label:`接收事项的频道`,children:(0,G.jsxs)(`select`,{value:l,disabled:i||!c,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`暂不连接频道`}),c?.selected&&!c.channels.some(e=>e.id===c.selected)&&(0,G.jsxs)(`option`,{value:c.selected,children:[c.selectedName,`(暂不可用)`]}),c?.channels.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{disabled:i||!c||c.refreshing,onClick:()=>void u(!0),children:c?.refreshing?`刷新中…`:`刷新`}),(0,G.jsx)(`button`,{className:`primary`,disabled:i||!c||l===(c.selected??``),onClick:()=>void u(!1),children:`保存`})]}),(0,G.jsx)(`p`,{className:`muted`,children:`机器人需允许获取所有内容、主动发送。仅发布新建共享事项,已有私人内容不会自动公开。`}),c?.pending?(0,G.jsxs)(`p`,{className:`muted`,children:[c.pending,` 条频道消息待发送。`]}):null]})}function ym(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom`,dm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);(0,B.useEffect)(()=>{t.data?.subscribed&&r(void 0)},[t.data?.subscribed]);async function c(n=!1){a(!0),s(``);try{n?(await e(`wecom`,dm,{method:`DELETE`}),r(void 0)):r(await e(`wecom/code`,fm,{method:`POST`})),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}let l=t.data;return(0,G.jsxs)(`div`,{className:`settings-section stack`,"data-testid":`wecom-project-settings`,children:[(0,G.jsx)(`h2`,{children:`企业微信`}),(0,G.jsx)(`p`,{children:`接收本项目的新消息,并在企业微信中与Tim对话。原消息、回答与回复仍保存在网页。`}),(0,G.jsx)(Z,{error:!0,children:t.error||o}),l?.available&&(0,G.jsx)(vm,{}),l?l.available?(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-personal-settings`,children:[(0,G.jsx)(`h3`,{children:`个人绑定`}),l.unboundMembers.length>0&&(0,G.jsxs)(`p`,{className:`muted`,"data-testid":`wecom-unbound-members`,children:[`待绑定成员:`,l.unboundMembers.join(`、`)]}),(0,G.jsxs)(`p`,{role:`status`,children:[l.subscribed?`个人账号已连接本项目`:`尚未绑定个人账号`,l.pending?` · ${l.pending} 条待转发`:``]}),(0,G.jsx)(Z,{error:!0,children:l.error??``}),l.subscribed?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`muted`,children:`引用通知回复即可同步到网页。直接提问进入独立对话;发送 /new 开始新话题,/projects 查看项目,/help 查看全部命令。`}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:i,onClick:()=>void c(!0),children:`解除本项目连接`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`muted`,children:`私聊 Tim 发送绑定命令即可完成身份关联,无需加入频道。绑定码 10 分钟内有效。`}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:i,onClick:()=>void c(),children:i?`生成中…`:n?`重新生成绑定码`:`获取绑定码`})}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Yd,{id:`wecom-bind-command`,label:`绑定消息`,value:`/bind ${n.code}`}),(0,G.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。绑定后自动更新此页面,历史通知仍可在网页查看。`]})]})]})]}):(0,G.jsx)(`p`,{className:`muted`,children:`请管理员先在全局设置中配置企业微信机器人。`}):(0,G.jsx)(`p`,{className:`muted`,children:`加载中…`}),l?.available&&(0,G.jsx)(bm,{})]})}function bm(){let{request:e}=ip(),t=K((0,B.useCallback)(t=>e(`wecom/groups`,pm,{signal:t}),[e]),3e3),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);async function c(){a(!0),s(``);try{r(await e(`wecom/groups/code`,fm,{method:`POST`}))}catch(e){s(W(e))}finally{a(!1)}}async function l(n){a(!0),s(``);try{await e(`wecom/groups/${encodeURIComponent(n)}`,pm,{method:`DELETE`}),await t.reload()}catch(e){s(W(e))}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`stack`,"data-testid":`wecom-group-settings`,children:[(0,G.jsx)(`h3`,{children:`群接入`}),(0,G.jsx)(`p`,{className:`muted`,children:`将机器人加入群,在群内发送绑定命令。绑定后,群内成员均可 @Tim 提问或分析项目资料,无需个人绑定。`}),(0,G.jsx)(Z,{error:!0,children:o||t.error}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{disabled:i,onClick:()=>void c(),children:i?`处理中…`:`获取群绑定码`})}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Yd,{id:`wecom-group-bind-command`,label:`在群内 @Tim 后发送`,value:`/bind ${n.code}`}),(0,G.jsxs)(`p`,{className:`muted`,children:[`有效至 `,new Date(n.expiresAt).toLocaleTimeString(),`。`]})]}),t.data?.groups.map(e=>(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsxs)(`span`,{children:[e.id,` · `,e.boundBy]}),(0,G.jsx)(`button`,{disabled:i,onClick:()=>void l(e.id),children:`解除群连接`})]},e.id)),(0,G.jsx)(`p`,{className:`muted`,children:`群内 /new 开始新话题,/help 查看命令。群聊天不在网页留存;明确收录的资料会保存在本项目。`})]})}function xm({config:e,session:t,reload:n,members:r,onLeave:i,initialTab:a}){let{request:o}=ip(),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,B.useState)(a&&s.some(e=>e.id===a)?a:`general`),[u,f]=(0,B.useState)(e),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(),ee=r.find(e=>e.id===t.memberId);async function te(){m(!0),g(``),v(``);try{let e=await o(`project/config`,Jc,{method:`PATCH`,body:Zc.parse({projectName:u.projectName,description:u.description})});f(e),v(H.configSaved),n()}catch(e){g(W(e))}finally{m(!1)}}return(0,G.jsxs)(Ep,{title:H.settings,navigation:(0,G.jsx)(pp,{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,G.jsx)(`section`,{id:`settings-panel-wecom`,role:`tabpanel`,"aria-labelledby":`settings-tab-wecom`,hidden:c!==`wecom`,children:c===`wecom`&&(0,G.jsx)(ym,{})}),(0,G.jsxs)(`section`,{id:`settings-panel-general`,role:`tabpanel`,"aria-labelledby":`settings-tab-general`,hidden:c!==`general`,children:[(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`span`,{hidden:!0,"data-testid":`saved-config-version`,"data-config-revision":e.configRevision}),(0,G.jsxs)(`form`,{"data-testid":`project-settings-form`,"aria-label":H.project,"aria-busy":p,"data-baseline-revision":u.configRevision,className:`stack`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,G.jsxs)(`fieldset`,{disabled:p,className:`stack`,children:[(0,G.jsx)(`h2`,{children:`项目信息`}),(0,G.jsx)(Q,{id:`project-name`,name:`projectName`,label:H.projectName,children:(0,G.jsx)(`input`,{required:!0,maxLength:120,value:u.projectName,onChange:e=>f({...u,projectName:e.target.value})})}),(0,G.jsx)(Q,{id:`project-description`,name:`description`,label:H.description,children:(0,G.jsx)(`textarea`,{rows:3,maxLength:2e3,value:u.description,onChange:e=>f({...u,description:e.target.value})})})]}),(0,G.jsx)(Z,{error:!0,children:h}),(0,G.jsx)(Z,{children:_}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{"data-testid":`settings-save`,className:`primary`,disabled:p,children:p?H.saving:H.save})})]})]}),(0,G.jsx)(sp,{}),(0,G.jsx)(lm,{}),(0,G.jsx)(Lp,{}),t.siteRole===`admin`&&(0,G.jsx)(am,{onImported:n})]}),t.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`settings-panel-repository`,role:`tabpanel`,"aria-labelledby":`settings-tab-repository`,hidden:c!==`repository`,children:(0,G.jsx)(tm,{members:r})}),(0,G.jsx)(`section`,{id:`settings-panel-members`,role:`tabpanel`,"aria-labelledby":`settings-tab-members`,hidden:c!==`members`,children:(0,G.jsx)(hp,{members:r,session:t,reload:n,onLeave:i})}),(0,G.jsxs)(`section`,{id:`settings-panel-connect`,role:`tabpanel`,"aria-labelledby":`settings-tab-connect`,hidden:c!==`connect`,children:[(0,G.jsxs)(`div`,{className:`settings-section stack`,children:[(0,G.jsx)(`h2`,{children:`项目文件夹绑定`}),(0,G.jsx)(`p`,{children:ee?.bound?`当前账号已连接客户端文件夹。`:`当前账号尚未连接客户端文件夹。`}),ee?.bound&&(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{onClick:()=>b(ee),children:`解除文件夹绑定`})})]}),(0,G.jsx)(ap,{members:r,memberId:t.memberId,admin:t.siteRole===`admin`}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:H.connectTitle}),(0,G.jsx)(`p`,{children:H.connectHint}),(0,G.jsx)(Yd,{id:`connect-command`,label:H.connectCommand,value:`teammy connect --url ${ml(e.publicServerUrl)} --project ${ml(e.projectId)}`}),(0,G.jsx)(`p`,{children:H.connectAfter})]}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:H.install}),(0,G.jsx)(`p`,{children:H.installHint}),(0,G.jsx)(Yd,{id:`install-command`,label:H.installCommandLabel,value:`npm install -g @teammy/cli`})]}),(0,G.jsxs)(`div`,{className:`settings-section connect-panel`,children:[(0,G.jsx)(`h2`,{children:`Agent 接入`}),(0,G.jsx)(`p`,{children:`通过 MCP 查询项目资料,或委托Tim处理工作。`}),(0,G.jsx)(`a`,{href:d(`/downloads/teammy-skill.zip`),download:!0,children:`下载 Teammy skill`})]})]}),y&&(0,G.jsx)(mp,{action:{kind:`disconnect`,member:y},onClose:()=>b(void 0),onSaved:async()=>{b(void 0),n()}})]})}function Sm({projects:e,session:t,onOpen:n,reload:r}){let[i,a]=(0,B.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qd,{title:`我的项目`,children:(0,G.jsxs)(Kd,{label:`项目操作`,children:[(0,G.jsx)(ef,{icon:`refresh`,label:`刷新项目`,onClick:()=>void r()}),t.siteRole===`admin`&&(0,G.jsxs)(`button`,{className:`primary`,"data-testid":`project-add`,onClick:()=>a(!0),children:[(0,G.jsx)($d,{name:`plus`}),`新建项目`]})]})}),(0,G.jsx)(`div`,{className:`project-list`,children:e.map(e=>(0,G.jsxs)(`button`,{className:`project-card`,"data-testid":`project-row`,"data-project-id":e.projectId,onClick:()=>n(e.projectId),children:[(0,G.jsx)($d,{name:`files`,size:`navigation`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.projectName}),e.description&&(0,G.jsx)(`small`,{children:e.description})]}),(0,G.jsx)($d,{name:`chevron`})]},e.projectId))}),!e.length&&(0,G.jsx)(Wd,{mascot:!0,title:`还没有项目`,description:t.siteRole===`admin`?`创建第一个项目,开始协作。`:`请项目成员添加你的 ID。`,children:t.siteRole===`admin`&&(0,G.jsxs)(`button`,{className:`primary`,"data-testid":`project-add-empty`,onClick:()=>a(!0),children:[(0,G.jsx)($d,{name:`plus`}),`新建项目`]})}),i&&(0,G.jsx)(Cm,{onClose:()=>a(!1),onCreated:async e=>{await r(),a(!1),n(e)}})]})}function Cm({onClose:e,onCreated:t}){let[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)({fingerprint:``,id:hl()});return(0,B.useEffect)(()=>{let e=new AbortController;return U(`setup/options`,Tf,{signal:e.signal}).then(e=>{e.initialProjectId||r(t=>t||e.projectName)}).catch(()=>{}),()=>e.abort()},[]),(0,G.jsx)(Jd,{id:`project-create-dialog`,title:`新建项目`,onClose:c?()=>{}:e,children:(0,G.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:hl()}),await t((await U(`projects`,Jc,{method:`POST`,body:{operationId:f.current.id,projectName:n,description:i,...o.trim()?{workspacePath:o.trim()}:{}}})).projectId)}catch(e){d(W(e))}finally{l(!1)}},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:c,children:[(0,G.jsx)(Q,{id:`new-project-name`,label:`项目名称`,children:(0,G.jsx)(`input`,{required:!0,autoFocus:!0,maxLength:120,value:n,onChange:e=>r(e.target.value)})}),(0,G.jsx)(Q,{id:`new-project-description`,label:`说明`,children:(0,G.jsx)(`textarea`,{maxLength:2e3,value:i,onChange:e=>a(e.target.value)})}),(0,G.jsx)(Q,{id:`new-project-workspace`,label:`已有工作区(可选)`,hint:`填写服务器或容器内的 teamcontext 绝对路径。Git 仓库可在创建后到项目设置中连接。`,children:(0,G.jsx)(`input`,{value:o,placeholder:`/imports/utu/teamcontext`,onChange:e=>s(e.target.value)})})]}),(0,G.jsx)(Z,{error:!0,children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:c,onClick:e,children:`取消`}),(0,G.jsx)(`button`,{className:`primary`,disabled:c,children:`创建项目`})]})]})})}function wm({admin:e,profiles:t,error:n,reload:r}){let[i,a]=(0,B.useState)(),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(0);return(0,G.jsxs)(`section`,{className:`settings-section stack`,"data-testid":`ai-profiles`,children:[(0,G.jsxs)(`div`,{className:`section-heading`,children:[(0,G.jsx)(`h2`,{children:`模型接入`}),e&&(0,G.jsx)(ef,{icon:`plus`,label:`添加模型`,"data-testid":`ai-profile-new`,onClick:()=>{a(void 0),s(!0),l(e=>e+1)}})]}),(0,G.jsx)(Z,{error:!0,children:n}),n&&(0,G.jsx)(`button`,{onClick:()=>r(),children:`重新加载模型`}),t?.length===0&&(0,G.jsx)(`p`,{children:`尚未配置模型。`}),t?.map(t=>(0,G.jsxs)(`div`,{className:`application-row ai-model-row`,"data-testid":`ai-profile-row`,"data-profile-id":t.id,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.name}),(0,G.jsxs)(`small`,{children:[t.model,` · `,t.enabled?`已启用`:`已停用`]})]}),e&&(0,G.jsx)(ef,{icon:`edit`,label:`配置 ${t.name}`,onClick:()=>{a(t),s(!0),l(e=>e+1)}})]},t.id)),e&&o&&(0,G.jsx)(Em,{initial:i,onSaved:e=>{a(e),r()},onClose:()=>s(!1)},c),!e&&(0,G.jsx)(`small`,{children:`由管理员维护接入点和密钥。`})]})}function Tm(e){let{revision:t,keyConfigured:n,...r}=e;return sf.parse(r)}function Em({initial:e,onSaved:t,onClose:n}){let[r,i]=(0,B.useState)(e?Tm(e):sf.parse({id:`default`,name:`团队模型`,protocol:`openai-completions`,baseUrl:`http://localhost:8000/v1`,model:`model`})),a=wl(),[o,s]=(0,B.useState)(e),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(``),v=!o||JSON.stringify(r)!==JSON.stringify(Tm(o))||!!c||u;async function y(){p(!0),h(``),_(``);try{let e=await U(`ai/profiles/${encodeURIComponent(r.id)}`,cf,{method:`PUT`,signal:a,body:lf.parse({expectedRevision:o?.revision??0,profile:r,...u?{apiKey:null}:c?{apiKey:c}:{}})});s(e),l(``),d(!1),t(e),_(`模型设置已保存。`)}catch(e){h(W(e))}finally{p(!1)}}async function b(){p(!0),h(``),_(``);try{let e=(await om(a)).profiles.find(e=>e.id===o?.id);e&&(s(e),i(Tm(e)),l(``),d(!1),t(e))}catch(e){a.aborted||h(W(e))}finally{p(!1)}}async function ee(e){p(!0),h(``),_(``);try{let t=await U(`ai/profiles/${encodeURIComponent(r.id)}/test`,pf,{method:`POST`,body:{mode:e},timeoutMs:305e3});_(`${{text:`文本`,tools:`工具往返`,json:`JSON 样例`}[e]}测试通过 · 输入 ${t.inputTokens} / 输出 ${t.outputTokens} token`)}catch(e){h(W(e))}finally{p(!1)}}return(0,G.jsxs)(`form`,{className:`stack`,"data-testid":`ai-profile-form`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:f,children:[(0,G.jsxs)(`div`,{className:`form-grid`,children:[(0,G.jsx)(Q,{id:`ai-profile-id`,label:`模型配置 ID`,children:(0,G.jsx)(`input`,{required:!0,value:r.id,disabled:!!o,onChange:e=>i({...r,id:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-name`,label:`模型名称`,children:(0,G.jsx)(`input`,{required:!0,maxLength:120,value:r.name,onChange:e=>i({...r,name:e.target.value})})})]}),(0,G.jsx)(Q,{id:`ai-profile-protocol`,label:`网关协议`,children:(0,G.jsxs)(`select`,{value:r.protocol,onChange:e=>i({...r,protocol:e.target.value}),children:[(0,G.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,G.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,G.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})}),(0,G.jsx)(Q,{id:`ai-profile-url`,label:`网关地址`,hint:`例如 https://gateway.example/v1;由服务器连接此地址。`,children:(0,G.jsx)(`input`,{required:!0,type:`url`,value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-model`,label:`模型 ID`,children:(0,G.jsx)(`input`,{required:!0,maxLength:200,value:r.model,onChange:e=>i({...r,model:e.target.value})})}),(0,G.jsx)(Q,{id:`ai-profile-key`,label:`API 密钥`,hint:o?.keyConfigured?`已配置;留空保留原密钥。`:`可留空,适用于无需密钥的网关。`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,maxLength:4096,value:c,disabled:u,onChange:e=>l(e.target.value)})}),o?.keyConfigured&&(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-clear-key`,checked:u,onChange:e=>d(e.target.checked)}),` `,`清除已保存密钥`]}),(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`ai-profile-enabled`,checked:r.enabled,onChange:e=>i({...r,enabled:e.target.checked})}),` `,`允许创建分析任务`]})]}),(0,G.jsx)(Z,{error:!0,children:m}),(0,G.jsx)(Z,{children:g}),(0,G.jsxs)(`div`,{className:`row wrap`,children:[(0,G.jsx)(`button`,{className:`primary`,"data-testid":`ai-profile-save`,disabled:f,children:`保存模型`}),(0,G.jsx)(`button`,{type:`button`,disabled:f,onClick:n,children:`关闭配置`})]}),(0,G.jsx)(`div`,{className:`row wrap`,children:[`text`,`tools`,`json`].map(e=>(0,G.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,G.jsx)(`button`,{type:`button`,"data-testid":`ai-profile-reload`,disabled:f,onClick:()=>void b(),children:`重新载入模型配置`}),(0,G.jsx)(`small`,{children:`测试使用已保存配置和合成内容。JSON 测试仅校验本次样例。`})]})}var Dm=e=>U(`site/config`,il,{signal:e});function Om(){let e=K(Dm);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Z,{error:!0,children:e.error}),e.data&&(0,G.jsx)(Am,{config:e.data,reload:()=>void e.reload()}),e.data&&(0,G.jsx)(km,{config:e.data,reload:()=>void e.reload()},e.data.revision),e.error&&(0,G.jsx)(`button`,{onClick:()=>void e.reload(),children:`重试`})]})}function km({config:e,reload:t}){let[n,r]=(0,B.useState)(e.sync),[i,a]=(0,B.useState)(e.revision),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``);return(0,B.useEffect)(()=>{r(e.sync),a(e.revision),l(``),d(``)},[e]),(0,G.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 U(`site/config`,il,{method:`PATCH`,body:al.parse({expectedRevision:i,sync:n})});a(e.revision),r(e.sync),d(`已保存,应用于所有项目。`)}catch(e){l(W(e))}finally{s(!1)}},children:(0,G.jsxs)(`section`,{className:`settings-section stack`,children:[(0,G.jsx)(`h2`,{children:`同步策略`}),(0,G.jsxs)(`fieldset`,{disabled:o,className:`form-grid`,children:[(0,G.jsx)(Q,{id:`sync-check-interval`,label:H.interval,children:(0,G.jsx)(`input`,{required:!0,type:`number`,min:1,max:86400,value:n.checkIntervalSeconds,onChange:e=>r({...n,checkIntervalSeconds:Number(e.target.value)})})}),(0,G.jsx)(Q,{id:`sync-file-settle`,label:H.settle,children:(0,G.jsx)(`input`,{required:!0,type:`number`,min:0,max:86400,value:n.fileSettleSeconds,onChange:e=>r({...n,fileSettleSeconds:Number(e.target.value)})})})]}),(0,G.jsx)(Z,{error:!0,children:c}),(0,G.jsx)(Z,{children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`刷新同步策略`,"data-testid":`site-sync-refresh`,disabled:o,onClick:t,children:`刷新`}),(0,G.jsx)(`button`,{className:`primary`,"data-testid":`site-sync-save`,disabled:o,children:`保存`})]})]})})}function Am({config:e,reload:t}){let[n,r]=(0,B.useState)(e.publicServerUrl),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``);return(0,B.useEffect)(()=>r(e.publicServerUrl),[e.publicServerUrl]),(0,G.jsxs)(`form`,{className:`settings-section stack`,onSubmit:async r=>{r.preventDefault(),a(!0),s(``);try{let r=await U(`site/config`,il,{method:`PATCH`,body:{expectedRevision:e.revision,publicServerUrl:n}});r.publicServerUrl===p()?t():location.assign(r.publicServerUrl.replace(/\/$/,``)+`/site-settings`)}catch(e){s(W(e))}finally{a(!1)}},children:[(0,G.jsx)(`h2`,{children:`访问地址`}),(0,G.jsx)(Q,{id:`site-server-url`,label:`服务外部地址`,hint:`包含路径前缀,用于客户端连接、资料链接和 Webhook。`,children:(0,G.jsx)(`input`,{"data-testid":`site-server-url`,required:!0,type:`url`,value:n,onChange:e=>r(e.target.value)})}),(0,G.jsx)(Z,{error:!0,children:o}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{className:`primary`,disabled:i,children:`保存地址`})})]})}var jm=e=>U(`users`,R({users:L(ol)}),{signal:e});function Mm({me:e}){let t=K(jm),[n,r]=(0,B.useState)();return(0,G.jsxs)(`div`,{className:`settings-section stack`,children:[(0,G.jsx)(Gd,{title:`用户信息`,children:(0,G.jsxs)(`button`,{"data-testid":`user-add`,onClick:()=>r({kind:`add`}),children:[(0,G.jsx)($d,{name:`plus`}),`新增用户`]})}),(0,G.jsx)(`p`,{className:`muted`,children:`建立账号后,在项目设置中添加该用户。`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.error&&(0,G.jsx)(`button`,{onClick:()=>void t.reload(),children:`重试`}),(0,G.jsx)(`div`,{className:`member-list`,children:t.data?.users.map(t=>(0,G.jsxs)(`article`,{className:`member-card`,"data-testid":`user-card`,"data-user-id":t.id,children:[(0,G.jsxs)(`div`,{className:`member-heading`,children:[(0,G.jsx)(Hd,{name:t.displayName}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:t.displayName}),(0,G.jsxs)(`small`,{children:[t.id,!t.enabled&&` · 已停用`]})]})]}),(0,G.jsxs)(`div`,{className:`member-actions`,children:[(0,G.jsx)(ef,{icon:`edit`,label:`修改显示名称`,"data-testid":`user-edit`,onClick:()=>r({kind:`edit`,user:t})}),t.id!==e&&(0,G.jsx)(ef,{icon:t.enabled?`disable`:`enable`,label:t.enabled?`停用账号`:`启用账号`,"data-testid":`user-toggle`,onClick:()=>r({kind:`toggle`,user:t})})]})]},t.id))}),n&&(0,G.jsx)(Nm,{action:n,onClose:()=>r(void 0),onSaved:async()=>{r(void 0),await t.reload()}})]})}function Nm({action:e,onClose:t,onSaved:n}){let[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(e.kind===`add`?``:e.user.displayName),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),d=e.kind===`add`?`新增用户`:e.kind===`edit`?`修改显示名称`:e.user.enabled?`停用账号`:`启用账号`;return(0,G.jsx)(Jd,{id:`user-dialog`,title:d,onClose:s?()=>{}:t,children:(0,G.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 U(`users`,ol,{method:`POST`,body:sl.parse({id:r.trim(),displayName:a})}):await U(`users/${encodeURIComponent(e.user.id)}`,ol,{method:`PATCH`,body:cl.parse({expectedRevision:e.user.revision,...e.kind===`edit`?{displayName:a}:{enabled:!e.user.enabled}})}),await n()}catch(e){u(W(e))}finally{c(!1)}},children:[e.kind===`add`&&(0,G.jsx)(Q,{id:`user-id`,label:`用户 ID`,hint:H.idHint,children:(0,G.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,G.jsx)(`p`,{children:e.user.enabled?`停用 ${e.user.id} 后,该用户无法登录或同步任何项目,历史资料会保留。`:`恢复 ${e.user.id} 的登录权限;客户端需要重新接入。`}):(0,G.jsx)(Q,{id:`user-display-name`,label:H.displayName,children:(0,G.jsx)(`input`,{autoFocus:e.kind===`edit`,maxLength:120,value:a,disabled:s,onChange:e=>o(e.target.value)})}),(0,G.jsx)(Z,{error:!0,children:l}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:H.cancel}),(0,G.jsx)(`button`,{className:`primary`,"data-testid":`user-submit`,disabled:s,children:s?H.saving:H.confirm})]})]})})}var Pm=R({enabled:I(),keyConfigured:I(),revision:F().int().nonnegative()});R({enabled:I(),expectedRevision:F().int().nonnegative(),apiKey:N().trim().min(1).max(4096).nullable().optional()}).strict();var Fm=R({ok:sc(!0),milliseconds:F().nonnegative(),results:F().int().nonnegative()}),Im=e=>U(`site/web-search`,Pm,{signal:e});function Lm(){let e=K(Im),t=wl(),[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),f=e.data,p=n??f?.enabled??!1,m=!!i||n!==null&&n!==f?.enabled;async function h(){if(f){s(`save`),l(``),d(``);try{await U(`site/web-search`,Pm,{method:`PUT`,signal:t,body:{enabled:p,expectedRevision:f.revision,...i.trim()?{apiKey:i.trim()}:{}}}),a(``),r(null),await e.reload(),d(`已保存,后续工具调用使用新配置。`)}catch(e){l(W(e))}finally{s(``)}}}async function g(){s(`probe`),l(``),d(``);try{let e=await U(`site/web-search/probe`,Fm,{method:`POST`,signal:t,timeoutMs:5e4});d(`连接正常 · ${(e.milliseconds/1e3).toFixed(1)} 秒`)}catch(e){l(W(e))}finally{s(``)}}return(0,G.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`网页搜索`,"data-testid":`web-search-settings`,children:[(0,G.jsx)(`h2`,{children:`网页搜索`}),(0,G.jsx)(`p`,{className:`muted`,children:`使用 DeepSeek 为 Tim 搜索和读取公开网页。`}),(0,G.jsx)(Z,{error:!0,children:c||e.error}),e.error&&(0,G.jsx)(`button`,{onClick:()=>void e.reload(),children:`重新加载搜索设置`}),(0,G.jsxs)(`form`,{className:`stack`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,G.jsxs)(`fieldset`,{className:`stack`,disabled:!!o||!f,children:[(0,G.jsx)(Q,{id:`web-search-api-key`,label:`DeepSeek API Key`,children:(0,G.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:i,required:p&&!f?.keyConfigured,placeholder:f?.keyConfigured?`已保存,留空保持不变`:`填写 DeepSeek 官方 API Key`,onChange:e=>{a(e.target.value),d(``)}})}),(0,G.jsx)(`div`,{className:`actions`,children:(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`启用网页搜索`,"aria-checked":p,className:p?`primary`:``,onClick:()=>{r(!p),d(``)},children:p?`已启用`:`已停用`})})]}),(0,G.jsx)(Z,{children:u}),(0,G.jsxs)(`div`,{className:`actions`,children:[(0,G.jsx)(`button`,{className:`primary`,disabled:!!o||!f||!m,children:o===`save`?`保存中…`:`保存`}),(0,G.jsx)(`button`,{type:`button`,disabled:!!o||m||!f?.enabled||!f.keyConfigured,onClick:()=>void g(),children:o===`probe`?`测试中…`:`测试连接`}),c&&(0,G.jsx)(`button`,{type:`button`,disabled:!!o,onClick:()=>{r(null),a(``),l(``),e.reload()},children:`刷新配置`})]})]}),(0,G.jsx)(`small`,{className:`muted`,children:`搜索与网页读取按次计费,测试连接会调用一次搜索。`})]})}function Rm({session:e}){let t=K(om),n=K(fl.server),[r,i]=(0,B.useState)(`general`),[a,o]=(0,B.useState)(0),s=()=>o(e=>e+1),c=()=>{t.reload(),s()};return(0,G.jsxs)(`div`,{className:`site-settings`,children:[(0,G.jsx)(qd,{title:`设置`}),(0,G.jsx)(pp,{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,G.jsxs)(`div`,{className:`site-settings-content`,children:[e.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`site-panel-wecom`,role:`tabpanel`,"aria-labelledby":`site-tab-wecom`,hidden:r!==`wecom`,children:r===`wecom`&&(0,G.jsx)(_m,{})}),(0,G.jsxs)(`section`,{id:`site-panel-general`,role:`tabpanel`,"aria-labelledby":`site-tab-general`,hidden:r!==`general`,children:[e.siteRole===`admin`?(0,G.jsx)(Om,{}):(0,G.jsx)(`p`,{className:`settings-section muted`,children:`全局同步策略由站点管理员维护。`}),(0,G.jsx)($p,{}),(0,G.jsxs)(`div`,{className:`settings-section`,children:[(0,G.jsx)(`h2`,{children:`服务端版本`}),(0,G.jsx)(Z,{error:!0,children:n.error}),(0,G.jsx)(`p`,{"data-testid":`server-version`,children:n.data?.version??`—`})]})]}),(0,G.jsxs)(`section`,{id:`site-panel-models`,role:`tabpanel`,"aria-labelledby":`site-tab-models`,hidden:r!==`models`,children:[(0,G.jsx)(`div`,{className:`settings-section-actions`,children:(0,G.jsx)(ef,{icon:`refresh`,label:`刷新模型设置`,onClick:c})}),(0,G.jsx)(wm,{admin:e.siteRole===`admin`,profiles:t.data?.profiles,error:t.error,reload:c}),(0,G.jsxs)(`section`,{className:`settings-section stack`,"aria-label":`默认接入点`,children:[(0,G.jsx)(`h2`,{children:`默认接入点`}),(0,G.jsx)(Z,{error:!0,children:t.error}),t.data&&(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(sm,{title:`全站默认`,profiles:t.data?.profiles??[],admin:e.siteRole===`admin`,generation:a,onChanged:s})})]}),e.siteRole===`admin`&&r===`models`&&(0,G.jsx)(Lm,{})]}),e.siteRole===`admin`&&(0,G.jsx)(`section`,{id:`site-panel-users`,role:`tabpanel`,"aria-labelledby":`site-tab-users`,hidden:r!==`users`,children:r===`users`&&(0,G.jsx)(Mm,{me:e.memberId})})]})]})}var zm=`modulepreload`,Bm=function(e,t){return new URL(e,t).href},Vm={},Hm=function(e){return e.pathname.endsWith(`.css`)},Um=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},Wm=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=Bm(t,n);let r=s(t),i=Hm(r);return Um(Vm,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`:zm,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)})},Gm=(0,B.lazy)(()=>Wm(()=>import(`./ResourceLibrary-CXqTEv7V.js`).then(e=>({default:e.ResourceLibrary})),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),Km=(0,B.lazy)(()=>Wm(()=>import(`./Help-BXvLax7h.js`).then(e=>({default:e.Help})),__vite__mapDeps([8,1,9]),import.meta.url)),qm=(0,B.lazy)(()=>Wm(()=>import(`./Files-BdfIlw8b.js`).then(e=>({default:e.Files})),__vite__mapDeps([10,1,4,5,11,6]),import.meta.url)),Jm=(0,B.lazy)(()=>Wm(()=>import(`./Assistant-Ceif-ARy.js`).then(e=>({default:e.Assistant})),__vite__mapDeps([12,1,2,3,13,14]),import.meta.url)),Ym=(0,B.lazy)(()=>Wm(()=>import(`./Computers-B_8KVFSv.js`).then(e=>({default:e.Computers})),__vite__mapDeps([15,1,2,3,13,14,4,16]),import.meta.url)),Xm=(0,B.lazy)(()=>Wm(()=>import(`./Dashboard-B-LuQT0a.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([17,5,11,18]),import.meta.url));function Zm(){let[e,t]=(0,B.useState)(),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(0);return(0,B.useEffect)(()=>{let e=new AbortController;return a(``),(async()=>{try{let n=await fl.setup(e.signal),i;if(n.initialized)try{i=await fl.session(e.signal)}catch(e){if(!(e instanceof ul&&e.status===401))throw e}e.signal.aborted||(t(i),r(n.initialized))}catch(t){e.signal.aborted||a(W(t))}})(),()=>e.abort()},[o]),(0,B.useEffect)(()=>{let e=()=>t(void 0);return window.addEventListener(`teammy:logout`,e),()=>window.removeEventListener(`teammy:logout`,e)},[]),i?(0,G.jsxs)(`main`,{className:`boot`,children:[(0,G.jsx)(Bd,{}),(0,G.jsx)(Z,{error:!0,children:i}),(0,G.jsx)(`button`,{onClick:()=>s(e=>e+1),children:H.retry})]}):n===void 0?(0,G.jsxs)(`main`,{className:`boot`,children:[(0,G.jsx)(Bd,{}),(0,G.jsx)(`p`,{role:`status`,children:H.loading})]}):n?e?f()===`/connect`?(0,G.jsx)(If,{session:e,onLogout:()=>t(void 0)}):(0,G.jsx)(xl,{children:(0,G.jsx)($m,{session:e,onLogout:()=>t(void 0)})},e.memberId):(0,G.jsx)(Of,{onLogin:t}):(0,G.jsx)(Mf,{onDone:e=>{history.replaceState(null,``,d(`/projects`)),r(!0),t(e)}})}function Qm(){let e=f().match(/^\/projects\/([a-z][a-z0-9_-]{0,63})\/(dashboard|assistant|messages|channels|computers|files|materials|memory|sessions|help|members|settings)$/);if(e?.[2]===`files`&&new URLSearchParams(location.search).get(`owner`)===`_resources`)return history.replaceState(null,``,d(`/projects/${e[1]}/memory`)),{projectId:e[1],page:`memory`};if(e?.[2]===`assistant`)return history.replaceState(null,``,d(`/projects/${e[1]}/messages${location.search}`)),{projectId:e[1],page:`messages`};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`,`memory`,`sessions`,...bp].includes(t)?t:f()===`/ai`?`dashboard`:`projects`}}function $m({session:e,onLogout:t}){let n=K(fl.projects,!0),[r,i]=(0,B.useState)(Qm),a=(0,B.useCallback)((e,t=!1)=>{t?history.replaceState(null,``,d(e)):history.pushState(null,``,d(e)),i(Qm()),document.querySelector(`main`)?.focus()},[]);(0,B.useEffect)(()=>{let e=()=>{i(Qm())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]);let o=n.data?.projects;(0,B.useEffect)(()=>{if(r.page===`members`&&r.projectId){a(xp(r.projectId,`settings`)+`?tab=members`,!0);return}if(r.projectId||![...bp,`memory`,`sessions`,`members`].includes(r.page)||!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?xp(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,B.useEffect)(()=>(document.title=s?`${s.projectName} | Teammy 工作台`:`Teammy 工作台`,()=>{document.title=`Teammy 工作台`}),[s?.projectName]),(0,B.useEffect)(()=>{if(s)try{localStorage.setItem(`teammy-project:${e.memberId}`,s.projectId)}catch{}},[s?.projectId,e.memberId]);let c=(0,B.useMemo)(()=>r.projectId?np(r.projectId):null,[r.projectId]),l=r.page===`projects`||r.page===`site-settings`;return(0,G.jsxs)(`div`,{className:`workspace ${l?`workspace-home`:``}`,children:[(0,G.jsx)(`a`,{className:`skip-link`,href:`#main`,children:H.skipToMain}),!l&&(0,G.jsx)(Cp,{projectId:r.projectId,page:r.page,navigate:a}),(0,G.jsx)(`div`,{className:`main-shell`,children:(0,G.jsxs)(`main`,{id:`main`,"data-testid":`workspace-main`,"data-page":r.page,"data-project-id":r.projectId||void 0,tabIndex:-1,children:[(0,G.jsx)(Z,{error:!0,children:n.error}),l?(0,G.jsx)(Tp,{session:e,navigate:a,onLogout:t,routeKey:r.page,children:r.page===`site-settings`?(0,G.jsx)(Rm,{session:e}):(0,G.jsx)(Sm,{projects:o??[],session:e,reload:n.reload,onOpen:e=>a(xp(e,`dashboard`))})}):c&&s?(0,G.jsx)(rp.Provider,{value:c,children:(0,G.jsx)(eh,{page:r.page,navigate:a,onLeave:async()=>{await n.reload(),a(`/projects`,!0)}})},r.projectId):o?(0,G.jsx)(Z,{error:!0,children:`项目不存在或你已不再是该项目成员。请从项目列表重新选择。`}):(0,G.jsx)(`p`,{role:`status`,children:H.loading})]})})]})}function eh({page:e,onLeave:t,navigate:n}){let r=ip(),i=K((0,B.useCallback)(async e=>{let[t,n,i]=await Promise.all([r.api.config(e),r.api.members(e),r.request(`identity`,el,{signal:e})]);return{config:t,members:n.members,session:i}},[r]),!0),a=i.data;return i.error?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{error:!0,children:i.error}),(0,G.jsx)(`button`,{onClick:()=>void i.reload(),children:`重试`})]}):a?(0,G.jsx)(B.Suspense,{fallback:(0,G.jsx)(`p`,{role:`status`,children:H.loading}),children:e===`files`?(0,G.jsx)(qm,{members:a.members,onRefresh:()=>void i.reload()}):e===`dashboard`?(0,G.jsx)(Xm,{members:a.members,config:a.config,userName:a.session.displayName||a.session.memberId}):e===`materials`||e===`memory`||e===`sessions`?(0,G.jsx)(Gm,{section:e,members:a.members,navigate:n}):e===`help`?(0,G.jsx)(Km,{config:a.config,navigate:n}):[`assistant`,`messages`,`channels`].includes(e)?(0,G.jsx)(Jm,{me:a.session.memberId,mode:e===`channels`?`channels`:`messages`},e):e===`computers`?(0,G.jsx)(Ym,{}):(0,G.jsx)(xm,{config:a.config,session:a.session,reload:()=>void i.reload(),members:a.members,onLeave:t,initialTab:new URLSearchParams(location.search).get(`tab`)??void 0})}):(0,G.jsx)(`p`,{role:`status`,children:H.loading})}(0,jc.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(Zm,{}));export{zc as $,Ud as A,Xd as B,Rf as C,of as D,Lf as E,Vd as F,vl as G,K as H,Jd as I,W as J,ul as K,Z as L,Q as M,$d as N,af as O,ef as P,H as Q,qd as R,Kf as S,l as St,Uf as T,Cl as U,wl as V,Sl as W,ml as X,hl as Y,ll as Z,fp as _,h as _t,Xp as a,z as at,Zf as b,o as bt,Np as c,sc as ct,kp as d,N as dt,Rc as et,Op as f,Qs as ft,up as g,ga as gt,dp as h,Cs as ht,Gp as i,Vs as it,Wd as j,Yd as k,Ip as l,F as lt,gp as m,Ts as mt,Jp as n,Lc as nt,Yp as o,L as ot,Dp as p,Ks as pt,fl as q,Kp as r,V as rt,Ap as s,I as st,qp as t,Ic as tt,Mp as u,R as ut,np as v,d as vt,$ as w,Yf as x,s as xt,ip as y,f as yt,Kd as z};